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:org.neuro4j.studio.core.diagram.wizards.customblock.CustomBlockParametersWizardPage.java

License:Apache License

private void typePageLinkActivated() {
    IJavaProject project = getJavaProject();
    if (project != null) {
        PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn(getShell(), project.getProject(),
                "org.eclipse.jdt.ui.propertyPages.CodeTemplatePreferencePage", null, null);
        dialog.open();
    } else {/* w  w w.  j  ava  2s.  c  o  m*/
        String title = NewWizardMessages.NewTypeWizardPage_configure_templates_title;
        String message = NewWizardMessages.NewTypeWizardPage_configure_templates_message;
        MessageDialog.openInformation(getShell(), title, message);
    }
}

From source file:org.nuxeo.ide.connect.ui.StudioPropertyPage.java

License:Open Source License

@Override
protected Form createForm() {
    Form form = super.createForm();
    form.addWidgetType(StudioProjectsWidget.class);
    form.addActionHandler("configure", new ActionHandler() {
        @Override/*from  w  ww.  ja v a  2 s  . com*/
        public void handleAction(Form form, UIObject<?> obj, Object event) {
            PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn(null,
                    "org.nuxeo.ide.prefs.connect", null, null);
            if (pref != null) {
                ((Dialog) getContainer()).close();
                pref.open();
            }
        }
    });
    return form;
}

From source file:org.nuxeo.ide.sdk.projects.UndefinedNuxeoSDKPage.java

License:Open Source License

@Override
public Form createForm() {
    Form form = super.createForm();
    form.addActionHandler("configureSDK", new ActionHandler() {
        @Override//from w  ww  .  j a v  a2s. co  m
        public void handleAction(Form form, UIObject<?> obj, Object event) {
            PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn(null, "org.nuxeo.ide.prefs.sdk",
                    null, null);
            if (pref != null) {
                ((WizardDialog) getWizard().getContainer()).close();
                pref.open();
            }
        }
    });
    return form;
}

From source file:org.org.eclipse.dws.core.internal.configuration.properties.Maven2TabItemDefinition.java

License:Open Source License

/**
 * Creates the contents.//from   w  w w  . j  av  a  2  s .co  m
 * 
 * @param parent
 *            the parent
 * 
 * @see org.org.eclipse.dws.utils.platform.properties.AbstractTabItemDefinition#createContents(org.eclipse.swt.widgets.Composite)
 */
@Override
protected void createContents(Composite parent) {

    final Composite fparent = parent;

    Composite usePrefsComposite = new Composite(parent, SWT.FLAT);
    usePrefsComposite.setLayout(new GridLayout(1, false));
    usePreferences = createLabelAndCheckBoxField(usePrefsComposite, USE_PREFERENCES_TITLE,
            USE_PREFERENCES_TOOLTIP, TEXT_FIELD_WIDTH);
    usePreferences.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(SelectionEvent e) {
            touch();
        }

        public void widgetSelected(SelectionEvent e) {
            touch();
        }
    });

    preferencesLink = new Link(usePrefsComposite, SWT.NONE);
    preferencesLink.setFont(usePrefsComposite.getFont());
    preferencesLink.setText("<A>" + PREFERENCES_LINK_LABEL + "</A>"); //$NON-NLS-1$ //$NON-NLS-2$
    preferencesLink.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            doLinkActivated((Link) e.widget);
        }

        private void doLinkActivated(Link link) {
            PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(fparent.getShell(),
                    GeneralPreferencePage.class.getName(), null, null);
            dialog.open();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            doLinkActivated((Link) e.widget);
        }
    });

    TabFolder tabFolder = new TabFolder(parent, SWT.FLAT);
    Composite tabItem1content = new Composite(tabFolder, SWT.FLAT);
    tabItem1content.setLayout(new GridLayout(1, false));
    IProject project = (IProject) getElement().getAdapter(IProject.class);

    createGeneralTabContent(tabItem1content, fparent, project);

    Composite tabItem2content = new Composite(tabFolder, SWT.FLAT);
    tabItem2content.setLayout(new GridLayout(1, false));

    createAdvancedTabContent(tabItem2content);

    Composite tabItem3content = new Composite(tabFolder, SWT.FLAT);
    tabItem3content.setLayout(new GridLayout(1, false));

    createSkippedTabContent(tabItem3content);

    Composite tabItem4content = new Composite(tabFolder, SWT.FLAT);
    tabItem4content.setLayout(new GridLayout(1, false));

    createPropertiesTabContent(tabItem4content);

    TabItem tabItem1 = new TabItem(tabFolder, SWT.BORDER);
    tabItem1.setControl(tabItem1content);
    tabItem1.setText(PropertiesMessages.Maven2TabItemDefinition_basicSettingsTab);

    TabItem tabItem2 = new TabItem(tabFolder, SWT.BORDER);
    tabItem2.setControl(tabItem2content);
    tabItem2.setText(PropertiesMessages.Maven2TabItemDefinition_advancedSettingsTab);

    TabItem tabItem3 = new TabItem(tabFolder, SWT.BORDER);
    tabItem3.setControl(tabItem3content);
    tabItem3.setText("Skipped libraries");

    TabItem tabItem4 = new TabItem(tabFolder, SWT.BORDER);
    tabItem4.setControl(tabItem4content);
    tabItem4.setText("Pom Properties");

    PropertiesFacade.loadProperties(project);
    touch();
}

