Package org.eclipse.imp.editor

Examples of org.eclipse.imp.editor.UniversalEditor


 
 
  private Action fgAction(final UniversalEditor uditor) {
    Action it = new Action("f • g") {
      public void run() {
        UniversalEditor editor = uditor;
        if (editor == null) {
          IEditorPart ed = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
          if (ed == null) return;
          if (ed instanceof UniversalEditor)
            editor = (UniversalEditor) ed;
          else return;
        }
        // editor is not null
        try {
          if (!editor.isEditable()) return;
          final Point where = editor.getSelection();
          // System.err.println("we are at " + where);
              final IDocument document= editor.
                  getDocumentProvider().
                  getDocument(editor.getEditorInput());
              if (document != null) {
                document.replace(where.x, where.y, "•");
                editor.selectAndReveal(where.x+1, 0);
              }
        }
          catch (BadLocationException e) {
          // TODO Auto-generated catch block
          // e.printStackTrace();
View Full Code Here


  }
 
  private Action rgxAction(final UniversalEditor uditor) {
    Action it = new Action("´regex´") {
      public void run() {
        UniversalEditor editor = uditor;
        if (editor == null) {
          IEditorPart ed = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
          if (ed == null) return;
          // System.err.println(ed.getClass().getName());
          if (ed instanceof UniversalEditor)
            editor = (UniversalEditor) ed;
          else return;
        }
        // editor is not null
        try {
          if (!editor.isEditable()) return;
          final Point where = editor.getSelection();
          // System.err.println("we are at " + where);
              final IDocument document= editor.
                  getDocumentProvider().
                  getDocument(editor.getEditorInput());
              if (document != null) {
                String w = document.get(where.x, where.y);
                document.replace(where.x, where.y, "´" + w + "´");
                if (w.length() == 0)
                  editor.selectAndReveal(where.x+1, 0);
              }
        }
          catch (BadLocationException e) {
          // TODO Auto-generated catch block
          // e.printStackTrace();
View Full Code Here

  }

  private Action opAction(final UniversalEditor uditor) {
    Action it = new Action("`op`") {
      public void run() {
        UniversalEditor editor = uditor;
        if (editor == null) {
          IEditorPart ed = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
          if (ed == null) return;
          // System.err.println(ed.getClass().getName());
          if (ed instanceof UniversalEditor)
            editor = (UniversalEditor) ed;
          else return;
        }
        // editor is not null
        try {
          if (!editor.isEditable()) return;
          final Point where = editor.getSelection();
          // System.err.println("we are at " + where);
              final IDocument document= editor.
                  getDocumentProvider().
                  getDocument(editor.getEditorInput());
              if (document != null) {
                String w = document.get(where.x, where.y);
                document.replace(where.x, where.y, "`" + w + "`");
                if (w.length() == 0)
                  editor.selectAndReveal(where.x+1, 0);
              }
        }
          catch (BadLocationException e) {
          // TODO Auto-generated catch block
          // e.printStackTrace();
View Full Code Here

  }

  private Action refreshAction(final UniversalEditor uditor) {
    Action it = new Action("Refresh") {
      public void run() {
        UniversalEditor editor = uditor;
        if (editor == null) {
          IEditorPart ed = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
          if (ed == null) return;
          // System.err.println(ed.getClass().getName());
          if (ed instanceof UniversalEditor)
            editor = (UniversalEditor) ed;
          else return;
        }
        final UniversalEditor theEditor = editor;
        // editor is not null
        try {
          if (!editor.isEditable()) return;
          IParseController pc = editor.getParseController();
          if (pc == null || !(pc instanceof FregeParseController)) return;
          final FregeParseController fpc = (FregeParseController) pc;
          TGlobal global = fpc.getCurrentAst();
              if (global == null) return;
              // global.mem$sub.mem$cache.put(TTree.DNil.it);
              // fpc.global = FregeParseController.runSTG(action, global);
             
              final IDocument document= editor.
                  getDocumentProvider().
                  getDocument(editor.getEditorInput());
             
              fpc.resetHash();
              fpc.msgHandler.clearMessages();
          theEditor.removeParserAnnotations();
          document.replace(0,1, document.get(0, 1));             
        }
          catch (Exception e) {
          // e.printStackTrace();
        }
View Full Code Here

 
  private Action compAction(final UniversalEditor uditor) {
    Action it = new Action("Compile") {
      public void run() {
        UniversalEditor editor = uditor;
        if (editor == null) {
          IEditorPart ed = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
          if (ed == null) return;
          // System.err.println(ed.getClass().getName());
          if (ed instanceof UniversalEditor)
            editor = (UniversalEditor) ed;
          else return;
        }
        // editor is not null
        try {
          if (!editor.isEditable()) return;
          IParseController pc = editor.getParseController();
          if (pc == null) return;
          IPath dpath = pc.getPath();
          ISourceProject project = pc.getProject();
          dpath = project != null ?
              project.getRawProject().getLocation().append(dpath)
View Full Code Here

TOP

Related Classes of org.eclipse.imp.editor.UniversalEditor

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.