Search in sources :

Example 11 with TabFolder

use of org.eclipse.swt.widgets.TabFolder in project cubrid-manager by CUBRID.

the class ShardWizardAllInfoPage method createControl.

/**
	 * Create the control for this page
	 *
	 * @param parent
	 *            the parent composite
	 */
public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 10;
    layout.marginWidth = 10;
    composite.setLayout(layout);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    composite.setLayoutData(gridData);
    Label tipLabel = new Label(composite, SWT.LEFT | SWT.WRAP);
    tipLabel.setText(Messages.msgDbInfoList);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    tipLabel.setLayoutData(gridData);
    gridData = new GridData(GridData.FILL_BOTH);
    TabFolder tabFolder = new TabFolder(composite, SWT.NONE);
    tabFolder.setLayoutData(gridData);
    tabFolder.setLayout(new GridLayout());
    gridData = new GridData(GridData.FILL_BOTH);
    shardGeneralInfoText = new Text(tabFolder, SWT.LEFT | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
    shardGeneralInfoText.setEditable(false);
    shardGeneralInfoText.setLayoutData(gridData);
    gridData = new GridData(GridData.FILL_BOTH);
    shardBrokerInfoText = new Text(tabFolder, SWT.LEFT | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
    shardBrokerInfoText.setEditable(false);
    shardBrokerInfoText.setLayoutData(gridData);
    gridData = new GridData(GridData.FILL_BOTH);
    shardConnectionInfoText = new Text(tabFolder, SWT.LEFT | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
    shardConnectionInfoText.setEditable(false);
    shardConnectionInfoText.setLayoutData(gridData);
    gridData = new GridData(GridData.FILL_BOTH);
    shardKeyInfoText = new Text(tabFolder, SWT.LEFT | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
    shardKeyInfoText.setEditable(false);
    shardKeyInfoText.setLayoutData(gridData);
    TabItem item = new TabItem(tabFolder, SWT.NONE);
    item.setText("General");
    item.setControl(shardGeneralInfoText);
    item = new TabItem(tabFolder, SWT.NONE);
    item.setText("Broker");
    item.setControl(shardBrokerInfoText);
    item = new TabItem(tabFolder, SWT.NONE);
    item.setText("Connection");
    item.setControl(shardConnectionInfoText);
    item = new TabItem(tabFolder, SWT.NONE);
    item.setText("Key");
    item.setControl(shardKeyInfoText);
    initialize();
    setTitle("All Information");
    setMessage("Add a new shard broker.");
    setControl(composite);
    // TODO why this method called again?
    initialize();
}
Also used : TabItem(org.eclipse.swt.widgets.TabItem) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) TabFolder(org.eclipse.swt.widgets.TabFolder) Text(org.eclipse.swt.widgets.Text)

Example 12 with TabFolder

use of org.eclipse.swt.widgets.TabFolder in project bndtools by bndtools.

the class AdvancedSearchDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    setTitle("Advanced Search");
    setMessage("Perform a search for resource capabilities in the Repositories. Select the\ncapability namespace using the tab bar.");
    Composite area = (Composite) super.createDialogArea(parent);
    tabFolder = new TabFolder(area, SWT.TOP);
    tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
    PropertyChangeListener changeListener = new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            updateFromPanel();
        }
    };
    final List<Image> images = new LinkedList<Image>();
    for (Entry<String, SearchPanel> panelEntry : panelMap.entrySet()) {
        String title = panelEntry.getKey();
        SearchPanel panel = panelEntry.getValue();
        Composite container = new Composite(tabFolder, SWT.NONE);
        container.setLayout(new GridLayout(1, false));
        Control control = panel.createControl(container);
        GridData controlLayoutData = new GridData(SWT.FILL, SWT.CENTER, true, true);
        controlLayoutData.widthHint = 200;
        control.setLayoutData(controlLayoutData);
        TabItem item = new TabItem(tabFolder, SWT.NONE);
        item.setText(title);
        item.setControl(container);
        item.setData(panel);
        Image image = panel.createImage(tabFolder.getDisplay());
        if (image != null) {
            images.add(image);
            item.setImage(image);
        }
        panel.addPropertyChangeListener(changeListener);
    }
    tabFolder.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            for (Image image : images) {
                if (!image.isDisposed())
                    image.dispose();
            }
        }
    });
    tabFolder.setSelection(activeTabIndex);
    SearchPanel currentPanel = (SearchPanel) tabFolder.getItem(activeTabIndex).getData();
    currentPanel.setFocus();
    requirement = currentPanel.getRequirement();
    tabFolder.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            activeTabIndex = tabFolder.getSelectionIndex();
            updateFromPanel();
            getSelectedPanel().setFocus();
        }
    });
    return area;
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) PropertyChangeEvent(java.beans.PropertyChangeEvent) Composite(org.eclipse.swt.widgets.Composite) PropertyChangeListener(java.beans.PropertyChangeListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) TabFolder(org.eclipse.swt.widgets.TabFolder) Image(org.eclipse.swt.graphics.Image) DisposeEvent(org.eclipse.swt.events.DisposeEvent) LinkedList(java.util.LinkedList) TabItem(org.eclipse.swt.widgets.TabItem) GridLayout(org.eclipse.swt.layout.GridLayout) Control(org.eclipse.swt.widgets.Control) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 13 with TabFolder

