/** @generated */
 public static LinkConstraints getLinkConstraints() {
   LinkConstraints cached = UMLDiagramEditorPlugin.getInstance().getLinkConstraints();
   if (cached == null) {
     UMLDiagramEditorPlugin.getInstance().setLinkConstraints(cached = new LinkConstraints());
   }
   return cached;
 }
 /** @generated */
 static {
   UMLDiagramEditorPlugin.getInstance()
       .getImageRegistry()
       .put(
           "Navigator?UnknownElement", ImageDescriptor.getMissingImageDescriptor()); // $NON-NLS-1$
   UMLDiagramEditorPlugin.getInstance()
       .getImageRegistry()
       .put("Navigator?ImageNotFound", ImageDescriptor.getMissingImageDescriptor()); // $NON-NLS-1$
 }
 public Rectangle getBounds() {
   View view = this.getNotationView();
   int width =
       ((Integer) getStructuralFeatureValue(view, NotationPackage.eINSTANCE.getSize_Width()))
           .intValue();
   int height =
       ((Integer) getStructuralFeatureValue(view, NotationPackage.eINSTANCE.getSize_Height()))
           .intValue();
   int x =
       ((Integer) getStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLocation_X()))
           .intValue();
   int y =
       ((Integer) getStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLocation_Y()))
           .intValue();
   String prefElementId = ViewUtil.resolveSemanticElement(view).eClass().getName();
   IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
   String preferenceConstantWitdh =
       PreferenceInitializerForElementHelper.getpreferenceKey(
           view, prefElementId, PreferencesConstantsHelper.WIDTH);
   String preferenceConstantHeight =
       PreferenceInitializerForElementHelper.getpreferenceKey(
           view, prefElementId, PreferencesConstantsHelper.HEIGHT);
   if (width <= 0) {
     width = store.getInt(preferenceConstantWitdh);
   }
   if (height <= 0) {
     height = store.getInt(preferenceConstantHeight);
   }
   return new Rectangle(x, y, width, height);
 }
Exemplo n.º 4
0
 /** @generated */
 public static void deleteMarkers(IResource resource) {
   try {
     resource.deleteMarkers(MARKER_TYPE, true, IResource.DEPTH_ZERO);
   } catch (CoreException e) {
     UMLDiagramEditorPlugin.getInstance()
         .logError("Failed to delete validation markers", e); // $NON-NLS-1$
   }
 }
 /** @generated */
 private String getConsiderIgnoreFragment_3007Text(View view) {
   ConsiderIgnoreFragment domainModelElement = (ConsiderIgnoreFragment) view.getElement();
   if (domainModelElement != null) {
     return String.valueOf(domainModelElement.getName());
   } else {
     UMLDiagramEditorPlugin.getInstance()
         .logError("No domain element for view with visualID = " + 3007); // $NON-NLS-1$
     return ""; //$NON-NLS-1$
   }
 }
 /** @generated */
 private String getInteractionOperand_3005Text(View view) {
   InteractionOperand domainModelElement = (InteractionOperand) view.getElement();
   if (domainModelElement != null) {
     return String.valueOf(domainModelElement.getName());
   } else {
     UMLDiagramEditorPlugin.getInstance()
         .logError("No domain element for view with visualID = " + 3005); // $NON-NLS-1$
     return ""; //$NON-NLS-1$
   }
 }
 /** @generated */
 private String getPackage_1000Text(View view) {
   Package domainModelElement = (Package) view.getElement();
   if (domainModelElement != null) {
     return String.valueOf(domainModelElement.getName());
   } else {
     UMLDiagramEditorPlugin.getInstance()
         .logError("No domain element for view with visualID = " + 1000); // $NON-NLS-1$
     return ""; //$NON-NLS-1$
   }
 }
 /** @generated */
 private String getBehaviorExecutionSpecification_3003Text(View view) {
   BehaviorExecutionSpecification domainModelElement =
       (BehaviorExecutionSpecification) view.getElement();
   if (domainModelElement != null) {
     return String.valueOf(domainModelElement.getName());
   } else {
     UMLDiagramEditorPlugin.getInstance()
         .logError("No domain element for view with visualID = " + 3003); // $NON-NLS-1$
     return ""; //$NON-NLS-1$
   }
 }
 /** @generated */
 private String getDestructionOccurrenceSpecification_3022Text(View view) {
   DestructionOccurrenceSpecification domainModelElement =
       (DestructionOccurrenceSpecification) view.getElement();
   if (domainModelElement != null) {
     return String.valueOf(domainModelElement.getName());
   } else {
     UMLDiagramEditorPlugin.getInstance()
         .logError("No domain element for view with visualID = " + 3022); // $NON-NLS-1$
     return ""; //$NON-NLS-1$
   }
 }
