Package org.eclipse.jface.text.contentassist

Examples of org.eclipse.jface.text.contentassist.CompletionProposal


        } else {
          checkReplacementStart = false;
          completionStartPos = offset;
        }
 
        ICompletionProposal proposal = new CompletionProposal(replacement, completionStartPos, offset - completionStartPos, replacement.length());
       
        if (checkReplacementStart) {
          if (replacement.startsWith(alreadyTyped)) {
            proposals.add(proposal);
          }
View Full Code Here


          }
        } else {
          completionStartPos = offset;
        }
        ICompletionProposal proposals[] = new ICompletionProposal[1];
        proposals[0] = new CompletionProposal(replacement, completionStartPos, offset - completionStartPos, replacement.length());
        return proposals;
      }
    } catch (BadLocationException e) {
      setErrorMessage(e.getMessage());
    }
View Full Code Here

        StringBuffer replacement = new StringBuffer();
        replacement.append("[" + module + "]");
        int cursorPosAfterReplace = replacement.length();     
        replacement.append(">");
        proposals.add(new CompletionProposal(replacement.toString(), cursorAbsolute - alreadyTyped.length(), alreadyTyped.length(), cursorPosAfterReplace, null, display, null, null));
      }

    }       
    return proposals;
  }
View Full Code Here

                if (completionStartPos == -1) {
                  completionStartPos = offset;
                } else {
                  completionStartPos = offset - (alreadyTyped.length() - completionStartPos);
                }               
                proposals.add(new CompletionProposal(replacement.toString(), completionStartPos, offset - completionStartPos, cursorPosAfterReplace, null, display, null, null));
              }
              // create close current tag completionv
              display = "/>";
              replacement = new StringBuffer("/>");
              cursorPosAfterReplace = replacement.length();             
              if (replacement.toString().startsWith(alreadyTyped.trim())) {
                int completionStartPos = previousRegion.getOffset() + previousRegion.getLength() + 1 - replacement.length();                         
                proposals.add(new CompletionProposal(replacement.toString(), completionStartPos, offset - completionStartPos, cursorPosAfterReplace, null, display, null, null));
              }
             
              break;
            } else {
              String replacement = "</tml:" + tagName + ">";
              if (replacement.startsWith(alreadyTyped.trim())) {
                int completionStartPos = alreadyTyped.lastIndexOf("<");
                if (completionStartPos == -1) {
                  completionStartPos = offset;
                } else {
                  completionStartPos = offset - (alreadyTyped.length() - completionStartPos);
                }
               
                proposals.add(new CompletionProposal(replacement, completionStartPos, offset - completionStartPos, replacement.length()));
                break;
              } else {
                break;
              }
            }
          } else {
            // completion in following line           
            String replacement = "</tml:" + tagName + ">";
            if (replacement.startsWith(alreadyTyped.trim())) {
              int completionStartPos = alreadyTyped.lastIndexOf("<");
              if (completionStartPos == -1) {
                completionStartPos = offset;
              } else {
                completionStartPos = offset - (alreadyTyped.length() - completionStartPos);
              }
             
              proposals.add(new CompletionProposal(replacement, completionStartPos, offset - completionStartPos, replacement.length()));
              break;
            } else {
              break;
            }
          }
View Full Code Here

  public TMLCompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString, ContextInformation contextInformation) {
//      String info = null;
//      if (contextInformation != null) {
//          info = contextInformation.getInformation();
//      }
    _proposal = new CompletionProposal(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString, null, null);
    _contextInformation = contextInformation;
  }
View Full Code Here

        return _lruCategory;
    }


    public TMLScriptCompletionProposal(String replacement, int replacementOffset, int replacementLength, int cursor, String display) {
        _proposal = new CompletionProposal(replacement, replacementOffset, replacementLength, cursor, null, display, null, null);       
        _replacementOffset = replacementOffset;
    }
View Full Code Here

        List<ICompletionProposal> proposalList = new ArrayList<ICompletionProposal>();
        for ( String string : proposals )
        {
            if ( string.toUpperCase().startsWith( attribute.toUpperCase() ) )
            {
                ICompletionProposal proposal = new CompletionProposal( string + ", ", start, //$NON-NLS-1$
                    documentOffset - start, string.length() + 2, null, string, null, null );
                proposalList.add( proposal );
            }
        }
        return proposalList.toArray( new ICompletionProposal[proposalList.size()] );
View Full Code Here

        try {
            int offset = context.getInvocationOffset();
            CharSequence prefix = context.computeIdentifierPrefix();

            result.add(new CompletionProposal("foobar", offset - prefix.length(), prefix.length(), offset - prefix.length() + 6));
            result.add(new CompletionProposal("fizzbuzz", offset - prefix.length(), prefix.length(), offset - prefix.length() + 8));
        } catch (BadLocationException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
View Full Code Here

        List<ICompletionProposal> proposals = new LinkedList<ICompletionProposal>();

        String suggestedVersion = marker.getAttribute(PROP_SUGGESTED_VERSION, null);
        int start = marker.getAttribute(IMarker.CHAR_START, 0);
        int end = marker.getAttribute(IMarker.CHAR_END, 0);
        CompletionProposal proposal = new CompletionProposal("version " + suggestedVersion, start, end - start, end, null, "Change package version to " + suggestedVersion, null, null);
        proposals.add(proposal);

        return proposals;
    }
View Full Code Here

        List<ICompletionProposal> proposals = new LinkedList<ICompletionProposal>();

        String suggestedVersion = marker.getAttribute(PROP_SUGGESTED_VERSION, null);
        int start = marker.getAttribute(IMarker.CHAR_START, 0);
        int end = marker.getAttribute(IMarker.CHAR_END, 0);
        CompletionProposal proposal = new CompletionProposal("version " + suggestedVersion, start, end - start, end, null, "Change package version to " + suggestedVersion, null, null);
        proposals.add(proposal);

        return proposals;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.contentassist.CompletionProposal

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.