List of usage examples for org.eclipse.jface.preference PreferenceDialog PreferenceDialog
public PreferenceDialog(Shell parentShell, PreferenceManager manager)
From source file:com.nokia.testfw.test.framework.PreferenceTestCase.java
License:Open Source License
/** * Sets up the fixture, for example, open a network connection. This method * is called before a test is executed.//w w w .j ava2 s . c om */ protected void setUp() throws Exception { Shell shell = Display.getDefault().getActiveShell(); preferenceManager = PlatformUI.getWorkbench().getPreferenceManager(); dialog = new PreferenceDialog(shell, preferenceManager); dialog.setBlockOnOpen(false); dialog.setSelectedNode(getPageId()); dialog.open(); // delay for 2 seconds after dialog open TestUtils.delay(2000); }
From source file:com.nokia.traceviewer.engine.ConnectionHelper.java
License:Open Source License
/** * Creates Client UI//from w w w. j a va 2 s . com */ private static void createClientUI() { PreferenceManager mgr = new PreferenceManager(); // Create connection preference page IPreferencePage connectionPage = new TraceViewerConnectionPreferencesPage(); IPreferenceNode connectionNode = new PreferenceNode("1", connectionPage); //$NON-NLS-1$ mgr.addToRoot(connectionNode); // Create the dialog PreferenceDialog dialog = new PreferenceDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), mgr); dialog.create(); }
From source file:com.nokia.traceviewer.view.TraceViewerView.java
License:Open Source License
public boolean openPreferencePage(TVPreferencePage TVpage) { boolean ret = false; PreferenceManager mgr = new PreferenceManager(); // Create general preference page IPreferencePage generalPage = new TraceViewerPreferencesPage(); generalPage.setTitle(TRACE_VIEWER_TITLE); IPreferenceNode generalNode = new PreferenceNode("1", generalPage); //$NON-NLS-1$ mgr.addToRoot(generalNode);//from w w w .ja v a 2 s .c o m // Create advanced preference page IPreferencePage advancedPage = new TraceViewerAdvancedPreferencesPage(); advancedPage.setTitle(Messages.getString("TraceViewerView.AdvancedPageTitle")); //$NON-NLS-1$ IPreferenceNode advancedNode = new PreferenceNode("2", advancedPage); //$NON-NLS-1$ mgr.addTo("1", advancedNode); //$NON-NLS-1$ // Create connection preference page IPreferencePage connectionPage = new TraceViewerConnectionPreferencesPage(); connectionPage.setTitle(Messages.getString("TraceViewerView.ConnectionPageTitle")); //$NON-NLS-1$ IPreferenceNode connectionNode = new PreferenceNode("3", connectionPage); //$NON-NLS-1$ mgr.addTo("1", connectionNode); //$NON-NLS-1$ PreferenceDialog dialog = new PreferenceDialog(getShell(), mgr); dialog.create(); dialog.getTreeViewer().expandAll(); // Switch the page switch (TVpage) { case GENERAL: dialog.getTreeViewer().setSelection(new StructuredSelection(generalNode)); break; case ADVANCED: dialog.getTreeViewer().setSelection(new StructuredSelection(advancedNode)); break; case CONNECTION: dialog.getTreeViewer().setSelection(new StructuredSelection(connectionNode)); break; default: break; } // Open dialog and get return value int ok = dialog.open(); if (ok == Window.OK) { ret = true; } return ret; }
From source file:com.nsn.squirrel.preferences.handlers.E4PreferencesHandler.java
License:Open Source License
@Execute public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, E4PreferenceRegistry prefReg) { PreferenceManager pm = prefReg.getPreferenceManager(); PreferenceDialog dialog = new PreferenceDialog(shell, pm); dialog.create();//w w w . ja v a2 s .c o m dialog.getTreeViewer().setComparator(new ViewerComparator()); dialog.getTreeViewer().expandAll(); dialog.open(); }
From source file:com.opcoach.e4.preferences.handlers.E4PreferencesHandler.java
License:Open Source License
@Execute public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, E4PreferenceRegistry prefReg) { PreferenceManager pm = prefReg.getPreferenceManager(); PreferenceDialog dialog = new PreferenceDialog(shell, pm); dialog.create();/*from w w w . ja va 2 s . c o m*/ dialog.getTreeViewer().setComparator(new ViewerComparator()); dialog.getTreeViewer().expandAll(); dialog.open(); }
From source file:com.palantir.typescript.preferences.FieldEditorProjectPreferencePage.java
License:Apache License
private void configureWorkspaceSettings() { String preferenceNodeId = this.getPreferenceNodeId(); IPreferencePage preferencePage = newPreferencePage(); final IPreferenceNode preferenceNode = new PreferenceNode(preferenceNodeId, preferencePage); PreferenceManager manager = new PreferenceManager(); manager.addToRoot(preferenceNode);//from ww w . ja v a 2 s. c om final PreferenceDialog dialog = new PreferenceDialog(this.getControl().getShell(), manager); BusyIndicator.showWhile(this.getControl().getDisplay(), new Runnable() { @Override public void run() { dialog.create(); dialog.setMessage(preferenceNode.getLabelText()); dialog.open(); } }); }
From source file:com.peergreen.eclipse.osgi.preferences.PeergreenPreferencePage.java
License:Apache License
public static void main(String[] args) throws Exception { Display display = new Display(); // Allows to test the preference page from Eclipse Shell shell = new Shell(); shell.setSize(450, 300);//from w w w . ja v a2s .c o m shell.setText("SWT Application"); //create an instance of the custom MyPreference class IPreferencePage page = new PeergreenPreferencePage(); //create a new PreferenceNode that will appear in the Preference window PreferenceNode node = new PreferenceNode("1", page); //use workbenches's preference manager PreferenceManager mgr = new PreferenceManager(); mgr.addToRoot(node); //add the node in the PreferenceManager //instantiate the PreferenceDialog PreferenceDialog pd = new PreferenceDialog(shell, mgr); pd.create(); pd.open(); }
From source file:com.persistent.util.WAEclipseHelper.java
License:Open Source License
/** * Method creates tree structure of azure property pages. and opens property * dialog with desired property page selected & active. * // w w w. ja v a 2 s . c o m * @param windowsAzureRole * : worker role * @param pageToDisplay * : property page Id which should be active after opening dialog * @param tabToSelect : In case pageToDisplay is Server Configuration page then * provide tab which should be selected. * @return integer */ public static int openRolePropertyDialog(WindowsAzureRole windowsAzureRole, String pageToDisplay, String tabToSelect) { int retVal = Window.CANCEL; // value corresponding to cancel try { // Node creation PreferenceNode nodeGeneral = new PreferenceNode(Messages.cmhIdGeneral, Messages.cmhLblGeneral, null, WARGeneral.class.toString()); nodeGeneral.setPage(new WARGeneral()); nodeGeneral.getPage().setTitle(Messages.cmhLblGeneral); PreferenceNode nodeCache = new PreferenceNode(Messages.cmhIdCach, Messages.cmhLblCach, null, WARCaching.class.toString()); nodeCache.setPage(new WARCaching()); nodeCache.getPage().setTitle(Messages.cmhLblCach); PreferenceNode nodeCert = new PreferenceNode(Messages.cmhIdCert, Messages.cmhLblCert, null, WARCertificates.class.toString()); nodeCert.setPage(new WARCertificates()); nodeCert.getPage().setTitle(Messages.cmhLblCert); PreferenceNode nodeCmpnts = new PreferenceNode(Messages.cmhIdCmpnts, Messages.cmhLblCmpnts, null, WARComponents.class.toString()); nodeCmpnts.setPage(new WARComponents()); nodeCmpnts.getPage().setTitle(Messages.cmhLblCmpnts); PreferenceNode nodeDebugging = new PreferenceNode(Messages.cmhIdDbg, Messages.cmhLblDbg, null, WARDebugging.class.toString()); nodeDebugging.setPage(new WARDebugging()); nodeDebugging.getPage().setTitle(Messages.cmhLblDbg); PreferenceNode nodeEndPts = new PreferenceNode(Messages.cmhIdEndPts, Messages.cmhLblEndPts, null, WAREndpoints.class.toString()); nodeEndPts.setPage(new WAREndpoints()); nodeEndPts.getPage().setTitle(Messages.cmhLblEndPts); PreferenceNode nodeEnvVars = new PreferenceNode(Messages.cmhIdEnvVars, Messages.cmhLblEnvVars, null, WAREnvVars.class.toString()); nodeEnvVars.setPage(new WAREnvVars()); nodeEnvVars.getPage().setTitle(Messages.cmhLblEnvVars); PreferenceNode nodeLdBlnc = new PreferenceNode(Messages.cmhIdLdBlnc, Messages.cmhLblLdBlnc, null, WARLoadBalance.class.toString()); nodeLdBlnc.setPage(new WARLoadBalance()); nodeLdBlnc.getPage().setTitle(Messages.cmhLblLdBlnc); PreferenceNode nodeLclStg = new PreferenceNode(Messages.cmhIdLclStg, Messages.cmhLblLclStg, null, WARLocalStorage.class.toString()); nodeLclStg.setPage(new WARLocalStorage()); nodeLclStg.getPage().setTitle(Messages.cmhLblLclStg); PreferenceNode nodeSrvCnfg = new PreferenceNode(Messages.cmhIdSrvCnfg, Messages.cmhLblSrvCnfg, null, WAServerConfiguration.class.toString()); nodeSrvCnfg.setPage(new WAServerConfiguration(tabToSelect)); nodeSrvCnfg.getPage().setTitle(Messages.cmhLblSrvCnfg); PreferenceNode nodeSslOff = new PreferenceNode(Messages.cmhIdSsl, Messages.cmhLblSsl, null, WASSLOffloading.class.toString()); nodeSslOff.setPage(new WASSLOffloading()); nodeSslOff.getPage().setTitle(Messages.cmhLblSsl); /* * Tree structure creation. Don't change order while adding nodes. * Its the default alphabetical order given by eclipse. */ nodeGeneral.add(nodeCache); nodeGeneral.add(nodeCert); nodeGeneral.add(nodeCmpnts); nodeGeneral.add(nodeDebugging); nodeGeneral.add(nodeEndPts); nodeGeneral.add(nodeEnvVars); nodeGeneral.add(nodeLdBlnc); nodeGeneral.add(nodeLclStg); nodeGeneral.add(nodeSrvCnfg); nodeGeneral.add(nodeSslOff); PreferenceManager mgr = new PreferenceManager(); mgr.addToRoot(nodeGeneral); // Dialog creation PreferenceDialog dialog = new PreferenceDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), mgr); // make desired property page active. dialog.setSelectedNode(pageToDisplay); dialog.create(); String dlgTitle = String.format(Messages.cmhPropFor, windowsAzureRole.getName()); dialog.getShell().setText(dlgTitle); dialog.open(); // return whether user has pressed OK or Cancel button retVal = dialog.getReturnCode(); } catch (Exception ex) { PluginUtil.displayErrorDialogAndLog(new Shell(), Messages.rolsDlgErr, Messages.rolsDlgErrMsg, ex); } return retVal; }
From source file:com.persistent.util.WAEclipseHelper.java
License:Open Source License
/** * Method creates tree structure of azure deployment project property pages. * and opens property dialog with desired property page selected & active. * // w w w . jav a 2 s. c o m * @param pageToDisplay * : property page Id which should be active after opening dialog * @return integer */ public static int openWAProjectPropertyDialog(String pageToDisplay) { int retVal = Window.CANCEL; // value corresponding to cancel // Node creation try { PreferenceNode nodeWindowsAzure = new PreferenceNode(Messages.cmhIdWinAz, Messages.cmhLblWinAz, null, WAWinAzurePropertyPage.class.toString()); nodeWindowsAzure.setPage(new WAWinAzurePropertyPage()); nodeWindowsAzure.getPage().setTitle(Messages.cmhLblWinAz); PreferenceNode nodeRemoteAcess = new PreferenceNode(Messages.cmhIdRmtAces, Messages.cmhLblRmtAces, null, WARemoteAccessPropertyPage.class.toString()); nodeRemoteAcess.setPage(new WARemoteAccessPropertyPage()); nodeRemoteAcess.getPage().setTitle(Messages.cmhLblRmtAces); PreferenceNode nodeRoles = new PreferenceNode(Messages.cmhIdRoles, Messages.cmhLblRoles, null, WARolesPropertyPage.class.toString()); nodeRoles.setPage(new WARolesPropertyPage()); nodeRoles.getPage().setTitle(Messages.cmhLblRoles); PreferenceNode nodeSubscriptions = new PreferenceNode(Messages.cmhIdCrdntls, Messages.cmhLblSubscrpt, null, SubscriptionPropertyPage.class.toString()); nodeSubscriptions.setPage(new SubscriptionPropertyPage()); nodeSubscriptions.getPage().setTitle(Messages.cmhLblSubscrpt); /* * Tree structure creation. Don't change order while adding nodes. * Its the default alphabetical order given by eclipse. */ nodeWindowsAzure.add(nodeRemoteAcess); nodeWindowsAzure.add(nodeRoles); nodeWindowsAzure.add(nodeSubscriptions); PreferenceManager mgr = new PreferenceManager(); mgr.addToRoot(nodeWindowsAzure); // Dialog creation PreferenceDialog dialog = new PreferenceDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), mgr); // make desired property page active. dialog.setSelectedNode(pageToDisplay); dialog.create(); String dlgTitle = String.format(Messages.cmhPropFor, getSelectedProject().getName()); dialog.getShell().setText(dlgTitle); dialog.open(); // return whether user has pressed OK or Cancel button retVal = dialog.getReturnCode(); } catch (Exception e) { PluginUtil.displayErrorDialogAndLog(new Shell(), Messages.rolsDlgErr, Messages.projDlgErrMsg, e); } return retVal; }
From source file:com.programmablefun.ide.App.java
License:Open Source License
private void showPreferences() { PreferencePage pages[] = new PreferencePage[] { new RepositoryPrefPage(codeRepository), new ColorSchemePrefPage(stylesheetRepository, wellKnownWords), }; PreferenceManager mgr = new PreferenceManager(); for (PreferencePage p : pages) { mgr.addToRoot(new PreferenceNode(p.getTitle(), p)); }//w ww . j a v a2 s .c o m PreferenceDialog dlg = new PreferenceDialog(Display.getCurrent().getActiveShell(), mgr); if (dlg.open() == Window.OK) { sourceCodeComposite.setStylesheet(stylesheetRepository.get(settings.getSelectedStylesheet())); settings.save(); } }