List of usage examples for org.eclipse.jface.preference PreferenceDialog open
public int open()
From source file:org.eclipse.recommenders.internal.privacy.rcp.preferences.AnonymousIdPreferencePage.java
License:Open Source License
private void createDescription(Composite parent, String message) { Link link = new Link(parent, SWT.WRAP); GridDataFactory.fillDefaults().hint(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH, SWT.DEFAULT) .grab(true, false).applyTo(link); final String linkToPreferencePage = PreferencesHelper.createLinkLabelToPreferencePage(PREF_PAGE_ID); link.setText(MessageFormat.format(Messages.ANONYMOUS_ID_PREFPAGE_DESCRIPTION, linkToPreferencePage)); link.addSelectionListener(new SelectionAdapter() { @Override//from ww w . j a v a 2 s . com public void widgetSelected(SelectionEvent event) { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, PREF_PAGE_ID, null, null); dialog.open(); } }); }
From source file:org.eclipse.recommenders.internal.privacy.rcp.wizards.IntroPage.java
License:Open Source License
private void createPreferenceLink(Composite parent) { Composite container = new Composite(parent, SWT.WRAP); glf.numColumns(1).applyTo(container); Link link = new Link(parent, SWT.WRAP); gdf.applyTo(link);/*w w w . j av a2 s.c o m*/ final String linkToPreferencePage = PreferencesHelper.createLinkLabelToPreferencePage(PREF_PAGE_ID); link.setText(MessageFormat.format(Messages.WIZARD_INTRO_PAGE_PREFS_LINK_DESCRIPTION, linkToPreferencePage)); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, PREF_PAGE_ID, null, null); getWizard().performCancel(); getWizard().getContainer().getShell().close(); dialog.open(); } }); }
From source file:org.eclipse.recommenders.internal.privacy.rcp.wizards.PermissionApprovalPage.java
License:Open Source License
private void createLinkToPreferencePage(Composite container) { Link link = new Link(container, SWT.WRAP); final String linkToPreferencePage = PreferencesHelper.createLinkLabelToPreferencePage(PREF_PAGE_ID); link.setText(MessageFormat.format(Messages.PREF_LINK_MESSAGE, linkToPreferencePage)); link.addSelectionListener(new SelectionAdapter() { @Override//from w ww . jav a 2 s .c o m public void widgetSelected(SelectionEvent event) { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, PREF_PAGE_ID, null, null); PrivacyPreferencePage preferencePage = (PrivacyPreferencePage) dialog.getSelectedPage(); preferencePage.checkElements(permissionWidget.getAllApprovedPermissions()); getWizard().performCancel(); getWizard().getContainer().getShell().close(); dialog.open(); } }); setControl(container); }
From source file:org.eclipse.recommenders.internal.utils.rcp.preferences.OpenPreferencesHandler.java
License:Open Source License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, event.getParameter(COMMAND_HREF_ID), null, null); dialog.open(); return null;// ww w . j a v a2 s.co m }
From source file:org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog.java
License:Open Source License
private void handleMacMenu() { Display.asyncExec(new Runnable() { @Override// w ww. jav a 2s . c o m public void run() { org.eclipse.jface.preference.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.eclipse.regexp.ui.view.RegexpPreferencesHandler.java
License:Open Source License
@Override public Object execute(final ExecutionEvent event) throws ExecutionException { PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn( PlatformUI.getWorkbench().getDisplay().getActiveShell(), RegexpUIConstants.PREF_PAGE, null, null); pref.open(); return null;//from w ww . j a va2 s.c o m }
From source file:org.eclipse.remote.internal.jsch.ui.wizards.JSchConnectionPage.java
License:Open Source License
private void createAuthControls(Composite parent) { Composite controls = new Composite(parent, SWT.NONE); controls.setLayout(new GridLayout(3, false)); controls.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); Label hostLabel = new Label(controls, SWT.NONE); hostLabel.setText(Messages.JSchNewConnectionPage_Host); fHostText = new Text(controls, SWT.BORDER | SWT.SINGLE); fHostText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); Label userLabel = new Label(controls, SWT.NONE); userLabel.setText(Messages.JSchNewConnectionPage_User); fUserText = new Text(controls, SWT.BORDER | SWT.SINGLE); fUserText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); // Key option box fPublicKeyButton = new Button(controls, SWT.RADIO); fPublicKeyButton.setText(Messages.JSchNewConnectionPage_Public_key_based_authentication); fPublicKeyButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1)); fPublicKeyButton.addSelectionListener(new SelectionAdapter() { @Override//from www . ja v a 2 s . c om public void widgetSelected(SelectionEvent e) { validateFields(); updateEnablement(); } }); Link link = new Link(controls, SWT.WRAP); final GridData linkLayoutData = new GridData(GridData.FILL_HORIZONTAL); link.setLayoutData(linkLayoutData); final String PREFS_PAGE_ID_NET_SSH = "org.eclipse.jsch.ui.SSHPreferences"; //$NON-NLS-1$ link.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { PreferenceDialog dlg = PreferencesUtil.createPreferenceDialogOn(getShell(), PREFS_PAGE_ID_NET_SSH, new String[] { PREFS_PAGE_ID_NET_SSH }, null); dlg.open(); } @Override public void widgetDefaultSelected(SelectionEvent e) { // ignore } }); link.setText(Messages.JSchConnectionPage_KeysAtSSH2); // Passphrase field Label passphraseLabel = new Label(controls, SWT.NONE); passphraseLabel.setText(Messages.JSchNewConnectionPage_Passphrase); fPassphraseText = new Text(controls, SWT.BORDER | SWT.SINGLE | SWT.PASSWORD); fPassphraseText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); // User option box fPasswordButton = new Button(controls, SWT.RADIO); fPasswordButton.setText(Messages.JSchNewConnectionPage_Password_based_authentication); fPasswordButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 3, 1)); fPasswordButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { validateFields(); updateEnablement(); } }); // Password field Label passwordLabel = new Label(controls, SWT.NONE); passwordLabel.setText(Messages.JSchNewConnectionPage_Password); fPasswordText = new Text(controls, SWT.BORDER | SWT.SINGLE | SWT.PASSWORD); fPasswordText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); fPasswordButton.setSelection(JSchConnection.DEFAULT_IS_PASSWORD); fPublicKeyButton.setSelection(!JSchConnection.DEFAULT_IS_PASSWORD); controls.setTabList(new Control[] { fHostText, fUserText, fPublicKeyButton, fPassphraseText, fPasswordButton, fPasswordText }); }
From source file:org.eclipse.remote.internal.jsch.ui.wizards.JSchConnectionPage.java
License:Open Source License
/** * Create controls for the bottom (hideable) proxy composite * * @param mold/*from ww w.j a v a 2s. c o m*/ * */ private void createProxyControls(final Composite proxyComp) { Label lblConnection = new Label(proxyComp, SWT.WRAP); lblConnection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); lblConnection.setText(Messages.JSchConnectionPage_SelectConnection); fProxyConnectionWidget = new RemoteConnectionWidget(proxyComp, SWT.NONE, null, 0); fProxyConnectionWidget.filterConnections(IRemoteConnectionHostService.class, IRemotePortForwardingService.class); Label lblCommand = new Label(proxyComp, SWT.WRAP); lblCommand.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); lblCommand.setText(Messages.JSchConnectionPage_SelectCommand); fProxyCommandText = new Text(proxyComp, SWT.BORDER); fProxyCommandText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Link link = new Link(proxyComp, SWT.WRAP); final GridData linkLayoutData = new GridData(GridData.FILL_HORIZONTAL); link.setLayoutData(linkLayoutData); link.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { PreferenceDialog dlg = PreferencesUtil.createPreferenceDialogOn(getShell(), PREFS_PAGE_ID_NET_PROXY, new String[] { PREFS_PAGE_ID_NET_PROXY }, null); dlg.open(); } @Override public void widgetDefaultSelected(SelectionEvent e) { // ignore } }); linkLayoutData.widthHint = 400; link.setText(Messages.JSchConnectionPage_Help); }
From source file:org.eclipse.tcf.internal.cdt.ui.breakpoints.BreakpointScopeCategoryPropertiesHandler.java
License:Open Source License
public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchPart part = HandlerUtil.getActivePartChecked(event); final BreakpointScopeCategory category = getScopeCategory(event.getApplicationContext()); if (part != null && category != null) { PreferenceDialog dlg = PreferencesUtil.createPropertyDialogOn(part.getSite().getShell(), category, null, null, null);/*from w w w. j a v a 2s . c om*/ if (dlg != null) { dlg.open(); } } return null; }
From source file:org.eclipse.tcf.internal.debug.ui.launch.setup.WizardLoginPage.java
License:Open Source License
private void openProtocolPreferences(Shell shell, String title) { try {/*from www. j a va 2 s . com*/ PreferenceManager mgr = new PreferenceManager(); IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.ui", "preferencePages"); IExtension[] extensions = point.getExtensions(); for (int i = 0; i < extensions.length; i++) { IConfigurationElement[] e = extensions[i].getConfigurationElements(); for (int j = 0; j < e.length; j++) { String nm = e[j].getName(); if (nm.equals("page")) { //$NON-NLS-1$ String cnm = e[j].getAttribute("class"); //$NON-NLS-1$ if (cnm == null) continue; if (!cnm.startsWith("org.eclipse.jsch.")) continue; String id = e[j].getAttribute("id"); //$NON-NLS-1$ if (id == null) id = cnm; Bundle bundle = Platform.getBundle(extensions[i].getNamespaceIdentifier()); Class<?> c = bundle.loadClass(cnm); IPreferencePage page = (IPreferencePage) c.newInstance(); String pnm = e[j].getAttribute("name"); //$NON-NLS-1$ if (pnm != null) page.setTitle(pnm); mgr.addToRoot(new PreferenceNode(id, page)); } } } PreferenceDialog dialog = new PreferenceDialog(shell, mgr); dialog.create(); dialog.setMessage(title); dialog.open(); } catch (Throwable err) { String msg = err.getLocalizedMessage(); if (msg == null || msg.length() == 0) msg = err.getClass().getName(); MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK); mb.setText("Error"); mb.setMessage("Cannot open preferences dialog:\n" + msg); mb.open(); } }