public void insertNode(NodePosition np, int index) {

    if (np != null) {
      if (index > nodeData.size()) {
        nodeData.addElement(np);
      } else {
        nodeData.insertElementAt(np, index);
      }
      sorter.reallocateIndexes();
      sorter.fireTableChanged(new TableModelEvent(this));
    }
  }
示例#2
0
  private void selectInAllMethods(JipMethod selectedMethod) {

    if (selectedMethod == null) {
      mMethods.clearSelection();
      return;
    }

    // which row should we select?
    boolean foundIt = false;
    int nRow = mAllMethodsModel.getRowCount();
    int iRow;
    for (iRow = 0; iRow < nRow; iRow++) {
      MethodRow scan = mAllMethodsModel.getRow(iRow);
      if (scan.getMethod().equals(selectedMethod)) {
        foundIt = true;
        break;
      }
    }
    if (!foundIt) {
      System.out.println("couldn't find " + selectedMethod.getName());
      return;
    }

    // update the listSelectionModel
    int iRowInView = mAllMethodsSorterModel.viewIndex(iRow);
    mMethods.getSelectionModel().setSelectionInterval(iRowInView, iRowInView);

    // scroll to contain the new selection
    Rectangle selectionRect = mMethods.getCellRect(iRowInView, 0, true);
    mMethods.scrollRectToVisible(selectionRect);
  }
 @Override
 public Component getTableCellRendererComponent(
     JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
   setText(value.toString());
   int convertColumn = table.convertColumnIndexToModel(column);
   if (m_sorter != null && m_sorter.isSortColumn(convertColumn)) {
     if (m_sorter.isAsscending(convertColumn)) {
       setIcon(UPARROW);
     } else {
       setIcon(DOWNARROW);
     }
   } else {
     setIcon(null);
   }
   return this;
 }
  public void insertNodes(NodePosition[] nps, int index) {

    if (index > nodeData.size()) index = nodeData.size();

    for (int i = 0; i < nps.length; i++) {
      if (nps[i] != null) {
        if (index > nodeData.size()) {
          nodeData.addElement(nps[i]);
        } else {
          nodeData.insertElementAt(nps[i], index + i);
        }
      }
    }

    sorter.reallocateIndexes();
    sorter.fireTableChanged(new TableModelEvent(this));
  }
示例#5
0
  public ClassExpTable(
      AxiomIndexer indexer,
      ConcisePlainVisitor visitor,
      HashedCounts classExpCounts,
      Hashtable classExpDepths) {
    this.myIndexer = indexer;
    String[] colNames = {"Class Expression", "#Occurences", "Depth", "Score"};

    Object[][] data = new Object[classExpCounts.keySet().size()][4];

    int i = 0;
    for (Iterator it = classExpCounts.keySet().iterator(); it.hasNext(); ) {
      OWLDescription desc = (OWLDescription) it.next();
      if (desc == null) System.out.println("description is null at " + i);
      Integer count = new Integer(classExpCounts.getCount(desc));
      Integer depth = (Integer) classExpDepths.get(desc);
      try {
        if (depth == null) {
          System.out.println(" depth is null at " + i);
          desc.accept(visitor);
          String str = visitor.result();
          System.out.println("        [" + str + "]");
          visitor.reset();
        }
      } catch (Exception e) {
        e.printStackTrace();
      }

      data[i][0] = desc;
      data[i][1] = count;
      data[i][2] = depth;
      data[i][3] = new Double(Math.pow(count.intValue(), (depth.intValue() + 1)));
      i++;
    }
    myDataModel = new ClassExpTableModel(colNames, data);
    myManipModel = new TableSorter(myDataModel);
    myTable = new JTable(myManipModel);
    myManipModel.setTableHeader(myTable.getTableHeader());

    /*
    for ( int vColIndex = 0; vColIndex < 3; vColIndex++ )
    {
    	TableColumn col = myTable.getColumnModel().getColumn(vColIndex);
    	col.setHeaderRenderer(new RichHeaderRenderer());
    }
    */

    myTable.setDefaultRenderer(OWLObjectImpl.class, new ClassExpRenderer(visitor));

    setupUI();

    this.addWindowListener(this);
    this.addComponentListener(this);
    myTable.addMouseListener(this);
    this.setSize(300, 600);
    this.setVisible(true);
  }
 public void createTable(int numRows) {
   hypListTableModel = new HypListTableModel(numRows);
   sorter = new TableSorter(hypListTableModel);
   hypsTable = new JTable(sorter);
   hypsTable.setShowGrid(true);
   hypsTable.setGridColor(Color.BLACK);
   sorter.setTableHeader(hypsTable.getTableHeader());
   hypsScrollPane = new JScrollPane(hypsTable);
   this.add(hypsScrollPane, BorderLayout.CENTER);
 }
  private void updateNodePos() {

    for (int i = 0; i < nodeData.size(); i++) {

      int oldIndex = ((Integer) sorter.getValueAt(i, 0)).intValue();
      sorter.setValueAt(new Integer(i), i, 0);

      if (oldIndex <= nodeData.size()) {
        NodePosition np = ((NodePosition) nodeData.elementAt(oldIndex));
        if (np != null) {
          try {
            view.setNodePosition(np.getNode().getId(), new Point(np.getXPos(), (i + 1) * 10));
            np.setYPos((i + 1) * 10);
          } catch (Exception ex) {
            log.error("Error...", ex);
            log.info("Error: Unable to update position " + ex.getMessage()); // $NON-NLS-1$
          }
        }
      }
    }
  }
  public void deleteRows(int[] rowIndexes) {

    Vector tempData = new Vector(nodeData.size());

    for (int j = 0; j < nodeData.size(); j++) {
      tempData.addElement(nodeData.elementAt(j));
    }

    if (rowIndexes.length <= nodeData.size()) {
      for (int i = 0; i < rowIndexes.length; i++) {
        int next = rowIndexes[i];
        NodePosition np = (NodePosition) tempData.elementAt(next);
        nodeData.remove(np);
      }
    }

    tempData.removeAllElements();
    tempData = null;

    sorter.reallocateIndexes();
    sorter.fireTableChanged(new TableModelEvent(this));
  }
