List of usage examples for org.eclipse.jface.preference PreferenceDialog open
public int open()
From source file:descent.ui.wizards.NewModuleWizardPage.java
License:Open Source License
private void typePageLinkActivated(SelectionEvent e) { IPackageFragmentRoot root = getPackageFragmentRoot(); if (root != null) { PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn(getShell(), root.getJavaProject().getProject(), CodeTemplatePreferencePage.PROP_ID, null, null); dialog.open(); } else {//from w w w . j av a 2s . com String title = NewWizardMessages.NewTypeWizardPage_configure_templates_title; String message = NewWizardMessages.NewTypeWizardPage_configure_templates_message; MessageDialog.openInformation(getShell(), title, message); } }
From source file:edu.uci.lighthouse.core.util.WorkbenchUtility.java
License:Open Source License
public static void openPreferences() { Display.getDefault().asyncExec(new Runnable() { public void run() { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); String rootId = "edu.uci.lighthouse.core.preferences"; PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(shell, rootId, new String[] { rootId + ".database", rootId + ".user" }, null); dialog.open(); }/*ww w . j av a2s . co m*/ }); }
From source file:es.bsc.servicess.ide.wizards.ServiceSsCommonWizardPage.java
License:Apache License
private void typePageLinkActivated() { IJavaProject project = getJavaProject(); if (project != null) { PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn(getShell(), project.getProject(), CodeTemplatePreferencePage.PROP_ID, null, null); dialog.open(); } else {/*from w w w .j a v a2s . c o m*/ String title = NewWizardMessages.NewTypeWizardPage_configure_templates_title; String message = NewWizardMessages.NewTypeWizardPage_configure_templates_message; MessageDialog.openInformation(getShell(), title, message); } }
From source file:eu.cloudwave.wp5.feedback.eclipse.base.core.feedbackhandler.RequestExceptionHandler.java
License:Apache License
public boolean handle(final IProject project, final RequestException exception, final ErrorType... handledErrorTypes) { final ErrorType type = exception.getType(); if (ImmutableList.copyOf(handledErrorTypes).contains(type)) { switch (type) { case FEEDBACK_HANDLER_NOT_AVAILABLE: new AbstractMessageDialog() { @Override/*from ww w . j a va 2 s. c o m*/ public void action(final Shell shell) { final PreferenceDialog preferencePage = PreferencesUtil.createPreferenceDialogOn(shell, BaseIds.PREFERENCE_PAGE, null, null); if (preferencePage != null) { preferencePage.open(); } } }.display(type.getTitle(), Messages.MESSAGE__FEEDBACK_HANDLER_NOT_AVAILABLE, MessageDialog.ERROR, Messages.OPEN_PREFERENCES); return true; case INVALID_APPLICATION_ID: openPropertyPage(project, BaseIds.PROPERTIES_PAGE__FDD_MAIN, type.getTitle(), Messages.MESSAGE__INVALID_APPLICATION_ID); return true; case WRONG_ACCESS_TOKEN: openPropertyPage(project, BaseIds.PROPERTIES_PAGE__FDD_MAIN, type.getTitle(), Messages.MESSAGE__WRONG_ACCESS_TOKEN); return true; default: break; } } Logger.print(exception.getMessage()); return false; }
From source file:eu.cloudwave.wp5.feedback.eclipse.base.core.feedbackhandler.RequestExceptionHandler.java
License:Apache License
private void openPropertyPage(final IProject project, final String propertyPageId, final String title, final String message) { new AbstractMessageDialog() { @Override/* w ww . j a v a 2 s .c o m*/ public void action(final Shell shell) { final PreferenceDialog propertyDialog = PreferencesUtil.createPropertyDialogOn(shell, project, propertyPageId, null, null); if (propertyDialog != null) { propertyDialog.open(); } } }.display(title, message, MessageDialog.ERROR, Messages.OPEN_PROPERTIES); }
From source file:eu.esdihumboldt.hale.ui.service.instance.sample.internal.InstanceViewPreferencesHandler.java
License:Open Source License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, InstanceViewPreferencePage.ID, null, null);/*w w w . j a v a 2s . co m*/ dialog.open(); return null; }
From source file:eu.geclipse.ui.problems.ShowPreferencePageSolver.java
License:Open Source License
public void solve() { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), this.preferencePageID, null, null);/*w ww . ja va 2 s. com*/ Shell dialogShell = dialog.getShell(); Shell currentShell = dialogShell.getDisplay().getActiveShell(); Shell parentShell = currentShell; // Create the chain of shells to be closed for making the preference // dialog the top level component List<Shell> toClose = new ArrayList<Shell>(); while ((parentShell != null) && (parentShell != dialogShell)) { toClose.add(parentShell); Composite parent = parentShell.getParent(); if (parent instanceof Shell) { parentShell = (Shell) parent; } else { parentShell = null; } } // If the preference dialog is part of the chain close // all shells "above" the dialog if (parentShell == dialogShell) { for (Shell shell : toClose) { shell.close(); } } dialogShell.forceActive(); dialog.open(); }
From source file:eu.geclipse.ui.wizards.VoSelectionWizardPage.java
License:Open Source License
public void createControl(final Composite parent) { GridData gData;//from w w w . j a v a2 s. c o m Composite mainComp = new Composite(parent, SWT.NONE); mainComp.setLayout(new GridLayout(1, false)); gData = new GridData(GridData.FILL_BOTH); gData.grabExcessHorizontalSpace = true; gData.grabExcessVerticalSpace = true; mainComp.setLayoutData(gData); Group voGroup = new Group(mainComp, SWT.NONE); voGroup.setLayout(new GridLayout(2, false)); voGroup.setText("&Available VOs"); gData = new GridData(SWT.FILL, SWT.FILL, true, true); gData.heightHint = 120; voGroup.setLayoutData(gData); int style = SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.CHECK; Table voTable = new Table(voGroup, style); gData = new GridData(SWT.FILL, SWT.FILL, true, true); voTable.setLayoutData(gData); voTable.setHeaderVisible(false); this.tableViewer = new CheckboxTableViewer(voTable); this.tableViewer.setContentProvider(new ArrayContentProvider()); this.tableViewer.setLabelProvider(new LabelProvider() { @Override public String getText(final Object element) { return ((IVirtualOrganization) element).getName(); } }); this.tableViewer.setComparator(new ViewerComparator() { @Override public int compare(final Viewer viewer, final Object vo1, final Object vo2) { String name1 = ((IVirtualOrganization) vo1).getName(); String name2 = ((IVirtualOrganization) vo2).getName(); // Sort by VO name return name1.compareTo(name2); } }); // Filter the VOs that can be used to create this type of auth-token this.tableViewer.addFilter(new ViewerFilter() { @Override public boolean select(final Viewer viewer, final Object parentElement, final Object element) { boolean ret = false; Class<?> type = VoSelectionWizardPage.this.voType; if (element instanceof IVirtualOrganization) { IVirtualOrganization vo = (IVirtualOrganization) element; if ((type == null) || type.isAssignableFrom(vo.getClass())) { ret = true; } } return ret; } }); this.tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(final SelectionChangedEvent event) { showSelectedInfo(); } }); this.tableViewer.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(final CheckStateChangedEvent event) { // If allowMultiSelection is not set, then implement a radio-button behavior if (!VoSelectionWizardPage.this.allowMultiSelection) { Object element = event.getElement(); if (element instanceof IVirtualOrganization) { IVirtualOrganization vo = (IVirtualOrganization) element; if (event.getChecked()) { VoSelectionWizardPage.this.tableViewer.setCheckedElements(new Object[] { vo }); VoSelectionWizardPage.this.tableViewer.refresh(); } } } setPageComplete(getSelectedVos() != null); } }); updateVoList(); this.tableViewer.setInput(this.voList); // Listen on new VOs, this will update the tableViewer GridModel.getVoManager().addGridModelListener(this); Button editVOsButton = new Button(voGroup, SWT.PUSH); editVOsButton.setText("Edit &VOs..."); gData = new GridData(); gData.horizontalAlignment = GridData.BEGINNING; gData.verticalAlignment = GridData.BEGINNING; editVOsButton.setLayoutData(gData); editVOsButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), VoSelectionWizardPage.this.PREFERENCE_PAGE_ID, null, null); /* * Even if the user pressed 'Cancel' VOs might have been * added/deleted, so ignore the dialog's return value. */ dialog.open(); } }); Group infoGroup = new Group(mainComp, SWT.NONE); infoGroup.setLayout(new GridLayout(1, false)); infoGroup.setText("&VO Info"); gData = new GridData(SWT.FILL, SWT.FILL, true, true); gData.heightHint = 120; infoGroup.setLayoutData(gData); this.infoText = new Text(infoGroup, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); this.infoText.setEditable(false); gData = new GridData(GridData.FILL_BOTH); gData.grabExcessHorizontalSpace = true; gData.grabExcessVerticalSpace = true; this.infoText.setLayoutData(gData); setInitialSelection(); showSelectedInfo(); setPageComplete(getSelectedVos() != null); setControl(mainComp); }
From source file:eu.numberfour.n4js.ui.binaries.IllegalBinaryStateDialog.java
License:Open Source License
/** * Creates a control with some message and with link to the Binaries preference page. * * @param parent/* w w w . ja v a 2 s. c o m*/ * the parent composite. * @param dialog * the container dialog that has to be closed. * @param binary * the binary with the illegal state. * * @return a control with error message and link that can be reused in dialogs. */ public static Control createCustomAreaWithLink(final Composite parent, final Dialog dialog, final Binary binary) { final String binaryLabel = binary.getLabel(); final String prefix = "The requested operation cannot be performed due to invalid '" + binaryLabel + "' settings. Check your '" + binaryLabel + "' configuration and preferences under the corresponding "; final String link = "preference page"; final String suffix = "."; final String text = prefix + link + suffix; final Composite control = new Composite(parent, NONE); control.setLayout(GridLayoutFactory.fillDefaults().create()); final GridData gridData = GridDataFactory.fillDefaults().align(LEFT, TOP).grab(true, true).create(); control.setLayoutData(gridData); final StyleRange style = new StyleRange(); style.underline = true; style.underlineStyle = UNDERLINE_LINK; final StyledText styledText = new StyledText(control, MULTI | READ_ONLY | WRAP); styledText.setWordWrap(true); styledText.setJustify(true); styledText.setText(text); final GridData textGridData = GridDataFactory.fillDefaults().align(FILL, FILL).grab(true, true).create(); textGridData.widthHint = TEXT_WIDTH_HINT; textGridData.heightHint = TEXT_HEIGHT_HINT; styledText.setLayoutData(textGridData); styledText.setEditable(false); styledText.setBackground(UIUtils.getSystemColor(COLOR_WIDGET_BACKGROUND)); final int[] ranges = { text.indexOf(link), link.length() }; final StyleRange[] styles = { style }; styledText.setStyleRanges(ranges, styles); styledText.addMouseListener(new MouseAdapter() { @Override public void mouseDown(final MouseEvent event) { try { final int offset = styledText.getOffsetAtLocation(new Point(event.x, event.y)); final StyleRange actualStyle = styledText.getStyleRangeAtOffset(offset); if (null != actualStyle && actualStyle.underline && UNDERLINE_LINK == actualStyle.underlineStyle) { dialog.close(); final PreferenceDialog preferenceDialog = createPreferenceDialogOn(UIUtils.getShell(), BinariesPreferencePage.ID, FILTER_IDS, null); if (null != preferenceDialog) { preferenceDialog.open(); } } } catch (final IllegalArgumentException e) { // We are not over the actual text. } } }); return control; }
From source file:eu.numberfour.n4js.ui.handler.OpenExternalLibraryPreferencePageHandler.java
License:Open Source License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { Shell shell = HandlerUtil.getActiveShell(event); PreferenceDialog dialog = createPreferenceDialogOn(shell, ExternalLibraryPreferencePage.ID, FILTER_IDS, null);//ww w . ja va2 s . c o m if (null != dialog) { dialog.open(); } return null; }