List of usage examples for org.eclipse.jface.preference PreferenceDialog open
public int open()
From source file:ag.ion.noa4e.ui.NOAUIPlugin.java
License:Open Source License
/** * Starts local office application./* w w w .j a v a2s. c o m*/ * * @param shell shell to be used * @param officeApplication office application to be started * * @return information whether the office application was started or not - only * if the status severity is <code>IStatus.OK</code> the application was started * * @author Joerg Sigle * @date 24.06.2012 * @date 20.02.2012 * * @author Andreas Brker * @date 28.06.2006 */ public static IStatus startLocalOfficeApplication(Shell shell, IOfficeApplication officeApplication) { System.out.println("NOAUIPlugin: startLocalOfficeApplication(Shell, officeApplication) begin"); while (true) { System.out.println("NOAUIPlugin: startLocalOfficeApplication(2): while (true) trying to start..."); IStatus status = internalStartApplication(shell, officeApplication); System.out.println("NOAUIPlugin: startLocalOfficeApplication(2): returned from trying to start."); if (status == null) System.out.println("NOAUIPlugin: startLocalOfficeApplication(2): status==null"); else System.out.println("NOAUIPlugin: startLocalOfficeApplication(2): status=" + status.toString()); if (status.getSeverity() == IStatus.ERROR) { System.out.println( "NOAUIPlugin: startLocalOfficeApplication(2): WARNING: status.getSeverity()==IStatus.ERROR"); if (MessageDialog.openQuestion(shell, Messages.NOAUIPlugin_dialog_change_preferences_title, Messages.NOAUIPlugin_dialog_change_preferences_message)) { PreferenceDialog preferenceDialog = PreferencesUtil.createPreferenceDialogOn(shell, LocalOfficeApplicationPreferencesPage.PAGE_ID, null, null); if (preferenceDialog.open() == Window.CANCEL) return Status.CANCEL_STATUS; else continue; } } else System.out.println( "NOAUIPlugin: startLocalOfficeApplication(2): SUCCESS: !status.getSeverity()==IStatus.ERROR"); try { //My warning in the following line referred to the original noa4e code: //System.out.println("NOAUIPlugin: internalStartApplication(2): getting officeHome (WARNING: probably from the wrong source)..."); System.out.println("NOAUIPlugin: startLocalOfficeApplication(2): getting officeHome..."); System.out.println( "NOAUIPlugin: startLocalOfficeApplication(2): Using js mod adopted for Elexis, reproducing prior GW adoptions, P_OOBASEDIR via ...(Hub.localCfg)"); //JS modified this: //The original code tries to access a preference store which is not used in Elexis, //according to GWs mods in (back then:) LocalOfficeApplicationPreferencesPage.java //Unsuitable original line, removed: //String officeHome = getDefault().getPreferenceStore().getString(PREFERENCE_OFFICE_HOME); //Newly inserted lines: IPreferenceStore preferenceStore = new SettingsPreferenceStore(CoreHub.localCfg); String officeHome = preferenceStore.getString(PreferenceConstants.P_OOBASEDIR); if (officeHome == null) System.out.println("NOAUIPlugin: startLocalOfficeApplication(2): WARNING: officeHome==null"); else System.out.println("NOAUIPlugin: startLocalOfficeApplication(2): officeHome=" + officeHome); System.out.println( "NOAUIPlugin: startLocalOfficeApplication(2): trying to get preventTermination setting..."); //My warning in the following line referred to the original noa4e code: //System.out.println("NOAUIPlugin: WARNING: THIS PROBABLY REFERENCES THE WRONG PREFERENCE STORE. SEE LocalPreferences...GWeirich/JS mods"); //JS modified this: //The original code tries to access a preference store which is not used in Elexis, //according to GWs mods in (back then:) LocalOfficeApplicationPreferencesPage.java //Unsuitable original line, removed: //boolean preventTermination = getDefault().getPreferenceStore().getBoolean(PREFERENCE_PREVENT_TERMINATION); //Newly inserted lines: //Already declared further above: IPreferenceStore preferenceStore = new SettingsPreferenceStore(Hub.localCfg); boolean preventTermination = preferenceStore.getBoolean(PREFS_PREVENT_TERMINATION); System.out.println("NOAUIPlugin: startLocalOfficeApplication(2): got preventTermination setting=" + preventTermination); if (preventTermination) { System.out.println( "NOAUIPlugin: startLocalOfficeApplication(2): trying officeApplication.getDesktopService().activateTerminationPrevention()..."); officeApplication.getDesktopService().activateTerminationPrevention(); System.out.println( "NOAUIPlugin: startLocalOfficeApplication(2): SUCCESS: officeApplication.getDesktopService().activateTerminationPrevention()"); } } catch (OfficeApplicationException officeApplicationException) { //no prevention System.out.println( "NOAUIPlugin: startLocalOfficeApplication(2): FAILED: preventTermination could NOT be set."); } System.out.println("NOAUIPlugin: startLocalOfficeApplication(2) end, returning status"); return status; } }
From source file:aktie.gui.CocoaUIEnhancer.java
License:Open Source License
private static void showPreferences() { System.out.println("Preferences..."); PreferenceManager manager = new PreferenceManager(); PreferenceDialog dialog = new PreferenceDialog(null, manager); dialog.open(); // delegate.runCommand(ActionFactory.PREFERENCES.getCommandId()); }
From source file:ariba.ideplugin.eclipse.Control.java
License:Apache License
public void earlyStartup() { Preferences pref = Activator.getDefault().getPluginPreferences(); if (pref.getBoolean(Activator.PrefAutoCheck)) { String awhome = pref.getString(Activator.PrefAWPath); if (awhome == null || awhome.length() == 0 || !new File(awhome).exists()) { Display.getDefault().asyncExec(new Runnable() { public void run() { PreferenceDialog pd = PreferencesUtil.createPreferenceDialogOn( PlatformUI.getWorkbench().getWorkbenchWindows()[0].getShell(), "ariba.ideplugin.eclipse.preferences.AWPreferencesPage", new String[0], null); pd.open(); }//w w w. j a v a 2 s . co m }); } } }
From source file:at.nucle.e4.preferences.example.handler.PreferenceHandler.java
License:Open Source License
@Execute public void execute(Shell shell, EPreferenceService service) { final PreferenceDialog dlg = new PreferenceDialog(shell, service.getPreferenceManager()); dlg.create();//from ww w . j a v a 2 s . c o m dlg.open(); }
From source file:at.spardat.xma.guidesign.preferences.AbstractPreferenceAndPropertyPage.java
License:Open Source License
/** * Show a single preference pages/* ww w. j ava 2s. c o m*/ * * @param id * - the preference page identification * @param page * - the preference page */ protected void showPreferencePage(String id, IPreferencePage page) { final IPreferenceNode targetNode = new PreferenceNode(id, page); PreferenceManager manager = new PreferenceManager(); manager.addToRoot(targetNode); final PreferenceDialog dialog = new PreferenceDialog(getControl().getShell(), manager); BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() { public void run() { dialog.create(); dialog.setMessage(targetNode.getLabelText()); dialog.open(); } }); }
From source file:au.gov.ga.earthsci.application.handlers.ShowPreferencesHandler.java
License:Apache License
@Execute public void execute(IEclipseContext context, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell) throws InvocationTargetException, InterruptedException { PreferenceManager pm = PreferenceUtil.createLegacyPreferenceManager(context, registry); PreferenceDialog dialog = new PreferenceDialog(shell, pm); dialog.setPreferenceStore(/* w w w. ja va 2 s . com*/ new ScopedPreferenceStore(InstanceScope.INSTANCE, PreferenceConstants.QUALIFIER_ID)); dialog.create(); dialog.getTreeViewer().setComparator(new ViewerComparator()); dialog.getTreeViewer().expandAll(); dialog.open(); }
From source file:au.gov.ga.earthsci.application.parts.globe.handlers.StereoHandler.java
License:Apache License
protected void setupViewDelegate(IDelegateView view, String menuItemId, Composite parent) { try {/* w ww. j ava 2s. co m*/ Double initFov = Configuration.getDoubleValue(AVKey.FOV); if (initFov == null) { initFov = 45d; } view.setFieldOfView(Angle.fromDegrees(initFov)); if (MENU_NONE.equals(menuItemId)) { view.setDelegate(null); return; } lastMenuItemId = menuItemId; if (MENU_OCULUSRIFT.equals(menuItemId)) { view.setDelegate(new RiftViewDistortionDelegate()); } else if (MENU_OCULUSRIFTPREVIEW.equals(menuItemId)) { view.setDelegate(new RiftViewPreviewDelegate()); } else { StereoViewDelegate delegate = new StereoViewDelegate(); view.setDelegate(delegate); StereoViewParameters parameters = delegate.getParameters(); parameters.setStereoEnabled(true); if (MENU_REDCYAN.equals(menuItemId)) { parameters.setStereoMode(StereoMode.RC_ANAGLYPH); } else if (MENU_GREENMAGENTA.equals(menuItemId)) { parameters.setStereoMode(StereoMode.GM_ANAGLYPH); } else if (MENU_BLUEYELLOW.equals(menuItemId)) { parameters.setStereoMode(StereoMode.BY_ANAGLYPH); } else { parameters.setStereoMode(StereoMode.STEREO_BUFFER); if (!lastWasStereo && !stereo) { if (MessageDialog.openQuestion(parent.getShell(), Messages.StereoHandler_StereoDialogTitle, Messages.StereoHandler_StereoDialogMessage)) { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(parent.getShell(), GlobePreferencePage.PREFERENCE_PAGE_ID, null, null); dialog.open(); } } } } } finally { lastWasStereo = MENU_QUADBUFFERED.equals(menuItemId); } }
From source file:au.gov.ga.earthsci.discovery.ui.handler.ServicesHandler.java
License:Apache License
@Execute public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell) { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(shell, "au.gov.ga.earthsci.discovery.services", null, null); //$NON-NLS-1$ dialog.open(); }
From source file:ca.edchipman.silverstripepdt.wizards.NewSilverStripeTemplatesWizardPage.java
License:Open Source License
void preferenceLinkClicked() { String pageId = getPreferencePageId(); PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), pageId, new String[] { pageId }, null); dialog.open(); fTableViewer.refresh();//from ww w .j a va 2 s . c o m }
From source file:cc.warlock.rcp.menu.PreferencesHandler.java
License:Open Source License
public Object execute(ExecutionEvent event) throws ExecutionException { //IWarlockClient activeClient; GameView inFocus = GameView.getGameViewInFocus(); //if (inFocus != null) //{//ww w. j a v a 2 s .c o m IWarlockClient activeClient = inFocus.getWarlockClient(); //} PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn(Display.getDefault().getActiveShell(), new WarlockClientAdaptable(activeClient), null, null, null); dialog.getTreeViewer().expandToLevel(2); int response = dialog.open(); return null; }