private void analyzePatternsImpl(CompilationInfo javac) {
      checkState(1);
      String clsname = javaFile.getName();
      TypeElement clselm = null;
      for (TypeElement top : javac.getTopLevelElements()) {
        if (clsname.contentEquals(top.getSimpleName())) {
          clselm = top;
        }
      }

      if (clselm == null) {
        isCancelled = true;
        error =
            new NotifyDescriptor.Message(
                NbBundle.getMessage(
                    GenerateBeanInfoAction.class,
                    "MSG_FileWitoutTopLevelClass",
                    clsname,
                    FileUtil.getFileDisplayName(javaFile)),
                NotifyDescriptor.ERROR_MESSAGE);
        return;
      }

      PatternAnalyser pa = new PatternAnalyser(javaFile, null, true);
      pa.analyzeAll(javac, clselm);
      // XXX analyze also superclasses here
      try {
        bia = new BiAnalyser(pa, javac);
      } catch (Exception ex) {
        isCancelled = true;
        Exceptions.printStackTrace(ex);
      }
    }
示例#2
0
  protected void performAction(Node[] activatedNodes) {
    DataObject c = activatedNodes[0].getCookie(DataObject.class);
    FileObject f = c.getPrimaryFile();
    // get classpath
    String cp = SmartFrogSvcUtil.getSFClassPath();

    // set options
    String iniFile = SmartFrogSvcUtil.getIniFile();
    String sfDefault = SmartFrogSvcUtil.getSFDefault();
    String userDir = FileUtil.getFileDisplayName(f.getParent());

    // call jvm

    Process proc = null;
    try {
      String[] procString = new String[8];
      procString[0] = "java";
      procString[1] = "-cp";
      procString[2] = cp;
      procString[3] = "-Duser.dir=\"" + userDir + "\"";
      procString[4] = "org.smartfrog.SFParse";
      procString[5] = "-d";
      procString[6] = "-v";
      procString[7] = FileUtil.getFileDisplayName(f);

      proc = Runtime.getRuntime().exec(procString);
    } catch (IOException ex) {
      ErrorManager.getDefault().notify(ErrorManager.EXCEPTION, ex);
    }
    if (proc != null) {
      ExecSupport es = new ExecSupport();
      try {
        es.displayProcessOutputs(proc, "Smart Frog Parse");
      } catch (InterruptedException ex) {
        ErrorManager.getDefault().notify(ErrorManager.EXCEPTION, ex);
      } catch (IOException ex) {
        ErrorManager.getDefault().notify(ErrorManager.EXCEPTION, ex);
      }
    } else {
      ErrorManager.getDefault()
          .notify(ErrorManager.EXCEPTION, new RuntimeException("Error starting Smart Frog"));
    }
  }
示例#3
0
 /**
  * Constructs a new instance of SourceRootNode.
  *
  * <p>
  *
  * @param root a sourcepath entry.
  */
 public SourceRootNode(FileObject root) {
   super(new SRNChildren(root));
   setIconBaseWithExtension("com/bluemarsh/jswat/views/resources/PackageRoot.gif");
   sourceRoot = root;
   displayName = FileUtil.getFileDisplayName(sourceRoot);
 }
示例#4
0
 public InvalidFileException(final FileObject fo) {
   super(
       NbBundle.getMessage(
           FileObjects.class, "FMT_InvalidFile", FileUtil.getFileDisplayName(fo))); // NOI18N
 }