예제 #1
0
  private void removeTerm() {

    TableItem[] sel = termsTableViewer.getTable().getSelection();

    if (sel.length > 0) {

      ITerm selTerm = (ITerm) (sel[0].getData());

      ITerminoConcept tc =
          ControlerFactoryImpl.getTerminoOntoControler().getCurrentTerminoConcept();

      ITerminoOntoAnnotation starTermAnnotation = getStarTermAnnotation(tc);

      if (starTermAnnotation != null) {

        if (starTermAnnotation.getValue().compareTo(selTerm.getId() + "") == 0) { // $NON-NLS-1$

          DatabaseAdapter.deleteTCAnnotation(tc, starTermAnnotation);
        }
      }

      List<ITerminoConcept> tcs = new ArrayList<ITerminoConcept>();
      tcs.add(tc);
      DatabaseAdapter.unlinkTerm(tcs, selTerm);

      updateInformation();
    }
  }
예제 #2
0
    @Override
    public Color getBackground(Object element) {
      ITerm term = (ITerm) element;
      Color starTermColor = null;

      if (currentTerminoConcept != null) {

        Set<ITerminoOntoAnnotation> annotations = currentTerminoConcept.getAnnotations();
        Iterator<ITerminoOntoAnnotation> it = annotations.iterator();
        ITerminoOntoAnnotation annotation = null;

        while (it.hasNext()) {
          ITerminoOntoAnnotation tmp = it.next();

          if (tmp.getTerminoOntoAnnotationType()
                  .getLabel()
                  .compareTo(DatabaseAdapter.STAR_TERM_ANNOTATION)
              == 0) {
            annotation = tmp;
          }
        }

        if (annotation != null) {

          if (annotation.getValue().compareTo(term.getId() + "") == 0) { // $NON-NLS-1$

            starTermColor = shell.getDisplay().getSystemColor(SWT.COLOR_YELLOW);
          }
        }
      }
      return starTermColor;
    }