示例#9
0
  public void valueChanged(ListSelectionEvent e) {
    if (e.getValueIsAdjusting()) {
      return;
    }

    JipMethod method = null;
    ListSelectionModel selectionModel = mMethods.getSelectionModel();
    if (!selectionModel.isSelectionEmpty()) {
      int iSelected = selectionModel.getMinSelectionIndex();
      iSelected = mAllMethodsSorterModel.modelIndex(iSelected);
      MethodRow row = mAllMethodsModel.getRow(iSelected);
      method = row.getMethod();
    }
    // System.out.println("valueChanged("+perMethod+")");
    mMethodModel.setValue(method);
  }
  /** Event handler for this dialog. */
  public void actionPerformed(ActionEvent e) {
    // Force table to accept any partial edits.
    if (metadataTable.isEditing()) {
      metadataTable.getCellEditor().stopCellEditing();
    }

    // Apply new/modified attributes to the object.
    Map currentObjectMetadata = currentObject.getModifiableMetadata();
    Set obsoleteMetadataItems = currentObjectMetadata.keySet();
    for (int row = 0; row < metadataTable.getRowCount(); row++) {
      String name = (String) objectMetadataTableModel.getValueAt(row, 0);
      String value = (String) objectMetadataTableModel.getValueAt(row, 1);
      currentObject.addMetadata(name, value);
      obsoleteMetadataItems.remove(name);
    }
    // Remove obsolete attributes.
    Iterator obsoleteNamesIter = obsoleteMetadataItems.iterator();
    while (obsoleteNamesIter.hasNext()) {
      currentObject.removeMetadata((String) obsoleteNamesIter.next());
    }

    if (e.getSource().equals(nextObjectButton)) {
      currentObjectIndex++;
      displayObjectProperties();
    } else if (e.getSource().equals(previousObjectButton)) {
      currentObjectIndex--;
      displayObjectProperties();
    } else if ("OK".equals(e.getActionCommand())) {
      modifyActionApproved = isModifyMode();
      this.setVisible(false);
    } else if ("Cancel".equals(e.getActionCommand())) {
      modifyActionApproved = false;
      this.setVisible(false);
    } else if ("addMetadataItem".equals(e.getActionCommand())) {
      int newRowNumber = metadataTable.getRowCount() + 1;
      objectMetadataTableModel.addRow(
          new String[] {"name-" + newRowNumber, "value-" + newRowNumber});
    } else if ("removeMetadataItem".equals(e.getActionCommand())) {
      int[] rows = metadataTable.getSelectedRows();
      for (int i = rows.length - 1; i >= 0; i--) {
        int modelIndex = metadataTableSorter.modelIndex(rows[i]);
        objectMetadataTableModel.removeRow(modelIndex);
      }
    }
  }
  /** Initialise the GUI elements to display the given item. */
  private void initGui() {
    this.setResizable(true);
    this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);

    JPanel unmodifiableAttributesPanel =
        skinsFactory.createSkinnedJPanel("ObjectStaticAttributesPanel");
    unmodifiableAttributesPanel.setLayout(new GridBagLayout());
    JPanel metadataContainer = skinsFactory.createSkinnedJPanel("ObjectPropertiesMetadataPanel");
    metadataContainer.setLayout(new GridBagLayout());
    metadataButtonsContainer =
        skinsFactory.createSkinnedJPanel("ObjectPropertiesMetadataButtonsPanel");
    metadataButtonsContainer.setLayout(new GridBagLayout());

    // Fields to display unmodifiable object details.
    JLabel objectKeyLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectKeyLabel");
    objectKeyLabel.setText("Object key:");
    objectKeyTextField = skinsFactory.createSkinnedJTextField("ObjectKeyTextField");
    objectKeyTextField.setEditable(false);
    JLabel objectContentLengthLabel =
        skinsFactory.createSkinnedJHtmlLabel("ObjectContentLengthLabel");
    objectContentLengthLabel.setText("Size:");
    objectContentLengthTextField =
        skinsFactory.createSkinnedJTextField("ObjectContentLengthTextField");
    objectContentLengthTextField.setEditable(false);
    JLabel objectLastModifiedLabel =
        skinsFactory.createSkinnedJHtmlLabel("ObjectLastModifiedLabel");
    objectLastModifiedLabel.setText("Last modified:");
    objectLastModifiedTextField =
        skinsFactory.createSkinnedJTextField("ObjectLastModifiedTextField");
    objectLastModifiedTextField.setEditable(false);
    JLabel objectETagLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectETagLabel");
    objectETagLabel.setText("ETag:");
    objectETagTextField = skinsFactory.createSkinnedJTextField("ObjectETagTextField");
    objectETagTextField.setEditable(false);
    JLabel bucketNameLabel = skinsFactory.createSkinnedJHtmlLabel("BucketNameLabel");
    bucketNameLabel.setText("Bucket:");
    bucketLocationTextField = skinsFactory.createSkinnedJTextField("BucketLocationTextField");
    bucketLocationTextField.setEditable(false);
    ownerNameLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerNameLabel");
    ownerNameLabel.setText("Owner name:");
    ownerNameTextField = skinsFactory.createSkinnedJTextField("OwnerNameTextField");
    ownerNameTextField.setEditable(false);
    ownerIdLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerIdLabel");
    ownerIdLabel.setText("Owner ID:");
    ownerIdTextField = skinsFactory.createSkinnedJTextField("OwnerIdTextField");
    ownerIdTextField.setEditable(false);

    int row = 0;

    unmodifiableAttributesPanel.add(
        objectKeyLabel,
        new GridBagConstraints(
            0,
            row,
            1,
            1,
            0,
            0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            insetsDefault,
            0,
            0));
    unmodifiableAttributesPanel.add(
        objectKeyTextField,
        new GridBagConstraints(
            1,
            row,
            1,
            1,
            1,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            insetsDefault,
            0,
            0));
    row++;
    unmodifiableAttributesPanel.add(
        objectContentLengthLabel,
        new GridBagConstraints(
            0,
            row,
            1,
            1,
            0,
            0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            insetsDefault,
            0,
            0));
    unmodifiableAttributesPanel.add(
        objectContentLengthTextField,
        new GridBagConstraints(
            1,
            row,
            1,
            1,
            1,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            insetsDefault,
            0,
            0));
    row++;
    unmodifiableAttributesPanel.add(
        objectLastModifiedLabel,
        new GridBagConstraints(
            0,
            row,
            1,
            1,
            0,
            0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            insetsDefault,
            0,
            0));
    unmodifiableAttributesPanel.add(
        objectLastModifiedTextField,
        new GridBagConstraints(
            1,
            row,
            1,
            1,
            1,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            insetsDefault,
            0,
            0));
    row++;
    unmodifiableAttributesPanel.add(
        objectETagLabel,
        new GridBagConstraints(
            0,
            row,
            1,
            1,
            0,
            0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            insetsDefault,
            0,
            0));
    unmodifiableAttributesPanel.add(
        objectETagTextField,
        new GridBagConstraints(
            1,
            row,
            1,
            1,
            1,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            insetsDefault,
            0,
            0));
    row++;
    unmodifiableAttributesPanel.add(
        ownerNameLabel,
        new GridBagConstraints(
            0,
            row,
            1,
            1,
            0,
            0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            insetsDefault,
            0,
            0));
    unmodifiableAttributesPanel.add(
        ownerNameTextField,
        new GridBagConstraints(
            1,
            row,
            1,
            1,
            1,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            insetsDefault,
            0,
            0));
    row++;
    unmodifiableAttributesPanel.add(
        ownerIdLabel,
        new GridBagConstraints(
            0,
            row,
            1,
            1,
            0,
            0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            insetsDefault,
            0,
            0));
    unmodifiableAttributesPanel.add(
        ownerIdTextField,
        new GridBagConstraints(
            1,
            row,
            1,
            1,
            1,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            insetsDefault,
            0,
            0));
    row++;
    unmodifiableAttributesPanel.add(
        bucketNameLabel,
        new GridBagConstraints(
            0,
            row,
            1,
            1,
            0,
            0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            insetsDefault,
            0,
            0));
    unmodifiableAttributesPanel.add(
        bucketLocationTextField,
        new GridBagConstraints(
            1,
            row,
            1,
            1,
            1,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            insetsDefault,
            0,
            0));

    // Build metadata table.
    objectMetadataTableModel =
        new DefaultTableModel(new Object[] {"Name", "Value"}, 0) {
          private static final long serialVersionUID = -3762866886166776851L;

          public boolean isCellEditable(int row, int column) {
            return isModifyMode();
          }
        };

    metadataTableSorter = new TableSorter(objectMetadataTableModel);
    metadataTable = skinsFactory.createSkinnedJTable("MetadataTable");
    metadataTable.setModel(metadataTableSorter);
    metadataTable
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {
              public void valueChanged(ListSelectionEvent e) {
                if (!e.getValueIsAdjusting() && removeMetadataItemButton != null) {
                  int row = metadataTable.getSelectedRow();
                  removeMetadataItemButton.setEnabled(row >= 0);
                }
              }
            });

    metadataTableSorter.setTableHeader(metadataTable.getTableHeader());
    metadataTableSorter.setSortingStatus(0, TableSorter.ASCENDING);
    metadataContainer.add(
        new JScrollPane(metadataTable),
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1,
            1,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            insetsHorizontalSpace,
            0,
            0));

    // Add/remove buttons for metadata table.
    removeMetadataItemButton =
        skinsFactory.createSkinnedJButton("ObjectPropertiesAddMetadataButton");
    removeMetadataItemButton.setEnabled(false);
    removeMetadataItemButton.setToolTipText("Remove the selected metadata item(s)");
    guiUtils.applyIcon(removeMetadataItemButton, "/images/nuvola/16x16/actions/viewmag-.png");
    removeMetadataItemButton.addActionListener(this);
    removeMetadataItemButton.setActionCommand("removeMetadataItem");
    addMetadataItemButton = skinsFactory.createSkinnedJButton("ObjectPropertiesAddMetadataButton");
    addMetadataItemButton.setToolTipText("Add a new metadata item");
    guiUtils.applyIcon(addMetadataItemButton, "/images/nuvola/16x16/actions/viewmag+.png");
    addMetadataItemButton.setActionCommand("addMetadataItem");
    addMetadataItemButton.addActionListener(this);
    metadataButtonsContainer.add(
        removeMetadataItemButton,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            insetsZero,
            0,
            0));
    metadataButtonsContainer.add(
        addMetadataItemButton,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            0,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            insetsZero,
            0,
            0));
    metadataContainer.add(
        metadataButtonsContainer,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            1,
            0,
            GridBagConstraints.EAST,
            GridBagConstraints.NONE,
            insetsHorizontalSpace,
            0,
            0));
    metadataButtonsContainer.setVisible(false);

    // OK Button.
    okButton = skinsFactory.createSkinnedJButton("ObjectPropertiesOKButton");
    okButton.setText("OK");
    okButton.setActionCommand("OK");
    okButton.addActionListener(this);

    // Cancel Button.
    cancelButton = null;
    cancelButton = skinsFactory.createSkinnedJButton("ObjectPropertiesCancelButton");
    cancelButton.setText("Cancel");
    cancelButton.setActionCommand("Cancel");
    cancelButton.addActionListener(this);
    cancelButton.setVisible(false);

    // Recognize and handle ENTER, ESCAPE, PAGE_UP, and PAGE_DOWN key presses.
    this.getRootPane().setDefaultButton(okButton);
    this.getRootPane()
        .getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
        .put(KeyStroke.getKeyStroke("ESCAPE"), "ESCAPE");
    this.getRootPane()
        .getActionMap()
        .put(
            "ESCAPE",
            new AbstractAction() {
              private static final long serialVersionUID = -7768790936535999307L;

              public void actionPerformed(ActionEvent actionEvent) {
                setVisible(false);
              }
            });
    this.getRootPane()
        .getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
        .put(KeyStroke.getKeyStroke("PAGE_UP"), "PAGE_UP");
    this.getRootPane()
        .getActionMap()
        .put(
            "PAGE_UP",
            new AbstractAction() {
              private static final long serialVersionUID = -6324229423705756219L;

              public void actionPerformed(ActionEvent actionEvent) {
                previousObjectButton.doClick();
              }
            });
    this.getRootPane()
        .getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
        .put(KeyStroke.getKeyStroke("PAGE_DOWN"), "PAGE_DOWN");
    this.getRootPane()
        .getActionMap()
        .put(
            "PAGE_DOWN",
            new AbstractAction() {
              private static final long serialVersionUID = -5808972377672449421L;

              public void actionPerformed(ActionEvent actionEvent) {
                nextObjectButton.doClick();
              }
            });

    // Put it all together.
    row = 0;
    JPanel container = skinsFactory.createSkinnedJPanel("ObjectPropertiesPanel");
    container.setLayout(new GridBagLayout());
    container.add(
        unmodifiableAttributesPanel,
        new GridBagConstraints(
            0,
            row++,
            1,
            1,
            1,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            insetsZero,
            0,
            0));

    // Object previous and next buttons, if we have multiple objects.
    previousObjectButton = skinsFactory.createSkinnedJButton("ObjectPropertiesPreviousButton");
    guiUtils.applyIcon(previousObjectButton, "/images/nuvola/16x16/actions/1leftarrow.png");
    previousObjectButton.addActionListener(this);
    previousObjectButton.setEnabled(false);
    nextObjectButton = skinsFactory.createSkinnedJButton("ObjectPropertiesNextButton");
    guiUtils.applyIcon(nextObjectButton, "/images/nuvola/16x16/actions/1rightarrow.png");
    nextObjectButton.addActionListener(this);
    nextObjectButton.setEnabled(false);
    currentObjectLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectPropertiesCurrentObjectLabel");
    currentObjectLabel.setHorizontalAlignment(JLabel.CENTER);

    nextPreviousPanel = skinsFactory.createSkinnedJPanel("ObjectPropertiesNextPreviousPanel");
    nextPreviousPanel.setLayout(new GridBagLayout());
    nextPreviousPanel.add(
        previousObjectButton,
        new GridBagConstraints(
            0, 0, 1, 1, 1, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsZero, 0, 0));
    nextPreviousPanel.add(
        currentObjectLabel,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            0,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            insetsHorizontalSpace,
            0,
            0));
    nextPreviousPanel.add(
        nextObjectButton,
        new GridBagConstraints(
            2, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0));
    container.add(
        nextPreviousPanel,
        new GridBagConstraints(
            0,
            row,
            1,
            1,
            1,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            insetsZero,
            0,
            0));
    nextPreviousPanel.setVisible(false);
    row++;

    JHtmlLabel metadataLabel = skinsFactory.createSkinnedJHtmlLabel("MetadataLabel");
    metadataLabel.setText("<html><b>Metadata Attributes</b></html>");
    metadataLabel.setHorizontalAlignment(JLabel.CENTER);
    container.add(
        metadataLabel,
        new GridBagConstraints(
            0,
            row++,
            1,
            1,
            1,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            insetsVerticalSpace,
            0,
            0));
    container.add(
        metadataContainer,
        new GridBagConstraints(
            0,
            row++,
            1,
            1,
            1,
            1,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            insetsZero,
            0,
            0));

    // Destination Access Control List setting.
    destinationPanel = skinsFactory.createSkinnedJPanel("DestinationPanel");
    destinationPanel.setLayout(new GridBagLayout());

    JPanel actionButtonsPanel =
        skinsFactory.createSkinnedJPanel("ObjectPropertiesActionButtonsPanel");
    actionButtonsPanel.setLayout(new GridBagLayout());
    actionButtonsPanel.add(
        cancelButton,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            insetsZero,
            0,
            0));
    actionButtonsPanel.add(
        okButton,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            1,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            insetsZero,
            0,
            0));
    cancelButton.setVisible(false);

    container.add(
        actionButtonsPanel,
        new GridBagConstraints(
            0,
            row++,
            3,
            1,
            0,
            0,
            GridBagConstraints.CENTER,
            GridBagConstraints.NONE,
            insetsDefault,
            0,
            0));
    this.getContentPane().add(container);

    this.pack();
    this.setSize(new Dimension(450, 500));
    this.setLocationRelativeTo(this.getOwner());
  }
