Example usage for org.eclipse.jface.preference PreferenceDialog open

List of usage examples for org.eclipse.jface.preference PreferenceDialog open

Introduction

In this page you can find the example usage for org.eclipse.jface.preference PreferenceDialog open.

Prototype

public int open() 

Source Link

Document

Opens this window, creating it first if it has not yet been created.

Usage

From source file:com.salesforce.ide.ui.internal.composite.BaseOrganizationComposite.java

License:Open Source License

protected void createGrpConnectionSettings(Composite parent) {
    grpConnectionSettings = new Group(parent, SWT.NONE);
    grpConnectionSettings.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 0));
    grpConnectionSettings.setLayout(new GridLayout(5, false));
    grpConnectionSettings.setText("Connection Settings");

    Label lblReadTimeout = new Label(grpConnectionSettings, SWT.NONE);
    lblReadTimeout.setText("Timeout (sec):");
    lblReadTimeout.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 1, 0));
    spnReadTimeout = new Spinner(grpConnectionSettings, SWT.NONE);
    spnReadTimeout.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 1, 0));
    spnReadTimeout.setValues(Constants.READ_TIMEOUT_IN_SECONDS_DEFAULT, Constants.READ_TIMEOUT_IN_SECONDS_MIN,
            Constants.READ_TIMEOUT_IN_SECONDS_MAX, 0, 30, 30);
    Label lblTimeoutMax = new Label(grpConnectionSettings, SWT.NONE);
    lblTimeoutMax.setText("(max 600)");
    lblTimeoutMax.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false, 3, 0));

    Link lnkProxySettings = new Link(grpConnectionSettings, SWT.NONE);
    lnkProxySettings.setText(UIMessages.getString(UIConstants.PROXY_LABEL));
    lnkProxySettings.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false, 5, 0));
    lnkProxySettings.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);/*from  ww w  .j  a  v a 2s  . c  om*/
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            ProxyManager proxyManager = PreferenceManager.getInstance().getProxyManager();
            PreferenceDialog dialog = null;
            if (proxyManager != null && proxyManager.isCoreNetAvailable()) {
                dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), Constants.PROXY_PREFERENCE_3_2_X,
                        null, null);
            } else {
                logger.warn("'" + Constants.PROXY_PREFERENCE_3_2_X + "' preference page not found, opening '"
                        + Constants.PROXY_PREFERENCE_3_3_X + "'");
                dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), Constants.PROXY_PREFERENCE_3_3_X,
                        null, null);
            }

            if (dialog != null) {
                dialog.open();
            } else {
                Utils.openWarn(getShell(), "Proxy Settings Not Found",
                        "Unable to open proxy preference - preference page not found.");
            }
        }
    });
}

From source file:com.siteview.mde.internal.ui.samples.ShowTargetPlatformAction.java

License:Open Source License

public void run() {
    final IPreferenceNode targetNode = new TargetPlatformPreferenceNode();
    PreferenceManager manager = new PreferenceManager();
    manager.addToRoot(targetNode);//from  w w w .j a  v a  2 s.co  m
    Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    final PreferenceDialog dialog = new PreferenceDialog(shell, manager);
    BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
        public void run() {
            dialog.create();
            dialog.setMessage(targetNode.getLabelText());
            dialog.open();
        }
    });
}

From source file:com.siteview.mde.internal.ui.wizards.imports.PluginImportWizardFirstPage.java

License:Open Source License

private boolean showPreferencePage(final IPreferenceNode targetNode, Shell shell) {
    PreferenceManager manager = new PreferenceManager();
    manager.addToRoot(targetNode);//from w ww .j  a  v  a2 s. co  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());
            if (dialog.open() == Window.OK)
                result[0] = true;
        }
    });
    return result[0];
}

From source file:com.telink.tc32eclipse.ui.actions.TCDBPrefAction.java

License:Open Source License

/**
 * Start the TCDB UploadJob.//from   w w  w  . jav a2 s .  c  om
 * 
 * @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:com.vectrace.MercurialEclipse.team.MercurialUtilities.java

License:Open Source License

/**
 * Starts the configuration for Mercurial executable by opening the preference page.
 *//*from  www .  ja v a2 s  .c om*/
