本文整理汇总了Java中org.eclipse.gmf.runtime.common.core.command.CommandResult类的典型用法代码示例。如果您正苦于以下问题:Java CommandResult类的具体用法?Java CommandResult怎么用?Java CommandResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CommandResult类属于org.eclipse.gmf.runtime.common.core.command包,在下文中一共展示了CommandResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doExecuteWithResult
import org.eclipse.gmf.runtime.common.core.command.CommandResult; //导入依赖的package包/类
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
if (!canExecute()) {
throw new ExecutionException(
"Invalid arguments in create link command"); //$NON-NLS-1$
}
Transition newElement = StatemachineFactory.eINSTANCE
.createTransition();
getContainer().getTransitions().add(newElement);
newElement.setSourceState(getSource());
newElement.setTargetState(getTarget());
doConfigure(newElement, monitor, info);
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
示例2: doExecuteWithResult
import org.eclipse.gmf.runtime.common.core.command.CommandResult; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
BooleanValueStyle inlineStyle = DiagramPartitioningUtil.getInlineStyle(node);
if (inlineStyle != null) {
inlineStyle.setBooleanValue(false);
} else {
inlineStyle = DiagramPartitioningUtil.createInlineStyle();
inlineStyle.setBooleanValue(false);
node.getStyles().add(inlineStyle);
}
Diagram subdiagram = ViewService.createDiagram(node.getElement(), StatechartDiagramEditor.ID,
DiagramActivator.DIAGRAM_PREFERENCES_HINT);
node.eResource().getContents().add(subdiagram);
return CommandResult.newOKCommandResult();
}
示例3: doExecuteWithResult
import org.eclipse.gmf.runtime.common.core.command.CommandResult; //导入依赖的package包/类
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
Vertex source = (Vertex) getRequest().getSource();
Vertex target = (Vertex) getRequest().getTarget();
if (source != null && target != null) {
Transition transition = SGraphFactory.eINSTANCE.createTransition();
source.getOutgoingTransitions().add(transition);
transition.setSource(source);
transition.setTarget(target);
source.getOutgoingTransitions().add(transition);
target.getIncomingTransitions().add(transition);
((CreateElementRequest) getRequest()).setNewElement(transition);
}
return CommandResult.newOKCommandResult();
}
示例4: doExecuteWithResult
import org.eclipse.gmf.runtime.common.core.command.CommandResult; //导入依赖的package包/类
/**
* Executes the command that switches the subregion layout orientation.
*/
@SuppressWarnings("unchecked")
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
BooleanValueStyle style = GMFNotationUtil.getBooleanValueStyle(
view, StateViewFactory.ALIGNMENT_ORIENTATION);
if (style == null) {
style = NotationFactory.eINSTANCE.createBooleanValueStyle();
style.setBooleanValue(true);
style.setName(StateViewFactory.ALIGNMENT_ORIENTATION);
view.getStyles().add(style);
} else {
style.setBooleanValue(!style.isBooleanValue());
}
return CommandResult.newOKCommandResult(view);
}
示例5: modify
import org.eclipse.gmf.runtime.common.core.command.CommandResult; //导入依赖的package包/类
/**
* Executes the modification in a transactional command.
*/
public void modify() {
if (! isApplicable()) throw new IllegalStateException("Modification " + getClass().getSimpleName() + " is not executable.");
final EObject semanticObject = getTargetView().getElement();
AbstractTransactionalCommand refactoringCommand = new AbstractTransactionalCommand(
TransactionUtil.getEditingDomain(semanticObject), getClass().getName(), Collections.EMPTY_LIST) {
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
try {
AbstractSemanticModification.this.execute(semanticObject, getTargetView());
} catch (Exception ex) {
ex.printStackTrace();
return CommandResult.newErrorCommandResult(ex);
}
return CommandResult.newOKCommandResult();
}
};
executeCommand(refactoringCommand, semanticObject.eResource());
}
示例6: doExecuteWithResult
import org.eclipse.gmf.runtime.common.core.command.CommandResult; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
View childView = (View) child.getAdapter(View.class);
View parentView = (View) parent.getAdapter(View.class);
if (parentView.getPersistedChildren().contains(childView)
&& index != ViewUtil.APPEND) {
parentView.getPersistedChildren().move(index, childView);
} else if (index == ViewUtil.APPEND) {
parentView.insertChild(childView);
} else {
parentView.insertChildAt(childView, index);
}
return CommandResult.newOKCommandResult();
}
示例7: doExecuteWithResult
import org.eclipse.gmf.runtime.common.core.command.CommandResult; //导入依赖的package包/类
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info){
View state = (View) stateEditPart.getModel();
View stateLabel = (View) state.getChildren().get(0);
View stateCompartment = CustomStateEditPart.getStateCompartmentView(state);
addLayoutConstraintForAllChildren(state);
Zone.setHeight(stateLabel, STATELABEL_HEIGHT);
Zone.setHeight(stateCompartment, Zone.getWidth(state)-STATELABEL_HEIGHT);
Zone.setWidth(stateLabel, Zone.getWidth(state));
Zone.setWidth(stateCompartment, Zone.getWidth(state));
if (stateCompartment.getChildren().size() == 1) {
// we need to resize the region
View defaultRegion = (View) stateCompartment.getChildren().get(0);
Zone.setWidth(defaultRegion, Zone.getWidth(stateCompartment));
Zone.setHeight(defaultRegion, Zone.getHeight(stateCompartment));
}
return CommandResult.newOKCommandResult();
}
示例8: doExecuteWithResult
import org.eclipse.gmf.runtime.common.core.command.CommandResult; //导入依赖的package包/类
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
if (!canExecute()) {
throw new ExecutionException(
"Invalid arguments in create link command"); //$NON-NLS-1$
}
ExternalFactLink newElement = SmcFactory.eINSTANCE
.createExternalFactLink();
getSource().getExternalFactLink().add(newElement);
newElement.setFact(getTarget());
doConfigure(newElement, monitor, info);
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
示例9: doExecuteWithResult
import org.eclipse.gmf.runtime.common.core.command.CommandResult; //导入依赖的package包/类
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
if (!canExecute()) {
throw new ExecutionException(
"Invalid arguments in create link command"); //$NON-NLS-1$
}
PlayerBinding newElement = SmcFactory.eINSTANCE.createPlayerBinding();
getContainer().getPlayerBinding().add(newElement);
newElement.setRole(getSource());
newElement.setPlayer(getTarget());
doConfigure(newElement, monitor, info);
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
示例10: doExecuteWithResult
import org.eclipse.gmf.runtime.common.core.command.CommandResult; //导入依赖的package包/类
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
if (!canExecute()) {
throw new ExecutionException(
"Invalid arguments in create link command"); //$NON-NLS-1$
}
FactLink newElement = SmcFactory.eINSTANCE.createFactLink();
getSource().getFactLink().add(newElement);
newElement.setFact(getTarget());
SmcElementTypes.init_FactLink_4006(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
示例11: doExecuteWithResult
import org.eclipse.gmf.runtime.common.core.command.CommandResult; //导入依赖的package包/类
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
if (!canExecute()) {
throw new ExecutionException(
"Invalid arguments in create link command"); //$NON-NLS-1$
}
FactLink newElement = SmcFactory.eINSTANCE.createFactLink();
getSource().getFactLink().add(newElement);
newElement.setFact(getTarget());
SmcElementTypes.init_FactLink_4003(newElement);
doConfigure(newElement, monitor, info);
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
示例12: doExecuteWithResult
import org.eclipse.gmf.runtime.common.core.command.CommandResult; //导入依赖的package包/类
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
// refresh visibility
parentView.setVisible(false);
parentView.setVisible(true);
// from generated DiagramUpdateCommand
List<?> editPolicies = CanonicalEditPolicy
.getRegisteredEditPolicies(rootObject);
for (Iterator<?> it = editPolicies.iterator(); it.hasNext(); ) {
CanonicalEditPolicy nextEditPolicy = (CanonicalEditPolicy) it.next();
nextEditPolicy.refresh();
}
return CommandResult.newOKCommandResult();
}
示例13: doExecuteWithResult
import org.eclipse.gmf.runtime.common.core.command.CommandResult; //导入依赖的package包/类
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
if (!canExecute()) {
throw new ExecutionException(
"Invalid arguments in create link command"); //$NON-NLS-1$
}
SimpleBPMN.Association newElement = SimpleBPMN.SimpleBPMNFactory.eINSTANCE
.createAssociation();
getContainer().getElements().add(newElement);
newElement.setFrom(getSource());
newElement.setTo(getTarget());
doConfigure(newElement, monitor, info);
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
示例14: doExecuteWithResult
import org.eclipse.gmf.runtime.common.core.command.CommandResult; //导入依赖的package包/类
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
if (!canExecute()) {
throw new ExecutionException(
"Invalid arguments in create link command"); //$NON-NLS-1$
}
SimpleBPMN.SequenceFlow newElement = SimpleBPMN.SimpleBPMNFactory.eINSTANCE
.createSequenceFlow();
getContainer().getElements().add(newElement);
newElement.setFrom(getSource());
newElement.setTo(getTarget());
doConfigure(newElement, monitor, info);
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
示例15: doExecuteWithResult
import org.eclipse.gmf.runtime.common.core.command.CommandResult; //导入依赖的package包/类
/**
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
try {
Diagram diagram = getDiagramToOpen();
if (diagram == null) {
diagram = intializeNewDiagram();
}
URI uri = EcoreUtil.getURI(diagram);
String editorName = uri.lastSegment() + '#'
+ diagram.eResource().getContents().indexOf(diagram);
IEditorInput editorInput = new URIEditorInput(uri, editorName);
IWorkbenchPage page = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage();
page.openEditor(editorInput, getEditorID());
return CommandResult.newOKCommandResult();
} catch (Exception ex) {
throw new ExecutionException("Can't open diagram", ex);
}
}