本文整理汇总了Java中org.eclipse.emf.common.command.AbstractCommand类的典型用法代码示例。如果您正苦于以下问题:Java AbstractCommand类的具体用法?Java AbstractCommand怎么用?Java AbstractCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbstractCommand类属于org.eclipse.emf.common.command包,在下文中一共展示了AbstractCommand类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: EcoreCodeGeneratorCheckStateListener
import org.eclipse.emf.common.command.AbstractCommand; //导入依赖的package包/类
public EcoreCodeGeneratorCheckStateListener(EditingDomain editingDomain, WritableValue<EcoreCodeGenerator> eCoreCodeGeneratorWritableValue, CheckboxTreeViewer checkboxTreeViewer) {
this.editingDomain = editingDomain;
this.eCoreCodeGeneratorWritableValue = eCoreCodeGeneratorWritableValue;
this.checkboxTreeViewer = checkboxTreeViewer;
refreshCommand = new AbstractCommand() {
@Override
public void redo() {
checkboxTreeViewer.refresh();
}
@Override
public void undo() {
checkboxTreeViewer.refresh();
}
@Override
public void execute() {
// NOP
}
@Override
protected boolean prepare() {
return true;
}
};
}
开发者ID:Nasdanika,项目名称:codegen-ecore,代码行数:29,代码来源:EcoreCodeGeneratorCheckStateListener.java
示例2: undo
import org.eclipse.emf.common.command.AbstractCommand; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected void undo() throws Throwable {
if (command != null) {
Object observed = getObserved();
EditingDomain domain = EMFUtils.getAnyDomain(observed);
domain.getCommandStack().execute(new AbstractCommand() {
@Override
protected boolean prepare() {
return true;
}
@Override
public void execute() {
command.undo();
}
@Override
public void undo() {
command.redo();
}
@Override
public void redo() {
command.undo();
}
});
} else if (pd instanceof MultiItemPropertyDescriptor) {
((MultiItemPropertyDescriptor) pd).setValues((Collection<Object>) oldValue);
} else {
pd.setPropertyValue(getObserved(), oldValue);
}
}
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:34,代码来源:UndoableObservableValue.java
示例3: redo
import org.eclipse.emf.common.command.AbstractCommand; //导入依赖的package包/类
@Override
protected void redo() throws Throwable {
if (command != null) {
Object observed = getObserved();
EditingDomain domain = EMFUtils.getAnyDomain(observed);
domain.getCommandStack().execute(new AbstractCommand() {
@Override
protected boolean prepare() {
return true;
}
@Override
public void execute() {
command.redo();
}
@Override
public void undo() {
command.undo();
}
@Override
public void redo() {
command.redo();
}
});
} else {
doit(new NullProgressMonitor());
}
}
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:31,代码来源:UndoableObservableValue.java
示例4: doSaveAs
import org.eclipse.emf.common.command.AbstractCommand; //导入依赖的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);
}
}
开发者ID:eclipse,项目名称:triquetrum,代码行数:42,代码来源:TriqDiagramEditor.java
示例5: selectionChanged
import org.eclipse.emf.common.command.AbstractCommand; //导入依赖的package包/类
@Override
public void selectionChanged(SelectionChangedEvent event) {
if(refreshInProgress){
return;
}
final StructuredSelection ss = (StructuredSelection)event.getSelection();
alternative.getEditingDomain().getCommandStack().execute(new AbstractCommand() {
Sequence last = null;
@Override
public void undo() {
UsageComposite.this.usage.setLoadEvolution(last);
}
@Override
public void redo() {
Sequence sequence = (Sequence)ss.getFirstElement();
UsageComposite.this.usage.setLoadEvolution(sequence);
}
@Override
public boolean canExecute() {
return true;
}
@Override
public void execute() {
last = UsageComposite.this.usage.getLoadEvolution();
IEditorInputResource eir = (IEditorInputResource)ss.getFirstElement();
if(eir instanceof EditorInputEMF){
EditorInputEMF eie = (EditorInputEMF)eir;
EObject eo = eie.getModelRootObject(ToolchainUtils.KEY_FILE_LIMBO);
UsageComposite.this.usage.setLoadEvolution((Sequence)eo);
}
}
});
}
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:43,代码来源:UsageComposite.java
注:本文中的org.eclipse.emf.common.command.AbstractCommand类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论