예제 #1
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);
          }
        }
      }
    }
예제 #2
0
 private boolean selectionChangedToEGL(IStructuredSelection selection) {
   if (selection.size() == 1) {
     if (selection.getFirstElement() instanceof IEGLFile) {
       IEGLElement eglElem = (IEGLElement) selection.getFirstElement();
       IResource resource = eglElem.getResource();
       if (resource != null) {
         openFileAction.selectionChanged(new StructuredSelection(resource));
         return true;
       }
     } else if (selection.getFirstElement() instanceof IClassFile) {
       IEGLElement eglElem = (IEGLElement) selection.getFirstElement();
       openIRFileAction.setClassFile(((IClassFile) eglElem));
       return true;
     }
   }
   return false;
 }