Exemplo n.º 1
0
 public boolean predicate2(Object dm, Designer dsgr) {
   if (!(dm instanceof MClassifier)) return NO_PROBLEM;
   MClassifier cls = (MClassifier) dm;
   String myName = cls.getName();
   //@ if (myName.equals(Name.UNSPEC)) return NO_PROBLEM;
   String myNameString = myName;
   if (myNameString.length() == 0) return NO_PROBLEM;
   Collection pkgs = cls.getElementImports2();
   if (pkgs == null) return NO_PROBLEM;
   for (Iterator iter = pkgs.iterator(); iter.hasNext();) {
     MElementImport imp = (MElementImport)iter.next();
     MNamespace ns = imp.getPackage();
     Collection siblings = ns.getOwnedElements();
     if (siblings == null) return NO_PROBLEM;
     Iterator enum = siblings.iterator();
     while (enum.hasNext()) {
       MElementImport eo = (MElementImport) enum.next();
       MModelElement me = (MModelElement) eo.getModelElement();
       if (!(me instanceof MClassifier)) continue;
       if (me == cls) continue;
       String meName = me.getName();
       if (meName == null || meName.equals("")) continue;
       if (meName.equals(myNameString)) return PROBLEM_FOUND;
     }
   };
   return NO_PROBLEM;
 }
 protected void updateStereotypeText() {
   MModelElement me = (MModelElement) getOwner();
   if (me == null) return;
   MStereotype stereo = me.getStereotype();
   if (stereo == null || stereo.getName() == null || stereo.getName().length() == 0)
     _stereo.setText("");
   else {
     _stereo.setText(Notation.generateStereotype(this, stereo));
   }
 }
Exemplo n.º 3
0
 public void initWizard(Wizard w) {
   if (w instanceof WizMEName) {
     ToDoItem item = w.getToDoItem();
     MModelElement me = (MModelElement) item.getOffenders().elementAt(0);
     String sug = me.getName();
     String ins = "Change the name to something different.";
     ((WizMEName)w).setInstructions(ins);
     ((WizMEName)w).setSuggestion(sug);
     ((WizMEName)w).setMustEdit(true);
   }
 }