本文整理匯總了Java中org.eclipse.uml2.uml.ActivityNode類的典型用法代碼示例。如果您正苦於以下問題:Java ActivityNode類的具體用法?Java ActivityNode怎麽用?Java ActivityNode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ActivityNode類屬於org.eclipse.uml2.uml包,在下文中一共展示了ActivityNode類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: undo
import org.eclipse.uml2.uml.ActivityNode; //導入依賴的package包/類
/**
* @see org.eclipse.gef.commands.Command#undo()
*/
@Override
public void undo() {
Element umlModel = containerNode.getUmlModel();
if (umlModel instanceof org.eclipse.uml2.uml.ActivityNode || umlModel instanceof org.eclipse.uml2.uml.Action) {
Activity activity = (Activity) containerNode.getParent();
activity.getNodes().remove(umlModel);
} else if (umlModel instanceof Lifeline) {
Interaction interaction = (Interaction) containerNode.getParent();
interaction.getLifelines().remove((Lifeline) umlModel);
} else if (false == request.getNewObjectType().equals(NodeType.TEXT)
&& false == request.getNewObjectType().equals(NodeType.NOTE) && null != request.getNewObjectType()) {
org.eclipse.uml2.uml.Package parentElement = (org.eclipse.uml2.uml.Package) containerNode.getParent();
parentElement.getPackagedElements().remove(umlModel);
}
if (parentNodeModel instanceof Diagram) {
((Diagram) parentNodeModel).getNodeList().remove(containerNode);
} else if (parentNodeModel instanceof ContainerNode) {
((ContainerNode) parentNodeModel).getNodeList().remove(containerNode);
}
}
示例2: undo
import org.eclipse.uml2.uml.ActivityNode; //導入依賴的package包/類
/**
* @see org.eclipse.gef.commands.Command#undo()
*/
@Override
public void undo() {
Element umlModel = containerNode.getUmlModel();
if (umlModel instanceof org.eclipse.uml2.uml.ActivityNode || umlModel instanceof org.eclipse.uml2.uml.Action) {
Activity activity = (Activity) containerNode.getParent();
activity.getNodes().remove(umlModel);
} else if (false == request.getNewObjectType().equals(NodeType.TEXT)
&& false == request.getNewObjectType().equals(NodeType.NOTE) && null != request.getNewObjectType()) {
org.eclipse.uml2.uml.Package parentElement = (org.eclipse.uml2.uml.Package) containerNode.getParent();
parentElement.getPackagedElements().remove(umlModel);
}
if (parentNodeModel instanceof Diagram) {
((Diagram) parentNodeModel).getNodeList().remove(containerNode);
} else if (parentNodeModel instanceof ContainerNode) {
((ContainerNode) parentNodeModel).getNodeList().remove(containerNode);
}
}
示例3: createExpansionRegionCode
import org.eclipse.uml2.uml.ActivityNode; //導入依賴的package包/類
String createExpansionRegionCode(ExpansionRegion node) {
String source = "UNKNOWN_EXPANSION_REAGION";
if (node.getMode().equals(ExpansionKind.ITERATIVE_LITERAL)) {
Variable iterativeVar = node.getVariables().get(0);
EList<ActivityNode> nodes = node.getNodes();
String body = activityExporter.createActivityNodeCode(nodes.get(nodes.size() - 1));
StringBuilder inits = new StringBuilder("");
for (int i = 0; i < nodes.size() - 1; i++) {
inits.append(activityExporter.createActivityNodeCode(nodes.get(i)));
}
String collection = activityExportResolver
.getTargetFromActivityNode(node.getInputElements().get(0).getIncomings().get(0).getSource());
source = ActivityTemplates.foreachCycle(iterativeVar.getType().getName(), iterativeVar.getName(),
collection, body.toString(), inits.toString());
}
return source;
}
示例4: getTypeFromSpecialAcivityNode
import org.eclipse.uml2.uml.ActivityNode; //導入依賴的package包/類
private String getTypeFromSpecialAcivityNode(ActivityNode node) {
String targetTypeName;
// because the output pins not count as parent i have to if-else again
// ...
if (node.eClass().equals(UMLPackage.Literals.READ_SELF_ACTION)) {
targetTypeName = getParentClass(node.getActivity()).getName();
}
if (node.eClass().equals(UMLPackage.Literals.ADD_STRUCTURAL_FEATURE_VALUE_ACTION)) {
targetTypeName = getTypeFromInputPin(((AddStructuralFeatureValueAction) node).getObject());
} else if (node.eClass().equals(UMLPackage.Literals.READ_STRUCTURAL_FEATURE_ACTION)) {
targetTypeName = getTypeFromInputPin(((ReadStructuralFeatureAction) node).getObject());
} else if (node.eClass().equals(UMLPackage.Literals.ACTIVITY_PARAMETER_NODE)) {
targetTypeName = ((ActivityParameterNode) node).getType().getName();
} else {
targetTypeName = "UNKNOWN_TARGET_TYPER_NAME";
// TODO unknown for me, need the model
}
return targetTypeName;
}
示例5: createFunctionBody
import org.eclipse.uml2.uml.ActivityNode; //導入依賴的package包/類
private ActivityExportResult createFunctionBody(Activity activity){
assert(activity != null);
activityExportResult = new ActivityExportResult();
init();
ActivityNode startNode = null;
for (ActivityNode node : activity.getOwnedNodes()) {
if (node.eClass().equals(UMLPackage.Literals.INITIAL_NODE)) {
startNode = node;
break;
}
}
activityExportResult.appendToSource(controlNodeExporter.createStructuredActivityNodeVariables(activity.getVariables()));
activityExportResult.appendToSource(createActivityPartCode(startNode));
activityExportResult.appendToSource(returnNodeExporter.createReturnParamaterCode());
for (VariableInfo varInfo : userVariableExporter.getElements()) {
if (!varInfo.isUsed()) {
activityExportResult.reduceSource(ActivityTemplates.declareRegex(varInfo.getName()));
activityExportResult.reduceSource(ActivityTemplates.setRegex(varInfo.getName()));
}
}
return activityExportResult;
}
示例6: getCommand
import org.eclipse.uml2.uml.ActivityNode; //導入依賴的package包/類
/**
* getCommand
*
* @param selectedElement
* @return Command
*/
public static Command getCommand(Element selectedElement) {
if (null == selectedElement.eContainer()) {
return null;
}
Command deleteCommand = null;
if (selectedElement instanceof Diagram) {
deleteCommand = new DeleteUMLDiagramCommand((Diagram) selectedElement);
} else if (selectedElement instanceof Association) {
deleteCommand = new DeleteUMLAssociationCommand((Association) selectedElement);
} else if (selectedElement instanceof Dependency) {
deleteCommand = new DeleteUMLDependencyCommand(selectedElement);
} else if (selectedElement instanceof Include) {
deleteCommand = new DeleteUMLIncludeCommand(selectedElement);
} else if (selectedElement instanceof Extend) {
deleteCommand = new DeleteUMLExtendCommand(selectedElement);
} else if (selectedElement instanceof Generalization) {
deleteCommand = new DeleteUMLGeneralizationCommand(selectedElement);
} else if (selectedElement instanceof InterfaceRealization) {
deleteCommand = new DeleteUMLInterfaceRealizationCommand(selectedElement);
} else if (selectedElement instanceof Realization) {
deleteCommand = new DeleteUMLRealizationCommand(selectedElement);
} else if (selectedElement instanceof Property) {
deleteCommand = new DeleteUMLPropertyCommand((Property) selectedElement);
} else if (selectedElement instanceof ActivityEdge) {
deleteCommand = new DeleteUMLActivityEdgeCommand((ActivityEdge) selectedElement);
} else if (selectedElement instanceof ActivityNode) {
deleteCommand = new DeleteUMLActivityNodeCommand((ActivityNode) selectedElement);
} else if ((selectedElement instanceof Lifeline) || (selectedElement instanceof Message)) {
deleteCommand = new DeleteUMLSequenceElementCommand((NamedElement)selectedElement);
} else if (selectedElement instanceof NamedElement) {
deleteCommand = new DeleteUMLPackageableElementCommand((NamedElement) selectedElement);
}//
return deleteCommand;
}
示例7: parentIsActivityAndDo
import org.eclipse.uml2.uml.ActivityNode; //導入依賴的package包/類
/**
* 상위 부모가 Activity 요소이고 자식 요소가 해당 Activity에 속한다면
* 붙이기를 수행한다.
* @param parent UML 요소를 붙여 넣을 부모
* @param copied 복사된 UML 요소
* @param original 원본 UML 요소
* @param something 복사할 것인지 복사 가능여부만 체크할 것인지 결정하는 플래그
* @return boolean 부모로 복사 성공 여부
*/
private static boolean parentIsActivityAndDo(EObject parent, EObject copied, EObject original, int something) {
boolean result = false;
Activity activity = (Activity) parent;
if (copied instanceof ActivityPartition) {
if (something == COPY) activity.getGroups().add((ActivityPartition) copied);
result = true;
} else if (copied instanceof Action) {
if (something == COPY) activity.getNodes().add((Action) copied);
result = true;
} else if (copied instanceof ActivityNode) {
if (something == COPY) activity.getNodes().add((ActivityNode) copied);
result = true;
} else if (copied instanceof ActivityEdge) {
if (something == COPY) activity.getEdges().add((ActivityEdge) copied);
result = true;
} else if (copied instanceof Diagram && something == CHECK_COPYABLE) {
if (((Diagram)copied).getType() != DiagramType.SEQUENCE_DIAGRAM)
result = true;
}
if (result && something == COPY) applyStereotypes(parent, copied, original);
return result;
}
示例8: isEnabled
import org.eclipse.uml2.uml.ActivityNode; //導入依賴的package包/類
/**
* @see org.eclipse.gef.ui.actions.WorkbenchPartAction#isEnabled()
*/
@Override
public boolean isEnabled() {
int count = this.getSelectedObjects().size();
if (0 == count) {
return false;
} else if (1 == count) {
Object object = this.getSelectedObjects().get(0);
if ((object instanceof AbstractDiagramEditPart) || (object instanceof AbstractParentCompartmentEditPart)) {
return false;
}
}
Object obj = this.getSelectedObjects().get(0);
if(obj instanceof EditPart){
Object model = ((EditPart)obj).getModel();
if (model instanceof AbstractView){
Element element = ((AbstractView) model).getUmlModel();
if (element instanceof Operation || element instanceof Property || element instanceof ActivityNode
|| element instanceof ActivityPartition) {
return false;
}
if (model instanceof AbstractNode ) {
if( NodeType.NOTE.equals( ((AbstractNode)model).getNodeType()) || NodeType.TEXT.equals( ((AbstractNode)model).getNodeType()) || nexcore.tool.uml.model.umldiagram.RelationType.ATTACHEMENT.equals( ((AbstractNode)model).getNodeType())) {
return false;
}
} else if( model instanceof AbstractConnection ) {
if(nexcore.tool.uml.model.umldiagram.RelationType.ATTACHEMENT.equals( ((AbstractConnection)model).getRelationType())) {
return false;
}
}
if( DomainUtil.isProxy(((AbstractView)model).getUmlModel()) ){
return false;
}
}
}
return true;
}
示例9: undo
import org.eclipse.uml2.uml.ActivityNode; //導入依賴的package包/類
/**
* @see org.eclipse.gef.commands.Command#undo()
*/
@Override
public void undo() {
Element umlModel = notationNode.getUmlModel();
if (umlModel instanceof org.eclipse.uml2.uml.ActivityNode || umlModel instanceof org.eclipse.uml2.uml.Action) {
Activity activity = (Activity) notationNode.getParent();
activity.getNodes().remove(umlModel);
} else if (false == request.getNewObjectType().equals(NodeType.TEXT)
&& false == request.getNewObjectType().equals(NodeType.NOTE) && null != request.getNewObjectType()) {
org.eclipse.uml2.uml.Package parentElement = (org.eclipse.uml2.uml.Package) notationNode.getParent();
parentElement.getPackagedElements().remove(umlModel);
}
if (parentNodeModel instanceof Diagram) {
((Diagram) parentNodeModel).getNodeList().remove(notationNode);
if (umlModel instanceof org.eclipse.uml2.uml.ControlNode) {
if( !notationNode.getLabels().isEmpty() )
((Diagram) parentNodeModel).getNodeList().remove(notationNode.getLabels().get(0));
}
} else if (parentNodeModel instanceof ContainerNode) {
((ContainerNode) parentNodeModel).getNodeList().remove(notationNode);
if (umlModel instanceof org.eclipse.uml2.uml.ControlNode) {
if( !notationNode.getLabels().isEmpty() )
((ContainerNode) parentNodeModel).getNodeList().remove(notationNode.getLabels().get(0));
}
}
}
示例10: loopBody
import org.eclipse.uml2.uml.ActivityNode; //導入依賴的package包/類
@SuppressWarnings("unchecked")
protected <T> T loopBody(LoopNode parent, int index, String name, java.lang.Class<T> type) {
ActivityNode node = parent.getBodyParts().get(index);
assertEquals(name, node.getName());
assertNotNull(node);
assertTrue("Node is not a " + type.getName(), type.isInstance(node));
return (T) node;
}
示例11: loopCond
import org.eclipse.uml2.uml.ActivityNode; //導入依賴的package包/類
@SuppressWarnings("unchecked")
protected <T> T loopCond(LoopNode parent, String name, java.lang.Class<T> type) {
ActivityNode node = parent.getTests().get(0);
assertEquals(name, node.getName());
assertNotNull(node);
assertTrue("Node is not a " + type.getName(), type.isInstance(node));
return (T) node;
}
示例12: loopSetup
import org.eclipse.uml2.uml.ActivityNode; //導入依賴的package包/類
@SuppressWarnings("unchecked")
protected <T> T loopSetup(LoopNode parent, String name, java.lang.Class<T> type) {
ActivityNode node = parent.getSetupParts().get(0);
assertEquals(name, node.getName());
assertNotNull(node);
assertTrue("Node is not a " + type.getName(), type.isInstance(node));
return (T) node;
}
示例13: createSequenceNodeCode
import org.eclipse.uml2.uml.ActivityNode; //導入依賴的package包/類
String createSequenceNodeCode(SequenceNode seqNode) {
StringBuilder source = new StringBuilder("");
returnNodeExporter.searchReturnNode(seqNode.getContainedEdges());
source.append(createStructuredActivityNodeVariables(seqNode.getVariables()));
for (ActivityNode aNode : seqNode.getNodes()) {
source.append(activityExporter.createActivityNodeCode(aNode));
}
return source.toString();
}
示例14: caseASelfIdentifierExpression
import org.eclipse.uml2.uml.ActivityNode; //導入依賴的package包/類
@Override
public void caseASelfIdentifierExpression(ASelfIdentifierExpression node) {
ReadSelfAction action = (ReadSelfAction) builder.createAction(IRepository.PACKAGE.getReadSelfAction());
try {
super.caseASelfIdentifierExpression(node);
Activity currentActivity = builder.getCurrentActivity();
while (MDDExtensionUtils.isClosure(currentActivity)) {
// TODO refactor to use ActivityUtils
ActivityNode rootNode = MDDExtensionUtils.getClosureContext(currentActivity);
currentActivity = ActivityUtils.getActionActivity(rootNode);
}
final BehavioralFeature operation = currentActivity.getSpecification();
boolean staticContext = false;
if (operation != null) {
staticContext = operation.isStatic();
} else if (MDDExtensionUtils.isConstraintBehavior(currentActivity)) {
Constraint constraint = MDDExtensionUtils.getBehaviorConstraint(currentActivity);
staticContext = MDDExtensionUtils.isStaticConstraint(constraint);
}
if (staticContext) {
problemBuilder.addProblem(new ReadSelfFromStaticContext(), node);
throw new AbortedStatementCompilationException();
}
Classifier currentClassifier = ActivityUtils.getContext(currentActivity);
if (currentClassifier == null) {
problemBuilder.addProblem(new InternalProblem("Could not determine context"), node);
throw new AbortedStatementCompilationException();
}
builder.registerOutput(action.createResult(null, currentClassifier));
fillDebugInfo(action, node);
} finally {
builder.closeAction();
}
checkIncomings(action, node.getSelf(), getBoundElement());
}
示例15: getActionActivity
import org.eclipse.uml2.uml.ActivityNode; //導入依賴的package包/類
public static Activity getActionActivity(ActivityNode action) {
// UML2 5
// return action.containingActivity()
if (action.getActivity() != null)
return action.getActivity();
return MDDUtil.getNearest(action, UMLPackage.Literals.ACTIVITY);
}