Exemplo n.º 1
0
  public void editorDeleted(ContainedEditorManager editor, ContainedEditorProperties props) {

    IEditorStatusLine statusLine =
        (IEditorStatusLine) containingEditor.getAdapter(IEditorStatusLine.class);
    statusLine.setMessage(false, "Editor Deleted", null);

    Position p = removeControl(editor, true);
    if (p != null) {
      try {
        containingEditor.getSelectionProvider().setSelection(new TextSelection(doc, p.offset, 0));
        doc.replace(p.offset, p.length, "");
      } catch (BadLocationException e) {
        // it's OK to ignore this
        // shouldn't happen anyway
      }
    }
    if (editor == moduleEditor) {
      // look for new module editor, or else it becomes null.
      replaceModuleEditor(null);
      for (final ContainedEditorManager contained : editorPositionMap.keySet()) {
        if (contained.editorKind() == CALModuleEditorManager.EDITOR_KIND) {
          replaceModuleEditor((CALModuleEditorManager) contained);
          break;
        }
      }
    }

    // remove this control's annotation
    EmbeddedAnnotation annotation = editorAnnotationMap.remove(editor);
    annotationModel.removeAnnotation(annotation);

    // remove listener
    editor.removeListener(this);
  }
Exemplo n.º 2
0
 /**
  * Sets the given message as error message to this editor's status line.
  *
  * @param msg message to be set
  */
 @Override
 public void setStatusLineErrorMessage(String msg) {
   IEditorStatusLine statusLine = (IEditorStatusLine) getAdapter(IEditorStatusLine.class);
   if (statusLine != null) {
     statusLine.setMessage(true, msg, null);
   }
 }
 /**
  * Reports the given error message to the user.
  *
  * @param message Message to report.
  * @param part Workbench part where action was invoked.
  */
 protected void report(String message, IWorkbenchPart part) {
   IEditorStatusLine statusLine = (IEditorStatusLine) part.getAdapter(IEditorStatusLine.class);
   if (statusLine != null) {
     if (message != null) {
       statusLine.setMessage(true, message, null);
     } else {
       statusLine.setMessage(true, null, null);
     }
   }
   if (message != null && CDebugUIPlugin.getActiveWorkbenchShell() != null) {
     CDebugUIPlugin.getActiveWorkbenchShell().getDisplay().beep();
   }
 }
 private static void showMessage(Shell shell, JavaEditor editor, String msg) {
   IEditorStatusLine statusLine = (IEditorStatusLine) editor.getAdapter(IEditorStatusLine.class);
   if (statusLine != null) statusLine.setMessage(true, msg, null);
   shell.getDisplay().beep();
 }