public Object execute(ExecutionEvent event) throws ExecutionException { UIJob job = new UIJob("Open Theme Preferences") //$NON-NLS-1$ { @Override public IStatus runInUIThread(IProgressMonitor monitor) { final PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(UIUtils.getActiveShell(), ThemePreferencePage.ID, null, null); dialog.open(); return Status.OK_STATUS; } }; job.setPriority(Job.INTERACTIVE); job.setRule(PopupSchedulingRule.INSTANCE); job.schedule(); return null; }
protected void createControls() { group = new Group(this, SWT.NONE); group.setLayout(new GridLayout(3, false)); imageLabel = new Label(group, SWT.NONE); GridDataFactory.fillDefaults().grab(false, false).align(SWT.BEGINNING, SWT.CENTER).applyTo(imageLabel); textLabel = new Link(group, SWT.WRAP); textLabel.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (DOWNLOAD_LINK.equals(e.text)) { Program.launch(DOWNLOAD_LINK); } else { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), PREF_PAGE_ID, new String[] { DISPLAY_ID }, null); dialog.setSelectedNode("DISPLAY_ID"); dialog.open(); } } }); GridDataFactory.fillDefaults().grab(true, false).align(SWT.CENTER, SWT.CENTER).applyTo(textLabel); button = new Button(group, SWT.FLAT); button.setText("Download"); GridDataFactory.fillDefaults().grab(false, false).align(SWT.END, SWT.CENTER).applyTo(button); }
protected void doaction(Actions anAction) { LiveTraceEditorInput source = (LiveTraceEditorInput) getEditorInput(); switch (anAction) { case CLEAR: source.clearAll(); break; case STOP: source.stop(); getAction(Actions.STOP).setEnabled(false); getAction(Actions.RESTART).setEnabled(true); break; case RESTART: source.restart(); getAction(Actions.STOP).setEnabled(true); getAction(Actions.RESTART).setEnabled(false); break; case CONFIG: //TODO: create our own preference page... PreferencesUtil.createPreferenceDialogOn(null, "com.novell.core.dstraceviewer.liveTrace.tracePrefs", null, null).open(); //TODO: how to get the preferences when they are changed break; default: break; } }
/** * Asks the user if he wants to edit doxygen configuration after a failed * doxygen invocation. * * @return @c true if doxygen configuration has been edited, @c false otherwise */ public static boolean editPreferencesAfterDoxygenInvocationFailed() { Shell shell = plugin.getWorkbench().getActiveWorkbenchWindow().getShell(); // Asks the user if he wants to edit the preferences to solve the problem. boolean editionWanted = MessageDialog.openQuestion(shell, "Doxygen Not Found", "Eclox was not able to run doxygen. Doxygen is either missing or eclox is not properly configured to use it.\n\nWould you like to edit preferences now ?"); if (!editionWanted) { return false; } // Allows the user to edit the preferences and eventually launch doxygen again. String[] filter = { eclox.core.ui.PreferencePage.ID }; int edited = PreferencesUtil.createPreferenceDialogOn(shell, eclox.core.ui.PreferencePage.ID, filter, null) .open(); return edited == Window.OK; }
@Override public void run(IAction action) { List<String> typesToFilter = getTypesToFilter(selection2); String preferencePageId = "DataHierarchy.globalPrefPage"; String types = DataHierarchyPlugin.getDefault().getPreferenceStore().getString( IPrefConstants.PREF_ACTIVE_FILTERS_LIST); PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, preferencePageId, null, typesToFilter); int open = dialog.open(); if (open != Window.OK) { return; } String newTypes = DataHierarchyPlugin.getDefault().getPreferenceStore().getString( IPrefConstants.PREF_ACTIVE_FILTERS_LIST); if (types.equals(newTypes)) { return; } part.updateFilter(newTypes); // SearchAgainAction search = new SearchAgainAction(); // search.init(part); // search.run(action); }
@Override public void run() { if (link == null) { return; } Display.getDefault().syncExec(new Runnable() { @Override public void run() { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window != null) { Shell shell = window.getShell(); shell.setMinimized(false); shell.forceActive(); PreferenceDialog prefsDialog = PreferencesUtil.createPreferenceDialogOn(shell, link, null, additionalData); prefsDialog.open(); } } }); }
public final Object execute(final ExecutionEvent event) { final String preferencePageId = event.getParameter(IWorkbenchCommandConstants.WINDOW_PREFERENCES_PARM_PAGEID); final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event); final Shell shell; if (activeWorkbenchWindow == null) { shell = null; } else { shell = activeWorkbenchWindow.getShell(); } final PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(shell, preferencePageId, new String[] { preferencePageId }, null); dialog.open(); return null; }
private void createUI_50_SetupExternalWebbrowser(final Composite parent, final Composite container) { /* * Link: Setup browser */ final Link linkSetupBrowser = new Link(container, SWT.WRAP); GridDataFactory.fillDefaults()// .align(SWT.FILL, SWT.END) .applyTo(linkSetupBrowser); linkSetupBrowser.setText(Messages.Search_View_Link_SetupExternalBrowser); linkSetupBrowser.setEnabled(true); linkSetupBrowser.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { PreferencesUtil.createPreferenceDialogOn(// parent.getShell(), PrefPageWebBrowser.ID, null, null).open(); } }); }
@Override public void run() { // set the currently displayed map provider so that this mp will be selected in the pref page final IPreferenceStore prefStore = TourbookPlugin.getDefault().getPreferenceStore(); prefStore.setValue(// IMappingPreferences.MAP_FACTORY_LAST_SELECTED_MAP_PROVIDER, _tourMapView.getMap().getMapProvider().getId()); PreferencesUtil.createPreferenceDialogOn( Display.getCurrent().getActiveShell(), PrefPageMapProviders.PREF_PAGE_MAP_PROVIDER_ID, null, null).open(); }
@Override public final Object execute(final ExecutionEvent event) { final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event); final Shell shell; if (activeWorkbenchWindow == null) { shell = null; } else { shell = activeWorkbenchWindow.getShell(); } final PreferenceDialog prefDialog = PreferencesUtil.createPreferenceDialogOn(shell, MergeEditorPreferencePage.PAGE_ID, null, null); if (prefDialog != null) prefDialog.open(); return null; }
@Override public final Object execute(final ExecutionEvent event) { final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event); final Shell shell; if (activeWorkbenchWindow == null) { shell = null; } else { shell = activeWorkbenchWindow.getShell(); } final PreferenceDialog prefDialog = PreferencesUtil.createPreferenceDialogOn(shell, DaysEditorPreferencePage.PAGE_ID, null, null); if (prefDialog != null) prefDialog.open(); return null; }
@Override public void init(IPageSite site) { super.init(site); IMenuManager menuManager = site.getActionBars().getMenuManager(); menuManager.insertBefore(IContextMenuConstants.GROUP_PROPERTIES, new Separator(GROUP_FILTERING)); fActionGroup.fillActionBars(site.getActionBars()); menuManager.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, new Action(SearchMessages.JavaSearchResultPage_preferences_label) { @Override public void run() { String pageId= "org.eclipse.search.preferences.SearchPreferencePage"; //$NON-NLS-1$ String[] displayedPages= { pageId, "org.eclipse.ui.editors.preferencePages.Annotations", //$NON-NLS-1$ "org.eclipse.ui.preferencePages.ColorsAndFonts" //$NON-NLS-1$ }; PreferencesUtil.createPreferenceDialogOn(JavaPlugin.getActiveWorkbenchShell(), pageId, displayedPages, null).open(); } }); }
@Override public void apply(IDocument document) { Map<Object, Object> data= null; if (fReferencedType != null) { IJavaElement elem= fReferencedType.getJavaElement(); if (elem != null) { IPackageFragmentRoot root= (IPackageFragmentRoot) elem.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); if (root != null) { try { IClasspathEntry entry= root.getRawClasspathEntry(); if (entry != null) { data= new HashMap<Object, Object>(1); data.put(BuildPathsPropertyPage.DATA_REVEAL_ENTRY, entry); if (entry.getEntryKind() != IClasspathEntry.CPE_CONTAINER) { data.put(BuildPathsPropertyPage.DATA_REVEAL_ATTRIBUTE_KEY, CPListElement.ACCESSRULES); } } } catch (JavaModelException e) { // ignore } } } } PreferencesUtil.createPropertyDialogOn(JavaPlugin.getActiveWorkbenchShell(), fProject, BuildPathsPropertyPage.PROP_ID, null, data).open(); }
private void createHeader(Composite contents) { String text= PreferencesMessages.PropertiesFileEditorPreferencePage_link; Link link= new Link(contents, SWT.NONE); link.setText(text); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if ("org.eclipse.ui.preferencePages.GeneralTextEditor".equals(e.text)) //$NON-NLS-1$ PreferencesUtil.createPreferenceDialogOn(getShell(), e.text, null, null); else if ("org.eclipse.ui.preferencePages.ColorsAndFonts".equals(e.text)) //$NON-NLS-1$ PreferencesUtil.createPreferenceDialogOn(getShell(), e.text, null, "selectFont:org.eclipse.jdt.ui.PropertiesFileEditor.textfont"); //$NON-NLS-1$ } }); GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false); gridData.widthHint= 150; // only expand further if anyone else requires it link.setLayoutData(gridData); addFiller(contents); }
private void createHeader(Composite contents) { final Shell shell= contents.getShell(); String text= PreferencesMessages.JavaEditorPreferencePage_link; Link link= new Link(contents, SWT.NONE); link.setText(text); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if ("org.eclipse.ui.preferencePages.GeneralTextEditor".equals(e.text)) //$NON-NLS-1$ PreferencesUtil.createPreferenceDialogOn(shell, e.text, null, null); else if ("org.eclipse.ui.preferencePages.ColorsAndFonts".equals(e.text)) //$NON-NLS-1$ PreferencesUtil.createPreferenceDialogOn(shell, e.text, null, "selectFont:org.eclipse.jdt.ui.editors.textfont"); //$NON-NLS-1$ } }); GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false); gridData.widthHint= 150; // only expand further if anyone else requires it link.setLayoutData(gridData); addFiller(contents); }
private void addLink(Composite composite, String text) { GridData gd; final Link link= new Link(composite, SWT.NONE); link.setText(text); gd= new GridData(SWT.FILL, SWT.BEGINNING, true, false); gd.widthHint= 300; // don't get wider initially gd.horizontalSpan= 2; gd.horizontalIndent= LayoutUtil.getIndent(); link.setLayoutData(gd); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { PreferencesUtil.createPreferenceDialogOn(link.getShell(), e.text, null, null); } }); }
private void createKeysLink(Composite composite, int h_span) { Link link= new Link(composite, SWT.NONE | SWT.WRAP); link.setText(PreferencesMessages.CodeAssistAdvancedConfigurationBlock_key_binding_hint); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { PreferencesUtil.createPreferenceDialogOn(getShell(), e.text, null, null); } }); PixelConverter pixelConverter= new PixelConverter(composite); int width= pixelConverter.convertWidthInCharsToPixels(40); // limit the size of the Link as it would take all it can get GridData gd= new GridData(GridData.FILL, GridData.FILL, false, false, h_span, 1); gd.widthHint= width; link.setLayoutData(gd); }
protected final void configButtonPressed() { String id= ClasspathVariablesPreferencePage.ID; Map<String, String> options= new HashMap<String, String>(); List<CPVariableElement> selected= fVariablesList.getSelectedElements(); if (!selected.isEmpty()) { String varName= selected.get(0).getName(); options.put(ClasspathVariablesPreferencePage.DATA_SELECT_VARIABLE, varName); } PreferencesUtil.createPreferenceDialogOn(getShell(), id, new String[] { id }, options).open(); List<CPVariableElement> oldElements= fVariablesList.getElements(); initializeElements(); List<CPVariableElement> newElements= fVariablesList.getElements(); newElements.removeAll(oldElements); if (!newElements.isEmpty()) { fVariablesList.selectElements(new StructuredSelection(newElements)); } else if (fVariablesList.getSelectedElements().isEmpty()) { fVariablesList.selectFirstElement(); } }
private void doButtonPressed(int index) { if (index == 0) { HashMap<String, String> data= new HashMap<String, String>(3); if (fEditResult != null) { data.put(UserLibraryPreferencePage.DATA_LIBRARY_TO_SELECT, fEditResult.getName()); } String id= UserLibraryPreferencePage.ID; PreferencesUtil.createPreferenceDialogOn(getShell(), id, new String[] { id }, data).open(); List<CPUserLibraryElement> newEntries= updateLibraryList(); if (newEntries.size() > 0) { if (fIsEditMode) { fLibrarySelector.setChecked(newEntries.get(0), true); } else { fLibrarySelector.setCheckedElements(newEntries); } } } else { fLibrarySelector.setCheckedElements(fLibrarySelector.getSelectedElements()); } }
private void configurePreferenceLink(Link link, final IJavaProject javaProject, final String preferenceId, final String propertyId) { link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (fContainer instanceof IWorkbenchPreferenceContainer) { IWorkbenchPreferenceContainer container= (IWorkbenchPreferenceContainer)fContainer; if (javaProject != null) { container.openPage(propertyId, null); } else { container.openPage(preferenceId, null); } } else { PreferencesUtil.createPreferenceDialogOn(fShell, preferenceId, null, null); } } }); }
private void createHeader(Composite contents) { String text = PreferencesMessages.EditorConfigEditorPreferencePage_link; Link link = new Link(contents, SWT.NONE); link.setText(text); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if ("org.eclipse.ui.preferencePages.GeneralTextEditor".equals(e.text)) //$NON-NLS-1$ PreferencesUtil.createPreferenceDialogOn(getShell(), e.text, null, null); else if ("org.eclipse.ui.preferencePages.ColorsAndFonts".equals(e.text)) //$NON-NLS-1$ PreferencesUtil.createPreferenceDialogOn(getShell(), e.text, null, "selectFont:org.eclipse.jdt.ui.EditorConfigEditor.textfont"); //$NON-NLS-1$ } }); GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false); gridData.widthHint = 150; // only expand further if anyone else requires // it link.setLayoutData(gridData); addFiller(contents); }
private void addLink(Composite composite, String text, int indent) { GridData gd; final Link link= new Link(composite, SWT.NONE); link.setText(text); gd= new GridData(SWT.FILL, SWT.BEGINNING, true, false); gd.widthHint= 300; // don't get wider initially gd.horizontalSpan= 2; gd.horizontalIndent= indent; link.setLayoutData(gd); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { PreferencesUtil.createPreferenceDialogOn(link.getShell(), e.text, null, null); } }); }
@Override public void init(final IPageSite pageSite) { super.init(pageSite); final IMenuManager menuManager = pageSite.getActionBars().getMenuManager(); menuManager.insertBefore(IContextMenuConstants.GROUP_PROPERTIES, new Separator( JiveSearchResultPage.LAYOUT_GROUP)); menuManager.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, new Action("Preferences...") { @Override public void run() { final String pageId = "org.eclipse.search.preferences.SearchPreferencePage"; //$NON-NLS-1$ final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); PreferencesUtil.createPreferenceDialogOn(shell, pageId, null, null).open(); } }); }
protected void checkPrefPageIdIsValid(String prefId) { Shell shell = WorkbenchUtils.getActiveWorkbenchShell(); PreferenceDialog prefDialog = PreferencesUtil.createPreferenceDialogOn(shell, prefId, null, null); assertNotNull(prefDialog); // Don't create, just eagerly check that it exits, that the ID is correct ISelection selection = prefDialog.getTreeViewer().getSelection(); if(selection instanceof IStructuredSelection) { IStructuredSelection ss = (IStructuredSelection) selection; if(ss.getFirstElement() instanceof IPreferenceNode) { IPreferenceNode prefNode = (IPreferenceNode) ss.getFirstElement(); if(prefNode.getId().equals(prefId)) { return; // Id exists } } } assertFail(); }
/** copied from PropertyAndPreferencePage */ protected final void openProjectProperties(IProject proj, Object data) { String id = getPropertyPageID(); if (id != null) { PreferencesUtil.createPropertyDialogOn(getShell(), proj, id, new String[] { id }, data).open(); } }
@Override protected Control createDialogArea(Composite parent) { // create a composite with standard margins and spacing Composite composite = (Composite)super.createDialogArea(parent); composite.setLayout(new GridLayout(1, false)); final CLabel warning = new CLabel(composite, SWT.LEFT); warning.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); warning.setImage(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/error.png").createImage()); warning.setText("Expert queue configuration parameters, please use with caution."); TableViewer viewer = new TableViewer(composite, SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); viewer.setUseHashlookup(true); viewer.getTable().setHeaderVisible(true); viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); createColumns(viewer); viewer.setContentProvider(createContentProvider()); viewer.setInput(props); final Button adv = new Button(composite, SWT.PUSH); adv.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false)); adv.setText("Advanced..."); adv.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn(getShell(), "org.dawnsci.commandserver.ui.activemqPage", null, null); if (pref != null) pref.open(); } }); return composite; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { PreferencesUtil.createPreferenceDialogOn( HandlerUtil.getActiveShell(event), PREF_PAGE.DB_STORE, null, null).open(); return null; }
/** * Opens the preferences dialog. */ private void openPreferences() { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn( shell, pageId, null, null); dialog.open(); // not sure if I have to do any cleanup. If so, the we probably want to: // dialog.blockOnOpen(true), then do the cleanup }
void openCommentTemplatesPreferencePage() { PreferencesUtil.createPreferenceDialogOn( null, "org.tigris.subversion.subclipse.ui.CommentTemplatesPreferences", //$NON-NLS-1$ new String[] { "org.tigris.subversion.subclipse.ui.CommentTemplatesPreferences" }, //$NON-NLS-1$ null).open(); fComboBox.setCommentTemplates( SVNUIPlugin.getPlugin().getRepositoryManager().getCommentsManager().getCommentTemplates()); }
@Override public void widgetDisposed(DisposeEvent event) { if (openPreferenceDialog) { // switch to Cloud SDK preferences panel event.display.asyncExec(new Runnable() { @Override public void run() { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn( null, CloudSdkPreferenceArea.PAGE_ID, null, null); dialog.open(); } }); } }
@Override public void run() { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); Object data = null; AnnotationPreference preference = getAnnotationPreference(fAnnotation); if (preference != null) data = preference.getPreferenceLabel(); fInfoControl.dispose(); // FIXME: should have protocol to hide, // rather than dispose PreferencesUtil .createPreferenceDialogOn(shell, "org.eclipse.ui.editors.preferencePages.Annotations", null, data) //$NON-NLS-1$ .open(); }
private void openAguiPrefs() { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn( getDisplay().getActiveShell(), AguiPreferencePage.PAGE_ID, //$NON-NLS-1$ preferencePageId null, // displayedIds null); // data dialog.open(); }