From source file:org.org.eclipse.dws.ui.internal.wizards.pages.HttpRepositoryInfosWizardPage.java

License:Open Source License

/**
 * Describe proxy info section.// www .j  a v a2 s  .  c o  m
 * 
 * @param parent
 *            the parent
 * 
 * @return the composite
 */
private Composite describeProxyInfoSection(Composite parent) {
    Composite proxyInfoComposite = WizardContentsHelper.createClientComposite(parent);
    proxyInfoComposite.setLayout(new GridLayout(2, false));
    Label label = WizardContentsHelper.createDescriptionLabel(proxyInfoComposite,
            WizardsMessages.HttpBrowsedRepositoryInfosWizardPage_proxy_description);
    GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false);
    data.horizontalSpan = 2;
    label.setLayoutData(data);
    preferencesLink = new Link(proxyInfoComposite, SWT.NONE);
    preferencesLink.setFont(getWizardContainer().getFont());
    preferencesLink.setText("<A>" + "Configure the proxy through Eclipse preferences" + "</A>"); //$NON-NLS-1$ //$NON-NLS-2$
    preferencesLink.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            doLinkActivated((Link) e.widget);
        }

        private void doLinkActivated(Link link) {
            PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
                    Display.getDefault().getActiveShell(), "org.eclipse.ui.net.NetPreferences", null, null);
            dialog.open();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            doLinkActivated((Link) e.widget);
        }
    });
    return proxyInfoComposite;
}

From source file:org.org.eclipse.dws.ui.internal.wizards.pages.PomJavaSynchronizationWizardPage.java

License:Open Source License

/**
 * Describe./*  w  w  w  . j av a  2 s  .co m*/
 * 
 * @see org.org.eclipse.core.utils.platform.wizards.page.AbstractWizardCustomPage#describe()
 */
