use of net.heartsome.cat.ts.ui.advanced.dialogs.CatalogManagerDialog in project translationstudio8 by heartsome.
the class CatalogManagerHandler method execute.
public Object execute(ExecutionEvent event) throws ExecutionException {
root = ResourcesPlugin.getWorkspace().getRoot();
//先检查目录管理器配置所需要的文件是否都存在于工作空间
File catalogXmlFile = root.getLocation().append(ADConstants.catalogueXmlPath).toFile();
// 如果不存在,就将net.heartsome.cat.ts.configurationfile.feature插件的net.heartsome.cat.converter里的catalogue.xml拷到工作空间
if (!catalogXmlFile.exists() || new File(catalogXmlFile.getParent()).list().length <= 0) {
//这是产品打包后,catalogue.xml所在的路径
String srcLocation = Platform.getConfigurationLocation().getURL().getPath() + "net.heartsome.cat.converter" + System.getProperty("file.separator") + "catalogue" + System.getProperty("file.separator") + "catalogue.xml";
String tagLoaction = catalogXmlFile.getParent();
try {
ResourceUtils.copyDirectory(new File(srcLocation).getParentFile(), new File(tagLoaction));
} catch (Exception e) {
e.printStackTrace();
}
}
catalogXmlFile = root.getLocation().append(ADConstants.catalogueXmlPath).toFile();
if (!catalogXmlFile.exists()) {
MessageDialog.openInformation(HandlerUtil.getActiveSite(event).getShell(), Messages.getString("handlers.CatalogManagerHandler.msgTitle"), Messages.getString("handlers.CatalogManagerHandler.msg"));
return null;
}
CatalogManagerDialog dialog = new CatalogManagerDialog(HandlerUtil.getActiveSite(event).getShell(), root);
dialog.open();
return null;
}
Aggregations