Example #1
0
 @Override
 public void run() {
   if (!fileBox.getText().isEmpty()) {
     selectedFile = new File(directory, fileBox.getText());
     close();
   } else {
     MessageDialog.showMessageDialog(
         getTextGUI(), "Error", "Please select a valid file name", MessageDialogButton.OK);
   }
 }
Example #2
0
 public static void selectToMarker(String s) {
   if (s == null) return;
   s = s.trim();
   if (s.length() == 0) return;
   final Editor editor = Editor.currentEditor();
   Marker m = null;
   try {
     final int index = Integer.parseInt(s);
     final Marker[] bookmarks = Editor.getBookmarks();
     if (index >= 0 && index < bookmarks.length) m = bookmarks[index];
   } catch (NumberFormatException e) {
   }
   if (m == null) {
     MessageDialog.showMessageDialog(editor, "No such marker", "Select To Marker");
     return;
   }
   m.selectToMarker(editor);
 }
Example #3
0
 private void selectToMarker(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.setMarkAtDot();
     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 | REPAINT);
   } else {
     // Marker is not in current buffer.
     MessageDialog.showMessageDialog(editor, "Marker is not in this buffer.", "Select To Marker");
   }
 }