Search in sources :

Example 6 with CTabFolderEvent

use of org.eclipse.swt.custom.CTabFolderEvent in project jbosstools-hibernate by jbosstools.

the class QueryPageTabView method createPartControl.

public void createPartControl(Composite parent) {
    tabs = new CTabFolder(parent, SWT.CLOSE | SWT.BOTTOM);
    tabs.setSimple(false);
    tabs.setUnselectedCloseVisible(false);
    tabs.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            fireSelectionChangedEvent();
        }
    });
    tabs.addCTabFolder2Listener(new CTabFolder2Adapter() {

        public void close(CTabFolderEvent event) {
            QueryPage qp = (QueryPage) event.item.getData();
            KnownConfigurations.getInstance().getQueryPageModel().remove(qp);
        }
    });
    rebuild();
    initActions();
    provideSelection();
}
Also used : CTabFolder(org.eclipse.swt.custom.CTabFolder) CTabFolder2Adapter(org.eclipse.swt.custom.CTabFolder2Adapter) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) CTabFolderEvent(org.eclipse.swt.custom.CTabFolderEvent) QueryPage(org.hibernate.console.QueryPage)

Example 7 with CTabFolderEvent

use of org.eclipse.swt.custom.CTabFolderEvent in project rap by entirej.

the class EJRWTTabPaneFormContainer method createContainer.

public Composite createContainer(Composite parent) {
    if (_folder != null) {
        _folder.dispose();
        _folder = null;
    }
    int style = SWT.FLAT | SWT.BORDER | getTabOrientation() | SWT.CLOSE;
    _folder = new CTabFolder(parent, style);
    _folder.addCTabFolder2Listener(new CTabFolder2Adapter() {

        @Override
        public void close(CTabFolderEvent event) {
            event.doit = false;
            if (event.item instanceof CTabItem) {
                EJInternalForm form = getFormByTab((CTabItem) event.item);
                if (form != null) {
                    try {
                        form.close();
                    } catch (Exception e) {
                        form.getFrameworkManager().getApplicationManager().handleException(e);
                    }
                }
            }
        }
    });
    _folder.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            CTabItem selection = _folder.getSelection();
            if (selection != null && selection.getData() instanceof EJInternalForm) {
                final EJInternalForm form = (EJInternalForm) selection.getData();
                EJ_RWT.setAttribute(_folder, "ej-item-selection", form.getProperties().getName());
                Display.getDefault().asyncExec(new Runnable() {

                    @Override
                    public void run() {
                        for (EJRWTFormSelectedListener listener : _formSelectedListeners) {
                            listener.fireFormSelected(form);
                        }
                        form.focusGained();
                    }
                });
            }
        }
    });
    return _folder;
}
Also used : CTabFolder(org.eclipse.swt.custom.CTabFolder) CTabFolder2Adapter(org.eclipse.swt.custom.CTabFolder2Adapter) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) CTabFolderEvent(org.eclipse.swt.custom.CTabFolderEvent) EJRWTFormSelectedListener(org.entirej.applicationframework.rwt.application.interfaces.EJRWTFormSelectedListener) CTabItem(org.eclipse.swt.custom.CTabItem) EJInternalForm(org.entirej.framework.core.internal.EJInternalForm)

Example 8 with CTabFolderEvent

use of org.eclipse.swt.custom.CTabFolderEvent in project tdq-studio-se by Talend.

the class MatchingKeySection method createRuleFolder.

/**
 * DOC yyin Comment method "createRuleFolder".
 *
 * @param parent
 */
protected void createRuleFolder(Composite parent) {
    ruleFolder = new CTabFolder(parent, SWT.MULTI | SWT.BORDER);
    ruleFolder.setRenderer(new MatchRuleCTabFolderRenderer(ruleFolder));
    ruleFolder.setMaximizeVisible(false);
    ruleFolder.setMinimizeVisible(false);
    // set higher than before, because add a edit button.
    ruleFolder.setTabHeight(36);
    ruleFolder.setSimple(false);
    ruleFolder.setDragDetect(true);
    GridData folderData = new GridData(GridData.FILL_BOTH);
    // folderData.verticalIndent = -26;
    ruleFolder.setLayoutData(folderData);
    ruleFolder.addCTabFolder2Listener(new CTabFolder2Adapter() {

        @Override
        public void close(CTabFolderEvent event) {
            CTabItem tabItem = (CTabItem) event.item;
            deleteMatchRuleTab(tabItem);
        }
    });
    ruleFolder.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            // when the user switch the rule tab, should notify the match analysis master page to change the table
            // column's color accordingly
            fireSwitchRuleTabEvent();
        }
    });
}
Also used : CTabFolder(org.eclipse.swt.custom.CTabFolder) CTabFolder2Adapter(org.eclipse.swt.custom.CTabFolder2Adapter) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) CTabFolderEvent(org.eclipse.swt.custom.CTabFolderEvent) CTabItem(org.eclipse.swt.custom.CTabItem)

Example 9 with CTabFolderEvent

use of org.eclipse.swt.custom.CTabFolderEvent in project tbd-studio-se by Talend.

the class CheckHadoopServicesDialog method createTabFolder.

