Search in sources :

Example 6 with PreferenceLinkArea

use of org.eclipse.ui.dialogs.PreferenceLinkArea in project webtools.sourceediting by eclipse.

the class XSDEditorPreferencePage method createContents.

protected Control createContents(Composite parent) {
    final Composite composite = super.createComposite(parent, 1);
    IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
    helpSystem.setHelp(parent, XSDEditorContextIds.XSDP_EDITOR_PREFERENCE_PAGE);
    new PreferenceLinkArea(composite, SWT.WRAP | SWT.MULTI, XML_EDITOR_PREFERENCE_PAGE_ID, Messages._UI_XML_TEXT_EDITOR_PREFS_LINK, (IWorkbenchPreferenceContainer) getContainer(), null).getControl().setLayoutData(GridDataFactory.fillDefaults().hint(150, SWT.DEFAULT).create());
    new Label(composite, SWT.NONE).setLayoutData(GridDataFactory.swtDefaults().create());
    createContentsForImportCleanup(composite);
    setSize(composite);
    loadPreferences();
    return composite;
}
Also used : IWorkbenchHelpSystem(org.eclipse.ui.help.IWorkbenchHelpSystem) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) PreferenceLinkArea(org.eclipse.ui.dialogs.PreferenceLinkArea)

Example 7 with PreferenceLinkArea

use of org.eclipse.ui.dialogs.PreferenceLinkArea in project dbeaver by serge-rider.

the class PrefPageDatabaseGeneral method createContents.

@Override
protected Control createContents(Composite parent) {
    Composite composite = UIUtils.createPlaceholder(parent, 1, 5);
    {
        Group groupObjects = UIUtils.createControlGroup(composite, CoreMessages.pref_page_ui_general_group_general, 1, GridData.VERTICAL_ALIGN_BEGINNING, 300);
        automaticUpdateCheck = UIUtils.createCheckbox(groupObjects, CoreMessages.pref_page_ui_general_checkbox_automatic_updates, false);
        automaticUpdateCheck.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false, 2, 1));
    }
    // Agent settings
    {
        Group agentGroup = UIUtils.createControlGroup(composite, "Task Bar", 2, SWT.NONE, 0);
        longOperationsCheck = UIUtils.createCheckbox(agentGroup, "Enable long-time operations notification", false);
        longOperationsCheck.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false, 2, 1));
        longOperationsCheck.setToolTipText("Shows special notification in system taskbar after long-time operation (e.g. SQL query) finish.");
        longOperationsTimeout = UIUtils.createLabelSpinner(agentGroup, "Long-time operation timeout", 0, 0, Integer.MAX_VALUE);
        if (RuntimeUtils.isPlatformMacOS()) {
            ControlEnableState.disable(agentGroup);
        }
    }
    {
        // Resources
        Group groupResources = UIUtils.createControlGroup(composite, "Resources", 2, GridData.VERTICAL_ALIGN_BEGINNING, 0);
        UIUtils.createControlLabel(groupResources, "Default resource encoding");
        defaultResourceEncoding = UIUtils.createEncodingCombo(groupResources, GeneralUtils.DEFAULT_ENCODING);
        defaultResourceEncoding.setToolTipText("Default encoding for scripts and text files. Change requires restart");
    }
    {
        // Link to secure storage config
        new PreferenceLinkArea(composite, SWT.NONE, PrefPageEntityEditor.PAGE_ID, "<a>''{0}''</a> settings", (IWorkbenchPreferenceContainer) getContainer(), //$NON-NLS-1$
        null);
        new PreferenceLinkArea(composite, SWT.NONE, PrefPageSQLEditor.PAGE_ID, "<a>''{0}''</a> settings", (IWorkbenchPreferenceContainer) getContainer(), //$NON-NLS-1$
        null);
    }
    performDefaults();
    return composite;
}
Also used : IWorkbenchPreferenceContainer(org.eclipse.ui.preferences.IWorkbenchPreferenceContainer) GridData(org.eclipse.swt.layout.GridData) PreferenceLinkArea(org.eclipse.ui.dialogs.PreferenceLinkArea)

Example 8 with PreferenceLinkArea

use of org.eclipse.ui.dialogs.PreferenceLinkArea in project dbeaver by dbeaver.

the class PrefPageDatabaseGeneral method createContents.