public static void configureHgExecutable() {
    final String jobName = Messages
            .getString("MercurialUtilities.openingPreferencesForConfiguringMercurialEclipse");
    SafeUiJob job = new SafeUiJob(jobName) {

        @Override
        protected IStatus runSafe(IProgressMonitor monitor) {
            String pageId = "com.vectrace.MercurialEclipse.prefspage"; //$NON-NLS-1$
            PreferenceDialog dlg = PreferencesUtil.createPreferenceDialogOn(getDisplay().getActiveShell(),
                    pageId, null, null);
            dlg.setErrorMessage(Messages.getString("MercurialUtilities.errorNotConfiguredCorrectly") //$NON-NLS-1$
                    + Messages.getString("MercurialUtilities.runDebugInstall")); //$NON-NLS-1$
            dlg.open();
            return super.runSafe(monitor);
        }

        @Override
        public boolean belongsTo(Object family) {
            return jobName.equals(family);
        }
    };
    IJobManager jobManager = Job.getJobManager();
    jobManager.cancel(jobName);
    Job[] jobs = jobManager.find(jobName);
    if (jobs.length == 0) {
        job.schedule(50);
    }
}

From source file:com.zeus.eclipsePlugin.actions.ZXTMSettingsAction.java

License:Open Source License

/**
 * Run the command, displaying a new project properties dialog on the ZXTM
 * settings page./* w  w  w .j  a  v a2 s  .c  om*/
 */
/* Override */
public void run(ExecutionEvent event) {
    ZXTM currentZXTM = zxtm;

    // No selection, check if the ZXTM Viewer has one currently.
    if (currentZXTM == null) {
        ModelSelection currentSelection = ZXTMViewer.getSelectionForOpenViewer();
        if (currentSelection != null && currentSelection.isOnlyOneZXTM()) {
            currentZXTM = currentSelection.firstZXTM();
        }
    }

    if (currentZXTM == null) {
        return;
    }

    // Display the settings page.
    IProject project = ZXTMProject.getProjectForZXTM(currentZXTM);
    PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn(Display.getCurrent().getActiveShell(),
            project, Ids.RES_PREFS_ZXTM, null, null);

    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//from www.ja  v a2 s. c  o  m
        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:de.loskutov.dh.actions.AddToFilterAction.java

License:Open Source License

@Override
public void run(IAction action) {
    List<String> typesToFilter = getTypesToFilter(selection2);

    String preferencePageId = "DataHierarchy.globalPrefPage";
    String types = DataHierarchyPlugin.getDefault().getPreferenceStore()
            .getString(IPrefConstants.PREF_ACTIVE_FILTERS_LIST);
    PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, preferencePageId, null,
            typesToFilter);/* w  w  w  . j a  va  2s .  co  m*/
    int open = dialog.open();
    if (open != Window.OK) {
        return;
    }
    String newTypes = DataHierarchyPlugin.getDefault().getPreferenceStore()
            .getString(IPrefConstants.PREF_ACTIVE_FILTERS_LIST);
    if (types.equals(newTypes)) {
        return;
    }
    part.updateFilter(newTypes);
    //        SearchAgainAction search = new SearchAgainAction();
    //        search.init(part);
    //        search.run(action);
}

From source file:de.walware.statet.r.internal.console.ui.launching.RRemoteConsoleMainTab.java

License:Open Source License

@Override
protected void createFooter(final Composite composite) {
    final Link link = new Link(composite, SWT.NONE);
    link.setText("Global preferences: "
            + "<a href=\"de.walware.statet.nico.preferencePages.ResourceMappings\">Folder Mapping</a>, "
            + "<a href=\"org.eclipse.jsch.ui.SSHPreferences\">SSH2 Options (Key Management)</a>.");
    composite.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false));
    link.addSelectionListener(new SelectionAdapter() {
        @Override//w  ww  .j  a va2 s .c  om
        public void widgetSelected(final SelectionEvent e) {
            final PreferenceDialog dialog = org.eclipse.ui.dialogs.PreferencesUtil
                    .createPreferenceDialogOn(null, e.text, null, null);
            if (dialog != null) {
                dialog.open();
            }
        }
    });
    super.createFooter(composite);
}

From source file:de.walware.statet.r.internal.ui.pkgmanager.RPkgManagerDialog.java

License:Open Source License

void openPrefPage(final String pageId) {
    final Control content = getContents();
    final PreferenceDialog dialog = org.eclipse.ui.dialogs.PreferencesUtil
            .createPreferenceDialogOn((content != null) ? content.getShell() : null, pageId, null, null);
    dialog.open();
    if (content != null) {
        content.setFocus();//from  w  ww  .  j  a v a2 s . c  o m
    }
}