use of org.eclipse.swt.widgets.TabFolder in project linuxtools by eclipse.

the class PerfEventsTab method createEventTabs.

private void createEventTabs(Composite top, ILaunchConfiguration config) {
    // Maybe not the best place to load the event list but we'll see.
    Map<String, List<String>> events = PerfCore.getEventList(config);
    // the special counters should be last
    ArrayList<String> tmpTabNames = new ArrayList<>(events.keySet());
    final List<String> SPECIAL_EVENTS = Arrays.asList(new String[] { PerfPlugin.STRINGS_HWBREAKPOINTS, PerfPlugin.STRINGS_RAWHWEvents });
    tmpTabNames.removeAll(SPECIAL_EVENTS);
    tmpTabNames.addAll(SPECIAL_EVENTS);
    String[] tabNames = tmpTabNames.toArray(new String[0]);
    eventTabItems = new TabItem[tabNames.length];
    eventTable = new Table[tabNames.length];
    tabFolder = new TabFolder(top, SWT.NONE);
    tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    // Initialize each tab.
    for (int i = 0; i < tabNames.length; i++) {
        eventTabItems[i] = new TabItem(tabFolder, SWT.NONE);
        eventTabItems[i].setText(tabNames[i]);
        // These are for the two special tabs for custom events.
        if (tabNames[i].equals(PerfPlugin.STRINGS_HWBREAKPOINTS) || tabNames[i].equals(PerfPlugin.STRINGS_RAWHWEvents)) {
            // Composite to contain it all
            Composite c = new Composite(tabFolder, SWT.NONE);
            c.setLayout(new GridLayout(2, false));
            // A list to check off existing custom events (or show the new ones added)
            Table table = new Table(c, SWT.CHECK | SWT.MULTI);
            eventTable[i] = table;
            table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
            table.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
                updateLaunchConfigurationDialog();
            }));
            // Right side to enter new events and delete old ones
            Composite right = new Composite(c, SWT.NONE);
            right.setLayout(new GridLayout(2, false));
            right.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, true));
            // for adding
            Label l = new Label(right, SWT.NONE);
            l.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
            Text t = new Text(right, SWT.SINGLE | SWT.BORDER);
            t.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
            if (tabNames[i].equals(PerfPlugin.STRINGS_HWBREAKPOINTS)) {
                bpTabIndex = i;
                bpText = t;
                l.setText(Messages.PerfEventsTab_HardwareBreakpoint);
            }
            if (tabNames[i].equals(PerfPlugin.STRINGS_RAWHWEvents)) {
                rawTabIndex = i;
                rawText = t;
                l.setText(Messages.PerfEventsTab_RawRegisterEncoding);
            }
            Button b = new Button(right, SWT.PUSH);
            b.setText(Messages.PerfEventsTab_Add);
            b.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false));
            b.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
                int index = tabFolder.getSelectionIndex();
                if (rawTabIndex == index) {
                    new TableItem(eventTable[index], SWT.NONE).setText(rawText.getText());
                } else if (bpTabIndex == index) {
                    new TableItem(eventTable[index], SWT.NONE).setText(bpText.getText());
                }
                updateLaunchConfigurationDialog();
            }));
            l = new Label(right, SWT.NONE);
            l.setForeground(new Color(right.getDisplay(), 100, 100, 100));
            if (tabNames[i].equals(PerfPlugin.STRINGS_HWBREAKPOINTS)) {
                l.setText(Messages.PerfEventsTab_ForExample);
            }
            if (tabNames[i].equals(PerfPlugin.STRINGS_RAWHWEvents)) {
                l.setText(Messages.PerfEventsTab_ForExampleR1A8);
            }
            l.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
            // spacer label.
            l = new Label(right, SWT.NONE);
            l.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
            // for removing
            b = new Button(right, SWT.PUSH);
            b.setText(Messages.PerfEventsTab_RemoveSelectedEvents);
            b.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false, 2, 1));
            b.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
                eventTable[tabFolder.getSelectionIndex()].remove(eventTable[tabFolder.getSelectionIndex()].getSelectionIndices());
                updateLaunchConfigurationDialog();
            }));
            l = new Label(right, SWT.NONE);
            l.setForeground(new Color(right.getDisplay(), 100, 100, 100));
            l.setText(Messages.PerfEventsTab_Note);
            l.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false, 2, 1));
            eventTabItems[i].setControl(c);
        } else {
            // This loads all the events 'perf list' gives into their respective tabs.
            Table table = new Table(tabFolder, SWT.CHECK);
            eventTable[i] = table;
            List<String> eventList = events.get(tabNames[i]);
            for (String event : eventList) {
                TableItem item = new TableItem(table, SWT.NONE);
                item.setText(event);
            }
            table.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> updateLaunchConfigurationDialog()));
            eventTabItems[i].setControl(table);
        }
    }
}
Also used : Arrays(java.util.Arrays) TabFolder(org.eclipse.swt.widgets.TabFolder) ResourcesPlugin(org.eclipse.core.resources.ResourcesPlugin) Image(org.eclipse.swt.graphics.Image) CoreException(org.eclipse.core.runtime.CoreException) PerfPlugin(org.eclipse.linuxtools.internal.perf.PerfPlugin) Table(org.eclipse.swt.widgets.Table) ArrayList(java.util.ArrayList) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) IProject(org.eclipse.core.resources.IProject) AbstractLaunchConfigurationTab(org.eclipse.debug.ui.AbstractLaunchConfigurationTab) Composite(org.eclipse.swt.widgets.Composite) Map(java.util.Map) GridData(org.eclipse.swt.layout.GridData) PerfCore(org.eclipse.linuxtools.internal.perf.PerfCore) TabItem(org.eclipse.swt.widgets.TabItem) TableItem(org.eclipse.swt.widgets.TableItem) Text(org.eclipse.swt.widgets.Text) Button(org.eclipse.swt.widgets.Button) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) List(java.util.List) ICDTLaunchConfigurationConstants(org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants) Color(org.eclipse.swt.graphics.Color) SWT(org.eclipse.swt.SWT) Label(org.eclipse.swt.widgets.Label) Control(org.eclipse.swt.widgets.Control) SelectionListener(org.eclipse.swt.events.SelectionListener) GridLayout(org.eclipse.swt.layout.GridLayout) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) TableItem(org.eclipse.swt.widgets.TableItem) Color(org.eclipse.swt.graphics.Color) ArrayList(java.util.ArrayList) TabFolder(org.eclipse.swt.widgets.TabFolder) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) TabItem(org.eclipse.swt.widgets.TabItem) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) ArrayList(java.util.ArrayList) List(java.util.List)

