Package org.eclipse.jst.jsp.core.internal.java

Examples of org.eclipse.jst.jsp.core.internal.java.IJSPTranslation


      IDOMModel domModel = (IDOMModel) model;
      ModelHandlerForJSP.ensureTranslationAdapterFactory(domModel);

      IDOMDocument xmlDoc = domModel.getDocument();
      JSPTranslationAdapter translationAdapter = (JSPTranslationAdapter) xmlDoc.getAdapterFor(IJSPTranslation.class);
      IJSPTranslation translation = translationAdapter.getJSPTranslation();

      if (!reporter.isCancelled()) {
        loadPreferences(f);

        // only update task markers if the model is the same as what's on disk
        boolean updateJavaTasks = UPDATE_JAVA_TASKS && !domModel.isDirty() && f != null && f.isAccessible();
        if (updateJavaTasks) {
          // remove old Java task markers
          try {
            IMarker[] foundMarkers = f.findMarkers(JAVA_TASK_MARKER_TYPE, true, IResource.DEPTH_ONE);
            for (int i = 0; i < foundMarkers.length; i++) {
              foundMarkers[i].delete();
            }
          }
          catch (CoreException e) {
            Logger.logException(e);
          }
        }

        translation.setProblemCollectingActive(true);
        translation.reconcileCompilationUnit();
        List problems = translation.getProblems();
        // add new messages
        for (int i = 0; i < problems.size() && !reporter.isCancelled(); i++) {
          IProblem problem = (IProblem) problems.get(i);
          /*
           * Possible error in problem collection; EL translation is
View Full Code Here


        // get Java range, translate coordinate to JSP

        try {
          ISourceRange range = null;
          IJSPTranslation jspTranslation = getJSPTranslation(document);
          if (jspTranslation != null) {
            // link to local variable definitions
            if (element instanceof ILocalVariable) {
              range = ((ILocalVariable) element).getNameRange();
            }
            // linking to fields of the same compilation unit
            else if (element.getElementType() == IJavaElement.FIELD) {
              Object cu = ((IField) element).getCompilationUnit();
              if (cu != null && cu.equals(jspTranslation.getCompilationUnit()))
                range = ((ISourceReference) element).getSourceRange();
            }
            // linking to methods of the same compilation unit
            else if (element.getElementType() == IJavaElement.METHOD) {
              Object cu = ((IMethod) element).getCompilationUnit();
              if (cu != null && cu.equals(jspTranslation.getCompilationUnit()))
                range = ((ISourceReference) element).getSourceRange();
            }
          }

          if (range != null && file != null) {
            jspOffset = jspTranslation.getJspOffset(range.getOffset());
            if (jspOffset >= 0) {
              link = new WorkspaceFileHyperlink(region, file, new Region(jspOffset, range.getLength()));
            }
          }
        }
View Full Code Here

        // get Java range, translate coordinate to JSP

        try {
          ISourceRange range = null;
          IJSPTranslation jspTranslation = getJSPTranslation(document);
          if (jspTranslation != null) {
            // link to local variable definitions
            if (element instanceof ILocalVariable) {
              range = ((ILocalVariable) element).getNameRange();
              Object cu = ((ILocalVariable) element).getDeclaringMember().getCompilationUnit();
              if (cu != null && cu.equals(jspTranslation.getCompilationUnit()))
                isInTranslationCU = true;
            }
            // linking to fields of the same compilation unit
            else if (element.getElementType() == IJavaElement.FIELD) {
              Object cu = ((IField) element).getCompilationUnit();
              if (cu != null && cu.equals(jspTranslation.getCompilationUnit())) {
                range = ((ISourceReference) element).getSourceRange();
                isInTranslationCU = true;
              }
            }
            // linking to methods of the same compilation unit
            else if (element.getElementType() == IJavaElement.METHOD) {
              Object cu = ((IMethod) element).getCompilationUnit();
              if (cu != null && cu.equals(jspTranslation.getCompilationUnit())) {
                range = ((ISourceReference) element).getSourceRange();
                isInTranslationCU = true;
              }
            }
          }

          if (range != null && file != null) {
            jspOffset = jspTranslation.getJspOffset(range.getOffset());
            if (jspOffset >= 0) {
              link = new WorkspaceFileHyperlink(region, file, new Region(jspOffset, range.getLength()));
            }
          }
        }
View Full Code Here

      IDOMModel domModel = (IDOMModel) model;
      ModelHandlerForJSP.ensureTranslationAdapterFactory(domModel);

      IDOMDocument xmlDoc = domModel.getDocument();
      JSPTranslationAdapter translationAdapter = (JSPTranslationAdapter) xmlDoc.getAdapterFor(IJSPTranslation.class);
      IJSPTranslation translation = translationAdapter.getJSPTranslation();

      if (!reporter.isCancelled()) {
        loadPreferences(f);

        // only update task markers if the model is the same as what's on disk
        boolean updateJavaTasks = UPDATE_JAVA_TASKS && !domModel.isDirty() && f != null && f.isAccessible();
        if (updateJavaTasks) {
          // remove old Java task markers
          try {
            IMarker[] foundMarkers = f.findMarkers(JAVA_TASK_MARKER_TYPE, true, IResource.DEPTH_ONE);
            for (int i = 0; i < foundMarkers.length; i++) {
              foundMarkers[i].delete();
            }
          }
          catch (CoreException e) {
            Logger.logException(e);
          }
        }

        translation.setProblemCollectingActive(true);
        translation.reconcileCompilationUnit();
        List problems = translation.getProblems();
        // add new messages
        for (int i = 0; i < problems.size() && !reporter.isCancelled(); i++) {
          IProblem problem = (IProblem) problems.get(i);
          IMessage m = createMessageFromProblem(problem, f, translation, domModel.getStructuredDocument());
          if (m != null) {
View Full Code Here

TOP

Related Classes of org.eclipse.jst.jsp.core.internal.java.IJSPTranslation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.