当前位置: 首页>>代码示例>>Java>>正文


Java CommandResult类代码示例

本文整理汇总了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);

}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:21,代码来源:TransitionCreateCommand.java

示例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();
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:18,代码来源:CreateSubdiagramCommand.java

示例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();
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:17,代码来源:CreateTransitionCommand.java

示例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);
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:19,代码来源:ToggleSubRegionLayoutCommand.java

示例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());
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:24,代码来源:AbstractSemanticModification.java

示例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();
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:19,代码来源:CompartmentLayoutEditPolicy.java

示例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();
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:23,代码来源:FixStateContentSizesCommand.java

示例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);

}
 
开发者ID:road-framework,项目名称:ROADDesigner,代码行数:20,代码来源:ExternalFactLinkCreateCommand.java

示例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);

}
 
开发者ID:road-framework,项目名称:ROADDesigner,代码行数:20,代码来源:PlayerBindingCreateCommand.java

示例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);

}
 
开发者ID:road-framework,项目名称:ROADDesigner,代码行数:20,代码来源:FactLink2CreateCommand.java

示例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);

}
 
开发者ID:road-framework,项目名称:ROADDesigner,代码行数:20,代码来源:FactLinkCreateCommand.java

示例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();
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:18,代码来源:RefreshElementCommand.java

示例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);

}
 
开发者ID:bluezio,项目名称:simplified-bpmn-example,代码行数:21,代码来源:Association2CreateCommand.java

示例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);

}
 
开发者ID:bluezio,项目名称:simplified-bpmn-example,代码行数:21,代码来源:SequenceFlowCreateCommand.java

示例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);
	}
}
 
开发者ID:bluezio,项目名称:simplified-bpmn-example,代码行数:23,代码来源:OpenDiagramEditPolicy.java


注:本文中的org.eclipse.gmf.runtime.common.core.command.CommandResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。