org.eclipse.jface.preference.IPreferenceNode Java Examples

The following examples show how to use org.eclipse.jface.preference.IPreferenceNode. 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: BonitaPreferenceDialog.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
protected boolean isLeafMatch(final IPreferenceNode element) {
    if (element != null) {
        final IPreferenceNode node = element;
        final String text = node.getLabelText();

        if (wordMatches(text)) {
            return true;
        }

        // Also need to check the keywords
        final String[] keywords = getKeywords(node);
        for (int i = 0; i < keywords.length; i++) {
            if (wordMatches(keywords[i])) {
                return true;
            }
        }
    }
    return false;
}
 
Example #2
Source File: PropertyLinkArea.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("rawtypes")
private IPreferenceNode getPreferenceNode(String pageId)
{
	/*
	 * code pulled from org.eclipse.ui.internal.dialogs.PropertyDialog - i'm not sure why this type of class doesn't
	 * already exist for property pages like it does for preference pages since it seems it would be very useful -
	 * guess we're breaking new ground :)
	 */
	PropertyPageManager pageManager = new PropertyPageManager();
	PropertyPageContributorManager.getManager().contribute(pageManager, element);

	Iterator pages = pageManager.getElements(PreferenceManager.PRE_ORDER).iterator();

	while (pages.hasNext())
	{
		IPreferenceNode node = (IPreferenceNode) pages.next();
		if (node.getId().equals(pageId))
		{
			return node;
		}
	}

	return null;
}
 
Example #3
Source File: GoUIPlugin.java    From goclipse with Eclipse Public License 1.0 6 votes vote down vote up
protected void checkPrefPageIdIsValid(String prefId) {
	Shell shell = WorkbenchUtils.getActiveWorkbenchShell();
	PreferenceDialog prefDialog = PreferencesUtil.createPreferenceDialogOn(shell, prefId, null, null);
	assertNotNull(prefDialog); // Don't create, just eagerly check that it exits, that the ID is correct
	ISelection selection = prefDialog.getTreeViewer().getSelection();
	if(selection instanceof IStructuredSelection) {
		IStructuredSelection ss = (IStructuredSelection) selection;
		if(ss.getFirstElement() instanceof IPreferenceNode) {
			IPreferenceNode prefNode = (IPreferenceNode) ss.getFirstElement();
			if(prefNode.getId().equals(prefId)) {
				return; // Id exists
			}
		}
	}
	assertFail();
}
 
Example #4
Source File: SWTUtil.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * This method allows us to open the preference dialog on the specific page, in this case the perspective page
 * 
 * @param id
 *            the id of pref page to show
 * @param page
 *            the actual page to show Copied from org.eclipse.debug.internal.ui.SWTUtil
 */
public static void showPreferencePage(String id, IPreferencePage page)
{
	final IPreferenceNode targetNode = new PreferenceNode(id, page);
	PreferenceManager manager = new PreferenceManager();
	manager.addToRoot(targetNode);
	final PreferenceDialog dialog = new PreferenceDialog(UIUtils.getActiveShell(), manager);
	BusyIndicator.showWhile(getStandardDisplay(), new Runnable()
	{
		public void run()
		{
			dialog.create();
			dialog.setMessage(targetNode.getLabelText());
			dialog.open();
		}
	});
}
 
Example #5
Source File: ProjectSettingDialog.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Selects the saved item in the tree of preference pages. If it cannot do this it saves the first one.
 */
protected void selectSavedItem() {
	IPreferenceNode node = findNodeMatching(getSelectedNodePreference());
	if (node == null) {
		IPreferenceNode[] nodes = preferenceManager.getRootSubNodes();
		ViewerComparator comparator = getTreeViewer().getComparator();
		if (comparator != null)	{
			comparator.sort(null, nodes);
		}			
		for (int i = 0; i < nodes.length; i++) {
			IPreferenceNode selectedNode = nodes[i];
			if (selectedNode != null) {
				node = selectedNode;
				break;
			}
		}
	}
	if (node != null) {
		getTreeViewer().setSelection(new StructuredSelection(node), true);
		// Keep focus in tree. See bugs 2692, 2621, and 6775.
		getTreeViewer().getControl().setFocus();
		boolean expanded = getTreeViewer().getExpandedState(node);
		getTreeViewer().setExpandedState(node, !expanded);
	}
}
 
