Search in sources :

Example 6 with PreferenceDialog

use of org.eclipse.jface.preference.PreferenceDialog in project tesb-studio-se by Talend.

the class OpenRuntimePrefsAction method run.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
public void run() {
    PreferenceDialog dlg = new PreferenceDialog(Display.getDefault().getActiveShell(), PlatformUI.getWorkbench().getPreferenceManager());
    dlg.setSelectedNode(RunContainerPreferencePage.ID);
    dlg.open();
}
Also used : PreferenceDialog(org.eclipse.jface.preference.PreferenceDialog)

Example 7 with PreferenceDialog

use of org.eclipse.jface.preference.PreferenceDialog in project tdi-studio-se by Talend.

the class ProjectSettingDialog method open.

public void open(final String pageId) {
    PreferenceManager manager = getNodeManager();
    Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    final PreferenceDialog dialog = new ProjectSettingsPreferenceDialog(shell, manager);
    BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {

        @Override
        public void run() {
            if (StringUtils.isNotEmpty(pageId)) {
                dialog.setSelectedNode(pageId);
            }
            dialog.create();
            dialog.getShell().setText(TITLE);
            dialog.getShell().setSize(DEFAULT_SIZE);
            dialog.open();
        }
    });
}
Also used : Shell(org.eclipse.swt.widgets.Shell) PreferenceDialog(org.eclipse.jface.preference.PreferenceDialog) PreferenceManager(org.eclipse.jface.preference.PreferenceManager)

Example 8 with PreferenceDialog

use of org.eclipse.jface.preference.PreferenceDialog in project bndtools by bndtools.

the class ProjectTemplateSelectionWizardPage method createHeaderControl.

@Override
protected Control createHeaderControl(Composite parent) {
    Composite composite;
    Workspace workspace = Central.getWorkspaceIfPresent();
    if (workspace == null || workspace.isDefaultWorkspace()) {
        composite = new Composite(parent, SWT.NONE);
        GridLayout layout = new GridLayout(2, false);
        layout.marginWidth = 0;
        layout.marginHeight = 0;
        layout.marginBottom = 15;
        layout.verticalSpacing = 15;
        composite.setLayout(layout);
        Label lblWarning = new Label(composite, SWT.NONE);
        warningImg = Icons.desc("warning.big").createImage(parent.getDisplay());
        lblWarning.setImage(warningImg);
        Link link = new Link(composite, SWT.NONE);
        link.setText("WARNING! The bnd workspace has not been configured. <a href=\"#workspace\">Create a workspace first</a> \n or configure a <a href=\"#prefs\">Template Repository</a> in Bndtools Preferences.");
        link.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent ev) {
                WizardDialog dialog = (WizardDialog) getContainer();
                dialog.close();
                if ("#workspace".equals(ev.text)) {
                    // We are going to open the New Workspace wizard in a new dialog.
                    // If that wizard completes successfully then we can reopen the New Project wizard.
                    WorkspaceSetupWizard workspaceWizard = new WorkspaceSetupWizard();
                    workspaceWizard.init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY);
                    dialog = new WizardDialog(dialog.getShell(), workspaceWizard);
                    if (Window.OK == dialog.open()) {
                        try {
                            NewBndProjectWizard projectWizard = new NewBndProjectWizardFactory().create();
                            projectWizard.init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY);
                            new WizardDialog(dialog.getShell(), projectWizard).open();
                        } catch (CoreException e) {
                            Plugin.getDefault().getLog().log(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Unable to open New Bnd Project wizard", e));
                        }
                    }
                } else if ("#prefs".equals(ev.text)) {
                    // Open the preference dialog with the template repositories page open.
                    // We can't reopen the New Project wizard after because we don't know that the user changed anything.
                    PreferenceDialog prefsDialog = PreferencesUtil.createPreferenceDialogOn(getShell(), "bndtools.prefPages.repos", null, null);
                    prefsDialog.open();
                }
            }
        });
        GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
        link.setLayoutData(gd);
        //            ControlDecoration decor = new ControlDecoration(link, SWT.LEFT, composite);
        //            decor.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage());
        Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
        separator.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
    } else {
        // There is a workspace, just return null (no controls will be inserted into the panel).
        composite = null;
    }
    return composite;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) WorkspaceSetupWizard(bndtools.wizards.workspace.WorkspaceSetupWizard) GridLayout(org.eclipse.swt.layout.GridLayout) CoreException(org.eclipse.core.runtime.CoreException) PreferenceDialog(org.eclipse.jface.preference.PreferenceDialog) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) WizardDialog(org.eclipse.jface.wizard.WizardDialog) Link(org.eclipse.swt.widgets.Link) Workspace(aQute.bnd.build.Workspace)

Example 9 with PreferenceDialog

use of org.eclipse.jface.preference.PreferenceDialog in project bndtools by bndtools.

the class NewTypeWizardPage method typePageLinkActivated.

private void typePageLinkActivated() {
    IJavaProject project = getJavaProject();
    if (project != null) {
        PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn(getShell(), project.getProject(), CodeTemplatePreferencePage.PROP_ID, null, null);
        dialog.open();
    } else {
        String title = NewWizardMessages.NewTypeWizardPage_configure_templates_title;
        String message = NewWizardMessages.NewTypeWizardPage_configure_templates_message;
        MessageDialog.openInformation(getShell(), title, message);
    }
}
Also used : IJavaProject(org.eclipse.jdt.core.IJavaProject) PreferenceDialog(org.eclipse.jface.preference.PreferenceDialog)

Aggregations

PreferenceDialog (org.eclipse.jface.preference.PreferenceDialog)9 GridLayout (org.eclipse.swt.layout.GridLayout)3 CoreException (org.eclipse.core.runtime.CoreException)2 PreferenceManager (org.eclipse.jface.preference.PreferenceManager)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 GridData (org.eclipse.swt.layout.GridData)2 Composite (org.eclipse.swt.widgets.Composite)2 Label (org.eclipse.swt.widgets.Label)2 Workspace (aQute.bnd.build.Workspace)1 JpmPreferences (bndtools.preferences.JpmPreferences)1 WorkspaceSetupWizard (bndtools.wizards.workspace.WorkspaceSetupWizard)1 IOException (java.io.IOException)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 IJavaProject (org.eclipse.jdt.core.IJavaProject)1 PreferenceNode (org.eclipse.jface.preference.PreferenceNode)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 Browser (org.eclipse.swt.browser.Browser)1 LocationAdapter (org.eclipse.swt.browser.LocationAdapter)1