List of usage examples for org.eclipse.jface.preference PreferenceManager PreferenceManager
public PreferenceManager()
From source file:aktie.gui.CocoaUIEnhancer.java
License:Open Source License
private static void showPreferences() { System.out.println("Preferences..."); PreferenceManager manager = new PreferenceManager(); PreferenceDialog dialog = new PreferenceDialog(null, manager); dialog.open();/* w ww . ja v a 2s . c o m*/ // delegate.runCommand(ActionFactory.PREFERENCES.getCommandId()); }
From source file:at.nucle.e4.plugin.preferences.core.internal.PreferenceService.java
License:Open Source License
@PostConstruct public void create() { this.preferenceManager = new PreferenceManager(); }
From source file:at.spardat.xma.guidesign.preferences.AbstractPreferenceAndPropertyPage.java
License:Open Source License
/** * Show a single preference pages/* w w w . j ava 2 s .co m*/ * * @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(); } }); }
From source file:au.gov.ga.earthsci.application.preferences.PreferenceUtil.java
License:Apache License
/** * Create a {@link PreferenceManager} instance which contains all the * {@link PreferencePage}s listed in the legacy plugin.xml. These are all * the 'org.eclipse.ui.preferencePages' extension points. * <p/>/*from w ww .j a v a 2 s .com*/ * The e4 platform doesn't support these extension points; this method helps * enumerate them manually. * * @param context * Application context * @param registry * Extension registry * @return {@link PreferenceManager} containing the preference pages */ public static PreferenceManager createLegacyPreferenceManager(IEclipseContext context, IExtensionRegistry registry) { List<IConfigurationElement> preferenceElements = findPreferenceElementsFromRegistry(registry); PreferenceManager pm = new PreferenceManager(); populatePreferenceManager(pm, context, preferenceElements); return pm; }
From source file:com.aerospike.core.nature.AddRemoveAerospikeNatureHandler.java
License:Apache License
/** * Toggles sample nature on a project// w w w .j av a2s. c o m * * @param project * to have sample nature added or removed */ private void toggleNature() { if (selection instanceof IStructuredSelection) { for (Iterator<?> it = ((IStructuredSelection) selection).iterator(); it.hasNext();) { Object element = it.next(); IProject project = null; if (element instanceof IProject) { project = (IProject) element; } else if (element instanceof IAdaptable) { project = (IProject) ((IAdaptable) element).getAdapter(IProject.class); } if (project != null) { try { IProjectDescription description = project.getDescription(); String[] natures = description.getNatureIds(); for (int i = 0; i < natures.length; ++i) { if (AerospikeNature.NATURE_ID.equals(natures[i])) { // Remove the nature String[] newNatures = new String[natures.length - 1]; System.arraycopy(natures, 0, newNatures, 0, i); System.arraycopy(natures, i + 1, newNatures, i, natures.length - i - 1); description.setNatureIds(newNatures); project.setDescription(description, null); return; } } // Add the nature String[] newNatures = new String[natures.length + 1]; System.arraycopy(natures, 0, newNatures, 0, natures.length); newNatures[natures.length] = AerospikeNature.NATURE_ID; description.setNatureIds(newNatures); project.setDescription(description, null); // Show property page ClusterPropertyPage page = new ClusterPropertyPage(); page.setElement((IAdaptable) element); PreferenceManager mgr = new PreferenceManager(); IPreferenceNode node = new PreferenceNode("1", page); mgr.addToRoot(node); Shell shell = this.part.getSite().getShell(); PropertyDialog dialog = new PropertyDialog(shell, mgr, this.selection); dialog.create(); dialog.setMessage(page.getTitle()); dialog.open(); } catch (CoreException e) { CoreActivator.showError(e, "Could not change Aerospike Nature"); } } } } }
From source file:com.agynamix.platform.frontend.preferences.ApplicationPreferenceDialog.java
License:Open Source License
public int open() { PreferenceConfigAdapterImpl configAdapter = new PreferenceConfigAdapterImpl(); ApplicationPreferenceStore store = new ApplicationPreferenceStore(configAdapter); // AppConfigUtil.getPreferencesFile()); store.addPropertyChangeListener(configAdapter); PreferenceManager manager = new PreferenceManager(); GlobalPreferencePageDefaults defaultPage = new GlobalPreferencePageDefaults(configAdapter); defaultPage.addPreferenceDialogListener(this); PreferenceNode defaultsNode = new PreferenceNode("defaultsPage"); GlobalPreferencePageNetwork networkPage = new GlobalPreferencePageNetwork(configAdapter); networkPage.addPreferenceDialogListener(this); PreferenceNode networkNode = new PreferenceNode("networkPage"); defaultsNode.setPage(defaultPage);//from w ww . j av a2 s. co m manager.addToRoot(defaultsNode); networkNode.setPage(networkPage); manager.addToRoot(networkNode); PreferenceDialog dialog = new PreferenceDialog(shell, manager); dialog.setPreferenceStore(store); int result = dialog.open(); for (IPreferenceDialogListener l : preferenceDialogListeners) { l.dialogClosed(result); } return result; }
From source file:com.aliyun.odps.eclipse.create.wizard.NewOdpsProjectWizardPage.java
License:Apache License
public void widgetSelected(SelectionEvent e) { if (e.getSource() == linkConfigDefaultConsoleLocation) { PreferenceManager manager = new PreferenceManager(); manager.addToRoot(new PreferenceNode("ODPS Console Directory", new PreferencePageOdpsConsole())); PreferenceDialog dialog = new PreferenceDialog(this.getShell(), manager); dialog.create();//from ww w. j a va 2 s . c o m dialog.setMessage(CONSOLE_LOCATION_TXT); dialog.setBlockOnOpen(true); dialog.open(); updateHadoopDirLabelFromPreferences(); } else if (e.getSource() == btnNewConsoleLocation) { DirectoryDialog dialog = new DirectoryDialog(this.getShell()); dialog.setMessage(CONSOLE_LOCATION_TXT); dialog.setText(CONSOLE_LOCATION_TXT); String directory = dialog.open(); if (directory != null) { txtNewConsoleLocation.setText(directory); if (!validateODPSConoleLocation()) { setErrorMessage("No ODPS SDK jar found in specified directory"); } else { setErrorMessage(null); } } } else if (radioNewConsoleLocation.getSelection()) { txtNewConsoleLocation.setEnabled(true); btnNewConsoleLocation.setEnabled(true); } else { txtNewConsoleLocation.setEnabled(false); btnNewConsoleLocation.setEnabled(false); } getContainer().updateButtons(); }
From source file:com.android.ddms.PrefsDialog.java
License:Apache License
/** * Create and display the dialog./*from w w w . ja v a 2s.co m*/ */ public static void run(Shell shell) { PreferenceStore prefStore = mStore.getPreferenceStore(); assert prefStore != null; PreferenceManager prefMgr = new PreferenceManager(); PreferenceNode node, subNode; // this didn't work -- got NPE, possibly from class lookup: //PreferenceNode app = new PreferenceNode("app", "Application", null, // AppPrefs.class.getName()); node = new PreferenceNode("debugger", new DebuggerPrefs()); prefMgr.addToRoot(node); subNode = new PreferenceNode("panel", new PanelPrefs()); //prefMgr.addTo(node.getId(), subNode); prefMgr.addToRoot(subNode); node = new PreferenceNode("LogCat", new LogCatPrefs()); prefMgr.addToRoot(node); node = new PreferenceNode("misc", new MiscPrefs()); prefMgr.addToRoot(node); node = new PreferenceNode("stats", new UsageStatsPrefs()); prefMgr.addToRoot(node); PreferenceDialog dlg = new PreferenceDialog(shell, prefMgr); dlg.setPreferenceStore(prefStore); // run it try { dlg.open(); } catch (Throwable t) { Log.e("ddms", t); } // save prefs try { prefStore.save(); } catch (IOException ioe) { } // discard the stuff we created //prefMgr.dispose(); //dlg.dispose(); }
From source file:com.aptana.formatter.ui.util.SWTUtil.java
License:Open Source License
/** * This method allows us to open the preference dialog on the specific page, in this case the perspective page * /*from w w w .j ava2 s . com*/ * @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(); } }); }
From source file:com.aptana.ide.debug.internal.ui.actions.DetailOptionsActionDelegate.java
License:Open Source License
/** * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) *///from w ww . j a va2 s.c o m public void run(IAction action) { final IPreferenceNode targetNode = new PreferenceNode( "com.aptana.ide.debug.ui.preferences.jsDetailFormatters", new JSDetailFormattersPreferencePage()); //$NON-NLS-1$ PreferenceManager manager = new PreferenceManager(); manager.addToRoot(targetNode); final PreferenceDialog dialog = new PreferenceDialog(DebugUiPlugin.getActiveWorkbenchShell(), manager); final boolean[] result = new boolean[] { false }; BusyIndicator.showWhile(DebugUiPlugin.getStandardDisplay(), new Runnable() { public void run() { dialog.create(); dialog.setMessage(targetNode.getLabelText()); result[0] = (dialog.open() == Window.OK); } }); }