Java 类org.eclipse.ui.part.EditorActionBarContributor 实例源码

项目:eclipsensis    文件:InstallOptionsEditDomain.java   
@Override
public synchronized void execute(Command command)
{
    Command command2 = command;
    if(validateEdit()) {
        CompoundCommand cmd = new CompoundCommand(command2.getLabel());
        cmd.add(command2);
        command2 = cmd;
        mCurrentCommands.push(command2);
        super.execute(command2);
        mCurrentCommands.pop();
    }
    else {
        IEditorActionBarContributor contributor= getEditorPart().getEditorSite().getActionBarContributor();
        if (contributor instanceof EditorActionBarContributor) {
            IActionBars actionBars= ((EditorActionBarContributor) contributor).getActionBars();
            if (actionBars != null) {
                IStatusLineManager manager = actionBars.getStatusLineManager();
                if(manager != null) {
                    if(mFile != null) {
                        manager.setMessage(InstallOptionsPlugin.getFormattedString("read.only.error",new Object[]{mFile.getName()})); //$NON-NLS-1$
                    }
                    else if(mFiles[0] != null) {
                        manager.setMessage(InstallOptionsPlugin.getFormattedString("read.only.error",new Object[]{mFiles[0].getName()})); //$NON-NLS-1$
                    }
                }
            }
        }
        getEditorPart().getEditorSite().getShell().getDisplay().beep();
    }
}
项目:Pydev    文件:EditorUtils.java   
public static IStatusLineManager getStatusLineManager(ITextEditor editor) {
    IEditorActionBarContributor contributor = editor.getEditorSite().getActionBarContributor();
    if (!(contributor instanceof EditorActionBarContributor)) {
        return null;
    }

    IActionBars actionBars = ((EditorActionBarContributor) contributor).getActionBars();
    if (actionBars == null) {
        return null;
    }

    return actionBars.getStatusLineManager();
}
项目:triquetrum    文件:TriqDiagramEditor.java   
@Override
public void doSaveAs() {
  String[] files = selectSaveAsDestinationPath(getSite().getShell());
  if (files.length > 0) {
    URI uri = URI.createFileURI(files[0]);
    URIEditorInput editorInput = new URIEditorInput(uri);
    (getEditingDomain().getResourceSet().getResources().get(0)).setURI(uri);
    (getEditingDomain().getResourceSet().getResources().get(0)).setModified(true);
    String fileName = editorInput.getName();
    String diagramName = fileName.substring(0, fileName.lastIndexOf('.'));
    getEditingDomain().getCommandStack().execute(new AbstractCommand() {
      String oldName;

      @Override
      public boolean canExecute() {
        return true;
      }

      @Override
      public void redo() {
        if (oldName != null) {
          getDiagramTypeProvider().getDiagram().setName(oldName);
        }
      }

      @Override
      public void execute() {
        oldName = getDiagramTypeProvider().getDiagram().getName();
        getDiagramTypeProvider().getDiagram().setName(diagramName);
      }
    });
    setInputWithNotify(editorInput);
    setPartName(diagramName);
    getSite().getShell().setText(uri.toString());
    IActionBars actionBars = ((EditorActionBarContributor) getEditorSite().getActionBarContributor()).getActionBars();
    IProgressMonitor progressMonitor = actionBars.getStatusLineManager() != null ? actionBars.getStatusLineManager().getProgressMonitor()
        : new NullProgressMonitor();

    doSave(progressMonitor);
  }
}