Exemplo n.º 1
0
 /**
  * Creates a marker with the specified type on this resource. Marker type ids are the id of an
  * extension installed in the <code>org.eclipse.core.resources.markers</code> extension point. The
  * specified type string must not be <code>null</code>.
  *
  * @param resource An IResource for which a marker must be added
  * @param message The message of the marker we want to display in the Problem View.
  * @param severity The severity of the marker
  * @param type the type of the marker to create
  * @return an optional Marker (none if problem during creation).
  */
 public static Option<IMarker> addMarkerFor(
     final IResource resource, final String message, final int severity, String type) {
   try {
     if (resource != null) {
       final IMarker marker = resource.createMarker(type);
       marker.setAttribute(IMarker.SEVERITY, severity);
       marker.setAttribute(IMarker.MESSAGE, message);
       return Options.newSome(marker);
     }
   } catch (final CoreException e) {
     DslCommonPlugin.getDefault().getLog().log(e.getStatus());
   }
   return Options.newNone();
 }
 @Override
 public Option<Session> getSession() {
   return Options.newSome(session);
 }
 /**
  * Return the target of kind DiagramElement or a null Option if any target or of another kind.
  *
  * @return An option of DDiagramElement.
  */
 public Option<DDiagramElement> getDiagramElementTarget() {
   if (getTarget() instanceof DDiagramElement) {
     return Options.newSome((DDiagramElement) getTarget());
   }
   return Options.newNone();
 }
 private Option<AbstractDiagramElementContainerEditPart> getLastRegionPart() {
   Iterable<AbstractDiagramElementContainerEditPart> regionParts = getRegionParts();
   return Options.newSome(Iterables.getLast(regionParts, null));
 }