Package org.cfeclipse.cfml.editors

Examples of org.cfeclipse.cfml.editors.ICFDocument


             applyPrefs = new FormattingPreferences();
         } else {
             applyPrefs = prefs;
         }
        
         ICFDocument doc = new ICFDocument();
         doc.set(text);
         new CFDocumentSetupParticipant().setup(doc);

         format(applyPrefs, doc, indent);

         return doc.get();
    }
View Full Code Here


  }

  public void format() {

    super.format();
    final ICFDocument document = (ICFDocument) fDocuments.removeFirst();
    final IRegion region = (IRegion) fRegions.removeFirst();
    if (region != null) {
      String regionText = "";
      try {
        regionText = document.get(region.getOffset(), region.getLength());
        StringBuffer currentIndent = XmlDocumentFormatter.getLeadingWhitespace(region.getOffset(), document);
        String formattedText = keyWordsToUpper(regionText);
        int lineOffset = document.getLineInformationOfOffset(region.getOffset()).getOffset();
        if (formattedText != null && !formattedText.equals(regionText)) {
          int newLength = region.getLength() + (region.getOffset() - lineOffset);
          document.replace(lineOffset, newLength, formattedText);
        }
      } catch (BadLocationException e) {
        e.printStackTrace();
      }
    } else {
      if (document != null) {
        String documentText = document.get();
        String formattedText = keyWordsToUpper(documentText);
        if (formattedText != null && !formattedText.equals(documentText)) {
          document.set(formattedText);
        }
      }

    }
  } 
View Full Code Here

 
 
  public void setActiveEditor(IAction action, IEditorPart targetEditor) {
    this.editor = (ITextEditor)targetEditor;
    IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
    ICFDocument cfd = (ICFDocument)doc;
   
    this.partitioner = (CFEPartitioner)cfd.getDocumentPartitioner();
   
   
  }
View Full Code Here

    }

 
    try {
      String invoker = viewer.getDocument().get(documentOffset-1,1);
      ICFDocument document = (ICFDocument) viewer.getDocument();
      CFDocument doc = document.getCFDocument();
      int start = document.getPartition(documentOffset).getOffset();
      String scanData =  document.get(start, documentOffset - start);
      scanData = scanData.replace('\n',' ')// Eliminate any non-character characters
      scanData = scanData.replace('\r',' ')// as this allows us to treat the buffer as
      scanData = scanData.replace('\t',' ')// one long string
      if (invoker.equals(" ")) {
              return null;
          }

      if (!",".equals(invoker)
&& !"(".equals(invoker) && !"<".equals(invoker) && !".".equals(invoker)) {
        String toBeMatched = extractPrefix(viewer,documentOffset).replaceAll("[\r\n\t]", " ").trim();
        Set allPoss = SyntaxDictionary.limitSet(doc.getFunctions(), toBeMatched);
        Set poss = SyntaxDictionary.limitSet(
            DictionaryManager.getDictionary(DictionaryToUse).getAllFunctions(),
            toBeMatched
          );
        Iterator it = poss.iterator();
        while(it.hasNext())
        {
          allPoss.add(it.next());
        }
       
        ICompletionProposal[] funks = makeSetToProposal(allPoss, documentOffset, TAGTYPE, toBeMatched.length());
        return funks;
      }
      //String originalData = scanData;  // This should never be changed.

     
      char lastChar = (scanData.length() > 0) ? scanData.charAt(scanData.length() - 1) : scanData.charAt(0);
           
      // Gonna allow debug by entering the tilde character. Entering this will cause
      // my debug function to run...
      if(lastChar == '~')
      {
        DebugFunction(viewer, documentOffset);
      }

      int triggerPos = scanData.length()-1;
      //int closerCharMatch = closerChars.indexOf(lastChar);

      // First test to see whether the last two characters are "it"...  if so then we'll
      // quit out of this
      if(lastChar == '\'' && document.getChar(documentOffset-1) == 't' &&
         document.getChar(documentOffset-2) == 'i')
      {
        //System.out.println("hit IT");
        return null;
      }
     
View Full Code Here

    public ICompletionProposal[] getTagProposals(IAssistState state) {
    if(!preferenceManager.getBooleanPref(AutoIndentPreferenceConstants.P_SUGGEST_VARIABLES)) {
      return null;
    }

      ICFDocument doc = (ICFDocument)state.getIDocument();
      // verify we have a parse tree to work with
      if(doc.getCFDocument() == null || state.getITextView().getTextWidget().getSelectionText().length() > 0) {
        return null;
      }

      //Check what partition we are in.
      System.out.println(state.getOffsetPartition().toString());
           
     
        if (state.getTriggerData() == '#') {
            return getPageVariables(state, doc);
        }
        else if(state.getTriggerData() != '.'){
          String paritionSection = "";
          //could return everything that is in the map here.
          try {
          ITypedRegion partition = doc.getPartition(state.getOffset());
          paritionSection = partition.getType();
        } catch (BadLocationException e) {
          e.printStackTrace();
        }       
            return getPageVariables(state, doc);
View Full Code Here

   */
  private void handleEnterBetweenTags(IDocument doc,
      DocumentCommand docCommand) {
    if (doc instanceof ICFDocument
        && this.isUseSmartIndent()) {
      ICFDocument cfd = (ICFDocument) doc;
      CFEPartitioner partitioner = (CFEPartitioner) cfd
          .getDocumentPartitioner();
      CFEPartition prevPartition = partitioner
          .getPreviousPartition(docCommand.offset);
      CFEPartition nextPartition = null;
      if (prevPartition != null) {
View Full Code Here

  boolean doIndent(IDocument doc, DocumentCommand docCommand) {

    boolean doIndent = true;
    if (doc instanceof ICFDocument && this.isUseSmartIndent()) {
      ICFDocument cfd = (ICFDocument) doc;
      CFEPartitioner partitioner = (CFEPartitioner) cfd.getDocumentPartitioner();
      CFEPartition prevPartition = partitioner.getPreviousPartition(docCommand.offset);
      CFEPartition nextPartition = null;
      if (prevPartition != null) {
        nextPartition = partitioner.getNextPartition(prevPartition.offset);
      }
View Full Code Here

      if (command.offset == -1 || document.getLength() == 0) {
        return;
      }
      String origChange = command.text;
      int position = (command.offset == document.getLength() ? command.offset - 1 : command.offset);
      ICFDocument cfd = (ICFDocument) document;
      // CfmlTagItem node = cfd.getTagAt(command.offset, command.offset,
      // true);
      DocItem node = editor.getSelectionCursorListener().getCurrentDocItem();
      if (node == null) {
        return;
View Full Code Here

        // Here is where we actually do the insertion

        if (thisEdit instanceof ITextEditor) {
          try {
            ICFDocument cfd = (ICFDocument) doc;
            cfd.replace(selection.getOffset(), selection.getLength(), tf.getTagStart());
          } catch (BadLocationException e) {
            e.printStackTrace();
          }
          thisEdit.setFocus();
        }
View Full Code Here

    /* (non-Javadoc)
     * @see org.cfeclipse.cfml.editors.contentassist.IAssistContributor#getTagProposals(org.cfeclipse.cfml.editors.contentassist.IAssistState)
     */
    public ICompletionProposal[] getTagProposals(IAssistState state) {
      ICFDocument doc = (ICFDocument)state.getIDocument();
      IProject project = doc.getResource().getProject();
     
      /*
         * Only show content assist if the trigger was .
         */
        if (state.getTriggerData() != '.') {
View Full Code Here

TOP

Related Classes of org.cfeclipse.cfml.editors.ICFDocument

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.