示例#12
0
  @Override
  public void createPartControl(Composite parent) {
    swtDisplay = parent.getDisplay();

    clipboard = new Clipboard(parent.getDisplay());

    tableViewer =
        new TableViewer(
            parent, SWT.H_SCROLL | SWT.VIRTUAL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
    tableViewer.setContentProvider(new ErrorViewTreeContentProvider());
    tableViewer.addDoubleClickListener(
        new IDoubleClickListener() {
          @Override
          public void doubleClick(DoubleClickEvent event) {
            openSelectedMarker();
          }
        });
    tableViewer.addSelectionChangedListener(
        new ISelectionChangedListener() {
          @Override
          public void selectionChanged(SelectionChangedEvent event) {
            ISelection selection = event.getSelection();
            if (selection instanceof IStructuredSelection) {
              updateStatusLine((IStructuredSelection) selection);
            }
          }
        });

    // Create actions; must be done after the construction of the tableViewer
    goToMarkerAction = new GoToMarkerAction();
    copyAction = new CopyMarkerAction();

    tableViewer.addSelectionChangedListener(copyAction);
    tableViewer.addSelectionChangedListener(goToMarkerAction);

    tableSorter = new TableSorter();
    tableSorter.setColumn(1);
    tableViewer.setComparator(tableSorter);
    tableViewer.getTable().setSortDirection(SWT.UP);

    Table table = tableViewer.getTable();

    TableViewerColumn descriptionColumn = new TableViewerColumn(tableViewer, SWT.LEFT);
    descriptionColumn.setLabelProvider(new DescriptionLabelProvider());
    descriptionColumn.getColumn().setText("Description");
    descriptionColumn.getColumn().setWidth(520);
    descriptionColumn.getColumn().setResizable(true);
    enableSorting(descriptionColumn.getColumn(), 0);

    TableViewerColumn fileNameColumn = new TableViewerColumn(tableViewer, SWT.LEFT);
    fileNameColumn.setLabelProvider(new FileNameLabelProvider());
    fileNameColumn.getColumn().setText("Location");
    fileNameColumn.getColumn().setWidth(220);
    fileNameColumn.getColumn().setResizable(true);
    enableSorting(fileNameColumn.getColumn(), 1);

    tableViewer.getTable().setSortColumn(fileNameColumn.getColumn());

    //    TableViewerColumn typeColumn = new TableViewerColumn(tableViewer, SWT.LEFT);
    //    typeColumn.setLabelProvider(new TypeLabelProvider());
    //    typeColumn.getColumn().setText("Type");
    //    typeColumn.getColumn().setWidth(130);
    //    typeColumn.getColumn().setResizable(true);
    //    enableSorting(typeColumn.getColumn(), 2);

    restoreColumnWidths();

    table.setLayoutData(new GridData(GridData.FILL_BOTH));
    //    table.setFont(parent.getFont());
    updateTableFont();

    table.setLinesVisible(true);
    table.setHeaderVisible(true);

    table.layout(true);

    getSite().setSelectionProvider(tableViewer);

    IToolBarManager toolbar = getViewSite().getActionBars().getToolBarManager();

    fillInToolbar(toolbar);
    registerContextMenu();

    tableFilter = new ErrorViewerFilter();

    updateFilters();

    startUpdateJob(swtDisplay);

    MarkersChangeService.getService().addListener(this);

    focusOnActiveEditor();
  }
 public void refreshTable() {
   updateNodePos();
   constructTableData();
   sorter.reallocateIndexes();
 }