Example 14 with TabFolder

use of org.eclipse.swt.widgets.TabFolder in project linuxtools by eclipse.

the class AbstractEventConfigTab method createCounterTabs.

/**
 * @since 1.1
 * @param top
 */
private void createCounterTabs(Composite top) {
    // tabs for each of the counters
    counters = getOprofileCounters(null);
    TabItem[] counterTabs = new TabItem[counters.length];
    // create only one counter for operf/opcontrol
    if (counters.length > 0) {
        counterSubTabs = new CounterSubTab[1];
    } else {
        counterSubTabs = new CounterSubTab[0];
    }
    TabFolder tabFolder = new TabFolder(top, SWT.NONE);
    tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    // This approach would make operf/opcontrol event selection more similar.
    for (int i = 0; i < counters.length; i++) {
        Composite c = new Composite(tabFolder, SWT.NONE);
        CounterSubTab currentTab = new CounterSubTab(c, counters[i]);
        counterSubTabs[i] = currentTab;
        counterTabs[i] = new TabItem(tabFolder, SWT.NONE);
        counterTabs[i].setControl(c);
        // $NON-NLS-1$
        counterTabs[i].setText(OprofileLaunchMessages.getString("tab.event.counterTab.counterText"));
        // just one tab for operf/opcontrol
        break;
    }
    getTabFolderComposite();
}
Also used : TabItem(org.eclipse.swt.widgets.TabItem) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) TabFolder(org.eclipse.swt.widgets.TabFolder) GridData(org.eclipse.swt.layout.GridData)

