Restriction on org.eclipse.ui.internal.* classes [message #1319894] |
Mon, 28 April 2014 13:02 |
Leo Rohr Messages: 1 Registered: April 2014 |
Junior Member |
|
|
Hello everybody,
we are developing a Modeling Environment as a plugin for Eclipse. Within this environment it should be possible for the user to modify one of the provided perspectives, i.e. hide/show items in the Coolbar, Menubar and views. It appeared to be difficult to modify the visible Coolbar-/MenuItems when you are not developing an entire RCP-Application but only a Plugin.
The only solution I was able to come up with was to add an access rule in the Java build path to make the org.eclipse.ui.internal.* packages available and then access the items with the CoolbarManager/MenuManager as in the following example:
WorkbenchWindow workbenchWin = (WorkbenchWindow)PlatformUI.getWorkbench().getActiveWorkbenchWindow();
ICoolBarManager coolbarManager = workbenchWin.getCoolBarManager2();
IContributionItem[] items = coolbarManager.getItems();
for(IContributionItem item : items) {
item.setVisible(false);
}
However, adding this access rule and then suppressing the "restriction" warnings on every call to these packages seems to a bit dirty.
Hence my question: Why are these packages restricted and is there a better way to do this?
Thanks,
Leo
|
|
|
Powered by
FUDForum. Page generated in 0.03732 seconds