Package org.objectstyle.wolips.templateeditor

Examples of org.objectstyle.wolips.templateeditor.TemplateEditor


    }
    return wodEditor;
  }
 
  public void createTab() {
    templateEditor = new TemplateEditor();
    IEditorSite htmlSite = this.getComponentEditorPart().publicCreateSite(templateEditor);
    try {
      templateEditor.init(htmlSite, htmlInput);
    } catch (PartInitException e) {
      ComponenteditorPlugin.getDefault().log(e);
View Full Code Here


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) {
      e.printStackTrace();
    }
View Full Code Here

  /**
   * This method will return the current template editor or null if there is
   * not a current template editor.
   */
  protected TemplateEditor getTemplateEditor() {
    TemplateEditor templateEditor = _templateEditor;
    if (_templateEditor == null && _activeEditor != null) {
      ComponentEditorPart cep = (ComponentEditorPart) _activeEditor;
      HtmlWodTab hwt = cep.htmlWodTab();
      if (hwt != null) {
        templateEditor = hwt.templateEditor();
View Full Code Here

  public void run(IAction action) {
    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();
View Full Code Here

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) {
      e.printStackTrace();
    }
View Full Code Here

  @Override
  public void partDeactivated(IWorkbenchPart part) {
    super.partDeactivated(part);
    if (part instanceof ComponentEditor) {
      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

  public void partActivated(IWorkbenchPart part) {
    super.partActivated(part);
    if (part instanceof ComponentEditor) {
      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);
      }
View Full Code Here

  public void run(IAction action) {
    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();
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

  public void run(IAction action) {
    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);
          ConvertInlineToWodRefactoring.run(cache, offset, buildProperties, new NullProgressMonitor());
        }
      }
    } catch (Exception e) {
View Full Code Here

  public void run(IAction action) {
    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 DeleteTagAction().run();
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

TOP

Related Classes of org.objectstyle.wolips.templateeditor.TemplateEditor

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.