List of usage examples for org.eclipse.jface.preference IPreferencePage getTitle
String getTitle();
From source file:au.gov.ga.earthsci.application.preferences.PreferenceUtil.java
License:Apache License
private static IPreferenceNode createPreferenceNode(IConfigurationElement elmt, IEclipseContext context) { if (elmt.getAttribute(ATTR_CLASS) != null) { IPreferencePage page = null; try {/* ww w . j a v a 2 s.co m*/ String prefPageURI = getClassURI(elmt.getNamespaceIdentifier(), elmt.getAttribute(ATTR_CLASS)); Object object = context.get(IContributionFactory.class).create(prefPageURI, context); if (!(object instanceof IPreferencePage)) { logger.error("Expected instance of IPreferencePage: {0}", elmt.getAttribute(ATTR_CLASS)); //$NON-NLS-1$ return null; } page = (IPreferencePage) object; } catch (Exception e) { logger.error(e); return null; } ContextInjectionFactory.inject(page, context); if ((page.getTitle() == null || page.getTitle().isEmpty()) && elmt.getAttribute(ATTR_NAME) != null) { page.setTitle(elmt.getAttribute(ATTR_NAME)); } return new PreferenceNode(elmt.getAttribute(ATTR_ID), page); } else { return new PreferenceNode(elmt.getAttribute(ATTR_ID), new EmptyPreferencePage(elmt.getAttribute(ATTR_NAME))); } }
From source file:com.mindquarry.desktop.preferences.dialog.FilteredPreferenceDialog.java
License:Open Source License
/** * Save the values specified in the pages. * <p>// w ww . j a v a 2s. c o m * The default implementation of this framework method saves all pages of * type <code>PreferencePage</code> (if their store needs saving and is a * <code>PreferenceStore</code>). * </p> * <p> * Subclasses may override. * </p> */ protected void handleSave() { Iterator nodes = preferenceManager.getElements(PreferenceManager.PRE_ORDER).iterator(); while (nodes.hasNext()) { IPreferenceNode node = (IPreferenceNode) nodes.next(); IPreferencePage page = node.getPage(); if (page instanceof PreferencePage) { // Save now in case tbe workbench does not shutdown cleanly IPreferenceStore store = ((PreferencePage) page).getPreferenceStore(); if (store != null && store.needsSaving() && store instanceof IPersistentPreferenceStore) { try { ((IPersistentPreferenceStore) store).save(); } catch (IOException e) { MessageDialog.openError(getShell(), JFaceResources.getString("PreferenceDialog.saveErrorTitle"), //$NON-NLS-1$ JFaceResources.format("PreferenceDialog.saveErrorMessage", //$NON-NLS-1$ new Object[] { page.getTitle(), e.getMessage() })); } } } } }
From source file:com.nokia.carbide.internal.bugdatacollector.ui.preferences.BugDataCollectorPreferencePage.java
License:Open Source License
/** * Shows the preference dialog with only this preference page * available in the tree/*from www .ja v a 2s.c om*/ * @param shell */ public static void showYourself(Shell shell) { IPreferencePage page = new BugDataCollectorPreferencePage(); PreferenceManager mgr = new PreferenceManager(); IPreferenceNode node = new PreferenceNode("1", page); //$NON-NLS-1$ mgr.addToRoot(node); PreferenceDialog dialog = new PreferenceDialog(shell, mgr); dialog.create(); dialog.setMessage(page.getTitle()); dialog.open(); }
From source file:com.nokia.s60tools.hticonnection.actions.OpenPreferencePageAction.java
License:Open Source License
/** * Open HTI API preferences page preference page *//*from ww w . j a v a2 s . c o m*/ private void openPreferencePage() { IPreferencePage page = new HtiApiPreferencePage(); PreferenceManager mgr = new PreferenceManager(); IPreferenceNode node = new PreferenceNode("1", page);//$NON-NLS-1$ mgr.addToRoot(node); PreferenceDialog dialog = new PreferenceDialog(HtiApiActivator.getCurrentlyActiveWbWindowShell(), mgr); dialog.create(); dialog.setMessage(page.getTitle()); dialog.open(); }
From source file:com.telink.tc32eclipse.ui.actions.TCDBPrefAction.java
License:Open Source License
/** * Start the TCDB UploadJob.//from w w w. jav a2s.c o m * * @param buildcfg * The build configuration for resolving macros. * @param props * The AVR properties for the project / the current configuration */ private void runTCDBPref(IConfiguration buildcfg, TC32ProjectProperties props) { TCDBProperties TCDBprops = props.getTCDBProperties(); // get the list of normal (non-action) arguments // List<String> optionargs = TCDBprops.getArguments(); // get a list of actions List<String> actionargs = TCDBprops.getActionArguments(buildcfg, true); // Get the ProgrammerConfig in case we need to display an error // message // ProgrammerConfig programmer = TCDBprops.getProgrammer(); actionargs.add(props.getBinaryTargetName()); // + " " + programmer.getArg2String()); // Set the working directory to the CWD of the active build config, so that // relative paths are resolved correctly. // IPath cwdunresolved = buildcfg.getBuildData().getBuilderCWD(); // IPath cwd = new Path(BuildMacro.resolveMacros(buildcfg, cwdunresolved.toString())); IPreferencePage page = new MainPreferencePage(); PreferenceManager mgr = new PreferenceManager(); IPreferenceNode node = new PreferenceNode("1", page); mgr.addToRoot(node); PreferenceDialog dialog = new PreferenceDialog(getShell(), mgr); dialog.create(); dialog.setMessage(page.getTitle()); dialog.open(); /* //ISelection sel = ... obtain the current selection PropertyPage page = new PageTCDB(); //MyPropertyPage(); PreferenceManager mgr = new PreferenceManager(); IPreferenceNode node = new PreferenceNode("1", page); mgr.addToRoot(node); @SuppressWarnings("restriction") ISelection sel = (ISelection) fProject; PropertyDialog dialog = new PropertyDialog(getShell(), mgr, sel); dialog.create(); dialog.setMessage(page.getTitle()); //PropertyDialog dialog = PropertyDialog.createDialogOn(getShell(), null, (ISelection) fProject); dialog.open(); */ }
From source file:de.jcup.egradle.eclipse.ide.IDEUtil.java
License:Apache License
private static void showPreferencePage(IPreferencePage page) { EclipseUtil.safeAsyncExec(new Runnable() { @Override// w w w .j a v a2s . c om public void run() { Shell shell = getSafeDisplay().getActiveShell(); PreferenceManager mgr = new PreferenceManager(); IPreferenceNode node = new PreferenceNode("1", page); mgr.addToRoot(node); PreferenceDialog dialog = new PreferenceDialog(shell, mgr); dialog.create(); dialog.setMessage(page.getTitle()); dialog.open(); } }); }
From source file:net.sourceforge.eclipsetrader.core.ui.WizardPageAdapter.java
License:Open Source License
public WizardPageAdapter(IPreferencePage preferencePage) { super(""); //$NON-NLS-1$ setTitle(preferencePage.getTitle()); setDescription(preferencePage.getDescription()); preferencePage.setContainer(preferencePageContainer); setPageComplete(preferencePage.isValid()); this.preferencePage = preferencePage; }
From source file:org.apache.opennlp.caseditor.OpenPreferenceDialog.java
License:Apache License
@Override public void run() { super.run();//from w w w .ja va 2s .co m PreferenceManager mgr = new PreferenceManager(); IPreferencePage opennlpPage = new OpenNLPPreferencePage(editor.getDocument().getCAS().getTypeSystem()); opennlpPage.setTitle("General"); mgr.addToRoot(new PreferenceNode("1", opennlpPage)); IPreferencePage sentenceDetectorPage = new SentenceDetectorPreferencePage( editor.getDocument().getCAS().getTypeSystem()); sentenceDetectorPage.setTitle("Sentence Detector"); mgr.addToRoot(new PreferenceNode("1", sentenceDetectorPage)); IPreferencePage tokenizerPage = new TokenizerPreferencePage(); tokenizerPage.setTitle("Tokenizer"); mgr.addToRoot(new PreferenceNode("1", tokenizerPage)); IPreferencePage nameFinderPage = new NameFinderPreferencePage( editor.getDocument().getCAS().getTypeSystem()); nameFinderPage.setTitle("Name Finder"); mgr.addToRoot(new PreferenceNode("1", nameFinderPage)); PropertyDialog dialog = new PropertyDialog(shell, mgr, null); dialog.setPreferenceStore(((AnnotationEditor) editor).getCasDocumentProvider() .getTypeSystemPreferenceStore(editor.getEditorInput())); dialog.create(); dialog.setMessage(nameFinderPage.getTitle()); dialog.open(); editor.getCasDocumentProvider().saveTypeSystemPreferenceStore(editor.getEditorInput()); }
From source file:org.cfeclipse.cfml.snippets.views.snips.SnipTreeView.java
License:Open Source License
/** * creates all the default actions//w w w .j a va 2 s . c o m */ protected void createActions() { openSnipExPage = new Action("Edit SnipEx Servers", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_SNIPEX)) { public void run() { IPreferencePage page = new SnipExPreferencePage(); PreferenceManager mgr = new PreferenceManager(); IPreferenceNode node = new PreferenceNode("1", page); mgr.addToRoot(node); PreferenceDialog dialog = new PreferenceDialog(getSite().getShell(), mgr); dialog.create(); dialog.setMessage(page.getTitle()); dialog.open(); } }; refreshSnipEx = new Action("Refresh SnipEx Server", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_REFRESH)) { public void run() { System.out.println("Refreshing the snipex server"); } }; insertAction = new Action("Insert", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_SNIP)) { public void run() { insertItem(); } }; insertAction.setToolTipText("Insert the selected snip into the document"); createFolderAction = new Action("Create Folder", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_PACKAGE)) { public void run() { createSnipFolder(); } }; createFolderAction.setToolTipText("Create a new snip package"); createSnippetAction = new Action("Create Snippet", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_ADD)) { public void run() { createSnippet(); } }; createSnippetAction.setToolTipText("Create a new snip"); editSnippetAction = new Action("Edit Snippet", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_EDIT)) { public void run() { editSnippet(); } }; editSnippetAction.setToolTipText("Edit the selected snip"); refreshSnippetsAction = new Action("Refresh Snippets", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_REFRESH)) { public void run() { reloadSnippets(true); } }; refreshSnippetsAction.setToolTipText("Refresh snip view"); deleteSnippetAction = new Action("Delete Snippet", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_REMOVE)) { public void run() { deleteSnippet(); } }; deleteSnippetAction.setToolTipText("Delete selected snip"); deleteFolderAction = new Action("Delete Folder", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_DELETE)) { public void run() { deleteSnipFolder(); } }; deleteFolderAction.setToolTipText("Delete selected snip package (must be empty)"); exportToSnipEx = new Action("Export to SnipEx server", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_SNIP_EXPORT)) { public void run() { IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection(); File selectedfile = (File) selection.getFirstElement(); Shell shell = getSite().getShell(); SnippetToSnipExWizard wizard = new SnippetToSnipExWizard(selectedfile); //TODO: pass in the object we have selected WizardDialog dialog = new WizardDialog(shell, wizard); dialog.open(); //Run the wizard } }; exportToSnipEx.setToolTipText("Export the selected snippet to a SnipX Server"); }
From source file:org.cfeclipse.cfml.views.snips.SnipTreeView.java
License:Open Source License
/** * creates all the default actions/*from w ww . j a v a 2 s .c o m*/ */ protected void createActions() { openSnipExPage = new Action("Edit SnipEx Servers", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_SNIPEX)) { public void run() { IPreferencePage page = new SnipExPreferencePage(); PreferenceManager mgr = new PreferenceManager(); IPreferenceNode node = new PreferenceNode("1", page); mgr.addToRoot(node); PreferenceDialog dialog = new PreferenceDialog(getSite().getShell(), mgr); dialog.create(); dialog.setMessage(page.getTitle()); dialog.open(); } }; refreshSnipEx = new Action("Refresh SnipEx Server", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_REFRESH)) { public void run() { System.out.println("Refreshing the snipex server"); } }; insertAction = new Action("Insert", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_SNIP)) { public void run() { insertItem(); } }; insertAction.setToolTipText("Insert the selected snip into the document"); createFolderAction = new Action("Create Folder", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_PACKAGE)) { public void run() { createSnipFolder(); } }; createFolderAction.setToolTipText("Create a new snip package"); createSnippetAction = new Action("Create Snippet", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_ADD)) { public void run() { createSnippet(); } }; createSnippetAction.setToolTipText("Create a new snip"); editSnippetAction = new Action("Edit Snippet", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_EDIT)) { public void run() { editSnippet(); } }; editSnippetAction.setToolTipText("Edit the selected snip"); refreshSnippetsAction = new Action("Refresh Snippets", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_REFRESH)) { public void run() { reloadSnippets(); } }; refreshSnippetsAction.setToolTipText("Refresh snip view"); deleteSnippetAction = new Action("Delete Snippet", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_REMOVE)) { public void run() { deleteSnippet(); } }; deleteSnippetAction.setToolTipText("Delete selected snip"); deleteFolderAction = new Action("Delete Folder", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_DELETE)) { public void run() { deleteSnipFolder(); } }; deleteFolderAction.setToolTipText("Delete selected snip package (must be empty)"); exportToSnipEx = new Action("Export to SnipEx server", CFPluginImages.getImageRegistry().getDescriptor(CFPluginImages.ICON_SNIP_EXPORT)) { public void run() { IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection(); File selectedfile = (File) selection.getFirstElement(); Shell shell = getSite().getShell(); SnippetToSnipExWizard wizard = new SnippetToSnipExWizard(selectedfile); //TODO: pass in the object we have selected WizardDialog dialog = new WizardDialog(shell, wizard); int result = dialog.open(); //Run the wizard } }; exportToSnipEx.setToolTipText("Export the selected snippet to a SnipX Server"); }