Exemplo n.º 10
0
 /** @generated */
 protected void setStatus(int severity, String message, Throwable throwable) {
   String pluginID = UMLDiagramEditorPlugin.ID;
   this.status =
       new Status(
           severity, pluginID, -1, (message != null) ? message : "", throwable); // $NON-NLS-1$
   if (!this.status.isOK()) {
     UMLDiagramEditorPlugin.getInstance()
         .logError(
             "Expression problem:" + message + "body:" + body(),
             throwable); //$NON-NLS-1$ //$NON-NLS-2$
   }
 }
Exemplo n.º 11
0
 /** @generated */
 @SuppressWarnings("rawtypes")
 public Object evaluate(Object context, Map env) {
   if (context().isInstance(context)) {
     try {
       return doEvaluate(context, env);
     } catch (Exception e) {
       UMLDiagramEditorPlugin.getInstance()
           .logError("Expression evaluation failure: " + body(), e); // $NON-NLS-1$
     }
   }
   return null;
 }
  /** @generated */
  private Image getImage(String key, IElementType elementType) {
    ImageRegistry imageRegistry = UMLDiagramEditorPlugin.getInstance().getImageRegistry();
    Image image = imageRegistry.get(key);
    if (image == null && elementType != null && UMLElementTypes.isKnownElementType(elementType)) {
      image = UMLElementTypes.getImage(elementType);
      imageRegistry.put(key, image);
    }

    if (image == null) {
      image = imageRegistry.get("Navigator?ImageNotFound"); // $NON-NLS-1$
      imageRegistry.put(key, image);
    }
    return image;
  }
Exemplo n.º 13
0
 /** @generated */
 @Override
 protected NodeFigure createNodePlate() {
   String prefElementId = "Comment";
   IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
   String preferenceConstantWitdh =
       PreferenceInitializerForElementHelper.getpreferenceKey(
           getNotationView(), prefElementId, PreferencesConstantsHelper.WIDTH);
   String preferenceConstantHeight =
       PreferenceInitializerForElementHelper.getpreferenceKey(
           getNotationView(), prefElementId, PreferencesConstantsHelper.HEIGHT);
   DefaultSizeNodeFigure result =
       new DefaultSizeNodeFigure(
           store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight));
   return result;
 }
  /** @generated */
  public Image getImage(Object element) {
    if (element instanceof UMLNavigatorGroup) {
      UMLNavigatorGroup group = (UMLNavigatorGroup) element;
      return UMLDiagramEditorPlugin.getInstance().getBundledImage(group.getIcon());
    }

    if (element instanceof UMLNavigatorItem) {
      UMLNavigatorItem navigatorItem = (UMLNavigatorItem) element;
      if (!isOwnView(navigatorItem.getView())) {
        return super.getImage(element);
      }
      return getImage(navigatorItem.getView());
    }

    return super.getImage(element);
  }
 /** @generated */
 private String getMessage_4009Text(View view) {
   IParser parser =
       UMLParserProvider.getParser(
           UMLElementTypes.Message_4009,
           view.getElement() != null ? view.getElement() : view,
           UMLVisualIDRegistry.getType(MessageName7EditPart.VISUAL_ID));
   if (parser != null) {
     return parser.getPrintString(
         new EObjectAdapter(view.getElement() != null ? view.getElement() : view),
         ParserOptions.NONE.intValue());
   } else {
     UMLDiagramEditorPlugin.getInstance()
         .logError("Parser was not found for label " + 6007); // $NON-NLS-1$
     return ""; //$NON-NLS-1$
   }
 }
 /** @generated */
 private String getGeneralOrdering_4012Text(View view) {
   IParser parser =
       UMLParserProvider.getParser(
           UMLElementTypes.GeneralOrdering_4012,
           view.getElement() != null ? view.getElement() : view,
           UMLVisualIDRegistry.getType(GeneralOrderingAppliedStereotypeEditPart.VISUAL_ID));
   if (parser != null) {
     return parser.getPrintString(
         new EObjectAdapter(view.getElement() != null ? view.getElement() : view),
         ParserOptions.NONE.intValue());
   } else {
     UMLDiagramEditorPlugin.getInstance()
         .logError("Parser was not found for label " + 6015); // $NON-NLS-1$
     return ""; //$NON-NLS-1$
   }
 }
 /** @generated */
 public IStructuredSelection findSelection(IEditorInput anInput) {
   IDiagramDocument document =
       UMLDiagramEditorPlugin.getInstance().getDocumentProvider().getDiagramDocument(anInput);
   if (document == null) {
     return StructuredSelection.EMPTY;
   }
   Diagram diagram = document.getDiagram();
   if (diagram == null || diagram.eResource() == null) {
     return StructuredSelection.EMPTY;
   }
   IFile file = WorkspaceSynchronizer.getFile(diagram.eResource());
   if (file != null) {
     UMLNavigatorItem item = new UMLNavigatorItem(diagram, file, false);
     return new StructuredSelection(item);
   }
   return StructuredSelection.EMPTY;
 }