@Override
protected void describe() {
    IProject project = null;
    if (PROJECT_NAMES.length == 1) {
        project = FileToolBox.getProject(PROJECT_NAMES[0]);
    } else if (CHOSENPROJECTNAME != null) {
        project = FileToolBox.getProject(CHOSENPROJECTNAME);
    }
    if (project != null && project.exists() && !AggregatedProperties.useWorkspacePreferences(project)) {
        label = new Label(getWizardContainer(), SWT.FLAT | SWT.BORDER);
        label.setText(
                WizardsMessages.PomJavaSynchronizationWizardPage_using_project_preferences + project.getName());
    } else {
        Composite workspacePreferences = new Composite(getWizardContainer(), SWT.BORDER);
        workspacePreferences.setLayout(new GridLayout(2, false));
        label = new Label(workspacePreferences, SWT.FLAT);
        label.setText(WizardsMessages.PomJavaSynchronizationWizardPage_using_workspace_preferences);
        preferencesLink = new Link(workspacePreferences, SWT.NONE);
        preferencesLink.setFont(getWizardContainer().getFont());
        preferencesLink.setText("<A>" + PREFERENCES_LINK_LABEL + "</A>"); //$NON-NLS-1$ //$NON-NLS-2$
        preferencesLink.addSelectionListener(new SelectionListener() {
            public void widgetSelected(SelectionEvent e) {
                doLinkActivated((Link) e.widget);
            }

            private void doLinkActivated(Link link) {
                PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
                        Display.getDefault().getActiveShell(), GeneralPreferencePage.class.getName(), null,
                        null);
                dialog.open();
                reOpenWizardWithSameProject();
            }

            public void widgetDefaultSelected(SelectionEvent e) {
                doLinkActivated((Link) e.widget);
            }
        });
    }

    ExpandBar expandBar = WizardContentsHelper.createExpandBar(getWizardContainer());
    expandBar.setLayoutData(new GridData(GridData.FILL_BOTH));

    Composite targetProjectComposite = describeTargetProjectSection(project, expandBar);
    targetProjectComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    WizardContentsHelper.createExpandItem(expandBar, targetProjectComposite,
            WizardsMessages.PomJavaSynchronizationWizardPage_targetProject,
            PlatformUtilsPlugin.getDefault().getImages().getImage(PluginImages.SMALL_OK_16));
    SearchContext searchContext = new SearchContext();
    searchContext.setDealWithTransitive(AggregatedProperties.getDealWithTransitive(project));
    searchContext.setDealWithOptional(AggregatedProperties.getDealWithOptional(project));
    searchContext.setDealWithUnknownOrRestrictiveScope(AggregatedProperties.getDealWithNarrow(project));
    if (DependenciesHelper.unresolvedLibraries(searchContext, LIBRARIES)) {
        Composite notFoundComposite = describeNotFoundSection(expandBar);
        notFoundComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
        WizardContentsHelper.createExpandItem(expandBar, notFoundComposite,
                WizardsMessages.PomJavaSynchronizationWizardPage_librariesWithIssues,
                PlatformUtilsPlugin.getDefault().getImages().getImage(PluginImages.SMALL_ERROR_16));
    }
    if (DependenciesHelper.resolvedArtifacts(searchContext, LIBRARIES)) {
        Composite addedLibrariesComposite = describeAddedLibrariesSection(expandBar);
        addedLibrariesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
        ExpandItem librariesExpandItem = WizardContentsHelper.createExpandItem(expandBar,
                addedLibrariesComposite, WizardsMessages.PomJavaSynchronizationWizardPage_addedLibraries,
                PlatformUtilsPlugin.getDefault().getImages().getImage(PluginImages.SMALL_OK_16));
        librariesExpandItem.setExpanded(false);
    }
    if (DependenciesHelper.transitiveDependencies(searchContext, LIBRARIES)) {
        Boolean automaticallyAddToClasspath = AggregatedProperties.getAutomaticallyAddTransitive(project);
        Composite transitiveDependenciesComposite = describeTransitiveDependenciesSection(expandBar,
                WizardsMessages.PomJavaSynchronizationWizardPage_addTransitiveLibrariesCheckbox);
        transitiveDependenciesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
        ExpandItem transitiveDependenciesExpandItem = WizardContentsHelper.createExpandItem(expandBar,
                transitiveDependenciesComposite,
                WizardsMessages.PomJavaSynchronizationWizardPage_transitiveDependencies,
                PlatformUtilsPlugin.getDefault().getImages().getImage(PluginImages.SMALL_OK_16));
        if (!automaticallyAddToClasspath) {
            transitiveDependenciesExpandItem.setImage(
                    PlatformUtilsPlugin.getDefault().getImages().getImage(PluginImages.SMALL_WARNING_16));
        }
        transitiveDependenciesExpandItem.setExpanded(false);
    }
    if (DependenciesHelper.containsConflictingClasspathEntries(searchContext, LIBRARIES)) {
        Boolean automaticallyRemoveFromClasspath = AggregatedProperties
                .getAutomaticallyRemoveConflicting(project);
        Composite conflictingComposite = describeConflictingSection(expandBar);
        conflictingComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
        ExpandItem conflictingLibrariesExpandItem = WizardContentsHelper.createExpandItem(expandBar,
                conflictingComposite, WizardsMessages.PomJavaSynchronizationWizardPage_conflictingLibraries,
                PlatformUtilsPlugin.getDefault().getImages().getImage(PluginImages.SMALL_OK_16));
        if (!automaticallyRemoveFromClasspath) {
            conflictingLibrariesExpandItem.setImage(
                    PlatformUtilsPlugin.getDefault().getImages().getImage(PluginImages.SMALL_WARNING_16));
        }
        conflictingLibrariesExpandItem.setExpanded(false);
    }
    if (DependenciesHelper.unknownOrRestrictedScope(searchContext, LIBRARIES)) {
        Boolean automaticallyAddUnknown = AggregatedProperties.getAutomaticallyAddUnknown(project);
        Composite unknownComposite = describeUnknownSection(expandBar);
        unknownComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
        ExpandItem undeterminedLibrariesExpandItem = WizardContentsHelper.createExpandItem(expandBar,
                unknownComposite, WizardsMessages.PomJavaSynchronizationWizardPage_unknownOrRestrictiveScope,
                PlatformUtilsPlugin.getDefault().getImages().getImage(PluginImages.SMALL_OK_16));
        if (!automaticallyAddUnknown) {
            undeterminedLibrariesExpandItem.setImage(
                    PlatformUtilsPlugin.getDefault().getImages().getImage(PluginImages.SMALL_WARNING_16));
        }
        undeterminedLibrariesExpandItem.setExpanded(false);
    }
}

