/** For internal use only. */
  public static void initMeta() {
    try {
      metaClass.setSuperMetaClass(DbSMSStructuralFeature.metaClass);
      metaClass.setIcon("dboodatamember.gif");

      fAssociationEnd.setJField(DbOODataMember.class.getDeclaredField("m_associationEnd"));
      fAssociationEnd.setVisibleInScreen(false);
      fVisibility.setJField(DbOODataMember.class.getDeclaredField("m_visibility"));
      fVisibility.setScreenOrder("<initialValue");
      fType.setJField(DbOODataMember.class.getDeclaredField("m_type"));
      fType.setFlags(MetaField.COPY_REFS | MetaField.INTEGRABLE_BY_NAME);
      fType.setRendererPluginName("DbFullNameInTip;DbOOAdt");
      fElementType.setJField(DbOODataMember.class.getDeclaredField("m_elementType"));
      fElementType.setFlags(MetaField.COPY_REFS | MetaField.INTEGRABLE_BY_NAME);
      fTypeUse.setJField(DbOODataMember.class.getDeclaredField("m_typeUse"));
      fTypeUseStyle.setJField(DbOODataMember.class.getDeclaredField("m_typeUseStyle"));
      fStatic.setJField(DbOODataMember.class.getDeclaredField("m_static"));
      fCommonItem.setJField(DbOODataMember.class.getDeclaredField("m_commonItem"));
      fDomain.setJField(DbOODataMember.class.getDeclaredField("m_domain"));

      fAssociationEnd.setOppositeRel(DbOOAssociationEnd.fAssociationMember);
      fType.setOppositeRel(DbOOAdt.fTypedDataMembers);
      fElementType.setOppositeRel(DbOOAdt.fTypedElementDataMembers);
      fCommonItem.setOppositeRel(DbORCommonItem.fFields);
      fDomain.setOppositeRel(DbORDomain.fFields);

    } catch (Exception e) {
      throw new RuntimeException("Meta init");
    }
  }
예제 #2
0
 public static MetaField getMetaField(DbObject dbo, String name) {
   MetaField[] allMetaFields = dbo.getMetaClass().getAllMetaFields();
   for (int i = 0; i < allMetaFields.length; i++) {
     MetaField metaField = allMetaFields[i];
     if (name.equals(metaField.getJField().getName())) return metaField;
   }
   return null;
 }
예제 #3
0
 // Overridden
 public void installDbListeners(boolean install) {
   MetaField[] tipsFields = DisplayToolTipsOptionGroup.getAvailableMetaFields();
   MetaField[] metaFields = new MetaField[] {DbObject.fComponents, DbSemanticalObject.fName};
   if (install) {
     MetaField.addDbRefreshListener(this, null, metaFields);
     MetaField.addDbRefreshListener(this, null, tipsFields);
   } else {
     MetaField.removeDbRefreshListener(this, metaFields);
     MetaField.removeDbRefreshListener(this, tipsFields);
   }
 }
