/** * {@inheritDoc} This method should be called after <code>setConfiguration</code> has been invoked * on this object. */ @Override protected void setup() { final TabFolder _tabFolder = new TabFolder(parent, SWT.TOP | SWT.BORDER); final TabItem _sliceInfoTab = new TabItem(_tabFolder, SWT.NONE); final Composite _sliceInfoTabComposite = new Composite(_tabFolder, SWT.NONE); setupSliceInfoUI(_sliceInfoTabComposite); _sliceInfoTabComposite.pack(); _sliceInfoTab.setControl(_sliceInfoTabComposite); _sliceInfoTab.setText("Slice"); _sliceInfoTab.setToolTipText("Configure slice properties."); final TabItem _dependenceDATab = new TabItem(_tabFolder, SWT.NONE); final Composite _dependenceDAComposite = new Composite(_tabFolder, SWT.NONE); setupDependenceDepUI(_dependenceDAComposite); _dependenceDAComposite.pack(); _dependenceDATab.setControl(_dependenceDAComposite); _dependenceDATab.setText("General Dependence"); _dependenceDATab.setToolTipText("Configure control and synchronization dependences."); final TabItem _divergenceDATab = new TabItem(_tabFolder, SWT.NONE); final Composite _divergenceDAComposite = new Composite(_tabFolder, SWT.NONE); setupDivergenceDepUI(_divergenceDAComposite); _divergenceDAComposite.pack(); _divergenceDATab.setControl(_divergenceDAComposite); _divergenceDATab.setText("Divergence"); _divergenceDATab.setToolTipText("Configure divergence dependences."); final TabItem _interferenceDATab = new TabItem(_tabFolder, SWT.NONE); final Composite _interferenceDATabComposite = new Composite(_tabFolder, SWT.NONE); setupInteferenceDepUI(_interferenceDATabComposite); _interferenceDATabComposite.pack(); _interferenceDATab.setControl(_interferenceDATabComposite); _interferenceDATab.setText("Intereference"); _interferenceDATab.setToolTipText("Configure interference dependences."); final TabItem _readyDATab = new TabItem(_tabFolder, SWT.NONE); final Composite _readyDATabComposite = new Composite(_tabFolder, SWT.NONE); setupReadyDepUI(_readyDATabComposite); _readyDATabComposite.pack(); _readyDATab.setControl(_readyDATabComposite); _readyDATab.setText("Ready"); _readyDATab.setToolTipText("Configure ready dependences."); _tabFolder.pack(); parent.pack(); }
public static void labelTab() { TabItem tab = new TabItem(folder, SWT.CLOSE); tab.setText("A Label"); // Text on the tab tab.setToolTipText("A simple label"); Label label = new Label(folder, SWT.CENTER); label.setText("Label text"); tab.setControl(label); }
/** * Initializes a tab for the given part. Sets the text, icon, tool tip, etc. This will also be * called whenever a relevant property changes in the part to reflect those changes in the tab. * Subclasses may override to change the appearance of tabs for a particular part. * * @param tabItem tab for the part * @param part the part being displayed */ protected void initTab(TabItem tabItem, IPresentablePart part) { tabItem.setText(part.getName()); tabItem.setToolTipText(part.getTitleToolTip()); Image tabImage = part.getTitleImage(); if (tabImage != tabItem.getImage()) { tabItem.setImage(tabImage); } }
public static void scribbleTab() { TabItem tab = new TabItem(folder, SWT.CLOSE); tab.setText("Scribble"); tab.setToolTipText("Simple graphics: drawing"); final Canvas canvas = new Canvas(folder, SWT.NONE); ScribbleMouseListener sml = new ScribbleMouseListener(); canvas.addMouseListener(sml); canvas.addMouseMoveListener(sml); tab.setControl(canvas); }
public TabItem createOn(TabFolder f) { if (tab.canBeVisible()) { TabItem ti = new TabItem(f, SWT.NONE); ti.setText(text); if (tip != null) ti.setToolTipText(tip); if (image != null) ti.setImage(image); ti.setControl(comp); ti.setData(tab); return ti; } return null; }
public static void sliderTab() { TabItem tab = new TabItem(folder, SWT.CLOSE); tab.setText("Sliders and Progress bars"); tab.setToolTipText("Tied Slider to ProgressBar"); Composite composite = new Composite(folder, SWT.NONE); composite.setLayout(new GridLayout(2, true)); final Slider slider = new Slider(composite, SWT.HORIZONTAL); final ProgressBar progress = new ProgressBar(composite, SWT.HORIZONTAL); slider.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { progress.setSelection(slider.getSelection()); } }); tab.setControl(composite); }
public static void buttonTab() { TabItem tab = new TabItem(folder, SWT.CLOSE); tab.setText("Buttons"); tab.setToolTipText("Different kinds of Buttons"); Composite composite = new Composite(folder, SWT.NONE); composite.setLayout(new GridLayout(4, true)); for (int dir : new int[] {SWT.UP, SWT.RIGHT, SWT.LEFT, SWT.DOWN}) { Button b = new Button(composite, SWT.ARROW | dir); b.addListener(SWT.MouseDown, listener); } newButton(composite, SWT.CHECK, "Check button"); newButton(composite, SWT.PUSH, "Push button"); newButton(composite, SWT.RADIO, "Radio button"); newButton(composite, SWT.TOGGLE, "Toggle button"); newButton(composite, SWT.FLAT, "Flat button"); tab.setControl(composite); }
public static void directoryDialogTab() { TabItem tab = new TabItem(folder, SWT.CLOSE); tab.setText("Directory Dialog"); tab.setToolTipText("Select a directory"); final Button b = new Button(folder, SWT.PUSH); b.setText("Select a Directory"); b.addListener( SWT.MouseDown, new Listener() { public void handleEvent(Event e) { DirectoryDialog dd = new DirectoryDialog(shell); String path = dd.open(); if (path != null) b.setText(path); } }); tab.setControl(b); }
public static void browserTab() { TabItem tab = new TabItem(folder, SWT.CLOSE); tab.setText("A Browser"); tab.setToolTipText("A Web browser"); Browser browser = null; try { browser = new Browser(folder, SWT.NONE); } catch (SWTError e) { Label label = new Label(folder, SWT.BORDER); label.setText("Could not initialize browser"); tab.setControl(label); } if (browser != null) { browser.setUrl("http://www.mindview.net"); tab.setControl(browser); } }
@Override public void doSetValue(Object value) { final Object oldValue = doGetValue(); if (attribute.equals(Constants.ATTR_IMAGE)) { item.setImage((Image) value); } else if (attribute.equals(Constants.ATTR_TEXT)) { item.setText((String) value); } else if (attribute.equals(Constants.ATTR_TOOLTIP)) { if (item instanceof TableColumn) { ((TableColumn) item).setToolTipText((String) value); } if (item instanceof TreeColumn) { ((TreeColumn) item).setToolTipText((String) value); } if (item instanceof ToolItem) { ((ToolItem) item).setToolTipText((String) value); } if (item instanceof TabItem) { ((TabItem) item).setToolTipText((String) value); } } else if (attribute.equals(Constants.ATTR_ALIGNMENT)) { if (item instanceof TableColumn) { ((TableColumn) item).setAlignment((Integer) value); } if (item instanceof TreeColumn) { ((TreeColumn) item).setAlignment((Integer) value); } } else if (attribute.equals(Constants.ATTR_WIDTH)) { if (item instanceof TableColumn) { ((TableColumn) item).setWidth((Integer) value); } if (item instanceof TreeColumn) { ((TreeColumn) item).setWidth((Integer) value); } if (item instanceof ToolItem) { ((ToolItem) item).setWidth((Integer) value); } } else if (attribute.equals(Constants.ATTR_ENABLED)) { if (item instanceof ToolItem) { ((ToolItem) item).setEnabled(value == Boolean.TRUE); } } fireValueChange(Diffs.createValueDiff(oldValue, value)); }
/** Creates the "Example" widgets. */ void createExampleWidgets() { /* Compute the widget style */ int style = getDefaultStyle(); if (topButton.getSelection()) style |= SWT.TOP; if (bottomButton.getSelection()) style |= SWT.BOTTOM; if (borderButton.getSelection()) style |= SWT.BORDER; /* Create the example widgets */ tabFolder1 = new TabFolder(tabFolderGroup, style); for (int i = 0; i < TabItems1.length; i++) { TabItem item = new TabItem(tabFolder1, SWT.NONE); item.setText(TabItems1[i]); item.setToolTipText(ControlExample.getResourceString("Tooltip", new String[] {TabItems1[i]})); Text content = new Text(tabFolder1, SWT.WRAP | SWT.MULTI); content.setText(ControlExample.getResourceString("TabItem_content") + ": " + i); item.setControl(content); } }
/** * Add a new (SQL) Execution Tab * * @param AbstractSQLExecution */ public void addSQLExecution(AbstractSQLExecution sqlExecution) { if (_tabFolder == null || _tabFolder.isDisposed()) { clearParent(); // create tab folder for different sessions _tabFolder = new TabFolder(_parent, SWT.NULL); _parent.layout(); _parent.redraw(); } // create tab _lastTabNumber = _lastTabNumber + 1; final TabItem tabItem = new TabItem(_tabFolder, SWT.NULL); // set tab text & tooltip String labelText = "" + _lastTabNumber; tabItem.setText(labelText); tabItem.setData("tabLabel", labelText); tabItem.setToolTipText(TextUtil.getWrappedText(sqlExecution.getSqlStatement())); // create composite for our result Composite composite = new Composite(_tabFolder, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 1; layout.marginLeft = 0; layout.horizontalSpacing = 0; layout.verticalSpacing = 2; layout.marginWidth = 0; layout.marginHeight = 0; composite.setLayout(layout); composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); tabItem.setControl(composite); tabItem.setData(sqlExecution); tabItem.addDisposeListener( new DisposeListener() { public void widgetDisposed(final DisposeEvent e) { BusyIndicator.showWhile( Display.getCurrent(), new Runnable() { public void run() { // stop all sql execution if still running TabItem tabItem = (TabItem) e.getSource(); AbstractSQLExecution sqlExecution = (AbstractSQLExecution) tabItem.getData(); sqlExecution.stop(); tabItem.setData(null); if (_tabFolder != null && !_tabFolder.isDisposed()) { if (_tabFolder.getItemCount() == 0) { // this is last tab.. clearParent(); setDefaultMessage(); } } else if (_tabFolder.isDisposed()) { clearParent(); setDefaultMessage(); } } }); } }); // add sql statement, first create temp label to calculate correct size String sqlStatement = sqlExecution.getSqlStatement(); int labelHeight = 60; int labelStyle = SWT.WRAP | SWT.MULTI; Text tmpLabel = new Text(composite, labelStyle); tmpLabel.setText(TextUtil.removeLineBreaks(sqlExecution.getSqlStatement())); tmpLabel.setLayoutData(new FillLayout()); int parentWidth = _parent.getClientArea().width; Point idealSize = tmpLabel.computeSize(parentWidth - 30, SWT.DEFAULT); if (idealSize.y <= 60) { // we don't need a scroll bar. minimize labelHeight = idealSize.y; } else { // we need a scroll bar labelStyle = SWT.WRAP | SWT.MULTI | SWT.V_SCROLL; } tmpLabel.dispose(); // now create real label // create spanned cell for table data Composite headerComposite = new Composite(composite, SWT.FILL); headerComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); GridLayout hLayout = new GridLayout(); hLayout.numColumns = 2; hLayout.marginLeft = 0; hLayout.horizontalSpacing = 0; hLayout.verticalSpacing = 0; hLayout.marginWidth = 0; hLayout.marginHeight = 0; headerComposite.setLayout(hLayout); Text label = new Text(headerComposite, labelStyle); label.setEditable(false); label.setBackground(_parent.getBackground()); label.setText(TextUtil.removeLineBreaks(sqlStatement)); label.setToolTipText(TextUtil.getWrappedText(sqlStatement)); GridData labelGridData = new GridData(SWT.FILL, SWT.TOP, true, false); labelGridData.heightHint = labelHeight; label.setLayoutData(labelGridData); // add action bar ToolBarManager toolBarMgr = new ToolBarManager(SWT.FLAT); toolBarMgr.createControl(headerComposite); toolBarMgr.add(new CloseSQLResultTab(tabItem)); toolBarMgr.update(true); GridData gid = new GridData(); gid.horizontalAlignment = SWT.RIGHT; gid.verticalAlignment = SWT.TOP; toolBarMgr.getControl().setLayoutData(gid); // add detail composite to show progress bar and results Composite detailComposite = new Composite(composite, SWT.FILL); detailComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); sqlExecution.setComposite(detailComposite); sqlExecution.setParentTab(tabItem); sqlExecution.startExecution(); // set new tab as the active one _tabFolder.setSelection(_tabFolder.getItemCount() - 1); // refresh view composite.layout(); _tabFolder.layout(); _tabFolder.redraw(); // bring this view to top of the view stack getSite().getPage().bringToTop(this); }
/** * Creates all the tabs in the detail pane to display the information for a given node. * * @param composite * @param node */ public static void createTabs(Composite composite, INode node) { List<IDetailTab> tabs = getTabs(node); if (tabs == null || tabs.size() == 0) { // no detail found.. Label label = new Label(composite, SWT.FILL); label.setText( Messages.getString("DatabaseDetailView.Tab.Unavailable") + " " + node.getLabelText()); label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); return; } // create tabs TabFolder tabFolder = new TabFolder(composite, SWT.NULL); // only init tabs when the tab becomes active tabFolder.addSelectionListener( new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { // noop } public void widgetSelected(SelectionEvent e) { TabItem tabItem = (TabItem) e.item; IDetailTab tab = (IDetailTab) tabItem.getData(); if (tab != null) { // create composite on tab and fill it.. Composite detailComposite = new Composite(tabItem.getParent(), SWT.FILL); tabItem.setControl(detailComposite); detailComposite.setLayout(new FillLayout()); tab.fillComposite(detailComposite); detailComposite.layout(); // store tab name, so we can reselect when other node is // chosen DetailTabManager.setActiveTabName(tabItem.getText()); } } }); // add tabs to folder int tabIndex = 0; for (IDetailTab detailTab : tabs) { // create tab TabItem tabItem = new TabItem(tabFolder, SWT.NULL); tabItem.setText(detailTab.getLabelText()); tabItem.setToolTipText(detailTab.getLabelToolTipText()); // store tab so we can fill later tabItem.setData(detailTab); // reselect same tab as was previous selected if (tabItem.getText() != null && _activeTabName != null) { if (tabItem.getText().equals(_activeTabName)) { tabFolder.setSelection(tabIndex); } } tabIndex++; } // load data for active tab, default to first one if none is selected tabIndex = tabFolder.getSelectionIndex(); if (tabIndex == -1) { tabIndex = 0; } TabItem tabItem = tabFolder.getItem(tabIndex); if (tabItem != null) { Composite detailComposite = new Composite(tabItem.getParent(), SWT.FILL); tabItem.setControl(detailComposite); detailComposite.setLayout(new FillLayout()); IDetailTab tab = (IDetailTab) tabItem.getData(); tab.fillComposite(detailComposite); detailComposite.layout(); } tabFolder.layout(); }
/** Create contents of the window. */ protected void createContents() { shlRigers = new Shell(); shlRigers.setSize(649, 316); shlRigers.setText("RIGERS"); shlRigers.setLayout(new FormLayout()); Composite composite = new Composite(shlRigers, SWT.NONE); composite.setLayout(new FillLayout(SWT.HORIZONTAL)); FormData fd_composite = new FormData(); fd_composite.left = new FormAttachment(0); fd_composite.top = new FormAttachment(0); fd_composite.bottom = new FormAttachment(0, 276); fd_composite.right = new FormAttachment(0, 643); composite.setLayoutData(fd_composite); TabFolder tabFolder = new TabFolder(composite, SWT.NONE); TabItem tbtmViewData = new TabItem(tabFolder, SWT.NONE); tbtmViewData.setToolTipText(""); tbtmViewData.setText("InsertData"); Composite composite_1 = new Composite(tabFolder, SWT.NONE); tbtmViewData.setControl(composite_1); composite_1.setLayout(new FillLayout(SWT.VERTICAL)); Group grpCompartimento = new Group(composite_1, SWT.NONE); grpCompartimento.setText("Compartimento"); grpCompartimento.setLayout(new GridLayout(7, false)); Label lblId = new Label(grpCompartimento, SWT.NONE); lblId.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1)); lblId.setText("ID"); Spinner spinner = new Spinner(grpCompartimento, SWT.BORDER); GridData gd_spinner = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_spinner.widthHint = 20; spinner.setLayoutData(gd_spinner); new Label(grpCompartimento, SWT.NONE); Label lblNome = new Label(grpCompartimento, SWT.NONE); lblNome.setText("Nome"); txtAsd = new Text(grpCompartimento, SWT.BORDER); GridData gd_txtAsd = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_txtAsd.widthHint = 150; txtAsd.setLayoutData(gd_txtAsd); Label lblNewLabel = new Label(grpCompartimento, SWT.NONE); lblNewLabel.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN)); lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1)); lblNewLabel.setText("OK"); Button btnInsert = new Button(grpCompartimento, SWT.NONE); btnInsert.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); btnInsert.setAlignment(SWT.LEFT); btnInsert.setText("INSERT"); Group grpEdificio = new Group(composite_1, SWT.NONE); grpEdificio.setText("Edificio"); grpEdificio.setLayout(new GridLayout(8, false)); Label lblId_1 = new Label(grpEdificio, SWT.NONE); lblId_1.setText("ID"); Spinner spinner_1 = new Spinner(grpEdificio, SWT.BORDER); GridData gd_spinner_1 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_spinner_1.widthHint = 20; gd_spinner_1.minimumWidth = 20; spinner_1.setLayoutData(gd_spinner_1); spinner_1.setBounds(0, 0, 440, 79); Label lblCompartimento = new Label(grpEdificio, SWT.NONE); lblCompartimento.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblCompartimento.setText("Compartimento"); Combo combo = new Combo(grpEdificio, SWT.NONE); combo.setItems(new String[] {"Comp1", "Comp2", "Comp3"}); GridData gd_combo = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); gd_combo.widthHint = 100; combo.setLayoutData(gd_combo); Label lblIndirizzo = new Label(grpEdificio, SWT.NONE); lblIndirizzo.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblIndirizzo.setText("Indirizzo"); text = new Text(grpEdificio, SWT.BORDER); GridData gd_text = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); gd_text.widthHint = 200; text.setLayoutData(gd_text); Label lblOk = new Label(grpEdificio, SWT.NONE); lblOk.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN)); lblOk.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1)); lblOk.setText("OK"); Button btnInsert_1 = new Button(grpEdificio, SWT.NONE); btnInsert_1.setText("INSERT"); new Label(grpEdificio, SWT.NONE); new Label(grpEdificio, SWT.NONE); new Label(grpEdificio, SWT.NONE); new Label(grpEdificio, SWT.NONE); new Label(grpEdificio, SWT.NONE); new Label(grpEdificio, SWT.NONE); new Label(grpEdificio, SWT.NONE); new Label(grpEdificio, SWT.NONE); TabItem tbtmInsertData = new TabItem(tabFolder, SWT.NONE); tbtmInsertData.setText("View Data"); Menu menu_1 = new Menu(shlRigers, SWT.BAR); shlRigers.setMenuBar(menu_1); MenuItem mntmNewSubmenu = new MenuItem(menu_1, SWT.CASCADE); mntmNewSubmenu.setText("File"); Menu menu_2 = new Menu(mntmNewSubmenu); mntmNewSubmenu.setMenu(menu_2); MenuItem mntmNewItem_1 = new MenuItem(menu_2, SWT.NONE); mntmNewItem_1.setText("Connect..."); new MenuItem(menu_2, SWT.SEPARATOR); MenuItem mntmNewItem_2 = new MenuItem(menu_2, SWT.NONE); mntmNewItem_2.setText("Quit"); }