From source file:org.org.eclipse.dws.ui.internal.wizards.pages.PomWebAppSynchronizationWizardPage.java

License:Open Source License

/**
 * Describe.//from  ww  w .  j  a  v a2s .co m
 * 
 * @see org.org.eclipse.core.utils.platform.wizards.page.AbstractWizardCustomPage#describe()
 */
@Override
protected void describe() {
    IProject project = null;
    if (PROJECT_NAMES.length == 1) {
        project = FileToolBox.getProject(PROJECT_NAMES[0]);
    } else if (CHOSENPROJECTNAME != null) {
        project = FileToolBox.getProject(CHOSENPROJECTNAME);
    }
    if (project != null && project.exists() && !AggregatedProperties.useWorkspacePreferences(project)) {
        label = new Label(getWizardContainer(), SWT.FLAT | SWT.BORDER);
        label.setText(WizardsMessages.PomWebAppSynchronizationWizardPage_preferences_from_project
                + project.getName());
    } else {
        Composite composite = new Composite(getWizardContainer(), SWT.BORDER);
        composite.setLayout(new GridLayout(2, false));
        label = new Label(composite, SWT.FLAT);
        label.setText(WizardsMessages.PomWebAppSynchronizationWizardPage_workspace_preferences);
        preferencesLink = new Link(composite, SWT.NONE);
        preferencesLink.setFont(composite.getFont());
        preferencesLink.setText("<A>" + PREFERENCES_LINK_LABEL + "</A>"); //$NON-NLS-1$ //$NON-NLS-2$
        preferencesLink.addSelectionListener(new SelectionListener() {
            public void widgetSelected(SelectionEvent e) {
                doLinkActivated((Link) e.widget);
            }

            private void doLinkActivated(Link link) {
                PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
                        Display.getDefault().getActiveShell(), GeneralPreferencePage.class.getName(), null,
                        null);
                dialog.open();
                reOpenWizardWithSameProject();
            }

            public void widgetDefaultSelected(SelectionEvent e) {
                doLinkActivated((Link) e.widget);
            }
        });
    }
    ExpandBar expandBar = WizardContentsHelper.createExpandBar(getWizardContainer());
    expandBar.setLayoutData(new GridData(GridData.FILL_BOTH));

    Composite targetProjectComposite = describeTargetProjectSection(project, expandBar);
    targetProjectComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    WizardContentsHelper.createExpandItem(expandBar, targetProjectComposite,
            WizardsMessages.PomWebAppSynchronizationWizardPage_targetProject,
            PlatformUtilsPlugin.getDefault().getImages().getImage(PluginImages.SMALL_OK_16));

    SearchContext searchContext = new SearchContext();
    searchContext.setDealWithTransitive(AggregatedProperties.getDealWithTransitive(project));
    searchContext.setDealWithOptional(AggregatedProperties.getDealWithOptional(project));
    searchContext.setDealWithUnknownOrRestrictiveScope(AggregatedProperties.getDealWithNarrow(project));
    if (DependenciesHelper.unresolvedLibraries(searchContext, LIBRARIES)) {
        Composite notFoundComposite = describeNotFoundSection(expandBar);
        notFoundComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
        WizardContentsHelper.createExpandItem(expandBar, notFoundComposite,
                WizardsMessages.PomWebAppSynchronizationWizardPage_libraries_with_issues,
                PlatformUtilsPlugin.getDefault().getImages().getImage(PluginImages.SMALL_ERROR_16));
    }
    if (DependenciesHelper.resolvedArtifacts(searchContext, LIBRARIES)) {
        Composite webInfComposite = describeWebInfSection(expandBar);
        webInfComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
        WizardContentsHelper.createExpandItem(expandBar, webInfComposite,
                WizardsMessages.PomWebAppSynchronizationWizardPage_librariesAddedToWEBINFLIB,
                PlatformUtilsPlugin.getDefault().getImages().getImage(PluginImages.SMALL_OK_16));

        Composite classpathComposite = describeClasspathSection(expandBar);
        classpathComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
        WizardContentsHelper.createExpandItem(expandBar, classpathComposite,
                WizardsMessages.PomWebAppSynchronizationWizardPage_librariesAddedToClasspath,
                PlatformUtilsPlugin.getDefault().getImages().getImage(PluginImages.SMALL_OK_16));
    }
    if (DependenciesHelper.transitiveDependencies(searchContext, LIBRARIES)) {
        Boolean automaticallyAddToClasspath = AggregatedProperties.getAutomaticallyAddTransitive(project);
        Composite composite = describeTransitiveDependenciesSection(expandBar,
                WizardsMessages.PomWebAppSynchronizationWizardPage_addTransitiveLibrariesToWEBINFLIB);
        composite.setLayoutData(new GridData(GridData.FILL_BOTH));
        ExpandItem transitiveDependenciesSection = WizardContentsHelper.createExpandItem(expandBar, composite,
                WizardsMessages.PomWebAppSynchronizationWizardPage_transitiveDependencies,
                PlatformUtilsPlugin.getDefault().getImages().getImage(PluginImages.SMALL_OK_16));
        if (!automaticallyAddToClasspath) {
            transitiveDependenciesSection.setImage(
                    PlatformUtilsPlugin.getDefault().getImages().getImage(PluginImages.SMALL_WARNING_16));
        }
    }
    if (DependenciesHelper.containsConflictingClasspathEntries(searchContext, LIBRARIES)) {
        Boolean automaticallyRemoveFromClasspath = AggregatedProperties
                .getAutomaticallyRemoveConflicting(project);
        Composite composite = describeConflictingSection(expandBar);
        composite.setLayoutData(new GridData(GridData.FILL_BOTH));
        ExpandItem conflictingLibrariesSection = WizardContentsHelper.createExpandItem(expandBar, composite,
                WizardsMessages.PomWebAppSynchronizationWizardPage_librariesConflicting,
                PlatformUtilsPlugin.getDefault().getImages().getImage(PluginImages.SMALL_OK_16));
        if (!automaticallyRemoveFromClasspath) {
            conflictingLibrariesSection.setImage(
                    PlatformUtilsPlugin.getDefault().getImages().getImage(PluginImages.SMALL_WARNING_16));
        }
    }
    if (DependenciesHelper.unknownOrRestrictedScope(searchContext, LIBRARIES)) {
        Boolean automaticallyAddUnknown = AggregatedProperties.getAutomaticallyAddUnknown(project);
        Composite composite = describeUnknownSection(expandBar);
        composite.setLayoutData(new GridData(GridData.FILL_BOTH));
        ExpandItem undeterminedLibrariesSection = WizardContentsHelper.createExpandItem(expandBar, composite,
                WizardsMessages.PomWebAppSynchronizationWizardPage_undeterminedLibraries,
                PlatformUtilsPlugin.getDefault().getImages().getImage(PluginImages.SMALL_OK_16));
        if (!automaticallyAddUnknown) {
            undeterminedLibrariesSection.setImage(
                    PlatformUtilsPlugin.getDefault().getImages().getImage(PluginImages.SMALL_WARNING_16));
        }
    }
}

