List of usage examples for org.eclipse.jface.preference PreferenceDialog open
public int open()
From source file:org.fusesource.ide.jmx.ui.internal.views.navigator.Navigator.java
License:Open Source License
@Override public void createPartControl(Composite aParent) { fillActionBars();/* w ww.j a v a 2 s .c o m*/ Composite newParent = new Composite(aParent, SWT.NONE); newParent.setLayout(new FormLayout()); super.createPartControl(newParent); filterText = new Text(newParent, SWT.SINGLE | SWT.BORDER); // layout the two objects FormData fd = new FormData(); fd.left = new FormAttachment(0, 5); fd.right = new FormAttachment(100, -5); fd.top = new FormAttachment(0, 5); filterText.setLayoutData(fd); Control topOfTree = filterText; // If tools.jar isn't available, JMX stuff won't work... boolean haveTools = false; try { haveTools = Class.forName("javax.tools.ToolProvider", false, getClass().getClassLoader()) != null; } catch (ClassNotFoundException e1) { // haveTools = false; } if (!haveTools) { Link noJDKLlink = new Link(newParent, SWT.SINGLE); noJDKLlink.setText( "You cannot use the JMX browser until you specify the location of the JDK\u2019s tools.jar file. Go to the <a>JMX Tools preferences page</a> to set it."); noJDKLlink.setForeground(noJDKLlink.getDisplay().getSystemColor(SWT.COLOR_RED)); fd = new FormData(); fd.left = new FormAttachment(0, 5); fd.right = new FormAttachment(100, -5); fd.top = new FormAttachment(filterText, 5); noJDKLlink.setLayoutData(fd); noJDKLlink.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn( ((Control) e.widget).getShell(), "org.fusesource.ide.jvmmonitor.tools.ToolsPreferencePage", null, null); if (pref != null) { pref.open(); } } }); topOfTree = noJDKLlink; } fd = new FormData(); fd.left = new FormAttachment(0, 0); fd.right = new FormAttachment(100, 0); fd.top = new FormAttachment(topOfTree, 5); fd.bottom = new FormAttachment(100, 0); final CommonViewer viewer = getCommonViewer(); Tree tree = viewer.getTree(); tree.setLayoutData(fd); viewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); viewerSelection = selection; propertySheetTracker.selectionChanged(Navigator.this, selection); } }); filterText.setToolTipText("Type in a filter"); filterText.setText("Type in a filter"); Display.getDefault().asyncExec(new Runnable() { public void run() { query = new QueryContribution(Navigator.this); } }); }
From source file:org.goko.controller.grbl.v09.internal.handlers.GrblConfigurationOpenHandler.java
License:Open Source License
@Execute public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, IGrblControllerService service, IEclipseContext context) throws GkException { PreferenceManager manager = new PreferenceManager('/'); GrblConfiguration cfg = service.getConfiguration(); manager.addToRoot(/* w w w.j a va 2 s .c om*/ new PreferenceNode("org.goko.controller.grbl.1.device", new GrblConfigurationDialog(cfg))); PreferenceDialog dialog = new PreferenceDialog(shell, manager); int result = dialog.open(); if (result == Dialog.OK) { try { service.setConfiguration(cfg); } catch (GkFunctionalException e) { LOG.log(e); GkDialog.openDialog(shell, e); } } }
From source file:org.goko.controller.tinyg.handlers.TinyGConfigurationOpenHandler.java
License:Open Source License
@Execute public void execute(@Named(IServiceConstants.ACTIVE_SHELL) final Shell shell, ITinygControllerService service, IEclipseContext context) throws GkException { PreferenceManager manager = new PreferenceManager('/'); TinyGConfiguration cfg = service.getConfiguration(); manager.addToRoot(//from w w w. j av a 2 s . co m new PreferenceNode("org.goko.controller.tinyg.1.device", new TinyGConfigurationDevicePage(cfg))); manager.addToRoot(new PreferenceNode("org.goko.controller.tinyg.2.communication", new TinyGConfigurationCommunicationPage(cfg))); manager.addToRoot(new PreferenceNode("org.goko.controller.tinyg.3.defaultgcode", new TinyGConfigurationGCodeDefaultPage(cfg))); manager.addToRoot( new PreferenceNode("org.goko.controller.tinyg.4.motion", new TinyGConfigurationMotionPage(cfg))); manager.addToRoot(new PreferenceNode("org.goko.controller.tinyg.5.motorMapping", new TinyGConfigurationMotorMappingPage(cfg))); manager.addTo("org.goko.controller.tinyg.5.motorMapping", new PreferenceNode("org.goko.controller.tinyg.5.a.motor1", new TinyGConfigurationMotorPage(cfg, "Motor 1", TinyGConfiguration.MOTOR_1_SETTINGS))); manager.addTo("org.goko.controller.tinyg.5.motorMapping", new PreferenceNode("org.goko.controller.tinyg.5.b.motor2", new TinyGConfigurationMotorPage(cfg, "Motor 2", TinyGConfiguration.MOTOR_2_SETTINGS))); manager.addTo("org.goko.controller.tinyg.5.motorMapping", new PreferenceNode("org.goko.controller.tinyg.5.c.motor3", new TinyGConfigurationMotorPage(cfg, "Motor 3", TinyGConfiguration.MOTOR_3_SETTINGS))); manager.addTo("org.goko.controller.tinyg.5.motorMapping", new PreferenceNode("org.goko.controller.tinyg.5.d.motor4", new TinyGConfigurationMotorPage(cfg, "Motor 4", TinyGConfiguration.MOTOR_4_SETTINGS))); manager.addToRoot( new PreferenceNode("org.goko.controller.tinyg.6.axis", new TinyGConfigurationAxisMainPage(cfg))); manager.addTo("org.goko.controller.tinyg.6.axis", new PreferenceNode("org.goko.controller.tinyg.6.a.xaxis", new TinyGConfigurationAxisPage(cfg, "X Axis", TinyGConfiguration.X_AXIS_SETTINGS))); manager.addTo("org.goko.controller.tinyg.6.axis", new PreferenceNode("org.goko.controller.tinyg.6.b.yaxis", new TinyGConfigurationAxisPage(cfg, "Y Axis", TinyGConfiguration.Y_AXIS_SETTINGS))); manager.addTo("org.goko.controller.tinyg.6.axis", new PreferenceNode("org.goko.controller.tinyg.6.c.zaxis", new TinyGConfigurationAxisPage(cfg, "Z Axis", TinyGConfiguration.Z_AXIS_SETTINGS))); manager.addTo("org.goko.controller.tinyg.6.axis", new PreferenceNode("org.goko.controller.tinyg.6.d.aaxis", new TinyGConfigurationAxisPage(cfg, "A Axis", TinyGConfiguration.A_AXIS_SETTINGS))); PreferenceDialog dialog = new PreferenceDialog(shell, manager); int result = dialog.open(); if (result == Dialog.OK) { try { service.updateConfiguration(cfg); } catch (GkFunctionalException e) { LOG.log(e); GkDialog.openDialog(shell, e); } } }
From source file:org.goko.tinyg.handlers.TinyGConfigurationOpenHandler.java
License:Open Source License
@Execute public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, ITinygControllerService service, IEclipseContext context) throws GkException { PreferenceManager manager = new PreferenceManager('/'); TinyGConfiguration cfg = service.getConfiguration(); manager.addToRoot(new PreferenceNode("org.goko.tinyg.1.device", new TinyGConfigurationDevicePage(cfg))); manager.addToRoot(/*from w ww. j a v a 2 s . c om*/ new PreferenceNode("org.goko.tinyg.2.communication", new TinyGConfigurationCommunicationPage(cfg))); manager.addToRoot( new PreferenceNode("org.goko.tinyg.3.defaultgcode", new TinyGConfigurationGCodeDefaultPage(cfg))); manager.addToRoot(new PreferenceNode("org.goko.tinyg.4.motion", new TinyGConfigurationMotionPage(cfg))); manager.addToRoot( new PreferenceNode("org.goko.tinyg.5.motorMapping", new TinyGConfigurationMotorMappingPage(cfg))); manager.addTo("org.goko.tinyg.5.motorMapping", new PreferenceNode("org.goko.tinyg.5.a.motor1", new TinyGConfigurationMotorPage(cfg, "Motor 1", TinyGConfiguration.MOTOR_1_SETTINGS))); manager.addTo("org.goko.tinyg.5.motorMapping", new PreferenceNode("org.goko.tinyg.5.b.motor2", new TinyGConfigurationMotorPage(cfg, "Motor 2", TinyGConfiguration.MOTOR_2_SETTINGS))); manager.addTo("org.goko.tinyg.5.motorMapping", new PreferenceNode("org.goko.tinyg.5.c.motor3", new TinyGConfigurationMotorPage(cfg, "Motor 3", TinyGConfiguration.MOTOR_3_SETTINGS))); manager.addTo("org.goko.tinyg.5.motorMapping", new PreferenceNode("org.goko.tinyg.5.d.motor4", new TinyGConfigurationMotorPage(cfg, "Motor 4", TinyGConfiguration.MOTOR_4_SETTINGS))); manager.addToRoot(new PreferenceNode("org.goko.tinyg.6.axis", new TinyGConfigurationAxisMainPage(cfg))); manager.addTo("org.goko.tinyg.6.axis", new PreferenceNode("org.goko.tinyg.6.a.xaxis", new TinyGConfigurationAxisPage(cfg, "X Axis", TinyGConfiguration.X_AXIS_SETTINGS))); manager.addTo("org.goko.tinyg.6.axis", new PreferenceNode("org.goko.tinyg.6.b.yaxis", new TinyGConfigurationAxisPage(cfg, "Y Axis", TinyGConfiguration.Y_AXIS_SETTINGS))); manager.addTo("org.goko.tinyg.6.axis", new PreferenceNode("org.goko.tinyg.6.c.zaxis", new TinyGConfigurationAxisPage(cfg, "Z Axis", TinyGConfiguration.Z_AXIS_SETTINGS))); manager.addTo("org.goko.tinyg.6.axis", new PreferenceNode("org.goko.tinyg.6.d.aaxis", new TinyGConfigurationAxisPage(cfg, "A Axis", TinyGConfiguration.A_AXIS_SETTINGS))); PreferenceDialog dialog = new PreferenceDialog(shell, manager); dialog.open(); }
From source file:org.gradle.eclipse.preferences.FieldEditorOverlayPage.java
License:Apache License
protected void showPreferencePage(String id, IPreferencePage page) { final IPreferenceNode targetNode = new PreferenceNode(id, page); PreferenceManager manager = new PreferenceManager(); manager.addToRoot(targetNode);/*from w w w .j a v a2 s .com*/ 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:org.infoglue.igide.helper.Utils.java
License:Open Source License
public static int showPrefs(String desc) { desc = "There was an error connecting to CMS\n\n" + desc + "\n\n"; PreferenceManager p = new PreferenceManager(); PreferenceNode node = new PreferenceNode("org.infoglue.igide.preferences.InfogluePreferencePage", new InfogluePreferencePage()); node.getPage().setTitle("Infoglue Connection"); node.getPage().setDescription(desc); p.addToRoot(node);/*from www . j a v a 2s . com*/ PreferenceDialog dia = new PreferenceDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), p); dia.setBlockOnOpen(true); dia.open(); return dia.getReturnCode(); }
From source file:org.jboss.ide.eclipse.as.wtp.ui.composites.AbstractJREComposite.java
License:Open Source License
protected boolean showPreferencePage(String pageId) { PreferenceManager manager = PlatformUI.getWorkbench().getPreferenceManager(); IPreferenceNode node = manager.find(pageId); PreferenceManager manager2 = new PreferenceManager(); manager2.addToRoot(node);/*from ww w .j a v a 2 s. c o m*/ PreferenceDialog dialog = new PreferenceDialog(getShell(), manager2); dialog.setSelectedNode(pageId); dialog.create(); dialog.setMessage(node.getLabelText()); return (dialog.open() == Window.OK); }
From source file:org.jboss.jca.eclipse.wizards.BuildWizardPage.java
License:Open Source License
/** * createControl//from w w w . jav a2s . c o m * @param parent Composite * @see IDialogPage#createControl(Composite) */ public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); container.setLayout(layout); layout.numColumns = 2; layout.verticalSpacing = 9; Label label = new Label(container, SWT.NULL); label.setText(((CodeGenWizard) getWizard()).getCodegenResourceString("gen.mbean") + ":"); final Button mbeanButton = new Button(container, SWT.CHECK); mbeanButton.setSelection(false); ((CodeGenWizard) getWizard()).getDef().setGenMbean(false); mbeanButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { ((CodeGenWizard) getWizard()).getDef().setGenMbean(mbeanButton.getSelection()); } }); createBuildGroup(container); Link homeSettingLink = new Link(container, SWT.NULL); GridData gdHomeSettingLink = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); homeSettingLink.setLayoutData(gdHomeSettingLink); homeSettingLink.setText("<a>IronJacamar home setting...</a>"); //homeSettingLink.setToolTipText("IronJacamar home setting:"); homeSettingLink.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { PreferenceDialog createPreferenceDialogOn = PreferencesUtil.createPreferenceDialogOn(null, "org.jboss.jca.eclipse.preferences.IronJacamarPreferencePage", null, null); createPreferenceDialogOn.open(); dialogChanged(); } }); initialize(); dialogChanged(); setControl(container); }
From source file:org.jboss.reddeer.swt.impl.menu.ShellMenu.java
License:Open Source License
private void openPreferencesDialog() { Display.asyncExec(new Runnable() { @Override// ww w.ja va 2s. c om public void run() { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, null, null, null); dialog.open(); } }); Display.syncExec(new Runnable() { @Override public void run() { // do nothing just process UI events } }); }
From source file:org.jboss.tools.aerogear.android.ui.SDKLocationHelper.java
License:Open Source License
public static boolean defineSDKLocationIfNecessary() { if (isSDKLocationDefined()) return true; Shell activeShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); boolean define = MessageDialog.openQuestion(activeShell, "Missing Android SDK", "In order to proceed," + " the location of the Android SDK must be defined. Define Now?"); if (!define) { return false; }/*from w w w. j a v a2 s. co m*/ PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(activeShell, "org.jboss.tools.aerogear.hybrid.ui.internal.preferences.HybridMoblePreferencePage", null, null); dialog.open(); return defineSDKLocationIfNecessary(); }