@Override
protected Control createContents(Composite parent) {
    Composite composite = UIUtils.createPlaceholder(parent, 1, 5);
    {
        Group groupObjects = UIUtils.createControlGroup(composite, CoreMessages.pref_page_ui_general_group_general, 2, GridData.VERTICAL_ALIGN_BEGINNING, 0);
        automaticUpdateCheck = UIUtils.createCheckbox(groupObjects, CoreMessages.pref_page_ui_general_checkbox_automatic_updates, null, false, 2);
    // automaticUpdateCheck.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false, 2, 1));
    }
    {
        Group groupLanguage = UIUtils.createControlGroup(composite, CoreMessages.pref_page_ui_general_group_language, 2, GridData.VERTICAL_ALIGN_BEGINNING, 0);
        workspaceLanguage = UIUtils.createLabelCombo(groupLanguage, CoreMessages.pref_page_ui_general_combo_language, CoreMessages.pref_page_ui_general_combo_language_tip, SWT.READ_ONLY | SWT.DROP_DOWN);
        workspaceLanguage.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
        List<PlatformLanguageDescriptor> languages = PlatformLanguageRegistry.getInstance().getLanguages();
        DBPPlatformLanguage pLanguage = DBeaverCore.getInstance().getLanguage();
        for (int i = 0; i < languages.size(); i++) {
            PlatformLanguageDescriptor lang = languages.get(i);
            workspaceLanguage.add(lang.getLabel());
            if (CommonUtils.equalObjects(pLanguage, lang)) {
                workspaceLanguage.select(i);
            }
        }
        if (workspaceLanguage.getSelectionIndex() < 0) {
            workspaceLanguage.select(0);
        }
        Label tipLabel = UIUtils.createLabel(groupLanguage, CoreMessages.pref_page_ui_general_label_options_take_effect_after_restart);
        tipLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 2, 1));
    }
    // Agent settings
    {
        Group agentGroup = UIUtils.createControlGroup(composite, CoreMessages.pref_page_ui_general_group_task_bar, 2, GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING, 0);
        longOperationsCheck = UIUtils.createCheckbox(agentGroup, CoreMessages.pref_page_ui_general_label_enable_long_operations, CoreMessages.pref_page_ui_general_label_enable_long_operations_tip, false, 2);
        longOperationsTimeout = UIUtils.createLabelSpinner(agentGroup, CoreMessages.pref_page_ui_general_label_long_operation_timeout, 0, 0, Integer.MAX_VALUE);
        if (RuntimeUtils.isPlatformMacOS()) {
            ControlEnableState.disable(agentGroup);
        }
    }
    /*
        {
            // Resources
            Group groupResources = UIUtils.createControlGroup(composite, CoreMessages.pref_page_ui_general_group_resources, 2, GridData.VERTICAL_ALIGN_BEGINNING, 0);

            UIUtils.createControlLabel(groupResources, CoreMessages.pref_page_ui_general_label_default_resource_encoding);
            defaultResourceEncoding = UIUtils.createEncodingCombo(groupResources, GeneralUtils.DEFAULT_ENCODING);
            defaultResourceEncoding.setToolTipText(CoreMessages.pref_page_ui_general_label_set_default_resource_encoding_tip);

        }
*/
    {
        // Logs
        Group groupLogs = UIUtils.createControlGroup(composite, CoreMessages.pref_page_ui_general_group_debug_logs, 2, GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING, 0);
        logsDebugEnabled = UIUtils.createCheckbox(groupLogs, CoreMessages.pref_page_ui_general_label_enable_debug_logs, CoreMessages.pref_page_ui_general_label_enable_debug_logs_tip, false, 2);
        UIUtils.createControlLabel(groupLogs, CoreMessages.pref_page_ui_general_label_log_file_location);
        logsDebugLocation = new TextWithOpenFile(groupLogs, CoreMessages.pref_page_ui_general_label_open_file_text, new String[] { "*.log", "*.txt" });
        UIUtils.installContentProposal(logsDebugLocation.getTextControl(), new TextContentAdapter(), new SimpleContentProposalProvider(new String[] { GeneralUtils.variablePattern(SystemVariablesResolver.VAR_WORKSPACE), GeneralUtils.variablePattern(SystemVariablesResolver.VAR_HOME) }));
        logsDebugLocation.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        Label tipLabel = UIUtils.createLabel(groupLogs, CoreMessages.pref_page_ui_general_label_options_take_effect_after_restart);
        tipLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 2, 1));
    }
    {
        // Link to secure storage config
        new PreferenceLinkArea(composite, SWT.NONE, PrefPageEntityEditor.PAGE_ID, "<a>''{0}''</a> " + CoreMessages.pref_page_ui_general_label_settings, (IWorkbenchPreferenceContainer) getContainer(), // $NON-NLS-1$
        null);
        new PreferenceLinkArea(composite, SWT.NONE, PrefPageSQLEditor.PAGE_ID, "<a>''{0}''</a>" + CoreMessages.pref_page_ui_general_label_settings, (IWorkbenchPreferenceContainer) getContainer(), // $NON-NLS-1$
        null);
    }
    performDefaults();
    return composite;
}
Also used : SimpleContentProposalProvider(org.eclipse.jface.fieldassist.SimpleContentProposalProvider) DBPPlatformLanguage(org.jkiss.dbeaver.model.app.DBPPlatformLanguage) IWorkbenchPreferenceContainer(org.eclipse.ui.preferences.IWorkbenchPreferenceContainer) GridData(org.eclipse.swt.layout.GridData) List(java.util.List) TextWithOpenFile(org.jkiss.dbeaver.ui.controls.TextWithOpenFile) PlatformLanguageDescriptor(org.jkiss.dbeaver.registry.language.PlatformLanguageDescriptor) TextContentAdapter(org.eclipse.jface.fieldassist.TextContentAdapter) PreferenceLinkArea(org.eclipse.ui.dialogs.PreferenceLinkArea)