Example #6
Source File: PreviewPreferencePage.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private void createLinkArea( Composite parent )
{
	IPreferenceNode node = getPreferenceNode( WBROWSER_PAGE_ID );
	if ( node != null )
	{
		PreferenceLinkArea linkArea = new PreferenceLinkArea( parent,
				SWT.WRAP,
				WBROWSER_PAGE_ID,
				Messages.getString( "designer.preview.preference.browser.extbrowser.link" ), //$NON-NLS-1$
				(IWorkbenchPreferenceContainer) getContainer( ),
				null );
		GridData data = new GridData( GridData.FILL_HORIZONTAL
				| GridData.GRAB_HORIZONTAL );
		linkArea.getControl( ).setLayoutData( data );
	}
}
 
Example #7
Source File: ProjectSettingDialog.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Selects the saved item in the tree of preference pages. If it cannot do this it saves the first one.
 */
protected void selectSavedItem() {
	IPreferenceNode node = findNodeMatching(getSelectedNodePreference());
	if (node == null) {
		IPreferenceNode[] nodes = preferenceManager.getRootSubNodes();
		ViewerComparator comparator = getTreeViewer().getComparator();
		if (comparator != null)	{
			comparator.sort(null, nodes);
		}			
		for (int i = 0; i < nodes.length; i++) {
			IPreferenceNode selectedNode = nodes[i];
			if (selectedNode != null) {
				node = selectedNode;
				break;
			}
		}
	}
	if (node != null) {
		getTreeViewer().setSelection(new StructuredSelection(node), true);
		// Keep focus in tree. See bugs 2692, 2621, and 6775.
		getTreeViewer().getControl().setFocus();
		boolean expanded = getTreeViewer().getExpandedState(node);
		getTreeViewer().setExpandedState(node, !expanded);
	}
}
 
Example #8
Source File: RoutesKarafRepositoryMavenSetting.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
public static List<IPreferenceNode> createRoutesKarafChildrenNodes(IFolder nodeFolder, RepositoryNode node, String parentId,
        boolean checkExist) {
    List<IPreferenceNode> childrenNodes = new ArrayList<IPreferenceNode>();

    // if have existed the pom and assembly
    if (!checkExist
            || DesignerMavenUiHelper.existMavenSetting(nodeFolder, TalendMavenConstants.POM_FILE_NAME,
                    IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_PARENT_FILE_NAME,
                    IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_BUNDLE_FILE_NAME,
                    IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_FEATURE_FILE_NAME)) {

        IFile pomTemplateFile = nodeFolder.getFile(TalendMavenConstants.POM_FILE_NAME);
        IFile parentTemplateFile = nodeFolder.getFile(IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_PARENT_FILE_NAME);
        IFile bundleTemplateFile = nodeFolder.getFile(IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_BUNDLE_FILE_NAME);
        IFile featureTemplateFile = nodeFolder.getFile(IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_FEATURE_FILE_NAME);

        String pomId = DesignerMavenUiHelper.buildRepositoryPreferenceNodeId(parentId, pomTemplateFile);
        String parentPomId = DesignerMavenUiHelper.buildRepositoryPreferenceNodeId(parentId, parentTemplateFile);
        String bundlePomId = DesignerMavenUiHelper.buildRepositoryPreferenceNodeId(parentId, bundleTemplateFile);
        String featurePomId = DesignerMavenUiHelper.buildRepositoryPreferenceNodeId(parentId, featureTemplateFile);

        RoutesKarafPomRepositorySettingNode pomNode = new RoutesKarafPomRepositorySettingNode(pomId, pomTemplateFile);
        RoutesKarafParentRepositorySettingNode parentNode = new RoutesKarafParentRepositorySettingNode(parentPomId,
                parentTemplateFile);
        RoutesKarafBundleRepositorySettingNode bundleNode = new RoutesKarafBundleRepositorySettingNode(bundlePomId,
                bundleTemplateFile);
        RoutesKarafFeatureRepositorySettingNode featureNode = new RoutesKarafFeatureRepositorySettingNode(featurePomId,
                featureTemplateFile);

        childrenNodes.add(pomNode);
        childrenNodes.add(parentNode);
        childrenNodes.add(bundleNode);
        childrenNodes.add(featureNode);
    }
    return childrenNodes;
}
 
