コード例 #1
0
ファイル: RmapEditor.java プロジェクト: eclipse/buckminster
  /**
   * Updates the problems indication with the information described in the specified diagnostic.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated
   */
  protected void updateProblemIndication() {
    if (updateProblemIndication) {
      BasicDiagnostic diagnostic =
          new BasicDiagnostic(
              Diagnostic.OK,
              "org.eclipse.buckminster.rmap.editor",
              0,
              null,
              new Object[] {editingDomain.getResourceSet()});
      for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) {
        if (childDiagnostic.getSeverity() != Diagnostic.OK) {
          diagnostic.add(childDiagnostic);
        }
      }

      int lastEditorPage = getPageCount() - 1;
      if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) {
        ((ProblemEditorPart) getEditor(lastEditorPage)).setDiagnostic(diagnostic);
        if (diagnostic.getSeverity() != Diagnostic.OK) {
          setActivePage(lastEditorPage);
        }
      } else if (diagnostic.getSeverity() != Diagnostic.OK) {
        ProblemEditorPart problemEditorPart = new ProblemEditorPart();
        problemEditorPart.setDiagnostic(diagnostic);
        problemEditorPart.setMarkerHelper(markerHelper);
        try {
          addPage(++lastEditorPage, problemEditorPart, getEditorInput());
          setPageText(lastEditorPage, problemEditorPart.getPartName());
          setActivePage(lastEditorPage);
          showTabs();
        } catch (PartInitException exception) {
          RmapEditorPlugin.INSTANCE.log(exception);
        }
      }

      if (markerHelper.hasMarkers(editingDomain.getResourceSet())) {
        markerHelper.deleteMarkers(editingDomain.getResourceSet());
        if (diagnostic.getSeverity() != Diagnostic.OK) {
          try {
            markerHelper.createMarkers(diagnostic);
          } catch (CoreException exception) {
            RmapEditorPlugin.INSTANCE.log(exception);
          }
        }
      }
    }
  }
コード例 #2
0
  @Override
  public void deleteMarkers(Object object, boolean includeSubtypes, int depth) {
    if (object instanceof ResourceSet) {
      ResourceSet resourceSet = (ResourceSet) object;
      List<Resource> resources = resourceSet.getResources();
      for (int i = 0, size = resources.size(); i < size; i++) {
        deleteMarkers(resources.get(i), includeSubtypes, depth);
      }
    } else if (object instanceof Diagnostic) {
      List<?> data = ((Diagnostic) object).getData();
      if (data != null) {
        for (Object datum : data) {
          if (datum instanceof ResourceSet) {
            deleteMarkers(datum, includeSubtypes, depth);
            return;
          }
        }
      }
    }

    super.deleteMarkers(object, includeSubtypes, depth);
  }