Search in sources :

Example 1 with CTabFolderEvent

use of org.eclipse.swt.custom.CTabFolderEvent in project cubrid-manager by CUBRID.

the class CombinedQueryEditorComposite method createResultFolder.

/**
	 * Create the result folder including query result and query plan result
	 *
	 * @param topSash SashForm
	 * @param sqlEditorParentComp Composite
	 */
private void createResultFolder(final SashForm topSash, final Composite sqlEditorParentComp) {
    final Composite resultComp = new Composite(topSash, SWT.NONE);
    {
        GridLayout gridLayout = new GridLayout();
        gridLayout.horizontalSpacing = 0;
        gridLayout.verticalSpacing = 0;
        gridLayout.marginWidth = 0;
        gridLayout.marginHeight = 0;
        resultComp.setLayout(gridLayout);
        resultComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    }
    // result folder
    final CTabFolder resultTabFolder = new CTabFolder(resultComp, SWT.TOP);
    resultTabFolder.setLayout(new FillLayout());
    resultTabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    resultTabFolder.setSimple(false);
    resultTabFolder.setUnselectedImageVisible(true);
    resultTabFolder.setUnselectedCloseVisible(true);
    resultTabFolder.setSelectionBackground(BACK_COLOR);
    resultTabFolder.setSelectionForeground(ResourceManager.getColor(SWT.COLOR_BLACK));
    resultTabFolder.setMinimizeVisible(true);
    resultTabFolder.setMaximizeVisible(true);
    this.resultTabFolder = resultTabFolder;
    resultTabFolder.addCTabFolder2Listener(new CTabFolder2Listener() {

        public void close(CTabFolderEvent event) {
        }

        public void maximize(CTabFolderEvent event) {
            resultTabFolder.setMaximized(true);
            topSash.setMaximizedControl(resultComp);
            editor.getShowResultItem().setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_panel_down.png"));
            topSash.layout(true);
        }

        public void minimize(CTabFolderEvent event) {
            resultTabFolder.setMinimized(true);
            topSash.setMaximizedControl(sqlEditorParentComp);
            editor.getShowResultItem().setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_panel_up.png"));
            topSash.layout(true);
        }

        public void restore(CTabFolderEvent event) {
            resultTabFolder.setMinimized(false);
            resultTabFolder.setMaximized(false);
            topSash.setMaximizedControl(null);
            editor.getShowResultItem().setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_panel_down.png"));
            topSash.layout(true);
        }

        public void showList(CTabFolderEvent event) {
        }
    });
    // query result tab area
    queryResultComp = new QueryResultComposite(resultTabFolder, SWT.NONE, editor);
    // query plan result tab area
    queryPlanResultComp = new QueryPlanCompositeWithHistory(resultTabFolder, SWT.NONE, editor);
    // recently Used SQL tab area
    recentlyUsedSQLComposite = new RecentlyUsedSQLComposite(resultTabFolder, SWT.NONE, editor);
    recentlyUsedSQLComposite.initialize();
    // create multiple query
    multiDBQueryComp = new MultiDBQueryComposite(resultTabFolder, SWT.NONE, editor);
    multiDBQueryComp.initialize();
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) CTabFolder(org.eclipse.swt.custom.CTabFolder) Composite(org.eclipse.swt.widgets.Composite) CTabFolder2Listener(org.eclipse.swt.custom.CTabFolder2Listener) GridData(org.eclipse.swt.layout.GridData) CTabFolderEvent(org.eclipse.swt.custom.CTabFolderEvent) FillLayout(org.eclipse.swt.layout.FillLayout)

Example 2 with CTabFolderEvent

use of org.eclipse.swt.custom.CTabFolderEvent in project linuxtools by eclipse.

the class GraphDisplaySet method createPartControl.

/**
 * This method creates the framework for what will be displayed by this dialog box.
 * @param parent The composite that will contain all the elements from this dialog
 */
