コード例 #1
0
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.jface.dialogs.Dialog#okPressed()
  */
 protected void okPressed() {
   super.okPressed();
   try {
     new ComponentFolderManager()
         .copyComponent(
             ResourcesPlugin.getWorkspace().getRoot().getProject(PluginConstant.COMPONENT_PROJECT),
             path,
             this.getValue());
   } catch (CoreException e) {
     // e.printStackTrace();
     org.talend.componentdesigner.exception.ExceptionHandler.process(e);
   } catch (IOException e) {
     // e.printStackTrace();
     org.talend.componentdesigner.exception.ExceptionHandler.process(e);
   }
 }
コード例 #2
0
    private List<String> checkComponentXMLinFolder(String folderPath) {

      List<String> invalidXMLs = new ArrayList();
      File componentFolder = new File(folderPath);
      // get the correct XML file for components
      File[] list =
          componentFolder.listFiles(
              new FilenameFilter() {

                @Override
                public boolean accept(File dir, String name) {
                  // _java.xml
                  String javaXmlName = dir.getName() + "_java.xml"; // $NON-NLS-1$
                  String perlXmlName = dir.getName() + "_perl.xml"; // $NON-NLS-1$
                  if (name.equals(javaXmlName) || name.equals(perlXmlName)) {
                    return true;
                  }
                  return false;
                }
              });

      if (list != null) {
        // check the xml one by one(for perl/java)
        for (File xmlFile : list) {
          try {
            String message = new XSDValidator().checkXSD(xmlFile.getCanonicalPath());
            if (message.length() > 0) {
              invalidXMLs.add(xmlFile.getName());
            }
          } catch (Exception e) {
            org.talend.componentdesigner.exception.ExceptionHandler.process(e);
          }
        }
      }

      return invalidXMLs;
    }