本文整理汇总了Java中org.eclipse.ui.part.EditorActionBarContributor类的典型用法代码示例。如果您正苦于以下问题:Java EditorActionBarContributor类的具体用法?Java EditorActionBarContributor怎么用?Java EditorActionBarContributor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EditorActionBarContributor类属于org.eclipse.ui.part包,在下文中一共展示了EditorActionBarContributor类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.eclipse.ui.part.EditorActionBarContributor; //导入依赖的package包/类
@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();
}
}
示例2: getStatusLineManager
import org.eclipse.ui.part.EditorActionBarContributor; //导入依赖的package包/类
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();
}
示例3: doSaveAs
import org.eclipse.ui.part.EditorActionBarContributor; //导入依赖的package包/类
@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);
}
}