From source file:org.outerrim.snippad.ui.swt.actions.PreferencesAction.java

License:Open Source License

/**
 * @see org.eclipse.jface.action.IAction#run()
 *//*  ww  w  .j av a 2  s. c om*/
public void run() {
    PreferenceDialog prefDialog = new PreferenceDialog(Display.getCurrent().getActiveShell(),
            new PreferenceManager());
    prefDialog.open();
}

From source file:org.overture.ide.plugins.codegen.commands.ConfigCommand.java

License:Open Source License

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(HandlerUtil.getActiveShell(event),
            "org.overture.ide.plugins.codegen.pageMain", null, null);
    dialog.open();

    return Status.OK_STATUS;
}

From source file:org.polymap.core.catalog.actions.PropertyDialogAction.java

License:Open Source License

public void runWithEvent(IAction action, Event ev) {
    PreferenceDialog dialog = createDialog();
    if (dialog != null) {
        dialog.open();
    }/*w  ww .  j ava2 s. com*/
    //        Display.getCurrent().asyncExec( new Runnable() {
    //
    //            public void run() {
    //                try {
    //                    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
    //                            .getActivePage();
    //                    page.showView( IPageLayout.ID_PROP_SHEET );
    //                }
    //                catch (PartInitException e) {
    //                    throw new RuntimeException( e.getMessage(), e );
    //                }
    //            }
    //        } );
}