Example #9
Source File: AnnotationStyleViewPage.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
@Override
public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager,
        IStatusLineManager statusLineManager) {
  super.makeContributions(menuManager, toolBarManager, statusLineManager);
  
  // TODO: Figure out how to use open properties dialog action here correctly
  // see http://wiki.eclipse.org/FAQ_How_do_I_open_a_Property_dialog%3F
  
  IAction action = new Action() {
    @Override
    public void run() {
      super.run();
      
      ISelection sel = new StructuredSelection(new AnnotationTypeNode(editor, null));
      PropertyPage page = new EditorAnnotationPropertyPage();
      page.setElement(new AnnotationTypeNode(editor, null));
      page.setTitle("Styles");
      PreferenceManager mgr = new PreferenceManager();
      IPreferenceNode node = new PreferenceNode("1", page);
      mgr.addToRoot(node);
      PropertyDialog dialog = new PropertyDialog(getSite().getShell(), mgr, sel);
      dialog.create();
      dialog.setMessage(page.getTitle());
      dialog.open();
    }
  };
  
  action.setImageDescriptor(CasEditorPlugin
          .getTaeImageDescriptor(Images.MODEL_PROCESSOR_FOLDER));
  
  toolBarManager.add(action);
}
 
Example #10
Source File: PreferenceUtil.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public static IPreferenceNode findNodeMatching(String nodeId) {
    List<?> nodes = PlatformUI.getWorkbench().getPreferenceManager().getElements(PreferenceManager.POST_ORDER);
    for (Iterator<?> i = nodes.iterator(); i.hasNext();) {
        final IPreferenceNode node = (IPreferenceNode) i.next();
        if (node.getId().equals(nodeId)) {
            return node;
        }
    }
    return null;
}
 
Example #11
Source File: E4PreferenceRegistry.java    From e4Preferences with Eclipse Public License 1.0 5 votes vote down vote up
private IPreferenceNode findNode(PreferenceManager pm, String categoryId)
{
	for (Object o : pm.getElements(PreferenceManager.POST_ORDER))
	{
		if (o instanceof IPreferenceNode && ((IPreferenceNode) o).getId().equals(categoryId))
		{
			return (IPreferenceNode) o;
		}
	}
	return null;
}
 
Example #12
Source File: StyleBuilder.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public String getColumnText( Object element, int columnIndex )
{
	if ( columnIndex == 1 )
		return ( (IPreferenceNode) element ).getLabelText( );
	else
		return ""; //$NON-NLS-1$
}
 
Example #13
Source File: StyleBuilder.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public Image getColumnImage( Object element, int columnIndex )
{
	if ( columnIndex == 1 )
		return ( (IPreferenceNode) element ).getLabelImage( );
	else
		return null;
}
 
Example #14
Source File: StyleBuilder.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Constructor
 * 
 * @param parentShell
 * @param handle
 */
public StyleBuilder( Shell parentShell, ReportElementHandle handle,
		AbstractThemeHandle theme, String title )
{
	super( parentShell, createPreferenceManager( handle, theme ) );
	setHelpAvailable( false );
	IPreferenceNode[] nodes = this.getPreferenceManager( )
			.getRootSubNodes( );
	for ( int i = 0; i < nodes.length; i++ )
	{
		( (BaseStylePreferencePage) nodes[i].getPage( ) ).setBuilder( this );
	}
	this.title = title;

}
 
Example #15
Source File: PreviewPreferencePage.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private IPreferenceNode getPreferenceNode( String pageId )
{
	Iterator iterator = PlatformUI.getWorkbench( )
			.getPreferenceManager( )
			.getElements( PreferenceManager.PRE_ORDER )
			.iterator( );
	while ( iterator.hasNext( ) )
	{
		IPreferenceNode next = (IPreferenceNode) iterator.next( );
		if ( next.getId( ).equals( pageId ) )
			return next;
	}
	return null;
}
 
Example #16
Source File: CppStylePropertyPage.java    From CppStyle with MIT License 5 votes vote down vote up
/**
 * Show a single preference pages
 * 
 * @param id
 *            - the preference page identification
 * @param page
 *            - the preference page
 */