Example 9 with PreferenceLinkArea

use of org.eclipse.ui.dialogs.PreferenceLinkArea in project eclipse-integration-commons by spring-projects.

the class PreferencesCurator method createContents.

@Override
protected Control createContents(Composite parent) {
    Composite contents = new Composite(parent, SWT.NONE);
    contents.setLayout(new GridLayout(1, true));
    Label desc = new Label(contents, SWT.WRAP);
    desc.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    desc.setText("We have scoured the Eclipse preferences pages and determined a handful of preferences\n" + "that are not set in an optimal way.  Do you trust us?");
    Composite allComposite = new Composite(contents, SWT.BORDER);
    allComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    allComposite.setLayout(new GridLayout(1, false));
    Label label = new Label(allComposite, SWT.NONE);
    label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    label.setText("Set/Reset all curated preferences.");
    label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
    Button allSetButton = new Button(allComposite, SWT.PUSH);
    allSetButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    allSetButton.setText("Set all preferences");
    allSetButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            new GlobalPreferenceEnhancer().enhanceAllPreferences();
        }
    });
    Button allUnsetButton = new Button(allComposite, SWT.PUSH);
    allUnsetButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    allUnsetButton.setText("Reset all preferences");
    allUnsetButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            new GlobalPreferenceEnhancer().undoAll();
        }
    });
    Composite jdtComposite = new Composite(contents, SWT.BORDER);
    jdtComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    jdtComposite.setLayout(new GridLayout(1, false));
    Label jdtLabel = new Label(jdtComposite, SWT.NONE);
    jdtLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    jdtLabel.setText("JDT preferences");
    jdtLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
    Label jdtLabelExplanation = new Label(jdtComposite, SWT.NONE);
    jdtLabelExplanation.setLayoutData(new GridData(SWT.BEGINNING, SWT.LEFT, false, false));
    jdtLabelExplanation.setText("We set the following JDT preferences:\n" + "* Editor smart paste (true)\n" + "* Editor smart semicolon placement (true)\n" + "* Editor smart opening brace placement (true)\n" + "* Editor smart backspace (true)\n" + "* Editor smart tab (true)\n" + "* Escape text when pasting into a string literal (true)\n" + "* Auto activation delay (40 ms)\n");
    // + "* Auto activation triggers for Java (._abcdefghijklmnopqrstuvwxyz)\n");
    Button jdtSetButton = new Button(jdtComposite, SWT.PUSH);
    jdtSetButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    jdtSetButton.setText("Set JDT preferences only");
    jdtSetButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            new GlobalPreferenceEnhancer().enhanceJDTPreferences();
        }
    });
    Button jdtUnsetButton = new Button(jdtComposite, SWT.PUSH);
    jdtUnsetButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    jdtUnsetButton.setText("Reset JDT preferences only");
    jdtUnsetButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            new GlobalPreferenceEnhancer().undoJDTEnhance();
        }
    });
    PreferenceLinkArea jdtEditorArea = new PreferenceLinkArea(jdtComposite, SWT.WRAP, "org.eclipse.jdt.ui.preferences.SmartTypingPreferencePage", "Go to the <a>JDT smart typing preferences page</a>", (IWorkbenchPreferenceContainer) getContainer(), null);
    GridData data = new GridData(SWT.FILL, SWT.CENTER, false, false);
    jdtEditorArea.getControl().setLayoutData(data);
    PreferenceLinkArea jdtContentAssistArea = new PreferenceLinkArea(jdtComposite, SWT.WRAP, "org.eclipse.jdt.ui.preferences.CodeAssistPreferencePage", "Go to the <a>JDT content assist preferences page</a>", (IWorkbenchPreferenceContainer) getContainer(), null);
    data = new GridData(SWT.FILL, SWT.CENTER, false, false);
    jdtContentAssistArea.getControl().setLayoutData(data);
    Composite m2eComposite = new Composite(contents, SWT.BORDER);
    m2eComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    m2eComposite.setLayout(new GridLayout(1, false));
    Label m2eLabel = new Label(m2eComposite, SWT.NONE);
    m2eLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    m2eLabel.setText("M2E preferences");
    m2eLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
    Label m2eLabelExplanation = new Label(m2eComposite, SWT.NONE);
    m2eLabelExplanation.setLayoutData(new GridData(SWT.BEGINNING, SWT.LEFT, false, false));
    m2eLabelExplanation.setText("We set the following M2E preferences:\n" + "* Hide folders of physically nested projects (true)\n" + "* Download repository updates on startup (false)\n" + "* Open XML page in pom editor by default (true)");
    Button m2eSetButton = new Button(m2eComposite, SWT.PUSH);
    m2eSetButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    m2eSetButton.setText("Set M2E preferences only");
    m2eSetButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            new GlobalPreferenceEnhancer().enhanceM2EPreferences();
        }
    });
    Button m2eUnsetButton = new Button(m2eComposite, SWT.PUSH);
    m2eUnsetButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    m2eUnsetButton.setText("Reset M2E preferences only");
    m2eUnsetButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            new GlobalPreferenceEnhancer().undoJDTEnhance();
        }
    });
    PreferenceLinkArea m2eArea = new PreferenceLinkArea(m2eComposite, SWT.WRAP, "org.eclipse.m2e.core.preferences.Maven2PreferencePage", "Go to the <a>M2E preferences page</a>", (IWorkbenchPreferenceContainer) getContainer(), null);
    data = new GridData(SWT.FILL, SWT.CENTER, false, false);
    m2eArea.getControl().setLayoutData(data);
    PreferenceLinkArea m2eUIArea = new PreferenceLinkArea(m2eComposite, SWT.WRAP, "org.eclipse.m2e.core.ui.preferences.UserInterfacePreferencePage", "Go to the <a>M2E UI preferences page</a>", (IWorkbenchPreferenceContainer) getContainer(), null);
    data = new GridData(SWT.FILL, SWT.CENTER, false, false);
    m2eUIArea.getControl().setLayoutData(data);
    // disable m2e components if it is not installed
    if (Platform.getBundle("org.eclipse.m2e.core") == null) {
        m2eComposite.setEnabled(false);
        m2eLabel.setText(m2eLabel.getText() + " (not installed)");
        m2eSetButton.setEnabled(false);
        m2eUnsetButton.setEnabled(false);
        m2eUIArea.getControl().setEnabled(false);
        m2eArea.getControl().setEnabled(false);
    }
    return contents;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GlobalPreferenceEnhancer(org.springsource.ide.eclipse.commons.core.preferences.GlobalPreferenceEnhancer) PreferenceLinkArea(org.eclipse.ui.dialogs.PreferenceLinkArea)

