List of usage examples for org.eclipse.jface.preference PreferenceDialog PreferenceDialog
public PreferenceDialog(Shell parentShell, PreferenceManager manager)
From source file:com.bdaum.overlayPages.FieldEditorOverlayPage.java
License:Open Source License
/** * Show a single preference pages/* www . j ava 2s . c om*/ * * @param id * - the preference page identification * @param page * - the preference page */ protected void showPreferencePage(final String id, final IPreferencePage page) { final IPreferenceNode targetNode = new PreferenceNode(id, page); final PreferenceManager manager = new PreferenceManager(); manager.addToRoot(targetNode); final PreferenceDialog dialog = new PreferenceDialog(getControl().getShell(), manager); BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() { @Override public void run() { dialog.create(); dialog.setMessage(targetNode.getLabelText()); dialog.open(); } }); }
From source file:com.blackducksoftware.integration.eclipseplugin.popupmenu.handlers.OpenProjectPreferences.java
License:Apache License
@Override public Object execute(final ExecutionEvent event) throws ExecutionException { final Shell activeShell = HandlerUtil.getActiveShell(event); final PreferenceManager mgr = new PreferenceManager(preferencePathSeparatorCharacter); final DependencyInformationService depService = new DependencyInformationService(); final FilePathGavExtractor extractor = new FilePathGavExtractor(); final ProjectInformationService projService = new ProjectInformationService(depService, extractor); final WorkspaceInformationService workspaceService = new WorkspaceInformationService(projService); final String projectPrefId = workspaceService.getSelectedProject(); final IndividualProjectPreferences prefPage = new IndividualProjectPreferences(projectPrefId, projectPrefId);//from ww w. j a v a 2 s. com final PreferenceNode prefNode = new PreferenceNode(projectPrefId, prefPage); mgr.addToRoot(prefNode); final PreferenceDialog prefDialog = new PreferenceDialog(activeShell, mgr); prefDialog.open(); return null; }
From source file:com.iw.plugins.spindle.ui.util.UIUtils.java
License:Mozilla Public License
public static boolean showPreferencePage(Shell shell, String id, IPreferencePage page) { final IPreferenceNode targetNode = new PreferenceNode(id, page); PreferenceManager manager = new PreferenceManager(); manager.addToRoot(targetNode);// www . ja va2s .c o m final PreferenceDialog dialog = new PreferenceDialog(shell, manager); final boolean[] result = new boolean[] { false }; BusyIndicator.showWhile(shell.getDisplay(), new Runnable() { public void run() { dialog.create(); dialog.setMessage(targetNode.getLabelText()); result[0] = (dialog.open() == Window.OK); } }); return result[0]; }
From source file:com.liferay.ide.ui.util.SWTUtil.java
License:Open Source License
public static boolean showPreferencePage(String id, Shell shell) { PreferenceManager manager = PlatformUI.getWorkbench().getPreferenceManager(); IPreferenceNode node = manager.find("org.eclipse.jdt.ui.preferences.JavaBasePreferencePage") //$NON-NLS-1$ .findSubNode(id);// w w w. j a v a 2 s . c om PreferenceManager manager2 = new PreferenceManager(); manager2.addToRoot(node); PreferenceDialog dialog = new PreferenceDialog(shell, manager2); dialog.create(); return (dialog.open() == Window.OK); }
From source file:com.mentor.nucleus.bp.core.ui.SetBPProjectPreferencesAction.java
License:Open Source License
public void run(IAction action) { IStructuredSelection structuredSelection = Selection.getInstance().getStructuredSelection(); if (structuredSelection != null) { Object selection = structuredSelection.getFirstElement(); if (selection instanceof SystemModel_c) { IProject selectedProject = (IProject) ((SystemModel_c) selection).getAdapter(IProject.class); if (selectedProject != null) { IScopeContext projectScope = new ProjectScope(selectedProject); Preferences projectNode = projectScope .getNode(BridgePointProjectPreferences.BP_PROJECT_PREFERENCES_ID); PreferenceDialog pd = new PreferenceDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), CorePlugin.getProjectPreferenceManager(projectNode)); pd.open();/*ww w .j a v a 2 s . c o m*/ } } } }
From source file:com.microsoft.azuretools.core.utils.PluginUtil.java
License:Open Source License
/** * Method opens property dialog with only desired property page. * * @param nodeId/* w w w .j a v a 2s . c o m*/ * : Node ID of property page * @param nodeLbl * : Property page name * @param classObj * : Class object of property page * @return */ public static int openPropertyPageDialog(String nodeId, String nodeLbl, Object classObj) { int retVal = Window.CANCEL; // value corresponding to cancel // Node creation try { PreferenceNode nodePropPg = new PreferenceNode(nodeId, nodeLbl, null, classObj.getClass().toString()); nodePropPg.setPage((IPreferencePage) classObj); nodePropPg.getPage().setTitle(nodeLbl); PreferenceManager mgr = new PreferenceManager(); mgr.addToRoot(nodePropPg); // Dialog creation PreferenceDialog dialog = new PreferenceDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), mgr); // make desired property page active. dialog.setSelectedNode(nodeLbl); dialog.create(); /* * If showing storage accounts preference page, don't show * properties for title as its common repository. */ String dlgTitle = ""; if (nodeLbl.equals(Messages.cmhLblStrgAcc) || nodeLbl.equals(Messages.aiTxt)) { dlgTitle = nodeLbl; } else { dlgTitle = String.format(Messages.cmhPropFor, getSelectedProject().getName()); } dialog.getShell().setText(dlgTitle); dialog.open(); // return whether user has pressed OK or Cancel button retVal = dialog.getReturnCode(); } catch (Exception e) { PluginUtil.displayErrorDialogAndLog(PluginUtil.getParentShell(), Messages.rolsDlgErr, Messages.projDlgErrMsg, e); } return retVal; }
From source file:com.microsoftopentechnologies.wacommon.utils.PluginUtil.java
License:Open Source License
/** * Method opens property dialog with only desired property page. * /*ww w. ja v a 2 s . co m*/ * @param nodeId * : Node ID of property page * @param nodeLbl * : Property page name * @param classObj * : Class object of property page * @return */ public static int openPropertyPageDialog(String nodeId, String nodeLbl, Object classObj) { int retVal = Window.CANCEL; // value corresponding to cancel // Node creation try { PreferenceNode nodePropPg = new PreferenceNode(nodeId, nodeLbl, null, classObj.getClass().toString()); nodePropPg.setPage((IPreferencePage) classObj); nodePropPg.getPage().setTitle(nodeLbl); PreferenceManager mgr = new PreferenceManager(); mgr.addToRoot(nodePropPg); // Dialog creation PreferenceDialog dialog = new PreferenceDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), mgr); // make desired property page active. dialog.setSelectedNode(nodeLbl); dialog.create(); /* * If showing storage accounts preference page, don't show * properties for title as its common repository. */ String dlgTitle = ""; if (nodeLbl.equals(Messages.cmhLblStrgAcc) || nodeLbl.equals(Messages.aiTxt)) { dlgTitle = nodeLbl; } else { dlgTitle = String.format(Messages.cmhPropFor, getSelectedProject().getName()); } dialog.getShell().setText(dlgTitle); dialog.open(); // return whether user has pressed OK or Cancel button retVal = dialog.getReturnCode(); } catch (Exception e) { PluginUtil.displayErrorDialogAndLog(new Shell(), Messages.rolsDlgErr, Messages.projDlgErrMsg, e); } return retVal; }
From source file:com.motorola.studio.android.common.utilities.ui.WidgetsUtil.java
License:Apache License
/** * Opens the Eclipse preferences dialog and selects the page of the given * id./*from w ww .j a va 2 s . c om*/ * * @param shell The shell. * @param selectedNode The preferences page to selec. * @return <code>true</code> if the Wizard dialog has constant OK, * <code>false</code> otherwise . */ public static boolean runPreferencePage(Shell shell, String selectedNode) { PreferenceManager manager = PlatformUI.getWorkbench().getPreferenceManager(); PreferenceDialog dialog = new PreferenceDialog(shell, manager); dialog.setSelectedNode(selectedNode); WidgetsUtil.centerDialog(shell); return dialog.open() == PreferenceDialog.OK; }
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/*ww w . j a v a2 s .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 *///ww w .j a v a2s.com 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(); }