示例#1
0
  public String[] getPackageName() {
    IPackageFragment packageFragment = (IPackageFragment) getAncestor(IEGLElement.PACKAGE_FRAGMENT);
    String[] packageName;
    if (packageFragment.isDefaultPackage()) {
      packageName = new String[0];
    } else {
      packageName = packageFragment.getElementName().split("\\.");
    }

    return packageName;
  }
示例#2
0
    protected void reconcile() {
      if (fDocument != null && fModel != null && fModel.isHandlingDynamicProblems()) {
        IFile file = ((IFileEditorInput) fEditor.getEditorInput()).getFile();
        IProject proj = file.getProject();
        IWorkingCopy[] currRegedWCs = EGLCore.getSharedWorkingCopies(EGLUI.getBufferFactory());
        IEGLElement eglFile = EGLCore.create(file);
        if (eglFile instanceof IEGLFile) {
          String pkgName;
          IPackageFragment packageFragment =
              (IPackageFragment) eglFile.getAncestor(IEGLElement.PACKAGE_FRAGMENT);
          if (packageFragment.isDefaultPackage()) {
            pkgName = "";
          } else {
            pkgName = packageFragment.getElementName();
          }
          ReconcilerProblemRequestorFactory problemFactory =
              new ReconcilerProblemRequestorFactory(file);

          IDocument document = fProvider.getDocument(fEditor.getEditorInput());
          if (document != null) {
            WorkingCopyCompiler.getInstance()
                .compileAllParts(
                    proj,
                    pkgName,
                    file,
                    currRegedWCs,
                    new IWorkingCopyCompileRequestor() {
                      public void acceptResult(WorkingCopyCompilationResult result) {}
                    },
                    problemFactory);

            List reportedProblems = new ArrayList();
            List errors = problemFactory.problemRequestor.getProblems();
            List syntaxErrors = problemFactory.syntaxErrorRequestor.getProblems();

            // create EGLProblemMarker objects from errors
            String filePath = file.getFullPath().toOSString();
            IEditorInput editorInput = fEditor.getEditorInput();
            if (editorInput == null) {
              System.out.println("Null editor input");
            }
            buildProblemList(document, filePath, reportedProblems, syntaxErrors, "SYN");
            buildProblemList(document, filePath, reportedProblems, errors, "VAL");

            fModel.reportProblems(reportedProblems);
          }
        }
      }
    }