/* (non-Javadoc)
   * @see org.eclipse.ui.internal.skins.StackPresentation#removePart(org.eclipse.ui.internal.skins.IPresentablePart)
   */
  public void removePart(IPresentablePart oldPart) {
    TabItem item = getTab(oldPart);
    if (item == null) {
      return;
    }
    oldPart.setVisible(false);

    item.dispose();
  }
示例#2
0
 @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;
   }
 }
示例#3
0
  private void addTabPage(LibraryCategory category) {
    TabItem tabPageLibrary = new TabItem(tabFolder, SWT.NONE);
    tabPageLibrary.setText(category.getName());
    ImageDescriptor icon = category.getIcon();
    if (icon != null) {
      tabPageLibrary.setImage(icon.createImage());
    }

    Composite composite_1 = new Composite(tabFolder, SWT.NONE);
    tabPageLibrary.setControl(composite_1);
    composite_1.setLayout(new GridLayout(1, false));

    Label lblDescription = new Label(composite_1, SWT.NONE);
    lblDescription.setText(category.getDescription());

    final CheckboxTableViewer checkboxTableViewer =
        CheckboxTableViewer.newCheckList(composite_1, SWT.BORDER | SWT.FULL_SELECTION);
    final Table table = checkboxTableViewer.getTable();
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    //		TableColumn tblclmnLibraryName = new TableColumn(table, SWT.NONE);
    //		tblclmnLibraryName.setWidth(200);
    //		tblclmnLibraryName.setText("Library Name");

    // TableColumn tblclmnLibraryDescription = new TableColumn(table,
    // SWT.NONE);
    // tblclmnLibraryDescription.setWidth(400);
    // tblclmnLibraryDescription.setText("Description");

    Composite composite_2 = new Composite(composite_1, SWT.NONE);
    composite_2.setLayout(new RowLayout(SWT.HORIZONTAL));

    final Button btnSelectAll = new Button(composite_2, SWT.NONE);
    final Button btnDeselectAll = new Button(composite_2, SWT.NONE);

    btnSelectAll.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            checkboxTableViewer.setAllChecked(true);
            updateButtonStatus(btnSelectAll, btnDeselectAll, checkboxTableViewer, table);
          }
        });
    btnSelectAll.setLayoutData(new RowData(100, SWT.DEFAULT));
    btnSelectAll.setText("Select All");

    btnDeselectAll.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            checkboxTableViewer.setAllChecked(false);
            updateButtonStatus(btnSelectAll, btnDeselectAll, checkboxTableViewer, table);
          }
        });
    btnDeselectAll.setLayoutData(new RowData(100, SWT.DEFAULT));
    btnDeselectAll.setText("Deselect All");

    checkboxTableViewer.addCheckStateListener(
        new ICheckStateListener() {

          public void checkStateChanged(CheckStateChangedEvent arg0) {
            updateButtonStatus(btnSelectAll, btnDeselectAll, checkboxTableViewer, table);
          }
        });
    loadLibraries(category, table);
    if (checkboxTableViewer.getTable().getItemCount() > 0) {
      viewerList.add(checkboxTableViewer);
      updateButtonStatus(btnSelectAll, btnDeselectAll, checkboxTableViewer, table);
    } else {
      tabPageLibrary.dispose();
    }
  }