本文整理汇总了Java中org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult方法的典型用法代码示例。如果您正苦于以下问题:Java CommandResult.newOKCommandResult方法的具体用法?Java CommandResult.newOKCommandResult怎么用?Java CommandResult.newOKCommandResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.gmf.runtime.common.core.command.CommandResult
的用法示例。
在下文中一共展示了CommandResult.newOKCommandResult方法的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$
}
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);
}
示例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$
}
SimpleBPMN.MessageFlow newElement = SimpleBPMN.SimpleBPMNFactory.eINSTANCE
.createMessageFlow();
getContainer().getElements().add(newElement);
newElement.setFrom(getSource());
newElement.setTo(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$
}
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);
}
示例11: getAfterConfigureCommand
import org.eclipse.gmf.runtime.common.core.command.CommandResult; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected ICommand getAfterConfigureCommand(final ConfigureRequest request) {
ICommand command = new ConfigureElementCommand(request) {
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
EObject elementToConfigure = request.getElementToConfigure();
if (!(elementToConfigure instanceof Class)) {
return CommandResult.newErrorCommandResult("Element to configure was not a Class: " + elementToConfigure);//$NON-NLS-1$
}
// retrieve stereotype
Stereotype st = ((Class)elementToConfigure).getAppliedStereotype(EXTLIBRARY_PERIODICAL);
if (st == null) {
return CommandResult.newErrorCommandResult("Element to configure did not have required stereotype"); //$NON-NLS-1$
}
((Class) elementToConfigure).setValue(st, ISSUES_PER_YEAR, 12);
// change name
String name = NamedElementUtil.getDefaultNameWithIncrementFromBase(MONTHLY, elementToConfigure.eContainer().eContents());
((Class) elementToConfigure).setName(name);
return CommandResult.newOKCommandResult(elementToConfigure);
}
};
return command.compose(super.getAfterConfigureCommand(request));
}
示例12: doExecuteWithResult
import org.eclipse.gmf.runtime.common.core.command.CommandResult; //导入方法依赖的package包/类
/**
* @generated NOT
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
State newElement = StatemachineFactory.eINSTANCE.createState();
Statemachine owner = (Statemachine) getElementToEdit();
owner.getStates().add(newElement);
StatemachineUtil.ensureUniqueIds(owner.eResource());
doConfigure(newElement, monitor, info);
((CreateElementRequest) getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
示例13: doExecuteWithResult
import org.eclipse.gmf.runtime.common.core.command.CommandResult; //导入方法依赖的package包/类
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
for (EditPart editPart : editParts) {
adjustAnchors(editPart);
}
return CommandResult.newOKCommandResult();
}
示例14: doExecuteWithResult
import org.eclipse.gmf.runtime.common.core.command.CommandResult; //导入方法依赖的package包/类
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
View view = ViewService.getInstance().createView(
viewDescriptor.getViewKind(),
viewDescriptor.getElementAdapter(), containerView,
viewDescriptor.getSemanticHint(), index,
viewDescriptor.isPersisted(),
viewDescriptor.getPreferencesHint());
Assert.isNotNull(view, "failed to create a view"); //$NON-NLS-1$
viewDescriptor.setView(view);
return CommandResult.newOKCommandResult(viewDescriptor);
}
示例15: doExecuteWithResult
import org.eclipse.gmf.runtime.common.core.command.CommandResult; //导入方法依赖的package包/类
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
final View parentView = TreeLayoutUtil.getTreeNodeParentView(editPart
.getNotationView());
if (parentView != null) {
final IGraphicalEditPart parentEditPart = (IGraphicalEditPart) editPart
.findEditPart(editPart.getParent(), parentView.getElement());
if (parentEditPart != null) {
final List<IGraphicalEditPart> treeChildren = new ArrayList<IGraphicalEditPart>(
TreeLayoutUtil.getOrderedTreeChildren(parentEditPart));
if (!treeChildren.isEmpty()) {
final int oldPos = treeChildren.indexOf(editPart);
final int newPos = layoutConstraint.getTreeInnerRankIndex();
if (newPos != -1) {
if (oldPos != newPos) {
final IGraphicalEditPart element = treeChildren
.get(oldPos);
treeChildren.remove(oldPos);
treeChildren.add(newPos, element);
TreeLayoutUtil
.setTreeNodesPositionAnnotation(TreeLayoutUtil
.getViews(treeChildren));
}
}
return CommandResult.newOKCommandResult();
}
}
}
return CommandResult
.newErrorCommandResult("Parent view or parent edit part not found!");
}