Example 10 with PreferenceLinkArea

use of org.eclipse.ui.dialogs.PreferenceLinkArea in project webtools.sourceediting by eclipse.

the class CSSSourcePreferencePage method createContents.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
	 */
protected Control createContents(Composite parent) {
    final Composite composite = super.createComposite(parent, 1);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.CSS_PREFWEBX_SOURCE_HELPID);
    new // $NON-NLS-1$
    PreferenceLinkArea(// $NON-NLS-1$
    composite, // $NON-NLS-1$
    SWT.WRAP | SWT.MULTI, // $NON-NLS-1$
    "org.eclipse.wst.sse.ui.preferences.editor", // $NON-NLS-1$
    CSSUIMessages._UI_STRUCTURED_TEXT_EDITOR_PREFS_LINK, (IWorkbenchPreferenceContainer) getContainer(), null).getControl().setLayoutData(GridDataFactory.fillDefaults().hint(150, SWT.DEFAULT).create());
    new Label(composite, SWT.NONE).setLayoutData(GridDataFactory.swtDefaults().create());
    createContentsForFormattingGroup(composite);
    createContentsForContentAssistGroup(composite);
    setSize(composite);
    loadPreferences();
    return composite;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) PreferenceLinkArea(org.eclipse.ui.dialogs.PreferenceLinkArea)

Aggregations

PreferenceLinkArea (org.eclipse.ui.dialogs.PreferenceLinkArea)13 Label (org.eclipse.swt.widgets.Label)11 Composite (org.eclipse.swt.widgets.Composite)10 GridData (org.eclipse.swt.layout.GridData)5 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 Button (org.eclipse.swt.widgets.Button)3 IWorkbenchPreferenceContainer (org.eclipse.ui.preferences.IWorkbenchPreferenceContainer)3 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 IWorkbenchHelpSystem (org.eclipse.ui.help.IWorkbenchHelpSystem)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 SimpleContentProposalProvider (org.eclipse.jface.fieldassist.SimpleContentProposalProvider)1 TextContentAdapter (org.eclipse.jface.fieldassist.TextContentAdapter)1 AccessibleAdapter (org.eclipse.swt.accessibility.AccessibleAdapter)1 AccessibleEvent (org.eclipse.swt.accessibility.AccessibleEvent)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1 Link (org.eclipse.swt.widgets.Link)1