Examples of EclipseEmmetEditor


Examples of io.emmet.eclipse.EclipseEmmetEditor

public class WrapWithAbbreviationAction extends AbstractHandler {

  @Override
  public Object execute(ExecutionEvent event) throws ExecutionException {
    ActionRunner runner = ActionRunner.getSingleton();
    EclipseEmmetEditor editor = runner.getEditor();
    Emmet js = Emmet.getSingleton();
    String profileName = "eclipse";
   
    if (editor != null) {
      try {
        String abbr = editor.promptWrap("Enter abbreviation:");
       
        if (abbr != null && !abbr.equals("")) {
          // expand abbreviation with current profile
          return js.runAction(editor, "wrap_with_abbreviation",
              abbr, editor.getSyntax(), profileName);
        }
       
      } catch (Exception e) {
        e.printStackTrace();
      }
View Full Code Here

Examples of io.emmet.eclipse.EclipseEmmetEditor

  private volatile static ActionRunner singleton;
  private EclipseEmmetEditor emmetEditor;
  private Emmet js;

  private ActionRunner() {
    emmetEditor = new EclipseEmmetEditor();
    js = Emmet.getSingleton();
  }
View Full Code Here

Examples of io.emmet.eclipse.EclipseEmmetEditor

   * Runs Emmet action, automatically setting up context editor
   * @param actionName Action name to perform
   * @return
   */
  public boolean run(String actionName) {
    EclipseEmmetEditor editor = getEditor();
    if (editor != null) {
      try {
        return js.runAction(editor, actionName);
      } catch (Exception e) {
        e.printStackTrace();
View Full Code Here

Examples of io.emmet.eclipse.EclipseEmmetEditor

public class InsertFormattedLineBreakAction {

  public static boolean execute() {
    if (!isEnabled()) return false;
   
    EclipseEmmetEditor editor = ActionRunner.getSingleton().getEditor();
   
    if (editor != null && shouldHandle(editor)) {
      try {
        Boolean result = Emmet.getSingleton().runAction(editor, "insert_formatted_line_break_only");
        if (!result) {
          String curPadding = editor.getCurrentLinePadding();
          String content = editor.getContent();
          int caretPos = editor.getCaretPos();
          int c_len = content.length();
          String nl = editor.getNewline();
         
          String nextNl = editor.getDocument().getLineDelimiter( editor.getDocument().getLineOfOffset(caretPos) );
         
          if (nextNl != null)
            nl = nextNl;
         
          // check out next line padding
          SelectionData lineRange = editor.getCurrentLineRange();
          StringBuilder nextPadding = new StringBuilder();
         
          for (int i = lineRange.getEnd() + nl.length(); i < c_len; i++) {
            char ch = content.charAt(i);
            if (ch == ' ' || ch == '\t')
              nextPadding.append(ch);
            else
              break;
          }
           
          if (nextPadding.length() > curPadding.length()) {
            editor.replaceContent(nl + nextPadding.toString(), caretPos, caretPos, true);
            result = true;
          }
        }
       
        return result;
View Full Code Here

Examples of io.emmet.eclipse.EclipseEmmetEditor

    return null;
  }
 
  public static boolean expand() {
    ActionRunner runner = ActionRunner.getSingleton();
    EclipseEmmetEditor editor = runner.getEditor();
    Emmet js = Emmet.getSingleton();
    String profileName = "eclipse";
   
    if (editor != null) {
      try {
        // force tab key handler installation
        TabKeyHandler.install(editor.getEditor());
       
        // expand abbreviation with current profile
        return js.runAction(editor, "expand_abbreviation", editor.getSyntax(), profileName);
      } catch (Exception e) {
        e.printStackTrace();
      }
     
    }
View Full Code Here

Examples of io.emmet.eclipse.EclipseEmmetEditor

public class ActionRunner {
  private volatile static ActionRunner singleton;
  private EclipseEmmetEditor emmetEditor;
 
  private ActionRunner() {
    emmetEditor = new EclipseEmmetEditor();
  }
View Full Code Here

Examples of io.emmet.eclipse.EclipseEmmetEditor

   * Runs Emmet action, automatically setting up context editor
   * @param actionName Action name to perform
   * @return
   */
  public boolean run(String actionName) {
    EclipseEmmetEditor editor = getEditor();
    if (editor != null) {
      try {
        return Emmet.getSingleton().runAction(editor, actionName);
      } catch (Exception e) {
        e.printStackTrace();
View Full Code Here

Examples of io.emmet.eclipse.EclipseEmmetEditor

    return null;
  }
 
  public static boolean expand() {
    ActionRunner runner = ActionRunner.getSingleton();
    EclipseEmmetEditor editor = runner.getEditor();
    Emmet js = Emmet.getSingleton();
//    String profileName = "eclipse";
   
    if (editor != null) {
      try {
        // force tab key handler installation
        TabKeyHandler.install(editor.getEditor());
       
        // expand abbreviation with current profile
        return js.runAction(editor, "expand_abbreviation", editor.getSyntax());
      } catch (Exception e) {
        e.printStackTrace();
      }
     
    }
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.