Example #1
0
 public void gotoMarker(Editor editor) {
   if (buffer == editor.getBuffer()
       || (file != null && file.equals(editor.getBuffer().getFile()))) {
     // Marker is in current buffer.
     editor.addUndo(SimpleEdit.MOVE);
     editor.unmark();
     editor.updateDotLine();
     if (pos != null && editor.getBuffer().contains(pos.getLine())) {
       editor.getDot().moveTo(pos);
     } else {
       editor.gotoline(lineNumber);
       editor.getDot().setOffset(offset);
     }
     if (editor.getDotOffset() > editor.getDotLine().length())
       editor.getDot().setOffset(editor.getDotLine().length());
     editor.moveCaretToDotCol();
     editor.updateDotLine();
     editor.setUpdateFlag(REFRAME);
   } else {
     // Marker is not in current buffer.
     BufferList buffer_list = Editor.getBufferList();
     Buffer buf = null;
     if (file != null) buf = buffer_list.findBuffer(file);
     else if (buffer_list.contains(buffer)) buf = buffer;
     if (buf != null) {
       editor.makeNext(buf);
       editor.activate(buf);
       editor.addUndo(SimpleEdit.MOVE);
       editor.updateDotLine();
       if (pos != null && buf.contains(pos.getLine())) {
         editor.getDot().moveTo(pos);
       } else {
         editor.gotoline(lineNumber);
         editor.getDot().setOffset(offset);
       }
       if (editor.getDotOffset() > editor.getDotLine().length())
         editor.getDot().setOffset(editor.getDotLine().length());
       editor.moveCaretToDotCol();
       editor.updateDotLine();
     } else if (file != null) {
       buf = Buffer.createBuffer(file);
       editor.makeNext(buf);
       editor.activate(buf);
       editor.gotoline(lineNumber);
       editor.getDot().setOffset(offset);
       if (editor.getDotOffset() > editor.getDotLine().length())
         editor.getDot().setOffset(editor.getDotLine().length());
       editor.moveCaretToDotCol();
     } else return;
   }
   pos = new Position(editor.getDot());
   buffer = editor.getBuffer();
 }
Example #2
0
 public void run() {
   Editor editor = Editor.currentEditor();
   if (v != null && v.size() > 0) {
     Editor other = editor.getOtherEditor();
     if (other != null && editor.getBuffer().isSecondary()) editor = other;
     if (!editor.getBuffer().isPrimary()) Debug.bug();
     Buffer toBeActivated = editor.openFiles(v);
     if (toBeActivated != null) {
       editor.makeNext(toBeActivated);
       editor.switchToBuffer(toBeActivated);
       if (!Editor.getEditorList().contains(editor)) Debug.bug();
       editor.updateDisplay();
     }
   }
   editor.getFrame().toFront();
   editor.requestFocus();
   Editor.restoreFocus();
 }