List of usage examples for org.eclipse.jface.preference PreferenceDialog open
public int open()
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 va 2 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();//ww w .j a v a 2s.c o m dialog.getTreeViewer().setComparator(new ViewerComparator()); dialog.getTreeViewer().expandAll(); dialog.open(); }
From source file:com.osp.ide.internal.ui.wizards.filewizard.AbstractFileCreationWizardPage.java
License:Open Source License
protected void editTemplates() { String prefPageId = CodeTemplatePreferencePage.PREF_ID; Map<String, String> data = null; String templateName = null;//from w w w . jav a 2 s .co m Template template = getSelectedTemplate(); if (template != null) { templateName = template.getName(); } if (templateName != null) { data = new HashMap<String, String>(); data.put(CodeTemplatePreferencePage.DATA_SELECT_TEMPLATE, templateName); } PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), prefPageId, new String[] { prefPageId }, data); if (dialog.open() == Window.OK) { updateTemplates(); } }
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 w w w . j a va 2 s. co m 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);/*w ww .jav a2 s . co 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. * /* ww w.j a v a2 s .c om*/ * @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. * //from www .java 2s .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.phonegap.runtime.SimulatorLaunchConfigurationDelegate.java
License:Open Source License
/** * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, * java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor) *///from w w w . j ava 2 s . com public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { String projectName = configuration.getAttribute("PROJECT", ""); //$NON-NLS-1$ String applicationFile = configuration.getAttribute("APPLICATION", ""); //$NON-NLS-1$ String commandArgs = configuration.getAttribute("COMMANDLINE", ""); //$NON-NLS-1$ String sdk = configuration.getAttribute("PHONEGAPSDK", ""); //$NON-NLS-1$ if (projectName.length() == 0 || applicationFile.length() == 0) { monitor.setCanceled(true); return; } IProject _project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); IFile file = _project.getFile(applicationFile); String sdkLocation = null; if (!sdk.equals("")) //$NON-NLS-1$ { IPreferenceStore store = PhoneGapPlugin.getDefault().getPreferenceStore(); String names = store.getString(PhoneGapPlugin.RUNTIME_NAMES_PREFERENCE); String locations = store.getString(PhoneGapPlugin.RUNTIME_LOCATIONS_PREFERENCE); String[] sdkPrefNames = names.split(PhoneGapPlugin.PREFERENCE_DELIMITER); String[] sdkPrefLocations = locations.split(PhoneGapPlugin.PREFERENCE_DELIMITER); for (int i = 0; i < sdkPrefNames.length; i++) { if (sdk.equals(sdkPrefNames[i])) { if (i < sdkPrefLocations.length) { sdkLocation = sdkPrefLocations[i]; break; } } } } if (sdkLocation == null) { sdkLocation = PhoneGapPlugin.getDefaultPhoneGapSDKLocation(); } // if (sdkLocation == null) // { // // Fail back to default // sdkLocation = store.getString(PhoneGapPlugin.RUNTIME_LOCATION_DEFAULT_PREFERENCE); // } // if (sdkLocation == null || sdkLocation.length() == 0) // { // sdkLocation = PhoneGapPlugin.getDefaultSDKLocation(); // } /* If you can't find an sdkLocaiton then don't run */ if (sdkLocation == null || sdkLocation.length() == 0) { Job job = new UIJob("No PhoneGap SDK Found Message") { @Override public IStatus runInUIThread(IProgressMonitor monitor) { //CoreUIUtils.logAndDialogError(CoreUIUtils.getActiveShell(), PhoneGapPlugin.getDefault(), "No PhoneGap SDK Found", "To launch your PhoneGap application, you must set your default PhoneGap SDK."); return Status.OK_STATUS; } }; job.setPriority(Job.INTERACTIVE); job.schedule(); return; } IPath sdkPath = new Path(sdkLocation); String applicationContent = file.getLocation().makeAbsolute().toOSString(); Map<String, String> attrs = new HashMap<String, String>(); Process process = null; String executable = null; if (org.eclipse.debug.core.ILaunchManager.DEBUG_MODE.equals(mode)) { SimulatorLauncher launcher = new SimulatorLauncher(sdkPath, applicationContent, commandArgs); attrs.put(IProcess.ATTR_CMDLINE, launcher.getCommand()); executable = launcher.getExecutable(); process = launcher.execute(); } else if (org.eclipse.debug.core.ILaunchManager.RUN_MODE.equals(mode)) { SimulatorLauncher launcher = new SimulatorLauncher(sdkPath, applicationContent, commandArgs); attrs.put(IProcess.ATTR_CMDLINE, launcher.getCommand()); executable = launcher.getExecutable(); process = launcher.execute(); } if (process == null) { UIJob errorJob = new UIJob("Error launching simulator.") { public IStatus runInUIThread(IProgressMonitor monitor) { MessageDialog.openError(Display.getDefault().getActiveShell(), "Error launching simulator.", "Check PhoneGap SDK location"); PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn( this.getDisplay().getActiveShell(), "com.phonegap.preferences.SDKPreferencePage", //$NON-NLS-1$ new String[] { "com.phonegap.preferences.SDKPreferencePage" }, null); //$NON-NLS-1$ dialog.open(); return Status.OK_STATUS; } }; errorJob.schedule(); monitor.setCanceled(true); return; } if (org.eclipse.debug.core.ILaunchManager.DEBUG_MODE.equals(mode)) { //c:\bin\phone-gap-sdk\adl c:\bin\phone-gap-sdk\application.xml c:\bin\phone-gap-sdk\bin-debug DebugPlugin.newProcess(launch, process, executable, attrs); } /* if (org.eclipse.debug.core.ILaunchManager.RUN_MODE == mode) { attrs.put(IProcess.ATTR_PROCESS_TYPE, "com.aptana.ide.apollo.AdlProcess"); //$NON-NLS-1$ DebugPlugin.newProcess(launch, process, executable, attrs); } else if (org.eclipse.debug.core.ILaunchManager.DEBUG_MODE == mode) { JSDebugTarget debugTarget = null; DebugConnection controller = FDBDebugConnection.createConnection(debugHost); IProcess debugProcess = new JSDebugProcess(launch, process, false, executable, attrs); try { debugTarget = new JSDebugTarget(launch, "AIR Debugger", debugProcess, null, null, controller, true); } catch(CoreException e) { if ( debugTarget != null ) { debugTarget.terminate(); } else { try { controller.dispose(); } catch (IOException ignore) { } } if (debugProcess != null) { debugProcess.terminate(); } throw e; } } */ }
From source file:com.predic8.plugin.membrane.actions.ShowSecurityPreferencesAction.java
License:Apache License
@Override public void run() { PreferenceDialog dlg = PreferencesUtil.createPreferenceDialogOn(Display.getCurrent().getActiveShell(), SecurityPreferencePage.PAGE_ID, null, null); dlg.open(); }
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)); }/* www. j a va2 s. co m*/ PreferenceDialog dlg = new PreferenceDialog(Display.getCurrent().getActiveShell(), mgr); if (dlg.open() == Window.OK) { sourceCodeComposite.setStylesheet(stylesheetRepository.get(settings.getSelectedStylesheet())); settings.save(); } }