Exemplo n.º 18
0
 /** @generated */
 public static IMarker addMarker(
     IFile file, String elementId, String location, String message, int statusSeverity) {
   IMarker marker = null;
   try {
     marker = file.createMarker(MARKER_TYPE);
     marker.setAttribute(IMarker.MESSAGE, message);
     marker.setAttribute(IMarker.LOCATION, location);
     marker.setAttribute(
         org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID, elementId);
     int markerSeverity = IMarker.SEVERITY_INFO;
     if (statusSeverity == IStatus.WARNING) {
       markerSeverity = IMarker.SEVERITY_WARNING;
     } else if (statusSeverity == IStatus.ERROR || statusSeverity == IStatus.CANCEL) {
       markerSeverity = IMarker.SEVERITY_ERROR;
     }
     marker.setAttribute(IMarker.SEVERITY, markerSeverity);
   } catch (CoreException e) {
     UMLDiagramEditorPlugin.getInstance()
         .logError("Failed to create validation marker", e); // $NON-NLS-1$
   }
   return marker;
 }
 /** @generated */
 public boolean canExistMessage_4009(
     Interaction container, Message linkInstance, Element source, Element target) {
   try {
     if (source == null) {
       return true;
     } else {
       Map<String, EClassifier> env =
           Collections.<String, EClassifier>singletonMap(
               "oppositeEnd", UMLPackage.eINSTANCE.getElement()); // $NON-NLS-1$
       Object sourceVal =
           UMLOCLFactory.getExpression(20, UMLPackage.eINSTANCE.getElement(), env)
               .evaluate(source, Collections.singletonMap("oppositeEnd", target)); // $NON-NLS-1$
       if (false == sourceVal instanceof Boolean || !((Boolean) sourceVal).booleanValue()) {
         return false;
       } // else fall-through
     }
     if (target == null) {
       return true;
     } else {
       Map<String, EClassifier> env =
           Collections.<String, EClassifier>singletonMap(
               "oppositeEnd", UMLPackage.eINSTANCE.getElement()); // $NON-NLS-1$
       Object targetVal =
           UMLOCLFactory.getExpression(22, UMLPackage.eINSTANCE.getElement(), env)
               .evaluate(target, Collections.singletonMap("oppositeEnd", source)); // $NON-NLS-1$
       if (false == targetVal instanceof Boolean || !((Boolean) targetVal).booleanValue()) {
         return false;
       } // else fall-through
     }
     return true;
   } catch (Exception e) {
     UMLDiagramEditorPlugin.getInstance()
         .logError("Link constraint evaluation error", e); // $NON-NLS-1$
     return false;
   }
 }
 /** @generated */
 protected IPreferenceStore getPreferenceStore() {
   return UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
 }