List of usage examples for org.eclipse.jface.preference PreferenceDialog open
public int open()
From source file:org.switchyard.tools.ui.common.SwitchYardSettingsGroup.java
License:Open Source License
private void createRuntimeControls(Composite content) { Group runtimeControls = new Group(content, SWT.NONE); runtimeControls.setLayout(new GridLayout(3, false)); runtimeControls.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); runtimeControls.setText(Messages.SwitchYardSettingsGroup_VersionDetailsGroup); Label label = new Label(runtimeControls, SWT.NONE); label.setText(Messages.SwitchYardSettingsGroup_ConfigurationVersionLabel); _configVersionsList = new ComboViewer(runtimeControls); _configVersionsList.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); _configVersionsList.setLabelProvider(new LabelProvider() { @Override/*from ww w .ja v a 2 s . c o m*/ public String getText(Object element) { return ((IProjectFacetVersion) element).getVersionString(); } }); _configVersionsList.setContentProvider(ArrayContentProvider.getInstance()); _configVersionsList.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { handleConfigVersionSelected(); } }); _configVersionsList.setInput(ISwitchYardFacetConstants.SWITCHYARD_FACET.getVersions()); // spacer new Label(runtimeControls, SWT.NONE); label = new Label(runtimeControls, SWT.NONE); label.setText(Messages.SwitchYardSettingsGroup_TargetRuntimeLabel); _runtimesList = new ComboViewer(runtimeControls); _runtimesList.getCombo().setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); _runtimesList.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { if (element instanceof IRuntimeComponent) { final IRuntimeComponent component = (IRuntimeComponent) element; final StringBuffer text = new StringBuffer(IRuntimeComponentLabelProvider.class .cast(component.getAdapter(IRuntimeComponentLabelProvider.class)).getLabel()); text.append(" [").append(component.getRuntime().getName()).append("]"); //$NON-NLS-1$ //$NON-NLS-2$ return text.toString(); } return Messages.SwitchYardSettingsGroup_EmptyRuntimeComponentLabel; } }); _runtimesList.setContentProvider(ArrayContentProvider.getInstance()); _runtimesList.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { handleRuntimeSelected(); } }); _runtimesList.setSorter(new RuntimesListSorter()); _runtimesList.addFilter(_runtimesFilter); _runtimesList.getControl().addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent event) { if (_project != null) { _project.removeListener(_projectListener); } } }); final Link newRuntimeLink = new Link(runtimeControls, SWT.NONE); newRuntimeLink.setText(Messages.SwitchYardSettingsGroup_RuntimeLinkLabel); newRuntimeLink.setEnabled(true); newRuntimeLink.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { String id = "org.eclipse.wst.server.ui.preferencePage"; //$NON-NLS-1$ String id2 = "org.eclipse.wst.server.ui.runtime.preferencePage"; //$NON-NLS-1$ String id3 = "org.jboss.tools.runtime.preferences.RuntimePreferencePage"; //$NON-NLS-1$ final PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(newRuntimeLink.getShell(), id2, new String[] { id, id2, id3 }, null); if (dialog.open() == PreferenceDialog.OK) { repopulateRuntimesList(); } } }); label = new Label(runtimeControls, SWT.NONE); label.setText(Messages.SwitchYardSettingsGroup_LibraryVersionLabel); _runtimeVersionsList = new VersionComboViewer(runtimeControls); _runtimeVersionsList.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); _runtimeVersionsList.setLabelProvider(new LabelProvider()); _runtimeVersionsList.setContentProvider(ArrayContentProvider.getInstance()); // spacer new Label(runtimeControls, SWT.NONE); }
From source file:org.switchyard.tools.ui.editor.diagram.PropertiesDialogFeature.java
License:Open Source License
@Override public void execute(ICustomContext context) { final InternalTransactionalEditingDomain transactionalDomain = (InternalTransactionalEditingDomain) getDiagramBehavior() .getEditingDomain();//from ww w . ja v a 2s. co m try { /* * create a transaction to wrap the transaction used by the property * pages. this will allow us to determine if any changes have been * made to the model so we can set hasDoneChanges appropriately. */ final Transaction newTransaction = transactionalDomain.startTransaction(false, null); PreferenceDialog dialog = _openProperties.createDialog(); dialog.getTreeViewer().addFilter(new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { String id = element == null ? null : ((IPreferenceNode) element).getId(); // filter out run/debug and svn info return id != null && !id.startsWith("org.eclipse.debug.ui.") //$NON-NLS-1$ && !id.startsWith("org.eclipse.team."); //$NON-NLS-1$ } }); try { dialog.open(); newTransaction.commit(); /* * change description will be empty if no changes were made * (i.e. rolled back or just no changes). */ _hasMadeChanges = !newTransaction.getChangeDescription().isEmpty(); } catch (RollbackException e) { e.printStackTrace(); } } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:org.swtchart.ext.InteractiveChart.java
License:Apache License
/** * Opens the properties dialog./*from w ww .j a v a 2s . com*/ */ private void openPropertiesDialog() { PreferenceManager manager = new PreferenceManager(); final String chartTitle = "Chart"; PreferenceNode chartNode = new PreferenceNode(chartTitle); chartNode.setPage(new ChartPage(this, resources, chartTitle)); manager.addToRoot(chartNode); final String legendTitle = "Legend"; PreferenceNode legendNode = new PreferenceNode(legendTitle); legendNode.setPage(new LegendPage(this, resources, legendTitle)); manager.addTo(chartTitle, legendNode); final String xAxisTitle = "X Axis"; PreferenceNode xAxisNode = new PreferenceNode(xAxisTitle); xAxisNode.setPage(new AxisPage(this, resources, Direction.X, xAxisTitle)); manager.addTo(chartTitle, xAxisNode); final String gridTitle = "Grid"; PreferenceNode xGridNode = new PreferenceNode(gridTitle); xGridNode.setPage(new GridPage(this, resources, Direction.X, gridTitle)); manager.addTo(chartTitle + "." + xAxisTitle, xGridNode); final String tickTitle = "Tick"; PreferenceNode xTickNode = new PreferenceNode(tickTitle); xTickNode.setPage(new AxisTickPage(this, resources, Direction.X, tickTitle)); manager.addTo(chartTitle + "." + xAxisTitle, xTickNode); final String yAxisTitle = "Y Axis"; PreferenceNode yAxisNode = new PreferenceNode(yAxisTitle); yAxisNode.setPage(new AxisPage(this, resources, Direction.Y, yAxisTitle)); manager.addTo(chartTitle, yAxisNode); PreferenceNode yGridNode = new PreferenceNode(gridTitle); yGridNode.setPage(new GridPage(this, resources, Direction.Y, gridTitle)); manager.addTo(chartTitle + "." + yAxisTitle, yGridNode); PreferenceNode yTickNode = new PreferenceNode(tickTitle); yTickNode.setPage(new AxisTickPage(this, resources, Direction.Y, tickTitle)); manager.addTo(chartTitle + "." + yAxisTitle, yTickNode); final String seriesTitle = "Series"; PreferenceNode plotNode = new PreferenceNode(seriesTitle); plotNode.setPage(new SeriesPage(this, resources, seriesTitle)); manager.addTo(chartTitle, plotNode); final String labelTitle = "Label"; PreferenceNode labelNode = new PreferenceNode(labelTitle); labelNode.setPage(new SeriesLabelPage(this, resources, labelTitle)); manager.addTo(chartTitle + "." + seriesTitle, labelNode); PreferenceDialog dialog = new PreferenceDialog(getShell(), manager); dialog.create(); dialog.getShell().setText("Properties"); dialog.getTreeViewer().expandAll(); dialog.open(); }
From source file:org.talend.designer.esb.runcontainer.core.LocalESBRunContainerService.java
License:Open Source License
@Override public void addRuntimeServer(TargetExecComposite targetExecComposite, JobJvmComposite jobComposite) { Combo targetCombo = null;//from w w w .j ava2 s . co m IPreferenceStore store = ESBRunContainerPlugin.getDefault().getPreferenceStore(); String url = store.getString(RunContainerPreferenceInitializer.P_ESB_RUNTIME_HOST); String port = store.getString(RunContainerPreferenceInitializer.P_ESB_RUNTIME_PORT); String rt = ESB_RUNTIME_ITEM + " (" + url + ":" + port + ")"; if (JobJvmComposite.class == jobComposite.getClass()) { // Update Tab SE try { Control control = ((Composite) jobComposite.getChildren()[0]).getChildren()[0]; if (control instanceof StyledText) { StyledText styled = (StyledText) control; styled.setText("Please select target execution environment"); targetCombo = new Combo((Composite) jobComposite.getChildren()[0], SWT.BORDER | SWT.READ_ONLY); GridData data = new GridData(GridData.FILL_BOTH); data.horizontalIndent = 5; targetCombo.setLayoutData(data); targetCombo.add("Default", 0); targetCombo.add(rt, 1); this.index = targetCombo.getSelectionIndex(); targetCombo.select(index == -1 ? 0 : index); } } catch (Exception ex) { } } else { // Update EE tab try { Control control = ((Composite) jobComposite.getChildren()[0]).getChildren()[0]; if (control instanceof Combo) { targetCombo = (Combo) control; targetCombo.add(rt); this.index = targetCombo.getSelectionIndex(); } } catch (Exception ex) { } } if (targetCombo != null) { if (RunProcessPlugin.getDefault() .getRunProcessContextManager() instanceof RunContainerProcessContextManager) { targetCombo.select(targetCombo.indexOf(rt)); } else { targetCombo.select(index); } targetCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (((Combo) e.getSource()).getText().startsWith(ESB_RUNTIME_ITEM)) { // check if server setting is validated. IPreferenceStore store = ESBRunContainerPlugin.getDefault().getPreferenceStore(); String host = store.getString(RunContainerPreferenceInitializer.P_ESB_RUNTIME_HOST); File containerDir = new File( store.getString(RunContainerPreferenceInitializer.P_ESB_RUNTIME_LOCATION)); if (containerDir.exists() || !(host.equals("localhost") || host.equals("127.0.0.1"))) { defaultContextManager = RunProcessPlugin.getDefault().getRunProcessContextManager(); esbProcessContext = defaultContextManager.getActiveContext(); if (runtimeContextManager == null) { runtimeContextManager = new RunContainerProcessContextManager(); } // reset context manager and active process RunProcessPlugin.getDefault().setRunProcessContextManager(runtimeContextManager); RunProcessPlugin.getDefault().getRunProcessContextManager() .setActiveProcess(esbProcessContext.getProcess()); ProcessManager.getInstance() .setProcessContext(runtimeContextManager.getActiveContext()); } else { boolean openPrefs = MessageDialog.openConfirm(jobComposite.getShell(), "Runtime Server Setting", "Runtime Server setting is not complete, please update runtime server informations before running."); if (openPrefs) { PreferenceDialog d = new PreferenceDialog(jobComposite.getShell(), PlatformUI.getWorkbench().getPreferenceManager()); d.setSelectedNode(RunContainerPreferencePage.ID); d.open(); } // ((Combo) e.getSource()).select(index); } } else if (defaultContextManager != null) { RunProcessPlugin.getDefault().setRunProcessContextManager(defaultContextManager); } } }); } }
From source file:org.talend.designer.esb.runcontainer.ui.actions.OpenRuntimePrefsAction.java
License:Open Source License
@Override public void run() { PreferenceDialog dlg = new PreferenceDialog(Display.getDefault().getActiveShell(), PlatformUI.getWorkbench().getPreferenceManager()); dlg.setSelectedNode(RunContainerPreferencePage.ID); dlg.open(); }
From source file:org.talend.repository.ui.dialog.ProjectSettingDialog.java
License:Open Source License
public void open(final String pageId) { PreferenceManager manager = getNodeManager(); Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); final PreferenceDialog dialog = new ProjectSettingsPreferenceDialog(shell, manager); BusyIndicator.showWhile(Display.getCurrent(), new Runnable() { @Override//from w w w. j a v a 2s .c om public void run() { if (StringUtils.isNotEmpty(pageId)) { dialog.setSelectedNode(pageId); } dialog.create(); dialog.getShell().setText(TITLE); dialog.getShell().setSize(DEFAULT_SIZE); dialog.open(); } }); }
From source file:org.talend.updates.runtime.ui.UpdateStudioWizardDialog.java
License:Open Source License
@Override protected org.eclipse.jface.wizard.ProgressMonitorPart createProgressMonitorPart(Composite parent, org.eclipse.swt.layout.GridLayout pmlayout) { final UpdateStudioWizard updateStudioWizard = (UpdateStudioWizard) getWizard(); Composite checkAndProgressComposite = new Composite(parent, SWT.NONE); checkAndProgressComposite.setLayout(new GridLayout(3, false)); GridDataFactory.fillDefaults().grab(true, false).applyTo(checkAndProgressComposite); // do not show this again check box updateStudioWizard.doNotShowAgainCB = new Button(checkAndProgressComposite, SWT.CHECK); updateStudioWizard.doNotShowAgainCB/*from ww w .j a va 2s .c om*/ .setText(Messages.getString("UpdateStudioWizard.do.no.show.check.box.text")); //$NON-NLS-1$ GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER) .applyTo(updateStudioWizard.doNotShowAgainCB); updateStudioWizard.updateCbStateFromPref(); // progress bar ProgressMonitorPart createProgressMonitorPart = super.createProgressMonitorPart(checkAndProgressComposite, pmlayout); // proxy configuration button Button proxyPrefBtn = new Button(checkAndProgressComposite, SWT.PUSH); proxyPrefBtn.setText(Messages.getString("UpdateStudioWizard.proxy.config.button.text")); //$NON-NLS-1$ GridDataFactory.fillDefaults().align(SWT.END, SWT.END).applyTo(proxyPrefBtn); proxyPrefBtn.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), "org.eclipse.ui.net.NetPreferences", new String[] { "org.eclipse.ui.net.NetPreferences" }, //$NON-NLS-1$//$NON-NLS-2$ null); dialog.open(); } @Override public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); } }); // store the fact that the user has modified the value of the check box to enable the finish button updateStudioWizard.doNotShowAgainCB.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { updateStudioWizard.updateWizardModel.hasDoNotShowThisAgainChanged = true; updateButtons(); } @Override public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); } }); return createProgressMonitorPart; }
From source file:org.vimplugin.editors.VimEditor.java
License:Open Source License
@Override public void createPartControl(Composite parent) { this.parent = parent; this.shell = parent.getShell(); VimPlugin plugin = VimPlugin.getDefault(); if (!plugin.gvimAvailable()) { MessageDialog dialog = new MessageDialog(shell, "Vimplugin", null, plugin.getMessage("gvim.not.found.dialog"), MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0) { protected void buttonPressed(int buttonId) { super.buttonPressed(buttonId); if (buttonId == IDialogConstants.OK_ID) { PreferenceDialog prefs = PreferencesUtil.createPreferenceDialogOn(shell, "org.vimplugin.preferences.VimPreferences", null, null); if (prefs != null) { prefs.open(); }//w w w . j a v a 2s. c o m } } }; dialog.open(); if (!plugin.gvimAvailable()) { throw new RuntimeException(plugin.getMessage("gvim.not.found")); } } IPreferenceStore prefs = plugin.getPreferenceStore(); tabbed = prefs.getBoolean(PreferenceConstants.P_TABBED); embedded = prefs.getBoolean(PreferenceConstants.P_EMBED); // disabling documentListen until there is a really good reason to have, // cause it is by far the buggest part of vim's netbeans interface. documentListen = false; //plugin.gvimNbDocumentListenSupported(); if (embedded) { if (!plugin.gvimEmbedSupported()) { String message = plugin.getMessage("gvim.not.supported", plugin.getMessage("gvim.embed.not.supported")); throw new RuntimeException(message); } } if (!plugin.gvimNbSupported()) { String message = plugin.getMessage("gvim.not.supported", plugin.getMessage("gvim.nb.not.enabled")); throw new RuntimeException(message); } //set some flags alreadyClosed = false; dirty = false; String projectPath = null; String filePath = null; IEditorInput input = getEditorInput(); if (input instanceof IFileEditorInput) { selectedFile = ((IFileEditorInput) input).getFile(); IProject project = selectedFile.getProject(); IPath path = project.getRawLocation(); if (path == null) { String name = project.getName(); path = ResourcesPlugin.getWorkspace().getRoot().getRawLocation(); path = path.append(name); } projectPath = path.toPortableString(); filePath = selectedFile.getRawLocation().toPortableString(); if (filePath.toLowerCase().indexOf(projectPath.toLowerCase()) != -1) { filePath = filePath.substring(projectPath.length() + 1); } } else { URI uri = ((IURIEditorInput) input).getURI(); filePath = uri.toString().substring("file:".length()); filePath = filePath.replaceFirst("^/([A-Za-z]:)", "$1"); } if (filePath != null) { editorGUI = new Canvas(parent, SWT.EMBEDDED); //create a vim instance VimConnection vc = createVim(projectPath, filePath, parent); viewer = new VimViewer(bufferID, vc, editorGUI != null ? editorGUI : parent, SWT.EMBEDDED); viewer.getTextWidget().setVisible(false); viewer.setDocument(document); viewer.setEditable(isEditable()); try { Field fSourceViewer = AbstractTextEditor.class.getDeclaredField("fSourceViewer"); fSourceViewer.setAccessible(true); fSourceViewer.set(this, viewer); } catch (Exception e) { logger.error("Unable to access source viewer field.", e); } // open eclimd view if necessary boolean startEclimd = plugin.getPreferenceStore().getBoolean(PreferenceConstants.P_START_ECLIMD); if (startEclimd) { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); try { if (page != null && page.findView(ECLIMD_VIEW_ID) == null) { page.showView(ECLIMD_VIEW_ID); } } catch (PartInitException pie) { logger.error("Unable to open eclimd view.", pie); } } // on initial open, our part listener isn't firing for some reason. if (embedded) { plugin.getPartListener().partOpened(this); plugin.getPartListener().partBroughtToTop(this); plugin.getPartListener().partActivated(this); } } }
From source file:org.wesnoth.utils.WorkspaceUtils.java
License:Open Source License
/** * Setups the workspace, by checking:/*from www . j av a 2 s . co m*/ * 1) The user has set all plugin's preferences. * If not, the preferences window will open * * @param guided * True to guide the user through the setup routine. */ public static void setupWorkspace(final boolean guided) { if (guided) { GUIUtils.showInfoMessageBox(Messages.WorkspaceUtils_0); } if (!checkPathsAreSet(Preferences.getDefaultInstallName(), false)) { PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn(WesnothPlugin.getShell(), "org.wesnoth.preferences.InstallsPage", null, null); //$NON-NLS-1$ pref.open(); if (!checkPathsAreSet(Preferences.getDefaultInstallName(), true)) { GUIUtils.showErrorMessageBox(Messages.WorkspaceUtils_7); return; } } if (guided) { GUIUtils.showInfoMessageBox(Messages.WorkspaceUtils_9); } WorkspaceJob job = new WorkspaceJob(Messages.WorkspaceUtils_13) { @Override public IStatus runInWorkspace(IProgressMonitor monitor) { try { // automatically import 'special' folders as projects List<File> userAddonsFiles = new ArrayList<File>(); Paths paths = Preferences.getPaths(Preferences.getDefaultInstallName()); if (GUIUtils.showMessageBox(Messages.WorkspaceUtils_18, SWT.ICON_QUESTION | SWT.YES | SWT.NO) == SWT.YES) { // useraddons/add-ons/data File[] tmp = new File(paths.getAddonsDir()).listFiles(); if (tmp != null) { userAddonsFiles.addAll(Arrays.asList(tmp)); } } monitor.beginTask(Messages.WorkspaceUtils_22, userAddonsFiles.size() * 10); for (File file : userAddonsFiles) { if (file.isDirectory() == false || file.getName().startsWith(".")) { continue; } String projectName = file.getName(); if (ResourceUtils.isCampaignDirPath(paths, file.getAbsolutePath())) { projectName = "_Mainline_" + file.getName(); //$NON-NLS-1$ } try { ProjectUtils.createWesnothProject(projectName, file.getAbsolutePath(), paths.getInstallName(), monitor); } catch (OperationCanceledException e) { // do nothing } monitor.worked(10); } if (guided) { GUIUtils.showInfoMessageBox(Messages.WorkspaceUtils_25); } else { Logger.getInstance().log("setupWorkspace was successful", //$NON-NLS-1$ Messages.WorkspaceUtils_29); } } catch (Exception e) { Logger.getInstance().logException(e); GUIUtils.showErrorMessageBox(Messages.WorkspaceUtils_30); } monitor.done(); return Status.OK_STATUS; } }; job.schedule(); }
From source file:org.wso2.developerstudio.eclipse.errorreporter.ui.dialogs.EditPreferencesDialog.java
License:Open Source License
/** * This method creates a link to the preferencs page of Developer Studio * error reporting tool.//from w ww .jav a2s. c o m * * @param container */ private void createLink(Composite container) { final Link link = new Link(container, SWT.NONE); link.setFont(container.getFont()); link.setText("<A>" + DialogBoxLabels.EDIT_PREFERENCES_LINK + "</A>"); GridData data = new GridData(SWT.LEFT, SWT.TOP, false, false); data.horizontalSpan = 3; link.setLayoutData(data); // directs the user to the prefernce page, once the link is pressed link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { Shell shell = new Shell(); PreferenceDialog preferencePage = PreferencesUtil.createPreferenceDialogOn(shell, ProjectConstants.PREFERENCE_PAGE, null, null); if (preferencePage != null) preferencePage.open(); } }); }