mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-13 12:05:21 +02:00
Bug 323141 - [context-menu] Cleanup introspection code for command contribution items
This commit is contained in:
parent
8be1c639c9
commit
210b711353
1 changed files with 13 additions and 7 deletions
|
@ -14,6 +14,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
|
* David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
|
||||||
* Uwe Stieber (Wind River) - [319618] [context-menu] Tool tip not shown in status bar for command contributions items
|
* Uwe Stieber (Wind River) - [319618] [context-menu] Tool tip not shown in status bar for command contributions items
|
||||||
|
* Martin Oberhuber (Wind River) - [323141] [context-menu] Cleanup introspection code for command contribution items
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.ui.view;
|
package org.eclipse.rse.internal.ui.view;
|
||||||
|
@ -166,6 +167,10 @@ implements ISystemViewMenuListener
|
||||||
if (data instanceof ActionContributionItem)
|
if (data instanceof ActionContributionItem)
|
||||||
tip = ((ActionContributionItem)data).getAction().getToolTipText();
|
tip = ((ActionContributionItem)data).getAction().getToolTipText();
|
||||||
else if (data instanceof CommandContributionItem) {
|
else if (data instanceof CommandContributionItem) {
|
||||||
|
try {
|
||||||
|
tip = ((CommandContributionItem) data).getData().tooltip;
|
||||||
|
} catch (Exception apiNotYetAvailable) {
|
||||||
|
//API was introduced with Eclipse 3.7m3 -- use introspection on older Eclipse
|
||||||
try {
|
try {
|
||||||
Field f = data.getClass().getDeclaredField("widget"); //$NON-NLS-1$
|
Field f = data.getClass().getDeclaredField("widget"); //$NON-NLS-1$
|
||||||
f.setAccessible(true);
|
f.setAccessible(true);
|
||||||
|
@ -175,6 +180,7 @@ implements ISystemViewMenuListener
|
||||||
tip = (String)m.invoke(data, new Object[] { widget instanceof Item ? ((Item)widget).getText() : (String)null });
|
tip = (String)m.invoke(data, new Object[] { widget instanceof Item ? ((Item)widget).getText() : (String)null });
|
||||||
} catch (Exception e) { /* ignored on purpose */ }
|
} catch (Exception e) { /* ignored on purpose */ }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (data instanceof SystemSubMenuManager)
|
else if (data instanceof SystemSubMenuManager)
|
||||||
tip = ((SystemSubMenuManager)data).getToolTipText();
|
tip = ((SystemSubMenuManager)data).getToolTipText();
|
||||||
if (tip != null)
|
if (tip != null)
|
||||||
|
|
Loading…
Add table
Reference in a new issue