protected void showPreferencePage(String id, IPreferencePage page) {
	final IPreferenceNode targetNode = new PreferenceNode(id, page);
	PreferenceManager manager = new PreferenceManager();
	manager.addToRoot(targetNode);
	final PreferenceDialog dialog = new PreferenceDialog(getControl()
			.getShell(), manager);
	BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() {
		public void run() {
			dialog.create();
			dialog.setMessage(targetNode.getLabelText());
			dialog.open();
		}
	});
}
 
Example #17
Source File: FieldEditorOverlayPage.java    From cppcheclipse with Apache License 2.0 5 votes vote down vote up
/**
 * Show a single preference pages
 * 
 * @param id
 *            - the preference page identification
 * @param page
 *            - the preference page
 */
protected void showPreferencePage(String id, IPreferencePage page) {
	final IPreferenceNode targetNode = new PreferenceNode(id, page);
	PreferenceManager manager = new PreferenceManager();
	manager.addToRoot(targetNode);
	final PreferenceDialog dialog = new PreferenceDialog(getControl()
			.getShell(), manager);
	BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() {
		public void run() {
			dialog.create();
			dialog.setMessage(targetNode.getLabelText());
			dialog.open();
		}
	});
}
 
Example #18
Source File: PropertyLinkArea.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public PropertyLinkArea(Composite parent, int style, final String pageId, IAdaptable element, String message,
		final IWorkbenchPreferenceContainer pageContainer)
{
	this.element = element;
	pageLink = new Link(parent, style);

	IPreferenceNode node = getPreferenceNode(pageId);
	String text = null;
	if (node == null)
	{
		text = NLS.bind(WorkbenchMessages.PreferenceNode_NotFound, pageId);
	}
	else
	{
		text = NLS.bind(message, node.getLabelText());
	}

	pageLink.addSelectionListener(new SelectionAdapter()
	{
		public void widgetSelected(SelectionEvent e)
		{
			pageContainer.openPage(pageId, null);
		}
	});

	pageLink.setText(text);
}
 
Example #19
Source File: ServiceKarafRepositoryMavenSetting.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
public static List<IPreferenceNode> createServicesKarafChildrenNodes(IFolder nodeFolder, RepositoryNode node,
        String parentId, boolean checkExist) {
    List<IPreferenceNode> childrenNodes = new ArrayList<IPreferenceNode>();

    // if have existed the pom and assembly
    if (!checkExist
            || DesignerMavenUiHelper.existMavenSetting(nodeFolder, TalendMavenConstants.POM_FILE_NAME,
                    IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_PARENT_FILE_NAME,
                    IProjectSettingTemplateConstants.MAVEN_CONTROL_BUILD_BUNDLE_FILE_NAME,
                    IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_FEATURE_FILE_NAME)) {

        IFile pomTemplateFile = nodeFolder.getFile(TalendMavenConstants.POM_FILE_NAME);
        IFile parentTemplateFile = nodeFolder.getFile(IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_PARENT_FILE_NAME);
        IFile bundleTemplateFile = nodeFolder.getFile(IProjectSettingTemplateConstants.MAVEN_CONTROL_BUILD_BUNDLE_FILE_NAME);
        IFile featureTemplateFile = nodeFolder.getFile(IProjectSettingTemplateConstants.MAVEN_KARAF_BUILD_FEATURE_FILE_NAME);

        String pomId = DesignerMavenUiHelper.buildRepositoryPreferenceNodeId(parentId, pomTemplateFile);
        String parentPomId = DesignerMavenUiHelper.buildRepositoryPreferenceNodeId(parentId, parentTemplateFile);
        String bundlePomId = DesignerMavenUiHelper.buildRepositoryPreferenceNodeId(parentId, bundleTemplateFile);
        String featurePomId = DesignerMavenUiHelper.buildRepositoryPreferenceNodeId(parentId, featureTemplateFile);

        ServicesKarafPomRepositorySettingNode pomNode = new ServicesKarafPomRepositorySettingNode(pomId, pomTemplateFile);
        ServicesKarafParentRepositorySettingNode parentNode = new ServicesKarafParentRepositorySettingNode(parentPomId,
                parentTemplateFile);
        ServicesKarafBundleRepositorySettingNode bundleNode = new ServicesKarafBundleRepositorySettingNode(bundlePomId,
                bundleTemplateFile);
        ServicesKarafFeatureRepositorySettingNode featureNode = new ServicesKarafFeatureRepositorySettingNode(featurePomId,
                featureTemplateFile);

        childrenNodes.add(pomNode);
        childrenNodes.add(parentNode);
        childrenNodes.add(bundleNode);
        childrenNodes.add(featureNode);
    }
    return childrenNodes;
}
 
