List of usage examples for org.eclipse.jface.preference PreferenceManager POST_ORDER
int POST_ORDER
To view the source code for org.eclipse.jface.preference PreferenceManager POST_ORDER.
Click Source Link
From source file:au.gov.ga.earthsci.application.preferences.PreferenceUtil.java
License:Apache License
private static 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; }/*www. ja va2 s. c om*/ } return null; }
From source file:com.aptana.ui.preferences.GenericRootPreferencePage.java
License:Open Source License
/** * Creates the links.//from www. j av a 2 s . c o m */ @SuppressWarnings({ "unchecked" }) protected Control createContents(Composite parent) { // pageNameToId = null if (pageNameToId == null) { pageNameToId = new HashMap<String, String>(); String pageId = getPageId(); // Locate all the pages that are defined as this page children PreferenceManager manager = PlatformUI.getWorkbench().getPreferenceManager(); List<IPreferenceNode> nodes = manager.getElements(PreferenceManager.POST_ORDER); for (Iterator<IPreferenceNode> i = nodes.iterator(); i.hasNext();) { IPreferenceNode node = i.next(); if (node.getId().equals(pageId)) { // we found the node, so take its child nodes and add them to the cache IPreferenceNode[] subNodes = node.getSubNodes(); for (IPreferenceNode child : subNodes) { pageNameToId.put(child.getLabelText(), child.getId()); } break; } } } Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(1, false)); String contentsMessage = getContentsMessage(); if (contentsMessage != null) { Label message = new Label(composite, SWT.WRAP); message.setText(contentsMessage); } Group group = new Group(composite, SWT.NONE); group.setLayout(new GridLayout(1, false)); GridData gd = new GridData(GridData.FILL_HORIZONTAL); group.setLayoutData(gd); group.setText(EplMessages.GenericRootPage_preferences); List<String> pagesNames = new ArrayList<String>(pageNameToId.keySet()); // In case there are no pages to link to, add a label that will indicate that there are no settings if (pagesNames.isEmpty()) { Label label = new Label(group, SWT.NONE); label.setText(EplMessages.GenericRootPage_noAvailablePages); label.setLayoutData(new GridData()); } else { Collections.sort(pagesNames); for (String pageName : pagesNames) { String id = pageNameToId.get(pageName); final Link link = new Link(group, SWT.NONE); link.setText("<a>" + pageName + "</a>"); //$NON-NLS-1$ //$NON-NLS-2$ link.addSelectionListener(new LinkSelectionListener(id)); gd = new GridData(); gd.horizontalIndent = 30; link.setLayoutData(gd); } } Group dialogsResetGroup = new Group(composite, SWT.NONE); dialogsResetGroup.setLayout(GridLayoutFactory.swtDefaults().numColumns(2).create()); dialogsResetGroup.setLayoutData(GridDataFactory.fillDefaults().create()); dialogsResetGroup.setText(EplMessages.GenericRootPreferencePage_dialogsGroup); Label label = new Label(dialogsResetGroup, SWT.WRAP); label.setText(EplMessages.GenericRootPreferencePage_clearMessagesLabelText); label.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.CENTER) .hint(convertVerticalDLUsToPixels(50), SWT.DEFAULT).create()); final Button clearBt = new Button(dialogsResetGroup, SWT.PUSH); clearBt.setText(EplMessages.GenericRootPreferencePage_clearMessagesButtonLabel); clearBt.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false)); // enable the 'reset' button only if there are dialogs to reset. final IEclipsePreferences prefs = (EclipseUtil.instanceScope()).getNode(UIEplPlugin.PLUGIN_ID); String messages = prefs.get(IEplPreferenceConstants.HIDDEN_MESSAGES, null); clearBt.setEnabled(!StringUtil.isEmpty(messages)); clearBt.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { try { prefs.remove(IEplPreferenceConstants.HIDDEN_MESSAGES); prefs.flush(); clearBt.setEnabled(false); } catch (Exception ex) { IdeLog.logError(UIEplPlugin.getDefault(), ex); } } }); Point point = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); gd = new GridData(); composite.setLayoutData(gd); gd.heightHint = point.y; return composite; }
From source file:com.google.dart.tools.deploy.ApplicationWorkbenchWindowAdvisor.java
License:Open Source License
private void filterUnwantedPreferenceNodes() { PreferenceManager preferenceManager = PlatformUI.getWorkbench().getPreferenceManager(); for (Object elem : preferenceManager.getElements(PreferenceManager.POST_ORDER)) { if (elem instanceof IPreferenceNode) { IPreferenceNode node = (IPreferenceNode) elem; if (isBlacklisted(node)) { if (!preferenceManager.remove(node)) { for (IPreferenceNode rootNode : preferenceManager.getRootSubNodes()) { if (rootNode.findSubNode(node.getId()) != null) { rootNode.remove(node); }/*from w ww . j ava2 s . c o m*/ } } } } } }
From source file:com.mindquarry.desktop.preferences.dialog.FilteredPreferenceDialog.java
License:Open Source License
/** * Find the <code>IPreferenceNode</code> that has data the same id as the * supplied value.//from w w w .ja v a 2s .co m * * @param nodeId the id to search for. * @return <code>IPreferenceNode</code> or <code>null</code> if not * found. */ protected IPreferenceNode findNodeMatching(String nodeId) { List nodes = preferenceManager.getElements(PreferenceManager.POST_ORDER); for (Iterator i = nodes.iterator(); i.hasNext();) { IPreferenceNode node = (IPreferenceNode) i.next(); if (node.getId().equals(nodeId)) { return node; } } return null; }
From source file:com.nsn.squirrel.preferences.internal.E4PreferenceRegistry.java
License:Open Source License
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; }/* ww w . j a v a2 s . c om*/ } return null; }
From source file:com.opcoach.e4.preferences.internal.E4PreferenceRegistry.java
License:Open Source License
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; }/*from w w w . j a va2 s .c o m*/ } return null; }
From source file:msi.gama.gui.views.GamaPreferencesView.java
License:Open Source License
private GamaPreferencesView(final Shell parent) { parentShell = parent;//from w w w .j a v a2s . co m shell = new Shell(parentShell, SWT.TITLE | SWT.RESIZE | SWT.APPLICATION_MODAL | SWT.SHEET); final GridLayout gridLayout = new GridLayout(2, false); gridLayout.marginWidth = gridLayout.marginHeight = 5; gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 5; shell.setLayout(gridLayout); PreferenceManager preferenceManager = PlatformUI.getWorkbench().getPreferenceManager(); // We clean the default preference manager to remove useless preferences for (Object elem : preferenceManager.getElements(PreferenceManager.POST_ORDER)) { if (elem instanceof IPreferenceNode) { String id = ((IPreferenceNode) elem).getId(); if (preferenceNames.containsKey(id)) { preferencePages.put(preferenceNames.get(id), (IPreferenceNode) elem); } if (id.contains("debug.ui") || id.contains("help.ui") || id.contains("search") || id.contains("Spelling") || id.contains("Linked") || id.contains("Perspectives") || id.contains("Content")) { preferenceManager.remove((IPreferenceNode) elem); } // GuiUtils.debug(((IPreferenceNode) elem).getId()); // preferenceManager.remove((IPreferenceNode) elem); } } buildContents(); }
From source file:org.bonitasoft.studio.preferences.dialog.BonitaPreferenceDialog.java
License:Open Source License
protected Composite createMenuComposite(Composite parent) { Composite menuComposite = new Composite(parent, SWT.NONE); GridLayout gl_menuComposite = new GridLayout(1, false); gl_menuComposite.marginWidth = 0;/*from w w w . j a v a 2s. c om*/ gl_menuComposite.marginHeight = 0; gl_menuComposite.horizontalSpacing = 0; gl_menuComposite.verticalSpacing = 0; gl_menuComposite.marginBottom = 15; menuComposite.setLayout(gl_menuComposite); Composite generalRow = null; if (PreferenceUtil.findNodeMatching(USER_PROFILE_PAGE_ID) != null) { generalRow = createRow(menuComposite, LIGHT_BACKGROUND, Messages.BonitaPreferenceDialog_general, 5); } else { generalRow = createRow(menuComposite, LIGHT_BACKGROUND, Messages.BonitaPreferenceDialog_general, 4); } if (PreferenceUtil.findNodeMatching(USER_PROFILE_PAGE_ID) != null) { ToolItem tltmProfiles = createTool(generalRow, LIGHT_BACKGROUND, Pics.getImage(PicsConstants.preferenceUserProfile), Pics.getImage(PicsConstants.preferenceUserProfileDisabled), USER_PROFILE_PAGE_ID); itemPerPreferenceNode.put(USER_PROFILE_PAGE_ID, tltmProfiles); } ToolItem tltmDatabase = createTool(generalRow, LIGHT_BACKGROUND, Pics.getImage(PicsConstants.preferenceDB), Pics.getImage(PicsConstants.preferenceDBdisabled), DATABASE_PAGE_ID); ToolItem tltmAppearance = createTool(generalRow, LIGHT_BACKGROUND, Pics.getImage(PicsConstants.preferenceAppearance), Pics.getImage(PicsConstants.preferenceAppearancedisabled), APPEARANCE_PAGE_ID); ToolItem tltmLanguage = createTool(generalRow, LIGHT_BACKGROUND, Pics.getImage(PicsConstants.preferenceLanguage), Pics.getImage(PicsConstants.preferenceLanguagedisabled), LANGUAGE_PAGE_ID); ToolItem tltmJava = createTool(generalRow, LIGHT_BACKGROUND, Pics.getImage(PicsConstants.preferenceJava), Pics.getImage(PicsConstants.preferenceJavadisabled), JAVA_PAGE_ID); if (PreferenceUtil.findNodeMatching(USER_PROFILE_PAGE_ID) != null) { Label lblProfiles = createItemLabel(generalRow, LIGHT_BACKGROUND, Messages.BonitaPreferenceDialog_userProfile); labelPerPreferenceNode.put(USER_PROFILE_PAGE_ID, lblProfiles); } Label lblDatabase = createItemLabel(generalRow, LIGHT_BACKGROUND, Messages.BonitaPreferenceDialog_database); itemPerPreferenceNode.put(DATABASE_PAGE_ID, tltmDatabase); labelPerPreferenceNode.put(DATABASE_PAGE_ID, lblDatabase); Label lblAppearance = createItemLabel(generalRow, LIGHT_BACKGROUND, Messages.BonitaPreferenceDialog_appearance); itemPerPreferenceNode.put(APPEARANCE_PAGE_ID, tltmAppearance); labelPerPreferenceNode.put(APPEARANCE_PAGE_ID, lblAppearance); Label lblLanguage = createItemLabel(generalRow, LIGHT_BACKGROUND, Messages.BonitaPreferenceDialog_language); itemPerPreferenceNode.put(LANGUAGE_PAGE_ID, tltmLanguage); labelPerPreferenceNode.put(LANGUAGE_PAGE_ID, lblLanguage); Label lblJava = createItemLabel(generalRow, LIGHT_BACKGROUND, Messages.BonitaPreferenceDialog_Java); itemPerPreferenceNode.put(JAVA_PAGE_ID, tltmJava); labelPerPreferenceNode.put(JAVA_PAGE_ID, lblJava); createSeparator(menuComposite); Composite deploymentRow = createRow(menuComposite, null, Messages.BonitaPreferenceDialog_Deployment, 4); ToolItem tltmRunMode = createTool(deploymentRow, null, Pics.getImage(PicsConstants.preferenceDeploy), Pics.getImage(PicsConstants.preferenceDeploydisabled), RUN_DEPLOY_MODE_PAGE_ID); ToolItem tltmUserxpSettings = createTool(deploymentRow, null, Pics.getImage(PicsConstants.preferenceLogin), Pics.getImage(PicsConstants.preferenceLogindisabled), USERXP_SETTINGS_PAGE_ID); ToolItem tltmDBConnectors = createTool(deploymentRow, null, Pics.getImage(PicsConstants.preferenceAdvanced), Pics.getImage(PicsConstants.preferenceAdvanceddisabled), DB_CONNECTORS_PAGE_ID); if (PreferenceUtil.findNodeMatching(REMOTE_ENGINE_PAGE_ID) != null) { ToolItem tltmRemoteEngine = createTool(deploymentRow, null, Pics.getImage(PicsConstants.preferenceRemote), Pics.getImage(PicsConstants.preferenceRemotedisabled), REMOTE_ENGINE_PAGE_ID); itemPerPreferenceNode.put(REMOTE_ENGINE_PAGE_ID, tltmRemoteEngine); } else { ToolBar emptyToolbar = new ToolBar(deploymentRow, SWT.FLAT | SWT.TRANSPARENT); GridData gd_toolBar_8 = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1); gd_toolBar_8.verticalIndent = 5; emptyToolbar.setLayoutData(gd_toolBar_8); emptyToolbar.setVisible(false); } Label lblRunMode = createItemLabel(deploymentRow, null, Messages.BonitaPreferenceDialog_RunMode); itemPerPreferenceNode.put(RUN_DEPLOY_MODE_PAGE_ID, tltmRunMode); labelPerPreferenceNode.put(RUN_DEPLOY_MODE_PAGE_ID, lblRunMode); Label lblUserxpSettings = createItemLabel(deploymentRow, null, Messages.BonitaPreferenceDialog_UserXP_Settings); itemPerPreferenceNode.put(USERXP_SETTINGS_PAGE_ID, tltmUserxpSettings); labelPerPreferenceNode.put(USERXP_SETTINGS_PAGE_ID, lblUserxpSettings); Label lblDbConnectors = createItemLabel(deploymentRow, null, Messages.BonitaPreferenceDialog_DBConnectors); itemPerPreferenceNode.put(DB_CONNECTORS_PAGE_ID, tltmDBConnectors); labelPerPreferenceNode.put(DB_CONNECTORS_PAGE_ID, lblDbConnectors); if (PreferenceUtil.findNodeMatching(REMOTE_ENGINE_PAGE_ID) != null) { Label lblRemoteEngine = createItemLabel(deploymentRow, null, Messages.BonitaPreferenceDialog_Remote_Engine); labelPerPreferenceNode.put(REMOTE_ENGINE_PAGE_ID, lblRemoteEngine); } else { new Label(deploymentRow, SWT.WRAP | SWT.CENTER); } createSeparator(menuComposite); Composite webRowComposite = createRow(menuComposite, LIGHT_BACKGROUND, Messages.BonitaPreferenceDialog_Web, 2); ToolItem tltmBrowser = createTool(webRowComposite, LIGHT_BACKGROUND, Pics.getImage(PicsConstants.preferenceWeb), Pics.getImage(PicsConstants.preferenceWebdisabled), WEB_BROWSER_PAGE_ID); ToolItem tltmProxy = createTool(webRowComposite, LIGHT_BACKGROUND, Pics.getImage(PicsConstants.preferenceProxy), Pics.getImage(PicsConstants.preferenceProxydisabled), PROXY_PAGE_ID); Label lblBrowser = createItemLabel(webRowComposite, LIGHT_BACKGROUND, Messages.BonitaPreferenceDialog_Browser); itemPerPreferenceNode.put(WEB_BROWSER_PAGE_ID, tltmBrowser); labelPerPreferenceNode.put(WEB_BROWSER_PAGE_ID, lblBrowser); Label lblProxy = createItemLabel(webRowComposite, LIGHT_BACKGROUND, Messages.BonitaPreferenceDialog_Proxy); itemPerPreferenceNode.put(PROXY_PAGE_ID, tltmProxy); labelPerPreferenceNode.put(PROXY_PAGE_ID, lblProxy); createSeparator(menuComposite); Composite otherRowComposite = createRow(menuComposite, null, Messages.BonitaPreferenceDialog_Other, 2); ToolItem tltmAdvancedSettings = createTool(otherRowComposite, null, Pics.getImage(PicsConstants.preferenceAdvanced), Pics.getImage(PicsConstants.preferenceAdvanceddisabled), ADVANCED_PAGE_ID); ToolItem eclipseItem = createTool(otherRowComposite, null, Pics.getImage(PicsConstants.preferenceEclipse), Pics.getImage(PicsConstants.preferenceEclipseDisabled), null); eclipseItem.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Set<String> preferencesToShow = new HashSet<String>(); for (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()); } } } WorkbenchPreferenceDialog dialog = WorkbenchPreferenceDialog.createDialogOn(null, null); dialog.showOnly(preferencesToShow.toArray(new String[] {})); dialog.open(); } }); Label lblAdvanced = createItemLabel(otherRowComposite, null, Messages.BonitaPreferenceDialog_Advanced); Label eclipseLabel = createItemLabel(otherRowComposite, null, Messages.EclipsePreferences); itemPerPreferenceNode.put(ADVANCED_PAGE_ID, tltmAdvancedSettings); labelPerPreferenceNode.put(ADVANCED_PAGE_ID, lblAdvanced); itemPerPreferenceNode.put(ECLIPSE_PAGE_ID, eclipseItem); labelPerPreferenceNode.put(ECLIPSE_PAGE_ID, eclipseLabel); return menuComposite; }
From source file:org.bonitasoft.studio.preferences.PreferenceUtil.java
License:Open Source License
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; }/*from w w w . j ava 2 s .c om*/ } return null; }
From source file:org.eclipse.bpmn2.modeler.ui.preferences.Bpmn2HomePreferencePage.java
License:Open Source License
public static IPreferencePage getPage(IPreferencePageContainer container, String nodeId) { PreferenceDialog pd = (PreferenceDialog) container; PreferenceManager pm = pd.getPreferenceManager(); List nodes = pm.getElements(PreferenceManager.POST_ORDER); for (Iterator i = nodes.iterator(); i.hasNext();) { IPreferenceNode node = (IPreferenceNode) i.next(); if (node.getId().equals(nodeId)) { return node.getPage(); }//from w w w . j a v a2s . c om } return null; }