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:sernet.gs.ui.rcp.main.preferences.ShowPreferencesAction.java

License:Open Source License

public void run() {

    PreferenceManager manager = PlatformUI.getWorkbench().getPreferenceManager();

    IPreferenceNode[] nodes = manager.getRootSubNodes();
    for (int i = 0; i < nodes.length; ++i) {
        if (nodes[i].getId().equals("org.eclipse.ui.preferencePages.Workbench")) {
            IPreferenceNode[] subNodes = nodes[i].getSubNodes();
            for (IPreferenceNode subNode : subNodes) {
                if (!subNode.getId().equals("org.eclipse.ui.net.NetPreferences")) {
                    nodes[i].remove(subNode.getId());
                } else {
                    manager.addToRoot(subNode);
                }//from ww  w.  j  a  v  a  2s .  c  om
                manager.remove(nodes[i]);
            }
        }

        if (nodes[i].getId().equals("org.eclipse.help.ui.browsersPreferencePage") //$NON-NLS-1$
                || nodes[i].getId().equals("org.eclipse.help.ui.appserverPreferencePage") //$NON-NLS-1$
        ) {
            manager.remove(nodes[i]);
        }
    }
    //|| nodes[i].getId().equals("org.eclipse.update.internal.ui.preferences.MainPreferencePage") //$NON-NLS-1$

    final PreferenceDialog dialog = new PreferenceDialog(
            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), manager);

    if (prefPage != null) {
        dialog.setSelectedNode(prefPage);
    }
    BusyIndicator.showWhile(PlatformUI.getWorkbench().getDisplay(), new Runnable() {
        public void run() {

            dialog.create();
            dialog.open();
        }
    });

}

From source file:tern.eclipse.ide.ui.handlers.AbstractConvertProjectCommandHandler.java

License:Open Source License

private void showPropertiesOn(final IProject project, final IProgressMonitor monitor,
        final ExecutionEvent event) {
    IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.ui.propertyPages") //$NON-NLS-1$
            .getExtensions();// w  ww .  j  a  va 2 s  .  c  o  m
    final List<String> pageIds = new ArrayList<String>(8);
    for (int i = 0; i < extensions.length; i++) {
        if (extensions[i].getNamespaceIdentifier().startsWith("tern.eclipse.ide.ui")) { //$NON-NLS-1$
            IConfigurationElement[] configurationElements = extensions[i].getConfigurationElements();
            for (int j = 0; j < configurationElements.length; j++) {
                if ("page".equals(configurationElements[j].getName())) { //$NON-NLS-1$
                    pageIds.add(configurationElements[j].getAttribute("id")); //$NON-NLS-1$
                }
            }
        }
    }
    Shell shell = HandlerUtil.getActiveShell(event);
    if (shell == null) {
        IWorkbenchWindow activeWorkbenchWindow = TernUIPlugin.getDefault().getWorkbench()
                .getActiveWorkbenchWindow();
        if (activeWorkbenchWindow != null)
            shell = activeWorkbenchWindow.getShell();
    }
    final Shell finalShell = shell;
    if (finalShell != null) {
        finalShell.getDisplay().asyncExec(new Runnable() {
            public void run() {
                PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn(finalShell, project,
                        TernModulesPropertyPage.PAGE_ID, (String[]) pageIds.toArray(new String[pageIds.size()]),
                        null); //$NON-NLS-1$
                if (dialog.open() == Window.CANCEL) {
                    doUninstall(project, monitor);
                }
            }
        });
    }
}

From source file:thahn.java.agui.ide.eclipse.wizard.AguiPlugin.java

private void openAguiPrefs() {
    PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getDisplay().getActiveShell(),
            AguiPreferencePage.PAGE_ID, //$NON-NLS-1$ preferencePageId
            null, // displayedIds
            null); // data
    dialog.open();
}

From source file:tinyos.dlrc.views.make.EditProperties.java

License:Open Source License

@Override
public void run() {
    if (selection != null && selection.isAccessible()) {
        String propertyPageId = "tinyOS.properties.maketarget.component";
        PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn(shell, selection, propertyPageId, null,
                selection);/*  w  w  w  .  ja  va 2s.  c  o m*/
        dialog.open();
    }
}

From source file:uk.ac.diamond.scisoft.analysis.rcp.editors.DataEditor.java

License:Apache License

private void createActions(final ContributionManager toolMan) {

    final Action exportCsv = new Action("Export current plotted data to csv file", IAction.AS_PUSH_BUTTON) {
        @Override//from   w  w  w.  jav  a 2  s  . com
        public void run() {
            CSVUtils.createCSV(EclipseUtils.getIFile(getEditorInput()), data, "_plot");
        }
    };
    exportCsv.setImageDescriptor(AnalysisRCPActivator.getImageDescriptor("icons/page_white_excel.png"));
    toolMan.add(exportCsv);

    toolMan.add(new Separator(getClass().getName() + "Sep1"));

    final Action format = new Action("Preferences...", IAction.AS_PUSH_BUTTON) {
        @Override
        public void run() {
            PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                    "uk.ac.diamond.scisoft.analysis.rcp.preferencePage", null, null);
            if (pref != null)
                pref.open();
        }
    };
    format.setImageDescriptor(Activator.getImageDescriptor("icons/application_view_list.png"));
    toolMan.add(format);
}

From source file:uk.ac.diamond.scisoft.analysis.rcp.editors.DataSetPlotEditor.java

License:Apache License

/**
 * Override to provide extra content.//  w w  w  . j  av  a 2s. c o m
 * @param toolMan
 */
protected void createCustomToolbarActionsRight(final ToolBarManager toolMan) {

    toolMan.add(new Separator(getClass().getName() + "Separator1"));

    final Action tableColumns = new Action("Open editor preferences.", IAction.AS_PUSH_BUTTON) {
        @Override
        public void run() {
            PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                    "uk.ac.diamond.scisoft.analysis.rcp.preferencePage", null, null);
            if (pref != null)
                pref.open();
        }
    };
    tableColumns.setChecked(false);
    tableColumns
            .setImageDescriptor(AnalysisRCPActivator.getImageDescriptor("icons/application_view_columns.png"));

    toolMan.add(tableColumns);

}

From source file:uk.ac.diamond.scisoft.analysis.rcp.preference.DiffractionViewerPreferencesHandler.java

License:Open Source License

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn(
            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), DIFFRACTION_PAGE_ID, null, null);
    if (pref != null)
        pref.open();
    return Boolean.TRUE;
}

From source file:uk.ac.diamond.scisoft.analysis.rcp.preference.Fitting1DPreferenceHandler.java

License:Open Source License

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn(
            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), FITTING1D_PAGE_ID, null, null);
    if (pref != null)
        pref.open();
    return Boolean.TRUE;
}

From source file:uk.ac.diamond.scisoft.analysis.rcp.preference.GridScanPreferencesHandler.java

License:Open Source License

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn(
            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), GRIDSCAN_PAGE_ID, null, null);
    if (pref != null)
        pref.open();
    return Boolean.TRUE;
}

From source file:uk.ac.diamond.scisoft.analysis.rcp.preference.PlotViewPreferencesHandler.java

License:Open Source License

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn(
            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), PLOTVIEW_PAGE_ID, null, null);
    if (pref != null)
        pref.open();
    return Boolean.TRUE;
}