private void turnToPage(SelectionEvent event) { final TabItem item = (TabItem) event.item; TabFolder folder = item.getParent(); SearchPageDescriptor descriptor = (SearchPageDescriptor) item.getData("descriptor"); // $NON-NLS-1$ if (item.getControl() == null) { item.setControl(createPageControl(folder, descriptor)); } Control oldControl = folder.getItem(fCurrentIndex).getControl(); Point oldSize = oldControl.getSize(); Control newControl = item.getControl(); Point newSize = newControl.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); resizeDialogIfNeeded(oldSize, newSize); ISearchPage oldPage = fCurrentPage; if (oldPage != null) { oldPage.setVisible(false); } fCurrentPage = descriptor.getPage(); fDialogSettings.put(STORE_PREVIOUS_PAGE, descriptor.getId()); fCurrentIndex = folder.getSelectionIndex(); setPerformActionEnabled(fCurrentPage != null); if (fCurrentPage != null) { fCurrentPage.setVisible(true); Control pageControl = fCurrentPage.getControl(); if (pageControl instanceof Composite) ((Composite) pageControl).layout(false, true); } fReplaceButton.setVisible(fCurrentPage instanceof IReplacePage); notifyPageChanged(); }
public void testFlatSectionAroundNestedSectionLayoutDecorator() { SwtMetawidget metawidget = new SwtMetawidget(new Shell(SwtMetawidgetTests.TEST_DISPLAY, SWT.NONE), SWT.NONE); metawidget.setMetawidgetLayout( new SeparatorLayoutDecorator( new SeparatorLayoutDecoratorConfig() .setLayout( new TabFolderLayoutDecorator( new TabFolderLayoutDecoratorConfig().setLayout(new GridLayout()))))); metawidget.setToInspect(new Baz()); Composite composite = (Composite) metawidget.getChildren()[0]; assertEquals(((org.eclipse.swt.layout.GridLayout) composite.getLayout()).marginWidth, 0); assertEquals("Foo", ((Label) composite.getChildren()[0]).getText()); assertEquals((composite.getChildren()[1].getStyle() & SWT.SEPARATOR), SWT.SEPARATOR); TabFolder innerTabFolder = (TabFolder) metawidget.getChildren()[1]; assertEquals("Bar", innerTabFolder.getItem(0).getText()); Composite innerPanel = (Composite) innerTabFolder.getChildren()[0]; assertEquals("Abc:", ((Label) innerPanel.getChildren()[0]).getText()); assertTrue(innerPanel.getChildren()[1] instanceof Text); assertEquals(2, innerPanel.getChildren().length); composite = (Composite) metawidget.getChildren()[2]; assertEquals(((org.eclipse.swt.layout.GridLayout) composite.getLayout()).marginWidth, 0); assertEquals("Baz", ((Label) composite.getChildren()[0]).getText()); assertEquals((composite.getChildren()[1].getStyle() & SWT.SEPARATOR), SWT.SEPARATOR); assertEquals("Def:", ((Label) metawidget.getChildren()[3]).getText()); assertTrue(metawidget.getChildren()[4] instanceof Button); assertEquals((metawidget.getChildren()[4].getStyle() & SWT.CHECK), SWT.CHECK); assertEquals(5, metawidget.getChildren().length); }
/** * Sets the control that is used to fill the client area of the tab folder when the user selects * the tab item. * * <p> * * @param control the new control (or null) * @exception IllegalArgumentException * <ul> * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed * <li>ERROR_INVALID_PARENT - if the control is not in the same widget tree * </ul> * * @exception SWTException * <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver * </ul> */ public void setControl(Control control) { checkWidget(); if (control != null) { if (control.isDisposed()) { error(SWT.ERROR_INVALID_ARGUMENT); } if (control.parent != parent) { error(SWT.ERROR_INVALID_PARENT); } } if (this.control != null && this.control.isDisposed()) { this.control = null; } Control oldControl = this.control; Control newControl = control; this.control = control; int index = parent.indexOf(this); if (index != parent.getSelectionIndex()) { if (newControl != null) { newControl.setVisible(false); } } else { if (newControl != null) { newControl.setBounds(parent.getClientArea()); newControl.setVisible(true); } if (oldControl != null) { oldControl.setVisible(false); } } }
/** This operation sets the input of the resourceTreeViewer. */ private void setTreeContent() { // If currently playing, stop. if (playAction.isInPlayState()) { playAction.stop(); } // If there are no files, but there are images, set to the images tab. // Otherwise, default to the files tab. if (textList.isEmpty() && !imageList.isEmpty()) { resourceTreeViewer.setInput(imageList); tabFolder.setSelection(1); playable = true; // Select the first available image resource. resourceTreeViewer.setSelection(new StructuredSelection(imageList.get(0)), true); } else { resourceTreeViewer.setInput(textList); tabFolder.setSelection(0); playable = false; // Select the first available text resource. if (!textList.isEmpty()) { resourceTreeViewer.setSelection(new StructuredSelection(textList.get(0)), true); } } return; }
private void createContents() { TabFolder tabFolder = new TabFolder(this, SWT.NONE); tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); CommonSelectorComposite commonCompositeRef = new CommonSelectorComposite(tabFolder, SWT.NONE, false, true); commonCompositeRef.getTreeViewer().getTree().setLinesVisible(false); commonCompositeRef.getTreeViewer().getTree().setHeaderVisible(false); commonCompositeRef.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); commonCompositeRef.setDataSet(this.dataset); commonCompositeRef.getTreeViewer().expandAll(); TabItem tabItem1 = new TabItem(tabFolder, SWT.NONE); tabItem1.setText("Ref"); tabItem1.setControl(commonCompositeRef); if (hasLabel) { CommonSelectorComposite commonCompositeLabel = new CommonSelectorComposite(tabFolder, SWT.NONE, false, true); commonCompositeLabel.getTreeViewer().getTree().setLinesVisible(false); commonCompositeLabel.getTreeViewer().getTree().setHeaderVisible(false); commonCompositeLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); commonCompositeLabel.setDataSet(this.dataset); commonCompositeLabel.getTreeViewer().expandAll(); TabItem tabItem2 = new TabItem(tabFolder, SWT.NONE); tabItem2.setText("Label"); tabItem2.setControl(commonCompositeLabel); } tabFolder.addSelectionListener( new SelectionListener() { public void widgetDefaultSelected(SelectionEvent event) { selectedRef = "Ref".equals(((TabItem) event.item).getText()); } public void widgetSelected(SelectionEvent event) { selectedRef = "Ref".equals(((TabItem) event.item).getText()); } }); Composite composite = new Composite(this, SWT.NONE); GridData gd_composite = new GridData(SWT.FILL, SWT.FILL, true, false); composite.setLayoutData(gd_composite); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 2; gridLayout.marginWidth = 0; gridLayout.marginHeight = 0; composite.setLayout(gridLayout); Label label = new Label(composite, SWT.NONE); label.setText("属性值"); displayText = new Text(composite, SWT.BORDER); displayText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); displayText.setEditable(false); displayText.setBackground(displayText.getParent().getBackground()); displayText.setText(this.propertyItem.getValue()); }
protected void validate() { // TODO Validation if (folder.getSelectionIndex() == 0) { name = nameText.getText(); userName = userNameText.getText(); password = passwordText.getText(); if (hostText.getText().equals(_BLANK_)) { showError(Messages.DefaultConnectionWizardPage_Blank_Invalid); return; } try { InetAddress.getByName(hostText.getText()); } catch (UnknownHostException e) { showError(e.getMessage()); return; } String host = hostText.getText(); if (portText.getText().equals(_BLANK_)) { showError(Messages.DefaultConnectionWizardPage_Blank_Invalid); return; } int port; try { port = Integer.parseInt(portText.getText()); if (port < 1 || port > 0xffff) { throw new NumberFormatException(); } } catch (NumberFormatException e) { showError(e.getMessage()); return; } url = SIMPLE_PREFIX + host + ":" + port + SIMPLE_SUFFIX; // $NON-NLS-1$ } else if (folder.getSelectionIndex() == 1) { name = advancedNameText.getText(); userName = advancedUserNameText.getText(); password = advancedPasswordText.getText(); if (urlText.getText().equals(_BLANK_)) { showError(Messages.DefaultConnectionWizardPage_Blank_Invalid); return; } url = urlText.getText(); } // now validate name if (name == null || nameTaken(name)) { showError(Messages.DefaultConnectionWizardPage_Name_In_Use); return; } try { getConnection(); } catch (CoreException ce) { showError(ce.getMessage()); return; } clearMessage(); }
public final void execute( final int keyLength, final int keyPos, final int overlayIndex, final boolean resetShift, final boolean executeCalc, final boolean whichTab, final boolean activateOverlay) { if (keyLength > 0) { if (keyLength == 1) { button3.setSelection(true); button4.setSelection(false); } else { button3.setSelection(false); button4.setSelection(true); } polyOnOffSelected(null); spinner1.setSelection(keyLength); changedVigOptions(); if (keyPos < 0) { text = getEditorText(); recalcGraph(); } } if (keyPos > -1) { spinner2.setSelection(keyPos); changedVigOptions(); text = getEditorText(); recalcGraph(); } if (overlayIndex > -1 && overlayIndex < combo1.getVisibleItemCount() - 1) { combo1.select(overlayIndex); } if (resetShift) { myGraph.getFrequencyGraph().resetDrag(); } if (executeCalc) { if (checkEditor()) { text = getEditorText(); selectAppropriateAlphabet(); recalcGraph(); } } if (whichTab) { tabFolder1.setSelection(0); } else { tabFolder1.setSelection(1); } btnReferenceTools.setSelection(activateOverlay); myGraph.setOverlayActivated(btnReferenceTools.getSelection()); myGraph.redraw(); }
@Override public void handleMessage(int code, Object data) { switch (code) { // First re-check visibility of all tabs. // While tab deletion can be made on the fly, // tabs adding will be made by re-creation // of all elements, to preserve their order case ICPropertyTab.MANAGEDBUILDSTATE: if (folder == null) { if (itabs == null || itabs.size() == 0) return; ICPropertyTab t = itabs.get(0).tab; if (!t.canBeVisible()) t.handleTabEvent(ICPropertyTab.VISIBLE, null); return; } boolean willAdd = false; TabItem[] ts = folder.getItems(); int x = folder.getSelectionIndex(); String currHeader = (x == -1) ? null : ts[x].getText(); for (int i = 0; i < itabs.size(); i++) { InternalTab itab = itabs.get(i); TabItem ti = null; for (TabItem element2 : ts) { if (element2.isDisposed()) continue; if (element2.getData() == itab.tab) { ti = element2; break; } } if (itab.tab.canBeVisible()) { if (ti == null) { willAdd = true; break; } } else { if (ti != null) ti.dispose(); } } // in case of new tab added, // we have to dispose and re-create all tabs if (willAdd) { for (int j = 0; j < ts.length; j++) if (ts[j] != null && !ts[j].isDisposed()) ts[j].dispose(); TabItem ti = null; for (int i = 0; i < itabs.size(); i++) { InternalTab itab = itabs.get(i); if (itab.tab.canBeVisible()) { TabItem currTI = itab.createOn(folder); if (currHeader != null && currHeader.equals(itab.text)) ti = currTI; } } if (ti != null) folder.setSelection(ti); } break; } }
public static Rectangle calculatePageBounds(TabFolder folder) { if (folder == null) { return new Rectangle(0, 0, 0, 0); } Rectangle bounds = folder.getBounds(); Rectangle offset = folder.getClientArea(); bounds.x += offset.x; bounds.y += offset.y; bounds.width = offset.width; bounds.height = offset.height; return bounds; }
/** * Ueberschrieben, um einen DisposeListener an das Composite zu haengen. * * @see de.willuhn.jameica.gui.parts.TablePart#paint(org.eclipse.swt.widgets.Composite) */ public synchronized void paint(Composite parent) throws RemoteException { final TabFolder folder = new TabFolder(parent, SWT.NONE); folder.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); TabGroup tab = new TabGroup(folder, i18n.tr("Anzeige einschränken")); ColumnLayout cols = new ColumnLayout(tab.getComposite(), 2); { this.left = new SimpleContainer(cols.getComposite()); Input t = this.getText(); this.left.addInput(t); // Duerfen wir erst nach dem Zeichnen t.getControl().addKeyListener(new DelayedAdapter()); this.left.addInput(this.getKonto()); } { Container right = new SimpleContainer(cols.getComposite()); right.addInput(this.getRange()); MultiInput range = new MultiInput(this.getFrom(), this.getTo()); right.addInput(range); } this.buttons.addButton( i18n.tr("Aktualisieren"), new Action() { public void handleAction(Object context) throws ApplicationException { handleReload(true); } }, null, true, "view-refresh.png"); this.buttons.paint(parent); // Erstbefuellung GenericIterator items = getList( getKonto().getValue(), (Date) getFrom().getValue(), (Date) getTo().getValue(), (String) getText().getValue()); if (items != null) { items.begin(); while (items.hasNext()) addItem(items.next()); } super.paint(parent); }
/** @see de.willuhn.jameica.gui.Part#paint(org.eclipse.swt.widgets.Composite) */ public void paint(Composite parent) throws RemoteException { try { if (this.konto == null) { if (tiny) { ColumnLayout layout = new ColumnLayout(parent, 2); Container left = new SimpleContainer(layout.getComposite()); left.addInput(this.getKontoAuswahl()); Container right = new SimpleContainer(layout.getComposite()); right.addInput(this.getRange()); } else { final TabFolder folder = new TabFolder(parent, SWT.NONE); folder.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); TabGroup tab = new TabGroup(folder, i18n.tr("Anzeige einschränken")); tab.addInput(this.getKontoAuswahl()); tab.addInput(this.getRange()); ButtonArea buttons = new ButtonArea(); buttons.addButton( i18n.tr("Aktualisieren"), new Action() { /** @see de.willuhn.jameica.gui.Action#handleAction(java.lang.Object) */ public void handleAction(Object context) throws ApplicationException { reloadListener.handleEvent(new Event()); } }, null, true, "view-refresh.png"); buttons.paint(parent); } } else { Container container = new SimpleContainer(parent); container.addInput(this.getRange()); } this.chart = new LineChart(); this.reloadListener.handleEvent(null); // einmal initial ausloesen chart.paint(parent); } catch (RemoteException re) { throw re; } catch (Exception e) { Logger.error("unable to paint chart", e); Application.getMessagingFactory() .sendMessage( new StatusBarMessage( i18n.tr("Fehler beim Anzeigen des Saldo-Verlaufs"), StatusBarMessage.TYPE_ERROR)); } }
/** * Opens the specified tab of preferences dialog * * @param tabIndex */ public void openTab(int tabIndex) { // widgets are created on demand createShell(); loadPreferences(); tabFolder.setSelection(tabIndex); // select ports text by default if ports tab is opened // this is needed for PortsFetcher that uses this tab as its preferences if (tabFolder.getItem(tabIndex) == portsTabItem) { portsText.forceFocus(); } super.open(); }
protected void adjustJARSigningTabVisibility() { IDialogSettings settings = getDialogSettings(); if (useJARFormat()) { if (fTabFolder.getItemCount() < 3) { createJARSigningTab(fTabFolder); fJARSiginingTab.initialize(settings); } } else { if (fTabFolder.getItemCount() >= 3) { fJARSiginingTab.saveSettings(settings); fTabFolder.getItem(2).dispose(); } } }
private void saveDialogSettings() { IDialogSettings settings; IDialogSettings section; settings = SystemBrowserPlugin.getDefault().getDialogSettings(); section = settings.addNewSection("PoolFilterDialog"); section.put("target", targetCombo.getText()); section.put("poolId", poolIdText.getText().trim()); section.put("tab", tabFolder.getSelectionIndex()); section.put("signalNumberFrom", signalNumberFromText.getText().trim()); section.put("signalNumberTo", signalNumberToText.getText().trim()); section.put("signalOwnerId", signalOwnerIdText.getText().trim()); section.put("signalOwnerName", signalOwnerNameText.getText().trim()); section.put("signalSenderId", signalSenderIdText.getText().trim()); section.put("signalSenderName", signalSenderNameText.getText().trim()); section.put("signalAddresseeId", signalAddresseeIdText.getText().trim()); section.put("signalAddresseeName", signalAddresseeNameText.getText().trim()); section.put("signalSizeFrom", signalSizeFromText.getText().trim()); section.put("signalSizeTo", signalSizeToText.getText().trim()); section.put("signalBufferSizeFrom", signalBufferSizeFromText.getText().trim()); section.put("signalBufferSizeTo", signalBufferSizeToText.getText().trim()); section.put("signalAddressFrom", signalAddressFromText.getText().trim()); section.put("signalAddressTo", signalAddressToText.getText().trim()); section.put("signalStatus", signalStatusCombo.getText()); section.put("signalNumberExclude", signalNumberCheckbox.getSelection()); section.put("signalOwnerIdExclude", signalOwnerIdCheckbox.getSelection()); section.put("signalOwnerNameExclude", signalOwnerNameCheckbox.getSelection()); section.put("signalSenderIdExclude", signalSenderIdCheckbox.getSelection()); section.put("signalSenderNameExclude", signalSenderNameCheckbox.getSelection()); section.put("signalAddresseeIdExclude", signalAddresseeIdCheckbox.getSelection()); section.put("signalAddresseeNameExclude", signalAddresseeNameCheckbox.getSelection()); section.put("signalSizeExclude", signalSizeCheckbox.getSelection()); section.put("signalBufferSizeExclude", signalBufferSizeCheckbox.getSelection()); section.put("signalAddressExclude", signalAddressCheckbox.getSelection()); section.put("signalStatusExclude", signalStatusCheckbox.getSelection()); section.put("stackOwnerId", stackOwnerIdText.getText().trim()); section.put("stackOwnerName", stackOwnerNameText.getText().trim()); section.put("stackSizeFrom", stackSizeFromText.getText().trim()); section.put("stackSizeTo", stackSizeToText.getText().trim()); section.put("stackBufferSizeFrom", stackBufferSizeFromText.getText().trim()); section.put("stackBufferSizeTo", stackBufferSizeToText.getText().trim()); section.put("stackAddressFrom", stackAddressFromText.getText().trim()); section.put("stackAddressTo", stackAddressToText.getText().trim()); section.put("stackUsedFrom", stackUsedFromText.getText().trim()); section.put("stackUsedTo", stackUsedToText.getText().trim()); section.put("stackUnusedFrom", stackUnusedFromText.getText().trim()); section.put("stackUnusedTo", stackUnusedToText.getText().trim()); section.put("stackOwnerIdExclude", stackOwnerIdCheckbox.getSelection()); section.put("stackOwnerNameExclude", stackOwnerNameCheckbox.getSelection()); section.put("stackSizeExclude", stackSizeCheckbox.getSelection()); section.put("stackBufferSizeExclude", stackBufferSizeCheckbox.getSelection()); section.put("stackAddressExclude", stackAddressCheckbox.getSelection()); section.put("stackUsedExclude", stackUsedCheckbox.getSelection()); section.put("stackUnusedExclude", stackUnusedCheckbox.getSelection()); }
protected Control createDialogArea(Composite parent) { Composite comp; Composite subComp; ValidationHandler validationHandler; Label label; comp = (Composite) super.createDialogArea(parent); subComp = new Composite(comp, SWT.NONE); subComp.setLayout(new GridLayout(1, false)); validationHandler = new ValidationHandler(); // Create pool group. createPoolGroup(subComp, validationHandler); // Create vertical spacer. label = new Label(subComp, SWT.NONE); label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // Create tab folder. tabFolder = new TabFolder(subComp, SWT.NONE); tabFolder.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); createSignalTab(tabFolder, validationHandler); createStackTab(tabFolder, validationHandler); // Create error message label. errorMessageLabel = new CLabel(subComp, SWT.NONE); errorMessageLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // Create separator line. label = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR); label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); applyDialogFont(comp); return comp; }
/** * Creates an instance of a ControlExample embedded inside the supplied parent Composite. * * @param parent the container of the example */ public ControlExample(Composite parent) { initResources(); tabFolder = new TabFolder(parent, SWT.NONE); tabs = createTabs(); for (Tab tab : tabs) { TabItem item = new TabItem(tabFolder, SWT.NONE); item.setText(tab.getTabText()); item.setControl(tab.createTabFolderPage(tabFolder)); item.setData(tab); } /* Workaround: if the tab folder is wider than the screen, * Mac platforms clip instead of somehow scrolling the tab items. * We try to recover some width by using shorter tab names. */ Point size = parent.computeSize(SWT.DEFAULT, SWT.DEFAULT); Rectangle monitorArea = parent.getMonitor().getClientArea(); boolean isMac = SWT.getPlatform().equals("cocoa"); if (size.x > monitorArea.width && isMac) { TabItem[] tabItems = tabFolder.getItems(); for (int i = 0; i < tabItems.length; i++) { tabItems[i].setText(tabs[i].getShortTabText()); } } startup = false; }
void moveHorizontal() { SelectTimeDialog theDialog = new SelectTimeDialog(folder.getShell(), theTimes, currentTime); if (theDialog.open() == 0 && theDialog.selectedTime != currentTime) { currentTime = theDialog.selectedTime; updateOverviewPage(); } }
public void setImage(Image image) { checkWidget(); int index = parent.indexOf(this); if (index > -1) { super.setImage(image); } }
protected void handleToolChanged() { try { // create dynamicTab loadDynamicArea(); if (launchConfigurationWorkingCopy == null) { if (launchConfiguration.isWorkingCopy()) { launchConfigurationWorkingCopy = (ILaunchConfigurationWorkingCopy) launchConfiguration; } else { launchConfigurationWorkingCopy = launchConfiguration.getWorkingCopy(); } } // setDefaults called on this tab so call on dynamicTab OR // user changed tool, not just restoring state if (initDefaults) { dynamicTab.setDefaults(launchConfigurationWorkingCopy); } initDefaults = false; dynamicTab.initializeFrom(launchConfigurationWorkingCopy); // change name of tool TabItem toolTab.setText(dynamicTab.getName()); optionsFolder.layout(true); // adjust minimum size for ScrolledComposite recomputeSize(); } catch (CoreException e) { ex = e; } }
/** This method initializes tabFolder */ private void createTabFolder() { tabFolder = new TabFolder(shell, SWT.NONE); createScanningTab(); TabItem tabItem = new TabItem(tabFolder, SWT.NONE); tabItem.setText(Labels.getLabel("title.preferences.scanning")); tabItem.setControl(scanningTab); scanningTabItem = tabItem; createPortsTab(); tabItem = new TabItem(tabFolder, SWT.NONE); tabItem.setText(Labels.getLabel("title.preferences.ports")); tabItem.setControl(portsTab); portsTabItem = tabItem; createDisplayTab(); tabItem = new TabItem(tabFolder, SWT.NONE); tabItem.setText(Labels.getLabel("title.preferences.display")); tabItem.setControl(displayTab); // createFetchersTab(); // tabItem = new TabItem(tabFolder, SWT.NONE); // tabItem.setText(Labels.getLabel("title.preferences.fetchers")); // tabItem.setControl(fetchersTab); tabFolder.pack(); }
/** * {@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(); }
/** * Returns the index of the tab for the given part, or returns tabFolder.getItemCount() if there * is no such tab. * * @param part part being searched for * @return the index of the tab for the given part, or the number of tabs if there is no such tab */ private final int indexOf(IPresentablePart part) { if (part == null) { return tabFolder.getItemCount(); } TabItem[] items = tabFolder.getItems(); for (int idx = 0; idx < items.length; idx++) { IPresentablePart tabPart = getPartForTab(items[idx]); if (part == tabPart) { return idx; } } return items.length; }
private void changeCurrentlyDisplayedExecutionRecord(ExecutionHistoryRecord newExecutionRecord) { if (newExecutionRecord.out.rows.isEmpty()) { // We do not want to erase the old content, but we want to give feedback that the command was // executed. return; } boolean needRefresh = currentlySelectedExecutionRecord == null; currentlySelectedExecutionRecord = newExecutionRecord; if (!needRefresh) { int percentage = 100 / (terminalDataLayer.getColumnCount() + 1); terminalDataLayer.setColumnWidthPercentageByPosition(0, percentage * 2); for (int i = 1; i < terminalDataLayer.getColumnCount(); i++) { terminalDataLayer.setColumnWidthPercentageByPosition(i, percentage); } } terminalGrid .refresh(); // FIXME: This somewhat works to display the columns the first time a command is // run. Especially if the output contains few rows and does not require a scroll // bar int selectedTab = 0; tabularErrorTable.clearAll(); int numberOfErrLines = 0; // if(currentlySelectedExecutionRecord.err!=null){ // numberOfErrLines=currentlySelectedExecutionRecord.err.rows.size(); // if(numberOfErrLines>0){ // selectedTab=1; // } // } TabFolder tabPane = (TabFolder) terminalGrid.getParent(); tabPane.getItem(1).setText("err " + numberOfErrLines + " lines"); tabularErrorTable.setItemCount(numberOfErrLines); tabularLogTable.clearAll(); int numberOfLogLines = 0; // if(currentlySelectedExecutionRecord.log!=null){ // numberOfLogLines=currentlySelectedExecutionRecord.log.rows.size(); // } tabPane.getItem(2).setText("log-" + numberOfLogLines); tabularLogTable.setItemCount(numberOfLogLines); tabPane.setSelection(selectedTab); commandLineTxt.setFocus(); }
private void updateSelectedTab() { ICPropertyTab newTab = (ICPropertyTab) folder.getSelection()[0].getData(); if (newTab != null && currentTab != newTab) { recentTabs.put(getClass(), newTab.getClass()); if (currentTab != null) currentTab.handleTabEvent(ICPropertyTab.VISIBLE, null); currentTab = newTab; currentTab.handleTabEvent(ICPropertyTab.VISIBLE, NOT_NULL); } }
/* * (non-Javadoc) * @see org.overture.ide.plugins.rttraceviewer.viewer.IViewCallback#panToTime(long, long) */ public void panToTime(long time, long thrid) { for (Iterator<Long> iter = theTimes.iterator(); iter.hasNext(); ) { long theTime = iter.next().longValue(); if (theTime < time) currentTime = theTime; } folder.setSelection(theOverview.getTabItem()); updateOverviewPage(); }
public void createWidgets(Composite c) { GridData gd; parentComposite = new Composite(c, SWT.NONE); parentComposite.setLayoutData(gd = new GridData(GridData.FILL_BOTH)); gd.widthHint = 800; itabs.clear(); if (!isSingle()) { parentComposite.setLayout(new FillLayout()); folder = new TabFolder(parentComposite, SWT.NONE); // folder.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY)); } loadExtensionsSynchronized(parentComposite); // Set listener after data load, to avoid firing // selection event on not-initialized tab items if (folder != null) { folder.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(org.eclipse.swt.events.SelectionEvent event) { if (folder.getSelection().length > 0) { updateSelectedTab(); } } }); if (folder.getItemCount() > 0) { int selectedTab = 0; Class<? extends ICPropertyTab> recentTab = recentTabs.get(getClass()); if (recentTab != null) { TabItem[] tabs = folder.getItems(); for (int i = 0; i < tabs.length; i++) { TabItem control = tabs[i]; if (recentTab.isInstance(control.getData())) { selectedTab = i; break; } } } folder.setSelection(selectedTab); updateSelectedTab(); } } }
@Override public void setVisible(boolean visible) { super.setVisible(visible); if (visible) { handleResize(true); displayedConfig = true; if (excludeFromBuildCheck != null && resd != null) excludeFromBuildCheck.setSelection(resd.isExcluded()); populateConfigurations(); } if (itabs.size() < 1) return; if (currentTab == null && folder.getItemCount() > 0) { Object ob = folder.getItem(0).getData(); currentTab = (ICPropertyTab) ob; } if (currentTab != null) currentTab.handleTabEvent(ICPropertyTab.VISIBLE, visible ? NOT_NULL : null); }
/** * Returns the tab for the given part, or null if there is no such tab * * @param part the part being searched for * @return the tab for the given part, or null if there is no such tab */ protected final TabItem getTab(IPresentablePart part) { TabItem[] items = tabFolder.getItems(); int idx = indexOf(part); if (idx < items.length) { return items[idx]; } return null; }
/* (non-Javadoc) * @see org.eclipse.ui.internal.skins.Presentation#dispose() */ public void dispose() { if (isDisposed()) { return; } PresentationUtil.removeDragListener(tabFolder, dragListener); // systemMenuManager.dispose(); tabFolder.dispose(); tabFolder = null; }
private void createParameterExceptionsFolder(Composite composite) { TabFolder folder = new TabFolder(composite, SWT.TOP); folder.setLayoutData(new GridData(GridData.FILL_BOTH)); TabItem item = new TabItem(folder, SWT.NONE); item.setText(RefactoringMessages.ChangeSignatureInputPage_parameters); item.setControl(createParameterTableControl(folder)); TabItem itemEx = new TabItem(folder, SWT.NONE); itemEx.setText(RefactoringMessages.ChangeSignatureInputPage_exceptions); itemEx.setControl(createExceptionsTableControl(folder)); folder.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ((TabItem) e.item).getControl().setFocus(); } }); }