Esempio n. 1
0
 /**
  * 保存一个类型的所有数据对象。
  *
  * @param cls 数据对象类型
  * @throws Exception
  */
 public void saveDataList(TypeInfo typeInfo) throws Exception {
   //		saveStart(cls);
   Element root = new Element(typeInfo.getName() + "s");
   Document doc = new Document(root);
   typeInfo.save(doc);
   File path = new File(CrossGateEditor.getClientFilePath());
   FileUtils.saveDOM(doc, new File(path, "editor/" + typeInfo.getName() + ".xml"));
   CrossGateEditor.getLog().info(typeInfo.getName() + " info has been save.");
   //		saveEnd(cls);
 }
Esempio n. 2
0
 @Override
 public void fileModified(File f) {
   TypeInfo[] infos = CrossGateEditor.getEditorPool().toArray();
   File base = CrossGateEditor.getBaseFile();
   for (TypeInfo info : infos) {
     if (info.getXML(base).equals(f)) {
       getSite().getShell().getDisplay().asyncExec(new DataChangedHandler(info.getName()));
     }
   }
 }
Esempio n. 3
0
 /**
  * 打开一个数据对象的编辑器。
  *
  * @param 基础对象的衍生类
  * @param obj 被编辑的对象
  */
 public void editObject(EditorObject obj) {
   TypeInfo typeInfo = obj.getTypeInfo();
   try {
     getSite()
         .getWorkbenchWindow()
         .getActivePage()
         .openEditor(new DataObjectInput(obj), typeInfo.getEditorId());
   } catch (Exception e) {
     CrossGateEditor.getLog()
         .error(getClass().getName() + "::editObject() : editorID = " + typeInfo.getEditorId(), e);
     //			CrossGateEditor.catchException(e, false);
     MessageDialog.openError(getSite().getShell(), "错误", "打开编辑器失败,原因:\n" + e.toString());
   }
 }