List of usage examples for org.eclipse.jface.preference PreferenceDialog setBlockOnOpen
public void setBlockOnOpen(boolean shouldBlock)
open
method should block until the window closes. 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 w w w .ja v a2s .c om*/ 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.google.code.t4eclipse.core.eclipse.helper.EclipsePrefHelper.java
License:Open Source License
public void openPrefPage(String pageID) { Shell windowShell = null;/*from w ww . j ava 2s . c om*/ Shell[] shells = Display.getDefault().getShells(); for (int i = 0; i < shells.length; i++) { Object data = shells[i].getData(); if (data != null && data instanceof IWorkbenchWindow) { windowShell = shells[i]; break; } } PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(windowShell, pageID, null, null); dialog.setBlockOnOpen(false); dialog.open(); }
From source file:com.google.eclipse.protobuf.ui.swtbot.ProtobufBot.java
License:Open Source License
public void openPreferencePage(final String preferencePageId) { runInUiThread(new Runnable() { @Override/* w ww .j av a 2s . c o m*/ public void run() { PreferenceDialog dialog = createPreferenceDialogOn(activeShell().widget, preferencePageId, null, null); dialog.setBlockOnOpen(false); dialog.open(); } }); }
From source file:monolipse.ui.views.BooExplorerView.java
License:Open Source License
private void hookDoubleClickAction() { _viewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { try { Object selectedElement = ((IStructuredSelection) event.getSelection()).getFirstElement(); if (selectedElement instanceof IResource) { openResource((IResource) selectedElement); } else if (selectedElement instanceof IAdaptable) { PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn(getSite().getShell(), (IAdaptable) selectedElement, null, null, null); dialog.setBlockOnOpen(true); dialog.open();//from w w w.j ava 2 s .c om } } catch (PartInitException e) { e.printStackTrace(); } } private void openResource(IResource resource) throws PartInitException { if (IResource.FILE == resource.getType()) { // TODO: use openAction here IDE.openEditor(getWorkbench().getActiveWorkbenchWindow().getActivePage(), (IFile) resource); } else if (IResource.FOLDER == resource.getType()) { _drillDownAdapter.goInto(resource); } } }); }
From source file:net.overscale.eclipse.pti.ui.preferences.AbstractPHPToolConfigurationBlock.java
License:Open Source License
protected Link addLink(Composite parent, String label, final String propertyPageID, final IPageChangedListener listener) { Link link = new Link(parent, SWT.NONE); link.setFont(parent.getFont());//from ww w . ja v a2 s . c om link.setLayoutData(new GridData(SWT.END, SWT.BEGINNING, true, false)); link.setText(label); link.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), propertyPageID, null, null); dialog.setBlockOnOpen(true); if (listener != null) { dialog.addPageChangedListener(listener); } dialog.open(); } }); return link; }
From source file:net.overscale.eclipse.pti.ui.preferences.dialogfields.PHPExecutableDialogField.java
License:Open Source License
public Control[] doFillIntoGrid(Composite parent, int nColumns) { assertEnoughColumns(nColumns);//w w w . j av a 2 s . c om Label label = getLabelControl(parent); label.setLayoutData(gridDataForLabel(1)); Combo combo = getTextControl(parent); combo.setLayoutData(gridDataForText(nColumns - 2)); Link link = new Link(parent, SWT.NONE); link.setFont(parent.getFont()); link.setLayoutData(new GridData(SWT.END, SWT.BEGINNING, true, false)); link.setText("<a>PHP Executables...</a>"); link.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn( Display.getCurrent().getActiveShell(), PHP_EXE_PAGE_ID, null, null); dialog.setBlockOnOpen(true); dialog.addPageChangedListener(new IPageChangedListener() { public void pageChanged(PageChangedEvent event) { Display.getDefault().asyncExec(new Runnable() { public void run() { } }); } }); dialog.open(); } }); return new Control[] { label, combo, link }; }
From source file:org.eclipse.acute.AcutePlugin.java
License:Open Source License
private static void openCommandErrorDialog(String title, String content) { Display.getDefault().asyncExec(() -> { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); int dialogResponse = MessageDialog.open(MessageDialog.CONFIRM, shell, title, content, SWT.NONE, Messages.acutePlugin_openPreferences, Messages.acutePlugin_cancel); if (dialogResponse == 0) { PreferenceDialog preferenceDialog = PreferencesUtil.createPreferenceDialogOn(shell, AcutePreferencePage.PAGE_ID, new String[] { AcutePreferencePage.PAGE_ID }, null); preferenceDialog.setBlockOnOpen(false); preferenceDialog.open();//from w ww .jav a 2 s. co m } }); }
From source file:org.eclipse.acute.dotnetnew.DotnetNewWizardPage.java
License:Open Source License
@Override public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); setControl(container);//from w ww . j a v a2s . c om container.setLayout(new GridLayout(4, false)); Label locationLabel = new Label(container, SWT.NONE); locationLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); locationLabel.setText(Messages.DotnetNewWizardPage_location); Image errorImage = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage(); locationText = new Text(container, SWT.BORDER); locationText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); locationControlDecoration = new ControlDecoration(locationText, SWT.TOP | SWT.LEFT); locationControlDecoration.setImage(errorImage); locationControlDecoration.setShowOnlyOnFocus(true); locationText.addModifyListener(e -> { updateDirectory(locationText.getText()); setPageComplete(isPageComplete()); }); Button browseButton = new Button(container, SWT.NONE); browseButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); browseButton.setText(Messages.DotnetNewWizardPage_browse); browseButton.addSelectionListener(widgetSelectedAdapter(e -> { DirectoryDialog dialog = new DirectoryDialog(browseButton.getShell()); String path = dialog.open(); if (path != null) { updateDirectory(path); } setPageComplete(isPageComplete()); })); Composite linesAboveLink = new Composite(container, SWT.NONE); GridData linesAboveLinkLayoutData = new GridData(SWT.FILL, SWT.FILL); linesAboveLinkLayoutData.heightHint = linesAboveLinkLayoutData.widthHint = 30; linesAboveLink.setLayoutData(linesAboveLinkLayoutData); linesAboveLink.addPaintListener(e -> { e.gc.setForeground(((Control) e.widget).getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY)); e.gc.drawLine(0, e.height / 2, e.width / 2, e.height / 2); e.gc.drawLine(e.width / 2, e.height / 2, e.width / 2, e.height); }); new Label(container, SWT.NONE); new Label(container, SWT.NONE); new Label(container, SWT.NONE); linkButton = new Button(container, SWT.TOGGLE); linkButton.setToolTipText(Messages.DotnetNewWizardPage_linkNames); linkButton.setSelection(true); try (InputStream iconStream = getClass().getResourceAsStream("/icons/link_obj.png")) { //$NON-NLS-1$ linkImage = new Image(linkButton.getDisplay(), iconStream); linkButton.setImage(linkImage); } catch (IOException e1) { AcutePlugin.logError(e1); } linkButton.addSelectionListener(widgetSelectedAdapter(s -> { isDirectoryAndProjectLinked = linkButton.getSelection(); projectNameText.setEnabled(!linkButton.getSelection()); updateProjectName(); })); Label projectNameLabel = new Label(container, SWT.NONE); projectNameLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); projectNameLabel.setText(Messages.DotnetNewWizardPage_projectName); projectNameText = new Text(container, SWT.BORDER); projectNameText.setEnabled(false); projectNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); projectNameControlDecoration = new ControlDecoration(projectNameText, SWT.TOP | SWT.LEFT); projectNameControlDecoration.setImage(errorImage); projectNameControlDecoration.setShowOnlyOnFocus(true); projectNameText.addModifyListener(e -> { updateProjectName(); setPageComplete(isPageComplete()); }); Composite linesBelowLink = new Composite(container, SWT.NONE); GridData linesBelowLinkLayoutData = new GridData(SWT.FILL, SWT.FILL); linesBelowLinkLayoutData.heightHint = linesBelowLinkLayoutData.widthHint = 30; linesBelowLink.setLayoutData(linesAboveLinkLayoutData); linesBelowLink.addPaintListener(e -> { e.gc.setForeground(((Control) e.widget).getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY)); e.gc.drawLine(0, e.height / 2, e.width / 2, e.height / 2); e.gc.drawLine(e.width / 2, e.height / 2, e.width / 2, 0); }); new Label(container, SWT.NONE).setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false, 4, 1)); Label projectTemplateLabel = new Label(container, SWT.NONE); projectTemplateLabel.setText(Messages.DotnetNewWizardPage_projectTemplate); List list = new List(container, SWT.V_SCROLL | SWT.BORDER); GridData listBoxData = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1); list.setLayoutData(listBoxData); templateViewer = new ListViewer(list); templateViewer.setContentProvider(new ArrayContentProvider()); templateViewer.setComparator(new ViewerComparator()); // default uses getLabel()/toString() templateViewer.addSelectionChangedListener(e -> { setPageComplete(isPageComplete()); }); templateControlDecoration = new ControlDecoration(templateViewer.getControl(), SWT.TOP | SWT.LEFT); templateControlDecoration.setImage(errorImage); updateTemplateList(); //Update Template List with preferences change IPreferenceStore store = AcutePlugin.getDefault().getPreferenceStore(); updateTemplatesListener = new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(AcutePreferenceInitializer.explicitDotnetPathPreference)) { updateTemplateList(); } } }; store.addPropertyChangeListener(updateTemplatesListener); new Label(container, SWT.NONE); new Label(container, SWT.NONE); Link preferencesLink = new Link(container, SWT.NONE); preferencesLink.setText(Messages.DotnetNewWizardPage_dotnetPreferencesLink); preferencesLink.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 2, 1)); preferencesLink.addSelectionListener(widgetSelectedAdapter(s -> Display.getDefault().asyncExec(() -> { PreferenceDialog preferenceDialog = PreferencesUtil.createPreferenceDialogOn(getShell(), AcutePreferencePage.PAGE_ID, new String[] { AcutePreferencePage.PAGE_ID }, null); preferenceDialog.setBlockOnOpen(false); preferenceDialog.open(); }))); new Label(container, SWT.NONE).setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false, 4, 1)); Composite workingSetComposite = new Composite(container, SWT.NONE); GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, false, 4, 1); workingSetComposite.setLayoutData(layoutData); workingSetComposite.setLayout(new GridLayout(1, false)); String[] workingSetIds = new String[] { "org.eclipse.ui.resourceWorkingSetPage" }; //$NON-NLS-1$ IStructuredSelection wsSel = null; if (this.workingSets != null) { wsSel = new StructuredSelection(this.workingSets.toArray()); } this.workingSetsGroup = new WorkingSetGroup(workingSetComposite, wsSel, workingSetIds); if (directory != null) { updateDirectory(directory.getAbsolutePath()); } }
From source file:org.eclipse.equinox.p2.tests.ui.dialogs.PreferencePagesTest.java
License:Open Source License
public void testGeneralPage() { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, GENERAL, null, null); dialog.setBlockOnOpen(false); dialog.open();/*from w ww . j a v a 2s . c o m*/ try { // nothing yet } finally { dialog.close(); } }
From source file:org.eclipse.equinox.p2.tests.ui.dialogs.PreferencePagesTest.java
License:Open Source License
public void testCopyrightPage() { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, SITES, null, null); dialog.setBlockOnOpen(false); dialog.open();/*from w ww.ja va 2 s.c o m*/ try { // nothing yet } finally { dialog.close(); } }