Example #20
Source File: PropToPrefLinkArea.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public PropToPrefLinkArea(Composite parent, int style, final String pageId, String message, final Shell shell,
		final Object pageData)
{
	/*
	 * breaking new ground yet again - want to link between property and preference paes. ie: project specific debug
	 * engine options to general debugging options
	 */
	pageLink = new Link(parent, style);

	IPreferenceNode node = getPreferenceNode(pageId);
	String result;
	if (node == null)
	{
		result = NLS.bind(WorkbenchMessages.PreferenceNode_NotFound, pageId);
	}
	else
	{
		result = MessageFormat.format(message, node.getLabelText());

		// only add the selection listener if the node is found
		pageLink.addSelectionListener(new SelectionAdapter()
		{

			public void widgetSelected(SelectionEvent e)
			{
				PreferencesUtil.createPreferenceDialogOn(shell, pageId, new String[] { pageId }, pageData).open();
			}

		});
	}
	pageLink.setText(result);

}
 
Example #21
Source File: PropToPrefLinkArea.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
private IPreferenceNode getPreferenceNode(String pageId)
{
	Iterator iterator = PlatformUI.getWorkbench().getPreferenceManager().getElements(PreferenceManager.PRE_ORDER)
			.iterator();
	while (iterator.hasNext())
	{
		IPreferenceNode next = (IPreferenceNode) iterator.next();
		if (next.getId().equals(pageId))
		{
			return next;
		}
	}
	return null;
}
 
Example #22
Source File: KarafRepositoryMavenSetting.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@Override
protected IPreferenceNode createFolderNode(String id, ILabelProvider labelProvider, RepositoryNode node) {
    if (STANDALONE_CATEGORY) {
        return super.createFolderNode(id, labelProvider, node);
    } else {
        return createKarafFolderNode(id, labelProvider, node);
    }
}
 
Example #23
Source File: KarafRepositoryMavenSetting.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@Override
public void createMavenScriptsChildren(IPreferenceNode parentNode, RepositoryNode node) {
    if (STANDALONE_CATEGORY) {
        RepositoryPreferenceNode karafNode = createKarafFolderNode(parentNode.getId(), null, node);
        parentNode.add(karafNode);

        parentNode = karafNode;
    }

    IFolder nodeFolder = DesignerMavenUiHelper.getNodeFolder(node);
    List<IPreferenceNode> routesKarafChildrenNodes = createKarafChildrenNodes(nodeFolder, node, parentNode.getId(), true);
    for (IPreferenceNode n : routesKarafChildrenNodes) {
        parentNode.add(n);
    }
}
 