Example 15 with TabFolder

use of org.eclipse.swt.widgets.TabFolder in project knime-core by knime.

the class SubnodeLayoutJSONEditorPage method createControl.

/**
 * {@inheritDoc}
 */
@Override
public void createControl(final Composite parent) {
    TabFolder tabs = new TabFolder(parent, SWT.BORDER);
    TabItem usageTab = new TabItem(tabs, SWT.NONE);
    usageTab.setText("Node Usage");
    m_nodeUsageComposite = new NodeUsageComposite(tabs, m_viewNodes, m_subNodeContainer);
    usageTab.setControl(m_nodeUsageComposite);
    usageTab.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(final DisposeEvent e) {
            m_nodeUsageComposite = null;
        }
    });
    TabItem basicTab = new TabItem(tabs, SWT.NONE);
    basicTab.setText("Basic Layout");
    basicTab.setControl(createBasicComposite(tabs));
    TabItem jsonTab = new TabItem(tabs, SWT.NONE);
    jsonTab.setText("Advanced Layout");
    jsonTab.setControl(createJSONEditorComposite(tabs));
    setControl(tabs);
}
Also used : TabItem(org.eclipse.swt.widgets.TabItem) DisposeListener(org.eclipse.swt.events.DisposeListener) TabFolder(org.eclipse.swt.widgets.TabFolder) DisposeEvent(org.eclipse.swt.events.DisposeEvent)

Aggregations

TabFolder (org.eclipse.swt.widgets.TabFolder)40 TabItem (org.eclipse.swt.widgets.TabItem)33 GridData (org.eclipse.swt.layout.GridData)30 Composite (org.eclipse.swt.widgets.Composite)28 GridLayout (org.eclipse.swt.layout.GridLayout)27 SelectionEvent (org.eclipse.swt.events.SelectionEvent)12 Text (org.eclipse.swt.widgets.Text)12 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)11 Button (org.eclipse.swt.widgets.Button)11 Label (org.eclipse.swt.widgets.Label)10 Combo (org.eclipse.swt.widgets.Combo)5 Shell (org.eclipse.swt.widgets.Shell)5 FillLayout (org.eclipse.swt.layout.FillLayout)4 Control (org.eclipse.swt.widgets.Control)4 Display (org.eclipse.swt.widgets.Display)4 Group (org.eclipse.swt.widgets.Group)4 Table (org.eclipse.swt.widgets.Table)4 Link (org.eclipse.swt.widgets.Link)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 SWT (org.eclipse.swt.SWT)2