org.eclipse.ui.IPluginContribution Java Examples

The following examples show how to use org.eclipse.ui.IPluginContribution. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ApplicationWorkbenchWindowAdvisor.java    From tlaplus with MIT License 4 votes vote down vote up
public void postWindowOpen() {
	final PreferenceManager preferenceManager = PlatformUI.getWorkbench().getPreferenceManager();
	final IPreferenceNode[] rootSubNodes = preferenceManager.getRootSubNodes();

	// @see Bug #191 in general/bugzilla/index.html
	final List<String> filters = new ArrayList<String>();
	filters.add("org.eclipse.compare");
	// The following three preferences are shown because the Toolbox uses
	// the local history feature provided by o.e.team.ui
	filters.add("org.eclipse.team.ui");
	filters.add("org.eclipse.ui.trace");
	filters.add("org.eclipse.jsch.ui");

	// Filter out Pdf4Eclipse preference page.
	filters.add("de.vonloesch.pdf4Eclipse");
	
	// Filter out GraphViz
	filters.add("com.abstratt.graphviz.ui");
	
	// Clean the preferences
	final List<IPreferenceNode> elements = preferenceManager.getElements(PreferenceManager.POST_ORDER);
	for (Iterator<IPreferenceNode> iterator = elements.iterator(); iterator.hasNext();) {
		final IPreferenceNode elem = iterator.next();
		if (elem instanceof IPluginContribution) {
			final IPluginContribution aPluginContribution = (IPluginContribution) elem;
			if (filters.contains(aPluginContribution.getPluginId())) {
				final IPreferenceNode node = (IPreferenceNode) elem;

				// remove from root node
				preferenceManager.remove(node);

				// remove from all subnodes
				for (int i = 0; i < rootSubNodes.length; i++) {
					final IPreferenceNode subNode = rootSubNodes[i];
					subNode.remove(node);
				}
			}
		}
	}
	super.postWindowOpen();
	
	// At this point in time we can be certain that the UI is fully
	// instantiated (views, editors, menus...). Thus, register
	// listeners that connect the UI to the workspace resources.
	ToolboxLifecycleParticipantManger.postWorkbenchWindowOpen();
}