Examples of WodEditor


Examples of org.objectstyle.wolips.wodclipse.editor.WodEditor

      ComponentEditor componentEditor = (ComponentEditor) part;
      TemplateEditor templateEditor = componentEditor.getTemplateEditor();
      if (templateEditor != null) {
        templateEditor.getSourceEditor().addCursorPositionListener(this);
      }
      WodEditor wodEditor = componentEditor.getWodEditor();
      if (wodEditor != null) {
        wodEditor.addCursorPositionListener(this);
      }
    } else if (part instanceof BindingsInspectorPageBookView) {
      if (_lastEditor != null && _lastSelectionRange != null) {
        cursorPositionChanged(_lastEditor, _lastSelectionRange);
      }
View Full Code Here

Examples of org.objectstyle.wolips.wodclipse.editor.WodEditor

      public void propertyChanged(Object source, int propertyId) {
        HtmlWodTab.this.getComponentEditorPart().publicHandlePropertyChange(propertyId);
      }
    });
    if (wodInput != null && ((ComponentEditorFileEditorInput)wodInput).getFile().exists()) {
      wodEditor = new WodEditor();
      IEditorSite wodSite = this.getComponentEditorPart().publicCreateSite(wodEditor);
      try {
        wodEditor.init(wodSite, wodInput);
      } catch (PartInitException e) {
        ComponenteditorPlugin.getDefault().log(e);
View Full Code Here

Examples of org.objectstyle.wolips.wodclipse.editor.WodEditor

    // });
    if (wodEditor == null) {
      return;
    }
   
    final WodEditor finalWodEditor = wodEditor;
    wodEditor.getSelectionProvider().addSelectionChangedListener(new ISelectionChangedListener() {

      public void selectionChanged(SelectionChangedEvent event) {
        WodclipsePlugin.getDefault().updateWebObjectsTagNames(finalWodEditor);
      }
View Full Code Here

Examples of org.objectstyle.wolips.wodclipse.editor.WodEditor

public class FormatAction extends AbstractTemplateAction {
  @Override
  public void run(IAction action) {
    try {
      TemplateEditor templateEditor = getTemplateEditor();
      WodEditor wodEditor = getWodEditor();
      if (templateEditor != null && wodEditor != null) {
        WodParserCache cache = templateEditor.getSourceEditor().getParserCache();
        FormatRefactoring.run(cache, new NullProgressMonitor());
      }
    } catch (Exception e) {
View Full Code Here

Examples of org.objectstyle.wolips.wodclipse.editor.WodEditor

  /**
   * This method will return the current WOD editor or null if there is not a
   * current WOD editor.
   */
  protected WodEditor getWodEditor() {
    WodEditor wodEditor = _wodEditor;
    if (_wodEditor == null && _activeEditor != null) {
      ComponentEditorPart cep = (ComponentEditorPart) _activeEditor;
      HtmlWodTab hwt = cep.htmlWodTab();
      if (hwt != null) {
        wodEditor = hwt.wodEditor();
View Full Code Here

Examples of org.objectstyle.wolips.wodclipse.editor.WodEditor

public class CleanWOBuilderElementNamesAction extends AbstractTemplateAction {
  @Override
  public void run(IAction action) {
    try {
      TemplateEditor templateEditor = getTemplateEditor();
      WodEditor wodEditor = getWodEditor();
      if (templateEditor != null && wodEditor != null) {
        WodParserCache cache = templateEditor.getSourceEditor().getParserCache();
        CleanWOBuilderRefactoring.run(cache, false, new NullProgressMonitor());
      }
    } catch (Exception e) {
View Full Code Here

Examples of org.objectstyle.wolips.wodclipse.editor.WodEditor

      ComponentEditor componentEditor = (ComponentEditor) part;
      TemplateEditor templateEditor = componentEditor.getTemplateEditor();
      if (templateEditor != null) {
        templateEditor.getSourceEditor().removeCursorPositionListener(this);
      }
      WodEditor wodEditor = componentEditor.getWodEditor();
      if (wodEditor != null) {
        wodEditor.removeCursorPositionListener(this);
      }
    }
  }
View Full Code Here

Examples of org.objectstyle.wolips.wodclipse.editor.WodEditor

    insert();
  }

  public void insert() {
    TemplateEditor te = getTemplateEditor();
    WodEditor we = getWodEditor();
    InsertComponentSpecification ics = getComponentSpecification();
    System.out.println("InsertHtmlAndWodAction.insert: " + te + ", " + we + ", " + ics);
    if (te != null && we != null && ics != null) {
      SimpleWodElement wodElement = new SimpleWodElement(ics.getComponentInstanceName(), ics.getComponentName());
      List<Binding> bindings = ics.getRequiredBindings();
      if (bindings != null) {
        for (Binding binding : bindings) {
          wodElement.addBinding(new SimpleWodBinding(null, binding.getName(), "", true));
        }
      }

      // If the component name is blank, then this is an HTML tag
      if (ics.getComponentName() == null || ics.getComponentName().length() == 0) {
        wodElement.setTagName(ics.getTagName());
      }

      SimpleWodElement htmlElement;
      if (ics.isInline()) {
        htmlElement = wodElement;
      } else {
        htmlElement = new SimpleWodElement("", "");
        htmlElement.setTagName(ics.getTagName());
      }

      Map<String, String> htmlAttributes = ics.getHtmlAttributes();
      if (htmlAttributes != null) {
        for (Map.Entry<String, String> htmlAttribute : htmlAttributes.entrySet()) {
          htmlElement.addBinding(new SimpleWodBinding(null, htmlAttribute.getKey(), htmlAttribute.getValue(), true));
        }
      }

      IDocument teDoc = te.getHtmlEditDocument();
      IDocument weDoc = we.getWodEditDocument();
      ITextSelection teDocTSel = (ITextSelection) te.getSourceEditor().getSelectionProvider().getSelection();

      // insert the WebObjects component into the template portion.
      try {
        ITextViewerExtension teExt = (ITextViewerExtension) te.getSourceEditor().getViewer();
        teExt.getRewriteTarget().beginCompoundChange();
        try {
          int selectionStartOffset = teDocTSel.getOffset();
          int selectionEndOffset = teDocTSel.getOffset() + teDocTSel.getLength();

          if (ics.isComponentContent()) {
            int selectionStartLine = teDocTSel.getStartLine();
            int selectionEndLine = teDocTSel.getEndLine();

            StringWriter startTagWriter = new StringWriter();
            htmlElement.writeInlineFormat(startTagWriter, "", true, true, false, false, "$", "");
            String startTag = startTagWriter.toString();

            StringWriter endTagWriter = new StringWriter();
            htmlElement.writeInlineFormat(endTagWriter, "", true, false, false, true, "$", "");
            String endTag = endTagWriter.toString();

            String indentText = getIndentText(teDoc, selectionStartOffset);
            IRegion startLineRegion = teDoc.getLineInformationOfOffset(selectionStartOffset);
            IRegion endLineRegion = teDoc.getLineInformationOfOffset(selectionEndOffset);

            // MS: If the selection starts within the indent
            // area, then you're actually selecting
            // from the beginning of the line, not splitting an
            // existing line of HTML.
            int selectionLineStartOffset = (selectionStartOffset - startLineRegion.getOffset());
            boolean selectionStartedInIndent = (indentText.length() >= selectionLineStartOffset);

            if (selectionStartLine == selectionEndLine) {
              if (selectionEndOffset == endLineRegion.getOffset() && selectionEndOffset > 0) {
                teDoc.replace(selectionEndOffset - 1, 0, endTag);
              } else {
                teDoc.replace(selectionEndOffset, 0, endTag);
              }

              if (selectionStartedInIndent) {
                if (indentText.length() == 0) {
                  int offset = Math.max(startLineRegion.getOffset() - 1, 0);
                  teDoc.replace(offset, 0, startTag);
                } else {
                  teDoc.replace(startLineRegion.getOffset() + indentText.length(), 0, startTag);
                }
              } else {
                teDoc.replace(selectionStartOffset, 0, startTag);
              }
            } else {
              int indentEndOffset;
              String lastLineIndentText = getIndentText(teDoc, selectionEndOffset);
              int selectionLineEndOffset = (selectionEndOffset - endLineRegion.getOffset());
              if (lastLineIndentText.length() >= selectionLineEndOffset) {
                String endText = indentText + endTag + "\n";
                teDoc.replace(endLineRegion.getOffset(), 0, endText);
                indentEndOffset = 1;
              } else {
                String endText = "\n" + indentText + endTag + "\n" + indentText;
                teDoc.replace(selectionEndOffset, 0, endText);
                indentEndOffset = 2;
              }

              int indentStartOffset;
              if (selectionStartedInIndent) {
                indentStartOffset = 1;
                String startText = startTag + "\n" + indentText;
                teDoc.replace(startLineRegion.getOffset() + indentText.length(), 0, startText);
              } else {
                indentStartOffset = 2;
                String startText = "\n" + indentText + startTag + "\n" + indentText;
                teDoc.replace(selectionStartOffset, 0, startText);
              }
              for (int line = selectionStartLine + indentStartOffset; line <= selectionEndLine + indentEndOffset; line++) {
                int lineOffset = teDoc.getLineOffset(line);
                teDoc.replace(lineOffset, 0, "\t");
              }
            }
          } else {
            StringWriter startTagWriter = new StringWriter();
            htmlElement.writeInlineFormat(startTagWriter, null, true, true, false, true, "$", "");
            String tag = startTagWriter.toString();
            teDoc.replace(selectionStartOffset, 0, tag);
          }
        } finally {
          teExt.getRewriteTarget().endCompoundChange();
        }

        // insert the WebObjects component into the bindings
        // portion.
        if (!ics.isInline()) {
          int firstBindingValueOffset = -1;

          int offset = weDoc.getLength();
          StringWriter wodElementWriter = new StringWriter();
          if (offset > 0) {
            wodElementWriter.write("\n");
          }
          wodElement.writeWodFormat(wodElementWriter, true);
          wodElementWriter.flush();
          String wodElementStr = wodElementWriter.toString();

          weDoc.replace(offset, 0, wodElementStr);

          if (-1 != firstBindingValueOffset) {
            we.selectAndReveal(offset + firstBindingValueOffset, 0);
          } else {
            we.selectAndReveal(offset, wodElementStr.length());
          }
        }
      } catch (Exception e) {
        e.printStackTrace();
        ComponenteditorPlugin.getDefault().log(e);
View Full Code Here

Examples of org.objectstyle.wolips.wodclipse.editor.WodEditor

    try {
      ComponentEditorPart componentEditorPart = getComponentEditorPart();
      if (componentEditorPart != null) {
        IEditorPart activeEditorPart = componentEditorPart.getActiveEditor();
        TemplateEditor templateEditor = getTemplateEditor();
        WodEditor wodEditor = getWodEditor();
        if (templateEditor != null && wodEditor != null) {
          if (activeEditorPart == templateEditor) {
            templateEditor.getSourceEditor().new UnwrapTagAction().run();
          }
        }
View Full Code Here

Examples of org.objectstyle.wolips.wodclipse.editor.WodEditor

    try {
      ComponentEditorPart componentEditorPart = getComponentEditorPart();
      if (componentEditorPart != null) {
        IEditorPart activeEditorPart = componentEditorPart.getActiveEditor();
        TemplateEditor templateEditor = getTemplateEditor();
        WodEditor wodEditor = getWodEditor();
        if (templateEditor != null && wodEditor != null && activeEditorPart == templateEditor) {
          ITextSelection templateSelection = (ITextSelection) templateEditor.getSourceEditor().getSelectionProvider().getSelection();
          int offset = templateSelection.getOffset();
          WodParserCache cache = templateEditor.getSourceEditor().getParserCache();
          BuildProperties buildProperties = (BuildProperties)cache.getProject().getAdapter(BuildProperties.class);
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.