예제 #4
0
 // Called at the end of a cell edition, to process the edition result.
 public final void valueForPathChanged(TreePath path, Object newValue) {
   DynamicNode node = (DynamicNode) path.getLastPathComponent();
   Object obj = node.getRealObject();
   if (obj instanceof DbObject) {
     boolean editable = false;
     try {
       Db db = ((DbObject) obj).getDb();
       if (db.isValid()) {
         db.beginReadTrans();
         MetaField editableMetaField = getEditableMetaField((DbObject) obj);
         if (editableMetaField == null)
           editable =
               ApplicationContext.getSemanticalModel()
                   .isNameEditable((DbObject) obj, Explorer.class);
         else
           editable =
               ApplicationContext.getSemanticalModel()
                   .isEditable(editableMetaField, (DbObject) obj, Explorer.class);
         db.commitTrans();
       }
     } catch (DbException ex) {
       org.modelsphere.jack.util.ExceptionHandler.processUncatchedException(
           ApplicationContext.getDefaultMainFrame(), ex);
       editable = false;
     }
     if (!editable) return;
   } else {
     return;
   }
   DbObject semObj = (DbObject) obj;
   try {
     MetaField editableMetaField = getEditableMetaField(semObj);
     String transName =
         (editableMetaField == null
             ? LocaleMgr.action.getString("rename")
             : MessageFormat.format(kUpdate0, new Object[] {editableMetaField.getGUIName()}));
     semObj.getDb().beginTrans(Db.WRITE_TRANS, transName);
     if (editableMetaField == null) {
       if (semObj.getTransStatus() == Db.OBJ_REMOVED) return;
       semObj.setName((String) newValue);
     } else semObj.set(editableMetaField, (String) newValue);
     semObj.getDb().commitTrans();
     nodeChanged(node); // in case it is a secondary node (only the
     // primary node is updated by the refresh
     // listener).
   } catch (Exception ex) {
     org.modelsphere.jack.util.ExceptionHandler.processUncatchedException(
         ApplicationContext.getDefaultMainFrame(), ex);
   }
 }
 public void set(MetaField metaField, Object value) throws DbException {
   if (metaField.getMetaClass() == metaClass) {
     if (metaField == fStereotypedObjects) ((DbSMSSemanticalObject) value).setUmlStereotype(this);
     else if (metaField == fSubStereotypes)
       setSubStereotypes((DbSMSStereotype) value, Db.ADD_TO_RELN);
     else if (metaField == fSuperStereotypes)
       setSuperStereotypes((DbSMSStereotype) value, Db.ADD_TO_RELN);
     else basicSet(metaField, value);
   } else super.set(metaField, value);
 }
  /** For internal use only. */
  public static void initMeta() {
    try {
      metaClass.setSuperMetaClass(DbSemanticalObject.metaClass);
      metaClass.setIcon("dbsmsumlstereotype.gif");

      fStereotypedObjects.setJField(DbSMSStereotype.class.getDeclaredField("m_stereotypedObjects"));
      fSubStereotypes.setJField(DbSMSStereotype.class.getDeclaredField("m_subStereotypes"));
      fSuperStereotypes.setJField(DbSMSStereotype.class.getDeclaredField("m_superStereotypes"));
      fIcon.setJField(DbSMSStereotype.class.getDeclaredField("m_icon"));
      fIcon.setRendererPluginName("SrImage;StereotypeIcon");
      fBuiltIn.setJField(DbSMSStereotype.class.getDeclaredField("m_builtIn"));
      fBuiltIn.setEditable(false);
      fMetaClassName.setJField(DbSMSStereotype.class.getDeclaredField("m_metaClassName"));
      fMetaClassName.setRendererPluginName("SMSSemanticalMetaClass");

      fSubStereotypes.setOppositeRel(DbSMSStereotype.fSuperStereotypes);
      fSuperStereotypes.setOppositeRel(DbSMSStereotype.fSubStereotypes);

    } catch (Exception e) {
      throw new RuntimeException("Meta init");
    }
  }
 public void set(MetaField metaField, Object value) throws DbException {
   if (metaField.getMetaClass() == metaClass) {
     basicSet(metaField, value);
   } else super.set(metaField, value);
 }
  /** For internal use only. */
  public static void initMeta() {
    try {
      metaClass.setSuperMetaClass(DbSMSStyle.metaClass);

      fOr_nameDescriptor.setJField(
          DbORCommonItemStyle.class.getDeclaredField("m_or_nameDescriptor"));
      fLineColorDbORCommonItem.setJField(
          DbORCommonItemStyle.class.getDeclaredField("m_lineColorDbORCommonItem"));
      fDescriptorFontDbORCommonItem.setJField(
          DbORCommonItemStyle.class.getDeclaredField("m_descriptorFontDbORCommonItem"));
      fDashStyleDbORCommonItem.setJField(
          DbORCommonItemStyle.class.getDeclaredField("m_dashStyleDbORCommonItem"));
      fTextColorDbORCommonItem.setJField(
          DbORCommonItemStyle.class.getDeclaredField("m_textColorDbORCommonItem"));
      fHighlightDbORCommonItem.setJField(
          DbORCommonItemStyle.class.getDeclaredField("m_highlightDbORCommonItem"));
      fBackgroundColorDbORCommonItem.setJField(
          DbORCommonItemStyle.class.getDeclaredField("m_backgroundColorDbORCommonItem"));
      fOr_commonItemLengthDecimalsDisplay.setJField(
          DbORCommonItemStyle.class.getDeclaredField("m_or_commonItemLengthDecimalsDisplay"));
      fOr_commonItemLengthDecimalsFont.setJField(
          DbORCommonItemStyle.class.getDeclaredField("m_or_commonItemLengthDecimalsFont"));
      fReferringProjectCommonItem.setJField(
          DbORCommonItemStyle.class.getDeclaredField("m_referringProjectCommonItem"));
      fOr_commonItemNullValueFont.setJField(
          DbORCommonItemStyle.class.getDeclaredField("m_or_commonItemNullValueFont"));
      fOr_commonItemTypeFont.setJField(
          DbORCommonItemStyle.class.getDeclaredField("m_or_commonItemTypeFont"));
      fOr_commonItemTypeDisplay.setJField(
          DbORCommonItemStyle.class.getDeclaredField("m_or_commonItemTypeDisplay"));
      fOr_commonItemNullValueDisplay.setJField(
          DbORCommonItemStyle.class.getDeclaredField("m_or_commonItemNullValueDisplay"));

      fReferringProjectCommonItem.setOppositeRel(DbSMSProject.fOrDefaultCommonItemStyle);

    } catch (Exception e) {
      throw new RuntimeException("Meta init");
    }
  }