Search in sources :

Example 1 with TabFolderLayout

use of org.eclipse.wst.sse.ui.internal.preferences.TabFolderLayout in project webtools.sourceediting by eclipse.

the class FilePreferencePage method createContents.

protected Control createContents(Composite parent) {
    Composite composite = createComposite(parent, 1);
    // $NON-NLS-1$
    String description = SSEUIMessages.FilePreferencePage_0;
    createLabel(composite, description);
    // $NON-NLS-1$
    createLabel(composite, "");
    TabFolder folder = new TabFolder(composite, SWT.NONE);
    folder.setLayout(new TabFolderLayout());
    folder.setLayoutData(new GridData(GridData.FILL_BOTH));
    // TabItem taskItem = new TabItem(folder, SWT.NONE);
    // IPreferenceTab tasksTab = new TaskTagPreferenceTab();
    // taskItem.setText(tasksTab.getTitle());
    // Control taskTags = tasksTab.createContents(folder);
    // taskItem.setControl(taskTags);
    TabItem translucenceItem = new TabItem(folder, SWT.NONE);
    IPreferenceTab translucenceTab = new TranslucencyPreferenceTab(this);
    translucenceItem.setText(translucenceTab.getTitle());
    Control translucenceControl = translucenceTab.createContents(folder);
    translucenceItem.setControl(translucenceControl);
    fTabs = new IPreferenceTab[] { /*tasksTab,*/
    translucenceTab };
    return composite;
}
Also used : TabItem(org.eclipse.swt.widgets.TabItem) Control(org.eclipse.swt.widgets.Control) Composite(org.eclipse.swt.widgets.Composite) TabFolder(org.eclipse.swt.widgets.TabFolder) GridData(org.eclipse.swt.layout.GridData) TabFolderLayout(org.eclipse.wst.sse.ui.internal.preferences.TabFolderLayout)

Example 2 with TabFolderLayout

use of org.eclipse.wst.sse.ui.internal.preferences.TabFolderLayout in project webtools.sourceediting by eclipse.

the class StructuredTextEditorPreferencePage method createContents.

/*
	 * @see PreferencePage#createContents(Composite)
	 */
protected Control createContents(Composite parent) {
    // need to create tabs before loading/starting overlaystore in case
    // tabs also add values
    IPreferenceTab hoversTab = new TextHoverPreferenceTab(this, fOverlayStore);
    fOverlayStore.load();
    fOverlayStore.start();
    TabFolder folder = new TabFolder(parent, SWT.NONE);
    folder.setLayout(new TabFolderLayout());
    folder.setLayoutData(new GridData(GridData.FILL_BOTH));
    TabItem item = new TabItem(folder, SWT.NONE);
    // $NON-NLS-1$
    item.setText(SSEUIMessages.StructuredTextEditorPreferencePage_0);
    item.setControl(createAppearancePage(folder));
    item = new TabItem(folder, SWT.NONE);
    item.setText(hoversTab.getTitle());
    item.setControl(hoversTab.createContents(folder));
    fTabs = new IPreferenceTab[] { hoversTab };
    initialize();
    Dialog.applyDialogFont(folder);
    return folder;
}
Also used : TabItem(org.eclipse.swt.widgets.TabItem) TabFolder(org.eclipse.swt.widgets.TabFolder) GridData(org.eclipse.swt.layout.GridData) TabFolderLayout(org.eclipse.wst.sse.ui.internal.preferences.TabFolderLayout)

Example 3 with TabFolderLayout

use of org.eclipse.wst.sse.ui.internal.preferences.TabFolderLayout in project webtools.sourceediting by eclipse.

the class TaskTagPreferencePage method createCommonContents.

