Package org.cfeclipse.cfml.parser.docitems

Examples of org.cfeclipse.cfml.parser.docitems.DocItem


      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;
      }

      // eat any WS before the insertion to the beginning of the line
      int firstLine = 1; // don't format the first line if it has other
                // content before it
      IRegion line = document.getLineInformationOfOffset(command.offset);
      String notSelected = document.get(line.getOffset(), command.offset - line.getOffset());
      if (notSelected.trim().length() == 0) {
        command.length += notSelected.length();
        command.offset = line.getOffset();
        firstLine = 0;
      }

      // handle the indentation computation inside a temporary document
      Document temp = new Document(command.text);

      // indent the first and second line
      // compute the relative indentation difference from the second line
      // (as the first might be partially selected) and use the value to
      // indent all other lines.
      boolean isIndentDetected = false;
      StringBuffer addition = new StringBuffer();
      int insertLength = 0;
      int lines = temp.getNumberOfLines();
      for (int l = firstLine; l < lines; l++) { // we don't change the
                            // number of lines while
                            // adding indents

        IRegion r = temp.getLineInformation(l);
        int lineOffset = r.getOffset();
        int lineLength = r.getLength();

        if (lineLength == 0) { // don't modify empty lines
          continue;
        }

        if (!isIndentDetected) {

          // indent the first pasted line
            StringBuffer current = XmlDocumentFormatter.getLeadingWhitespace(lineOffset, temp);
            StringBuffer correct = XmlDocumentFormatter.getLeadingWhitespace(node.getStartPosition(), document);
            // relatively indent all pasted lines
            if (doIndent(document, command)) {
              correct.append(XmlDocumentFormatter.createIndent());
            }
            insertLength = subtractIndent(correct, current, addition);
View Full Code Here


        //need to go and get all the cffunctions
      CFParser parser = new CFParser();
          CFDocument doc = parser.parseDoc(cfdocument.get());

          // Now we just want to add the nodes!
          DocItem docroot = doc.getDocumentRoot();
         
          CFNodeList compNodes = docroot.selectNodes("/cfcomponent");
         
          CFNodeList nodes = docroot.selectNodes("//cffunction");
     
         Iterator funcIter =  nodes.iterator();
         while(funcIter.hasNext()){
              TagItem thisFunction = (TagItem)funcIter.next();
View Full Code Here

    // the selection and the shell
    IEditorPart activeEditor = Workbench.getInstance().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    CFMLEditor thisEdit = (CFMLEditor) activeEditor;
    IDocument doc = thisEdit.getDocumentProvider().getDocument(thisEdit.getEditorInput());
    ISelection sel = thisEdit.getSelectionProvider().getSelection();
    DocItem docItem = thisEdit.getSelectionCursorListener().getSelectedTag();
    if (docItem != null && docItem instanceof CfmlTagItem) {
      CfmlTagItem tagItem = (CfmlTagItem) docItem;

      int tagStart = tagItem.getStartPosition();
      int tagEnd = tagItem.getEndPosition();
View Full Code Here

    try {
      CFDocument doc = document.getCFDocument();
      if(doc == null) {  // OBT: Added to handle when the parse fatally fails.
        return EMPTY_ARRAY;
      }
      DocItem rootItem = doc.getDocumentRoot();

      //nodes = rootItem.selectNodes("//function[#startpos>=0 and #endpos < 200]");
      nodes = rootItem.selectNodes("//cffunction");
      if (nodes.size() == 0) {
        nodes = rootItem.selectNodes("//ASTFunctionDeclaration");
      }
      return getMethods(nodes);
    }
    catch (Exception e){
      System.err.println("CFCMethodsContentProvider has no elements");
View Full Code Here

    MethodViewItem[] methods = new MethodViewItem[nodes.size()];
    int index = 0;
    while (i.hasNext()) {
      try {
        Object itemThing = i.next();
        DocItem thisTag = (DocItem) itemThing;
        MethodViewItem item;
        if (itemThing instanceof FunctionInfo) {
          item = new CFCMethodViewScriptItem((FunctionInfo) itemThing);

        } else {
View Full Code Here

  private static String filter = "";
  protected static GotoFileAction gfa = new GotoFileAction();

  public void createControl(Composite parent) {
    super.createControl(parent);
    DocItem root = getRootInput();
    TreeViewer viewer = getTreeViewer();
    viewer.setContentProvider(new OutlineContentProvider(root));
    viewer.setLabelProvider(new OutlineLabelProvider());
    viewer.addSelectionChangedListener(this);
    // this listener listens to the editor (vs. this outline view)
View Full Code Here

   *
   * @param filter
   * @return
   */
  public DocItem getItems(String filter) {
    DocItem scratch = new TagItem(1, 1, 1, "root");

    DocItem rootItem = getRootInput();
    CFNodeList nodes = rootItem.selectNodes(filter);

    Iterator i = nodes.iterator();
    while (i.hasNext()) {
      try {
        scratch.addChild((DocItem) i.next());
View Full Code Here

   *
   * @return the root directory
   */
  public DocItem getRootInput() {
    try {
      DocItem docRoot = null;

      IEditorPart iep = getSite().getPage().getActiveEditor();

      iep.addPropertyListener(this);
      getSite().getPage().addPartListener(this);
View Full Code Here

   *
   * @return
   */
  private void expandParentItems(DocItem item) {
    // can't do much if nothing is selected
    DocItem parentItem = item.getParent();
    if (parentItem != null) {
      TreeViewer tree = getTreeViewer();
      tree.setExpandedState(parentItem, true);
      tree.refresh(parentItem, false);
      expandParentItems(parentItem);
View Full Code Here

    if (!selecteditems.hasNext())
      return;

    ITextEditor editor = (ITextEditor) iep;
    DocItem firstItem = ((DocItem) selecteditems.next());
    int startPos = firstItem.getStartPosition();
    int endPos = firstItem.getEndPosition();
    if (!selecteditems.hasNext()) {
      // select whole tag
      if(firstItem.getClass().getName().endsWith("CfmlComment")){
        editor.selectAndReveal(firstItem.getStartPosition(), firstItem.getEndPosition() - firstItem.getStartPosition() + 1);
        return;
      }
      if (firstItem instanceof TagItem) {
        TagItem cti = (TagItem) firstItem;
        if (cti.matchingItem != null) {
View Full Code Here

TOP

Related Classes of org.cfeclipse.cfml.parser.docitems.DocItem

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.