예제 #1
0
  /** Invoked when an entity is selected */
  private void entitySelected(Entity entity) {
    ArrayList<Reference> references = entity.getReferences();
    // TODO This code is used to display dangling references in the current file only.
    // 		Remember to remove this code later.
    // BEGIN OF CODE TO BE REMOVED
    if (entity instanceof UndeclaredEntity) {
      for (Reference reference : entity.getReferences()) {
        if (!filePathLabel.getText().endsWith(reference.getFilePath())) {
          references.remove(reference);
        }
      }
    }
    // END OF CODE TO BE REMOVED
    Collections.sort(
        references,
        new Reference.ReferenceComparator(
            new Reference.ReferenceComparatorByName(),
            new Reference.ReferenceComparatorByFile(),
            new Reference.ReferenceComparatorByPosition()));

    referenceListLabel.setText("Reference List: (" + references.size() + " references found)");
    referenceTableViewer.setInput(references);

    for (Reference reference : references) {
      if (filePathLabel.getText().endsWith(reference.getFilePath())) {
        referenceSelected(reference);
        break;
      }
    }
    entityTableViewer.getControl().setFocus();
  }
예제 #2
0
 /** Invoked when a reference is selected */
 private void referenceSelected(Reference reference) {
   Helper.selectAndReveal(
       reference.getFilePath(), reference.getPosition(), reference.getName().length());
   referenceTableViewer.getControl().setFocus();
 }