コード例 #1
0
 /**
  * Gets the standard stereotype according to specified name.
  *
  * @param name specified stereotype name
  * @return the found stereotype, null if not found
  */
 private Stereotype getStandardStereotype(String name) {
   try {
     List<Stereotype> standardStereotypes =
         getMainFrame().getPropertiesPanel().getStereotypes(element.getClass());
     for (Stereotype standard : standardStereotypes) {
       if (standard.getName().equalsIgnoreCase(name)) {
         return standard;
       }
     }
   } catch (Exception e) {
     // ignore
   }
   return null;
 }
コード例 #2
0
  /** Creates the model element for new node. */
  protected void createModelElement() {
    element = new ClassImpl();
    element.setName(name);

    // Obtain the stereotypes from project configuration manager
    Set<Stereotype> newStereotypes = new HashSet<Stereotype>();

    newStereotypes.add(getStandardStereotype("Enum"));

    getMainFrame().getPropertiesPanel().addStereotypes(newStereotypes, element.getClass());
    for (Stereotype stereotype : newStereotypes) {
      element.addStereotype(stereotype);
    }

    NodeContainer nodeContainer = getNodeContainer();
    if (nodeContainer != null) {
      setAddModelElementAction(
          new AddClassAction(
              element, modelManager, (Namespace) DeployHelper.getElement(nodeContainer)));
    } else {
      setAddModelElementAction(new AddClassAction(element, modelManager));
    }
  }