private void createPartControl(Composite parent) {
    parent.setLayout(new FormLayout());
    FormData data1 = new FormData();
    Composite cmpCoolBar = new Composite(parent, SWT.NONE);
    data1.left = new FormAttachment(0, 0);
    data1.top = new FormAttachment(0, 0);
    data1.right = new FormAttachment(100, 0);
    data1.bottom = new FormAttachment(0, 10);
    cmpCoolBar.setLayoutData(data1);
    FormData data2 = new FormData();
    data2.left = new FormAttachment(0, 0);
    data2.top = new FormAttachment(cmpCoolBar);
    data2.right = new FormAttachment(100, 0);
    data2.bottom = new FormAttachment(100, 0);
    Composite cmpGraph = new Composite(parent, SWT.NONE);
    cmpGraph.setLayoutData(data2);
    // This is for the tab view
    cmpGraph.setLayout(new FormLayout());
    folder = new CTabFolder(cmpGraph, SWT.NONE);
    FormData data = new FormData();
    data.top = new FormAttachment(0, 0);
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.bottom = new FormAttachment(100, 0);
    folder.setLayoutData(data);
    listener = new ButtonClickListener();
    folder.addSelectionListener(listener);
    folder.addCTabFolder2Listener(new CTabFolder2Adapter() {

        @Override
        public void close(CTabFolderEvent e) {
            int selected = folder.indexOf((CTabItem) e.item) - 2;
            if (null != updater) {
                updater.removeUpdateListener(builders.get(selected));
            }
            builders.remove(selected);
        }
    });
    // This is a tab/button for opening new graphs
    CTabItem newGraph = new CTabItem(folder, SWT.NONE);
    // $NON-NLS-1$
    newGraph.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(GraphingUIPlugin.PLUGIN_ID, "icons/actions/new_wiz.gif").createImage());
    // $NON-NLS-1$
    newGraph.setToolTipText(Localization.getString("GraphDisplaySet.CreateGraph"));
    // Tab containing the data table
    CTabItem item = new CTabItem(folder, SWT.NONE);
    // $NON-NLS-1$
    item.setText(Localization.getString("GraphDisplaySet.DataView"));
    Composite c = new Composite(folder, SWT.NONE);
    GridLayout grid = new GridLayout();
    grid.marginHeight = 0;
    grid.marginWidth = 0;
    c.setLayout(grid);
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    DataGrid table = DataSetFactory.getDataGrid(c, dataSet);
    if (null != updater) {
        updater.addUpdateListener(table);
    }
    table.getControl().setLayoutData(gd);
    item.setControl(c);
    folder.setSelection(item);
    lastSelectedTab = 1;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) CTabFolder(org.eclipse.swt.custom.CTabFolder) CTabFolder2Adapter(org.eclipse.swt.custom.CTabFolder2Adapter) GraphComposite(org.eclipse.linuxtools.systemtap.graphing.ui.widgets.GraphComposite) Composite(org.eclipse.swt.widgets.Composite) DataGrid(org.eclipse.linuxtools.systemtap.graphing.ui.datadisplay.DataGrid) CTabFolderEvent(org.eclipse.swt.custom.CTabFolderEvent) CTabItem(org.eclipse.swt.custom.CTabItem) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 3 with CTabFolderEvent

use of org.eclipse.swt.custom.CTabFolderEvent in project linuxtools by eclipse.

the class GraphSelectorEditor method createPartControl.

/**
 * This method creates the framework for what will be displayed by this dialog box.
 * @param parent The composite that will contain all the elements from this dialog
 */
@Override
public void createPartControl(Composite parent) {
    FormData data2 = new FormData();
    data2.left = new FormAttachment(0, 0);
    data2.top = new FormAttachment(0, 0);
    data2.right = new FormAttachment(100, 0);
    data2.bottom = new FormAttachment(100, 0);
    Composite cmpGraph = new Composite(parent, SWT.NONE);
    cmpGraph.setLayoutData(data2);
    // This is for the tab view
    cmpGraph.setLayout(new FormLayout());
    // Create the folder for all of the script sets, so it takes up all of the parent composite
    scriptFolder = new CTabFolder(cmpGraph, SWT.NONE);
    FormData data = new FormData();
    data.top = new FormAttachment(0, 0);
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.bottom = new FormAttachment(100, 0);
    scriptFolder.setLayoutData(data);
    scriptFolder.addCTabFolder2Listener(new CTabFolder2Adapter() {

        @Override
        public void close(CTabFolderEvent e) {
            displaySets.remove(scriptFolder.indexOf((CTabItem) e.item));
        }
    });
}
Also used : FormData(org.eclipse.swt.layout.FormData) FormLayout(org.eclipse.swt.layout.FormLayout) CTabFolder(org.eclipse.swt.custom.CTabFolder) CTabFolder2Adapter(org.eclipse.swt.custom.CTabFolder2Adapter) Composite(org.eclipse.swt.widgets.Composite) CTabFolderEvent(org.eclipse.swt.custom.CTabFolderEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 4 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 5 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)

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