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

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


             * correct, that should reduce the reported problems
             * to those the user can correct.
             */
            if (((problemID & IProblem.Internal) != 0) && ((problemID & IProblem.Syntax) != 0) && translation instanceof JSPTranslation) {
              // Attach to the last code scripting section
              JSPTranslation jspTranslation = ((JSPTranslation) translation);
              Position[] jspPositions = (Position[]) jspTranslation.getJsp2JavaMap().keySet().toArray(new Position[jspTranslation.getJsp2JavaMap().size()]);
              for (int i = 0; i < jspPositions.length; i++) {
                sourceStart = Math.max(sourceStart, jspPositions[i].getOffset());
              }
              IMessage m = new LocalizedMessage(sev, problem.getMessage(), f);
              m.setOffset(sourceStart);
View Full Code Here


    if (region != null && textViewer != null) {
      IDocument document = textViewer.getDocument();

      // check and make sure this is a valid Java type
      JSPTranslation jspTranslation = getJSPTranslation(document);
      if (jspTranslation != null) {
        // check if we are in JSP Java content
        int javaOffset = jspTranslation.getJavaOffset(region.getOffset());
        if (javaOffset > -1) {
          // check that we are not in indirect Java content (like
          // included files)
          if (!jspTranslation.isIndirect(javaOffset)) {
            // get Java elements
            IJavaElement[] elements = jspTranslation.getElementsFromJspRange(region.getOffset(), region.getOffset() + region.getLength());
            if (elements != null && elements.length > 0) {
              // create a JSPJavaHyperlink for each Java element
              for (int i = 0; i < elements.length; ++i) {
                IJavaElement element = elements[i];
View Full Code Here

   * Get JSP translation object
   *
   * @return JSPTranslation if one exists, null otherwise
   */
  private JSPTranslation getJSPTranslation(IDocument document) {
    JSPTranslation translation = null;

    IDOMModel xmlModel = null;
    try {
      xmlModel = (IDOMModel) StructuredModelManager.getModelManager().getExistingModelForRead(document);
      if (xmlModel != null) {
View Full Code Here

          IDOMModel xmlModel = (IDOMModel)model;
          IDOMDocument xmlDoc = xmlModel.getDocument();

          JSPTranslationAdapter adapter = (JSPTranslationAdapter) xmlDoc.getAdapterFor(IJSPTranslation.class);
          if (adapter != null) {
            JSPTranslation translation = adapter.getJSPTranslation();
            elements = translation.getElementsFromJspRange(textSelection.getOffset(), textSelection.getOffset() + textSelection.getLength());
          }
        }
      }
      finally {
        if (model != null)
View Full Code Here

        fTranslationAdapter = (JSPTranslationAdapter) xmlDoc.getAdapterFor(IJSPTranslation.class);
        fModelId = xmlModel.getId();
      }
      if (fTranslationAdapter != null) {

        JSPTranslation translation = fTranslationAdapter.getJSPTranslation();
        int javaPosition = translation.getJavaOffset(pos) + javaPositionExtraOffset;

        try {

          ICompilationUnit cu = translation.getCompilationUnit();

          // can't get java proposals w/out a compilation unit
          // or without a valid position
          if (cu == null || -1 == javaPosition)
            return new ArrayList(0);
View Full Code Here

    if (region != null && textViewer != null) {
      IDocument document = textViewer.getDocument();

      // check and make sure this is a valid Java type
      JSPTranslation jspTranslation = getJSPTranslation(document);
      if (jspTranslation != null) {
        // check if we are in JSP Java content
        int javaOffset = jspTranslation.getJavaOffset(region.getOffset());
        if (javaOffset > -1) {
          // check that we are not in indirect Java content (like
          // included files)
          if (!jspTranslation.isIndirect(javaOffset)) {
            // get Java elements
            IJavaElement[] elements = jspTranslation.getElementsFromJspRange(region.getOffset(), region.getOffset() + region.getLength());
            if (elements != null && elements.length > 0) {
              // create a JSPJavaHyperlink for each Java element
              for (int i = 0; i < elements.length; ++i) {
                IJavaElement element = elements[i];
View Full Code Here

   * Get JSP translation object
   *
   * @return JSPTranslation if one exists, null otherwise
   */
  private JSPTranslation getJSPTranslation(IDocument document) {
    JSPTranslation translation = null;

    IDOMModel xmlModel = null;
    try {
      xmlModel = (IDOMModel) StructuredModelManager.getModelManager().getExistingModelForRead(document);
      if (xmlModel != null) {
View Full Code Here

  public int getJspOffset(int javaOffset) {
    // copied from JSPTranslation
    int result = -1;
    int offsetInRange = 0;
    Position jspPos, javaPos = null;
    JSPTranslation trans = getJSPTranslation();
    if (trans != null) {
      HashMap java2jspMap = trans.getJava2JspMap();

      // iterate all mapped java ranges
      Iterator it = java2jspMap.keySet().iterator();
      while (it.hasNext()) {
        javaPos = (Position) it.next();
View Full Code Here

        fTranslationAdapter = (JSPTranslationAdapter) xmlDoc.getAdapterFor(IJSPTranslation.class);
        fModelId = xmlModel.getId();
      }
      if (fTranslationAdapter != null) {

        JSPTranslation translation = fTranslationAdapter.getJSPTranslation();
        int javaPosition = translation.getJavaOffset(pos) + javaPositionExtraOffset;

        try {

          ICompilationUnit cu = translation.getCompilationUnit();

          // can't get java proposals w/out a compilation unit
          // or without a valid position
          if (cu == null || -1 == javaPosition)
            return new ArrayList(0);
View Full Code Here

    try {
      if (model != null && model instanceof IDOMModel) {
        IDOMDocument xmlDoc = ((IDOMModel) model).getDocument();
        JSPTranslationAdapter adapter = (JSPTranslationAdapter) xmlDoc.getAdapterFor(IJSPTranslation.class);
        if (adapter != null) {
          JSPTranslation translation = adapter.getJSPTranslation();

          // https://bugs.eclipse.org/bugs/show_bug.cgi?id=102211
          elements = translation.getElementsFromJspRange(selection.getOffset(), selection.getOffset() + selection.getLength());
        }
      }
    }
    finally {
      if (model != null)
View Full Code Here

TOP

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

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.