Example #24
Source File: StyleBuilder.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private static PreferenceManager createPreferenceManager(
		ReportElementHandle handle, AbstractThemeHandle theme )
{
	PreferenceManager preferenceManager = new PreferenceManager( '/' );

	// Get the pages from the registry
	List<IPreferenceNode> pageContributions = new ArrayList<IPreferenceNode>( );

	// adds preference pages into page contributions.
	pageContributions.add( new StylePreferenceNode( "General", //$NON-NLS-1$
			new GeneralPreferencePage( handle, theme ) ) );
	pageContributions.add( new StylePreferenceNode( "Font", //$NON-NLS-1$
			new FontPreferencePage( handle ) ) );
	pageContributions.add( new StylePreferenceNode( "Size", //$NON-NLS-1$
			new SizePreferencePage( handle ) ) );
	pageContributions.add( new StylePreferenceNode( "Background", //$NON-NLS-1$
			new BackgroundPreferencePage( handle ) ) );
	pageContributions.add( new StylePreferenceNode( "Block", //$NON-NLS-1$
			new BlockPreferencePage( handle ) ) );
	pageContributions.add( new StylePreferenceNode( "Box", //$NON-NLS-1$
			new BoxPreferencePage( handle ) ) );
	pageContributions.add( new StylePreferenceNode( "Border", //$NON-NLS-1$
			new BorderPreferencePage( handle ) ) );
	pageContributions.add( new StylePreferenceNode( "Number Format", //$NON-NLS-1$
			new FormatNumberPreferencePage( handle ) ) );
	pageContributions.add( new StylePreferenceNode( "DateTime Format", //$NON-NLS-1$
			new FormatDateTimePreferencePage( handle ) ) );
	pageContributions.add( new StylePreferenceNode( "String Format", //$NON-NLS-1$
			new FormatStringPreferencePage( handle ) ) );
	pageContributions.add( new StylePreferenceNode( "PageBreak", //$NON-NLS-1$
			new PageBreakPreferencePage( handle ) ) );
	pageContributions.add( new StylePreferenceNode( "Map", //$NON-NLS-1$
			new MapPreferencePage( handle ) ) );
	pageContributions.add( new StylePreferenceNode( "Highlights", //$NON-NLS-1$
			new HighlightsPreferencePage( handle ) ) );
	pageContributions.add( new StylePreferenceNode( "Comments", //$NON-NLS-1$
			new CommentsPreferencePage( handle ) ) );

	// Add the contributions to the manager
	Iterator<IPreferenceNode> it = pageContributions.iterator( );
	while ( it.hasNext( ) )
	{
		IPreferenceNode node = it.next( );
		preferenceManager.addToRoot( node );
	}
	return preferenceManager;
}
 
Example #25
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();
}
 
Example #26
Source File: BonitaPreferenceDialog.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
protected void createOtherCategoryLine(final Composite menuComposite) {
    final Composite otherRowComposite = createRow(menuComposite, null, Messages.BonitaPreferenceDialog_Other, 3);

    final ToolItem tltmValidation = createTool(otherRowComposite, null, Pics.getImage(PicsConstants.validation),
            Pics.getImage(PicsConstants.validationDisabled), CONSTRAINTS_PAGE_ID);

    final ToolItem tltmAdvancedSettings = createTool(otherRowComposite, null,
            Pics.getImage(PicsConstants.preferenceAdvanced),
            Pics.getImage(PicsConstants.preferenceAdvanceddisabled), ADVANCED_PAGE_ID);

    final ToolItem eclipseItem = createTool(otherRowComposite, null, Pics.getImage(PicsConstants.preferenceEclipse),
            Pics.getImage(PicsConstants.preferenceEclipseDisabled), null);
    eclipseItem.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {

            final Set<String> preferencesToShow = new HashSet<>();
            for (final Object elem : PlatformUI.getWorkbench().getPreferenceManager()
                    .getElements(PreferenceManager.POST_ORDER)) {
                if (elem instanceof IPreferenceNode) {
                    //REMOVE BONITA PREFS
                    if (!((IPreferenceNode) elem).getId().contains("org.bonitasoft")) {
                        preferencesToShow.add(((IPreferenceNode) elem).getId());
                    }
                }
            }

            final WorkbenchPreferenceDialog dialog = WorkbenchPreferenceDialog.createDialogOn(null, null);
            dialog.showOnly(preferencesToShow.toArray(new String[] {}));
            dialog.open();
        }
    });

    final Label lblValidation = createItemLabel(otherRowComposite, null, Messages.BonitaPreferenceDialog_Validation);
    final Label lblAdvanced = createItemLabel(otherRowComposite, null, Messages.BonitaPreferenceDialog_Advanced);
    final Label eclipseLabel = createItemLabel(otherRowComposite, null, Messages.EclipsePreferences);

    putInItemPerPreferenceNode(CONSTRAINTS_PAGE_ID, tltmValidation);
    putInLabelPerPreferenceNode(CONSTRAINTS_PAGE_ID, lblValidation);

    putInItemPerPreferenceNode(ADVANCED_PAGE_ID, tltmAdvancedSettings);
    putInLabelPerPreferenceNode(ADVANCED_PAGE_ID, lblAdvanced);

    putInItemPerPreferenceNode(ECLIPSE_PAGE_ID, eclipseItem);
    putInLabelPerPreferenceNode(ECLIPSE_PAGE_ID, eclipseLabel);
}
 
