/** @not-generated */
    @Override
    public void refresh() {
      removeDecoration();
      View view = (View) getDecoratorTarget().getAdapter(View.class);
      Resource viewResource = null;
      if (view != null) {
        viewResource = view.eResource();
      }
      if (viewResource == null) {
        return;
      }
      EditPart editPart = (EditPart) getDecoratorTarget().getAdapter(EditPart.class);
      if (editPart == null || editPart.getParent() == null || editPart.getViewer() == null) {
        return;
      }

      // query for all the validation markers of the current resource
      String elementId = SiriusGMFHelper.getViewId(view);
      if (elementId == null) {
        return;
      }

      // Directly retrieve the main Session resource
      // (session.getSessionResource()) as we know we put the marker on
      // it.
      Session currentSession = null;
      ResourceSet currentRs = viewResource.getResourceSet();
      for (Session session : SessionManager.INSTANCE.getSessions()) {
        if (currentRs == session.getTransactionalEditingDomain().getResourceSet()) {
          currentSession = session;
          break;
        }
      }
      Resource markedResource = currentSession == null ? null : currentSession.getSessionResource();
      IResource resource = WorkspaceSynchronizer.getFile(markedResource);

      if (resource == null || !resource.exists()) {
        return;
      }
      IMarker[] markers = null;
      try {
        markers = resource.findMarkers(MARKER_TYPE, true, IResource.DEPTH_INFINITE);
      } catch (CoreException e) {
        DiagramPlugin.getDefault()
            .logError(Messages.StatusDecorator_validationMarkersFailureMsg, e);
      }
      if (markers == null || markers.length == 0) {
        return;
      }

      int severity = IMarker.SEVERITY_INFO;
      IMarker foundMarker = null;
      Label toolTip = null;
      for (int i = 0; i < markers.length; i++) {
        IMarker marker = markers[i];
        String attribute =
            marker.getAttribute(
                org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID, ""); // $NON-NLS-1$
        if (attribute.equals(elementId)) {
          int nextSeverity = marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO);
          Image nextImage = getImage(nextSeverity);
          if (foundMarker == null) {
            foundMarker = marker;
            toolTip =
                new Label(
                    marker.getAttribute(IMarker.MESSAGE, ""), // $NON-NLS-1$
                    nextImage);
          } else {
            if (toolTip.getChildren().isEmpty()) {
              Label comositeLabel = new Label();
              FlowLayout fl = new FlowLayout(false);
              fl.setMinorSpacing(0);
              comositeLabel.setLayoutManager(fl);
              comositeLabel.add(toolTip);
              toolTip = comositeLabel;
            }
            toolTip.add(
                new Label(
                    marker.getAttribute(IMarker.MESSAGE, ""), // $NON-NLS-1$
                    nextImage));
          }
          severity = (nextSeverity > severity) ? nextSeverity : severity;
        }
      }
      if (foundMarker == null) {
        return;
      }

      // add decoration
      if (editPart instanceof org.eclipse.gef.GraphicalEditPart) {
        IDecoration decoration = null;

        if (view instanceof Diagram) {
          // There is not yet defined decorator for a diagram
        } else if (view instanceof Edge) {
          decoration = getDecoratorTarget().addConnectionDecoration(getImage(severity), 50, true);
        } else {
          int margin = -1;
          margin =
              MapModeUtil.getMapMode(((org.eclipse.gef.GraphicalEditPart) editPart).getFigure())
                  .DPtoLP(margin);
          decoration =
              getDecoratorTarget()
                  .addShapeDecoration(
                      getImage(severity), IDecoratorTarget.Direction.NORTH_EAST, margin, true);
        }

        if (decoration != null) {
          setDecoration(decoration);

          // getDecaration() returns a {@link Decoration} instead of a
          // {@link IDecoration}
          getDecoration().setToolTip(toolTip);
        }
      }
    }
    /** @generated */
    public void refresh() {
      removeDecoration();
      View view = (View) getDecoratorTarget().getAdapter(View.class);
      if (view == null || view.eResource() == null) {
        return;
      }
      EditPart editPart = (EditPart) getDecoratorTarget().getAdapter(EditPart.class);
      if (editPart == null || editPart.getViewer() == null) {
        return;
      }

      // query for all the validation markers of the current resource
      String elementId = ViewUtil.getIdStr(view);
      if (elementId == null) {
        return;
      }
      int severity = IMarker.SEVERITY_INFO;
      IMarker foundMarker = null;
      IResource resource = WorkspaceSynchronizer.getFile(view.eResource());
      if (resource == null || !resource.exists()) {
        return;
      }
      IMarker[] markers = null;
      try {
        markers = resource.findMarkers(MARKER_TYPE, true, IResource.DEPTH_INFINITE);
      } catch (CoreException e) {
        GSN1DiagramEditorPlugin.getInstance()
            .logError("Validation markers refresh failure", e); // $NON-NLS-1$
      }
      if (markers == null || markers.length == 0) {
        return;
      }
      Label toolTip = null;
      for (int i = 0; i < markers.length; i++) {
        IMarker marker = markers[i];
        String attribute =
            marker.getAttribute(
                org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID, ""); // $NON-NLS-1$
        if (attribute.equals(elementId)) {
          int nextSeverity = marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO);
          Image nextImage = getImage(nextSeverity);
          if (foundMarker == null) {
            foundMarker = marker;
            toolTip =
                new Label(
                    marker.getAttribute(IMarker.MESSAGE, ""), // $NON-NLS-1$
                    nextImage);
          } else {
            if (toolTip.getChildren().isEmpty()) {
              Label comositeLabel = new Label();
              FlowLayout fl = new FlowLayout(false);
              fl.setMinorSpacing(0);
              comositeLabel.setLayoutManager(fl);
              comositeLabel.add(toolTip);
              toolTip = comositeLabel;
            }
            toolTip.add(
                new Label(
                    marker.getAttribute(IMarker.MESSAGE, ""), // $NON-NLS-1$
                    nextImage));
          }
          severity = (nextSeverity > severity) ? nextSeverity : severity;
        }
      }
      if (foundMarker == null) {
        return;
      }

      // add decoration
      if (editPart instanceof org.eclipse.gef.GraphicalEditPart) {
        if (view instanceof Edge) {
          setDecoration(getDecoratorTarget().addConnectionDecoration(getImage(severity), 50, true));
        } else {
          int margin = -1;
          if (editPart instanceof org.eclipse.gef.GraphicalEditPart) {
            margin =
                MapModeUtil.getMapMode(((org.eclipse.gef.GraphicalEditPart) editPart).getFigure())
                    .DPtoLP(margin);
          }
          setDecoration(
              getDecoratorTarget()
                  .addShapeDecoration(
                      getImage(severity), IDecoratorTarget.Direction.NORTH_EAST, margin, true));
        }
        getDecoration().setToolTip(toolTip);
      }
    }