private void createTabFolder(Composite parent) {
    tabFolder = new CTabFolder(parent, SWT.BORDER | SWT.FLAT);
    tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
    tabFolder.setLayout(new GridLayout());
    tabFolder.addCTabFolder2Listener(new CTabFolder2Adapter() {

        @Override
        public void close(CTabFolderEvent event) {
            CTabItem tabItem = (CTabItem) event.item;
            serviceToException.remove(tabItem.getData());
            super.close(event);
        }
    });
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) CTabFolder(org.eclipse.swt.custom.CTabFolder) CTabFolder2Adapter(org.eclipse.swt.custom.CTabFolder2Adapter) GridData(org.eclipse.swt.layout.GridData) CTabFolderEvent(org.eclipse.swt.custom.CTabFolderEvent) CTabItem(org.eclipse.swt.custom.CTabItem)

Example 10 with CTabFolderEvent

use of org.eclipse.swt.custom.CTabFolderEvent in project tdq-studio-se by Talend.

the class SQLEditor method createResultTabs.

/**
 * Creates the results tabs in the bottom half
 *
 * @param parent
 * @return
 */
private CTabFolder createResultTabs(Composite parent) {
    tabFolder = new CTabFolder(parent, SWT.TOP | SWT.CLOSE);
    tabFolder.setBorderVisible(true);
    tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
    // Set up a gradient background for the selected tab
    Display display = getSite().getShell().getDisplay();
    tabFolder.setSelectionBackground(new Color[] { display.getSystemColor(SWT.COLOR_WHITE), firstColor, secondColor, IConstants.TAB_BORDER_COLOR }, new int[] { 25, 50, 75 }, true);
    messagesTab = new CTabItem(tabFolder, SWT.NONE);
    messagesTab.setText(Messages.getString("SQLEditor.Results.Messages.Caption"));
    messagesTable = new Table(tabFolder, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
    messagesTab.setControl(messagesTable);
    messagesTable.setLinesVisible(true);
    messagesTable.setHeaderVisible(true);
    messagesTable.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            super.widgetSelected(e);
            Message message = (Message) ((TableItem) e.item).getData();
            setCursorPosition(message.getLineNo(), message.getCharNo());
        }
    });
    TableColumn col = new TableColumn(messagesTable, SWT.NONE);
    col.setText(Messages.getString("SQLEditor.Results.Messages.Status"));
    col.pack();
    col = new TableColumn(messagesTable, SWT.NONE);
    col.setText(Messages.getString("SQLEditor.Results.Messages.Location"));
    col.pack();
    col = new TableColumn(messagesTable, SWT.NONE);
    col.setText(Messages.getString("SQLEditor.Results.Messages.SQL"));
    col.pack();
    col = new TableColumn(messagesTable, SWT.NONE);
    col.setText(Messages.getString("SQLEditor.Results.Messages.Text"));
    col.pack();
    tabFolder.setSelection(messagesTab);
    // Add a listener to get the close button on each tab
    tabFolder.addCTabFolder2Listener(new CTabFolder2Adapter() {

        /*
             * (non-JavaDoc)
             * 
             * @see org.eclipse.swt.custom.CTabFolder2Adapter#close(org.eclipse.swt.custom.CTabFolderEvent)
             */
        @Override
        public void close(CTabFolderEvent event) {
            super.close(event);
            CTabItem tabItem = (CTabItem) event.item;
            event.doit = onCloseTab(tabItem);
        }
    });
    return tabFolder;
}
Also used : CTabFolder(org.eclipse.swt.custom.CTabFolder) Table(org.eclipse.swt.widgets.Table) CTabFolder2Adapter(org.eclipse.swt.custom.CTabFolder2Adapter) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) TableItem(org.eclipse.swt.widgets.TableItem) CTabFolderEvent(org.eclipse.swt.custom.CTabFolderEvent) CTabItem(org.eclipse.swt.custom.CTabItem) TableColumn(org.eclipse.swt.widgets.TableColumn) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Display(org.eclipse.swt.widgets.Display)

Aggregations

CTabFolder (org.eclipse.swt.custom.CTabFolder)12 CTabFolderEvent (org.eclipse.swt.custom.CTabFolderEvent)12 CTabFolder2Adapter (org.eclipse.swt.custom.CTabFolder2Adapter)11 CTabItem (org.eclipse.swt.custom.CTabItem)9 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)8 SelectionEvent (org.eclipse.swt.events.SelectionEvent)8 Composite (org.eclipse.swt.widgets.Composite)7 Display (org.eclipse.swt.widgets.Display)5 DragSourceEvent (org.eclipse.swt.dnd.DragSourceEvent)4 FormAttachment (org.eclipse.swt.layout.FormAttachment)4 FormData (org.eclipse.swt.layout.FormData)4 FormLayout (org.eclipse.swt.layout.FormLayout)4 GridData (org.eclipse.swt.layout.GridData)4 Menu (org.eclipse.swt.widgets.Menu)4 SashForm (org.eclipse.swt.custom.SashForm)3 DragSource (org.eclipse.swt.dnd.DragSource)3 DragSourceAdapter (org.eclipse.swt.dnd.DragSourceAdapter)3 FocusEvent (org.eclipse.swt.events.FocusEvent)3 KeyEvent (org.eclipse.swt.events.KeyEvent)3 ModifyEvent (org.eclipse.swt.events.ModifyEvent)3