protected Control createCommonContents(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout compositeLayout = new GridLayout();
    compositeLayout.marginLeft = 0;
    compositeLayout.marginRight = 0;
    composite.setLayout(compositeLayout);
    IScopeContext[] preferenceScopes = createPreferenceScopes();
    fOriginalEnableTaskTags = fEnableTaskTags = fPreferencesService.getBoolean(getPreferenceNodeQualifier(), TaskTagPreferenceKeys.TASK_TAG_ENABLE, false, preferenceScopes);
    fEnableCheckbox = new Button(composite, SWT.CHECK);
    fEnableCheckbox.setSelection(fEnableTaskTags);
    // $NON-NLS-1$
    fEnableCheckbox.setText(SSEUIMessages.TaskTagPreferenceTab_31);
    fEnableCheckbox.setSelection(fEnableTaskTags);
    fEnableCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_END, false, false, 1, 1));
    fTabFolder = new TabFolder(composite, SWT.NONE);
    fTabFolder.setLayout(new TabFolderLayout());
    fTabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
    TabItem taskItem = new TabItem(fTabFolder, SWT.NONE);
    MainTab mainTab = new MainTab(this, fPreferencesService, preferenceScopes);
    taskItem.setText(mainTab.getTitle());
    final Control taskTagsControl = mainTab.createContents(fTabFolder);
    taskItem.setControl(taskTagsControl);
    TabItem exclusionItem = new TabItem(fTabFolder, SWT.NONE);
    ExclusionsTab exclusionsTab = new ExclusionsTab(this, fPreferencesService, preferenceScopes);
    exclusionItem.setText(exclusionsTab.getTitle());
    final Control exclusionControl = exclusionsTab.createContents(fTabFolder);
    exclusionItem.setControl(exclusionControl);
    fTabs = new IPreferenceTab[] { mainTab, exclusionsTab };
    fTabEnablementListener = new SelectionAdapter() {

        ControlEnableState[] lastEnableStates = null;

        public void widgetSelected(SelectionEvent e) {
            fEnableTaskTags = fEnableCheckbox.getSelection();
            if (fEnableTaskTags) {
                if (lastEnableStates != null) {
                    for (int i = 0; i < lastEnableStates.length; i++) {
                        if (lastEnableStates[i] != null) {
                            lastEnableStates[i].restore();
                        }
                    }
                    lastEnableStates = null;
                    fTabFolder.redraw();
                }
            } else if (lastEnableStates == null) {
                lastEnableStates = new ControlEnableState[fTabs.length + 1];
                lastEnableStates[0] = ControlEnableState.disable(taskTagsControl);
                lastEnableStates[1] = ControlEnableState.disable(exclusionControl);
                if (fRedetectButton != null) {
                    lastEnableStates[2] = ControlEnableState.disable(fRedetectButton);
                }
            }
        }
    };
    fTabEnablementListener.widgetSelected(null);
    fEnableCheckbox.addSelectionListener(fTabEnablementListener);
    // restore last selected tab
    int activeTab = new DefaultScope().getNode(getPreferenceNodeQualifier()).getInt(TASK_TAG_LAST_TAB, 0);
    if (activeTab > 0) {
        fTabFolder.setSelection(activeTab);
    }
    SSEUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.PREFWEBX_TASKTAGS_HELPID);
    return composite;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) TabFolder(org.eclipse.swt.widgets.TabFolder) DefaultScope(org.eclipse.core.runtime.preferences.DefaultScope) TabFolderLayout(org.eclipse.wst.sse.ui.internal.preferences.TabFolderLayout) IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) TabItem(org.eclipse.swt.widgets.TabItem) GridLayout(org.eclipse.swt.layout.GridLayout) Control(org.eclipse.swt.widgets.Control) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ControlEnableState(org.eclipse.jface.dialogs.ControlEnableState)

Aggregations

GridData (org.eclipse.swt.layout.GridData)3 TabFolder (org.eclipse.swt.widgets.TabFolder)3 TabItem (org.eclipse.swt.widgets.TabItem)3 TabFolderLayout (org.eclipse.wst.sse.ui.internal.preferences.TabFolderLayout)3 Composite (org.eclipse.swt.widgets.Composite)2 Control (org.eclipse.swt.widgets.Control)2 DefaultScope (org.eclipse.core.runtime.preferences.DefaultScope)1 IScopeContext (org.eclipse.core.runtime.preferences.IScopeContext)1 ControlEnableState (org.eclipse.jface.dialogs.ControlEnableState)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Button (org.eclipse.swt.widgets.Button)1