Example #27
Source File: UnwantedPreferenceManager.java    From tlaplus with MIT License 4 votes vote down vote up
public void initialize()
{
    if (Activator.getDefault().getWorkbench() == null)
    {
        return;
    }
    PreferenceManager pm = Activator.getDefault().getWorkbench().getPreferenceManager();

    if (pm != null)
    {
        /*
         * Subpages need to be removed by calling the remove method
         * on their parent. Pages with no parent can be removed
         * by calling the remove method on the preference manager.
         * 
         * Getting the appropriate id of the page to remove can be done
         * using the code that is commented at the end of this method.
         * It will print out the name followed by the id of every preference page.
         */
        IPreferenceNode generalNode = pm.find("org.eclipse.ui.preferencePages.Workbench");
        if (generalNode != null)
        {
            // these are sub pages of general that we want removed
            generalNode.remove("org.eclipse.ui.preferencePages.Workspace");
            generalNode.remove("org.eclipse.ui.preferencePages.ContentTypes");
            // We no longer want to remove this node.
            // We only want to remove one of its sub nodes.
            // generalNode.remove("org.eclipse.ui.preferencePages.Views");
            // we only want to remove some subnodes of the Editors page
            IPreferenceNode editorsNode = generalNode.findSubNode("org.eclipse.ui.preferencePages.Editors");
            if (editorsNode != null)
            {
                // remove File Associations page
                editorsNode.remove("org.eclipse.ui.preferencePages.FileEditors");
                // want to remove only some subnodes of the Text Editors page
                IPreferenceNode textEditorsNode = editorsNode
                        .findSubNode("org.eclipse.ui.preferencePages.GeneralTextEditor");
                if (textEditorsNode != null)
                {
                    textEditorsNode.remove("org.eclipse.ui.editors.preferencePages.Spelling");
                    textEditorsNode.remove("org.eclipse.ui.editors.preferencePages.QuickDiff");
                    textEditorsNode.remove("org.eclipse.ui.editors.preferencePages.LinkedModePreferencePage");
                }
            }
            generalNode.remove("org.eclipse.ui.preferencePages.Perspectives");
            generalNode.remove("org.eclipse.equinox.security.ui.category");
            IPreferenceNode appearanceNode = generalNode.findSubNode("org.eclipse.ui.preferencePages.Views");
            if (appearanceNode != null)
            {
                // Removes the label decorators node that is a sub node of
                // the appearance node.
                // We want to keep the other sub node, colors and fonts
                // because it allows for setting the font for
                // the module editor.
                appearanceNode.remove("org.eclipse.ui.preferencePages.Decorators");
            }
        }

        // remove Install/Update
        pm.remove("org.eclipse.equinox.internal.p2.ui.sdk.ProvisioningPreferencePage");

        // remove the sub node of help
        IPreferenceNode helpNode = pm.find("org.eclipse.help.ui.browsersPreferencePage");
        if (helpNode != null)
        {
            helpNode.remove("org.eclipse.help.ui.contentPreferencePage");
        }
    }
}
 
Example #28
Source File: KarafRepositoryMavenSetting.java    From tesb-studio-se with Apache License 2.0 4 votes vote down vote up
protected abstract List<IPreferenceNode> createKarafChildrenNodes(IFolder nodeFolder, RepositoryNode node, String parentId,
boolean checkExist);
 
Example #29
Source File: ServiceKarafRepositoryMavenSetting.java    From tesb-studio-se with Apache License 2.0 4 votes vote down vote up
@Override
protected List<IPreferenceNode> createKarafChildrenNodes(IFolder nodeFolder, RepositoryNode node, String parentId,
        boolean checkExist) {
    return createServicesKarafChildrenNodes(nodeFolder, node, parentId, checkExist);
}
 
Example #30
Source File: ServicesKarafRepositorySettingPage.java    From tesb-studio-se with Apache License 2.0 4 votes vote down vote up
@Override
protected List<IPreferenceNode> createMavenChildrenNodes(IFolder nodeFolder) {
    List<IPreferenceNode> routesKarafChildrenNodes = ServiceKarafRepositoryMavenSetting.createServicesKarafChildrenNodes(
            nodeFolder, getNode(), getPrefNodeId(), false);
    return routesKarafChildrenNodes;
}