Examples of JSPTranslation


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

   */
  protected String getRenameText(JavaSearchDocumentDelegate searchDoc, SearchMatch javaMatch) {
   
    String renameText = getElement().getElementName();

    JSPTranslation trans = searchDoc.getJspTranslation();
    String matchText = trans.getJavaText().substring(javaMatch.getOffset(), javaMatch.getOffset() + javaMatch.getLength());
   
    // if it's an import or jsp:useBean, we need to add the package name as well
    if(trans.isImport(javaMatch.getOffset()) || trans.isUseBean(javaMatch.getOffset()) || isFullyQualified(matchText)) {
      if(!getNewName().equals("")) //$NON-NLS-1$
        // getNewName() is the pkg name
        renameText = getNewName() + "." + renameText; //$NON-NLS-1$
    }

View Full Code Here

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

    String renameText = getNewName();
   
    String pkg = getType().getPackageFragment().getElementName();
    IJavaElement parent = getType().getParent();
    String parentName = (parent != null) ? parent.getElementName() : null;
    JSPTranslation trans = searchDoc.getJspTranslation();
    String matchText = trans.getJavaText().substring(javaMatch.getOffset(), javaMatch.getOffset() + javaMatch.getLength());
   
    // if it's an import or jsp:useBean or fully qualified type, we need to add the package name as well
    // else if starts with parent name such as "MyClass.Enum" then need to add the parent name as well
    if(trans.isImport(javaMatch.getOffset()) || isFullyQualified(matchText)) {
      if(!pkg.equals("")) //$NON-NLS-1$
        renameText = pkg + "." + renameText; //$NON-NLS-1$
    } else if(parentName != null && matchText.startsWith(parentName)) {
      renameText = parentName + "." + renameText; //$NON-NLS-1$
    }
View Full Code Here

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

    if (searchDoc != null && searchDoc instanceof JavaSearchDocumentDelegate) {
      JavaSearchDocumentDelegate javaSearchDoc = (JavaSearchDocumentDelegate)searchDoc;
      int jspStart = javaSearchDoc.getJspOffset(match.getOffset());
      int jspEnd = javaSearchDoc.getJspOffset(match.getOffset() + match.getLength());

      JSPTranslation trans = javaSearchDoc.getJspTranslation();
      String jspText = trans.getJspText();
      String javaText = javaSearchDoc.getJavaText();

      if (DEBUG)
        displayDebugInfo(match, jspStart, jspEnd, jspText, javaText);
   
      if (jspStart > -1 && jspEnd > -1)
        addSearchMatch(new Document(trans.getJspText()), javaSearchDoc.getFile(), jspStart, jspEnd, jspText);
    }
  }
View Full Code Here

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

    try {
      if (xmlModel != null) {
        IDOMDocument xmlDoc = xmlModel.getDocument();
        JSPTranslationAdapter adapter = (JSPTranslationAdapter) xmlDoc.getAdapterFor(IJSPTranslation.class);
        if (adapter != null) {
          JSPTranslation translation = adapter.getJSPTranslation();
         
          IJavaElement[] result = translation.getElementsFromJspRange(hoverRegion.getOffset(), hoverRegion.getOffset() + hoverRegion.getLength());
          return translation.fixupMangledName(getHoverInfo(result));
        }
      }
    }
    finally {
      if (xmlModel != null)
View Full Code Here

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

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

        JSPTranslation translation = fTranslationAdapter.getJSPTranslation();
        fJavaPosition = translation.getJavaOffset(getDocumentPosition())+javaPositionExtraOffset;

        if (DEBUG)
          System.out.println(debug(translation));

        try {

          ICompilationUnit cu = translation.getCompilationUnit();

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

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

   * @see org.eclipse.jdt.core.search.SearchDocument#getCharContents()
   */
  public char[] getCharContents() {
   
    if(fCachedCharContents == null || isDirty()) {
        JSPTranslation trans = getJSPTranslation();   
        fCachedCharContents = trans != null ? trans.getJavaText().toCharArray() : new char[0];
        fCUPath = trans.getJavaPath();
    }
    return fCachedCharContents;
  }
View Full Code Here

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

   */
  public String getPath() {
      // caching the path since it's expensive to get translation
    // important that isDirty() check is second to cache modification stamp
      if(this.fCUPath == null || isDirty()) {
          JSPTranslation trans = getJSPTranslation();
          if(trans != null) {
              this.fCUPath = trans.getJavaPath();
              // save since it's expensive to calculate again later
              fCachedCharContents = trans.getJavaText().toCharArray();
          }
      }
    return fCUPath;
  }
View Full Code Here

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
TOP
Copyright © 2018 www.massapi.com. 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.