Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy.java')
-rw-r--r--incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy.java29
1 files changed, 14 insertions, 15 deletions
diff --git a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy.java b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy.java
index 9d1b9c91490..fa9e76e1e08 100644
--- a/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy.java
+++ b/incoming/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/policies/CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy.java
@@ -50,9 +50,9 @@ public class CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy exte
protected Command getCreateCommand(final CreateViewRequest request) {
final Command superCommand = super.getCreateCommand(request);
final List<? extends ViewDescriptor> viewDescriptors = request.getViewDescriptors();
- if (viewDescriptors.size() == 1 && Integer.toString(StateDefinitionEditPart.VISUAL_ID).equals(viewDescriptors.get(0).getSemanticHint())) {
- final View lifelineView = (View) getHost().getParent().getModel();
- final Lifeline lifeline = (Lifeline) lifelineView.getElement();
+ if(viewDescriptors.size() == 1 && Integer.toString(StateDefinitionEditPart.VISUAL_ID).equals(viewDescriptors.get(0).getSemanticHint())) {
+ final View lifelineView = (View)getHost().getParent().getModel();
+ final Lifeline lifeline = (Lifeline)lifelineView.getElement();
final List<?> children = getHost().getChildren();
final boolean firstStateDefinition = children.size() == 0;
return createStateDefinitionCommand(superCommand, lifeline, firstStateDefinition);
@@ -61,36 +61,35 @@ public class CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy exte
}
private Command createStateDefinitionCommand(final Command superCommand, final Lifeline lifeline, final boolean first) {
- final CompoundCommand compoundCommand = new CompoundCommand(
- Messages.CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy_CreateStateDefinition);
+ final CompoundCommand compoundCommand = new CompoundCommand(Messages.CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy_CreateStateDefinition);
final FullLifelineEditPartCN lifelineEditPart = getLifelineEditPart();
compoundCommand.add(new RefreshCommandForUndo(lifelineEditPart));
// creates the state definition View
compoundCommand.add(superCommand);
- final CommandResult superCommandResult = ((ICommandProxy) superCommand).getICommand().getCommandResult();
+ final CommandResult superCommandResult = ((ICommandProxy)superCommand).getICommand().getCommandResult();
final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(lifeline);
- if (editingDomain == null) {
+ if(editingDomain == null) {
throw new IllegalStateException("no editing domain"); //$NON-NLS-1$
}
- final AbstractTransactionalCommand initStateDefinitionCommand = new AbstractTransactionalCommand(editingDomain,
- Messages.CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy_InitializeStateDefinition, null) {
+ final AbstractTransactionalCommand initStateDefinitionCommand = new AbstractTransactionalCommand(editingDomain, Messages.CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy_InitializeStateDefinition, null) {
+
@Override
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
// the result from the super command that creates the view
- final ViewDescriptor viewDescriptor = (ViewDescriptor) superCommandResult.getReturnValue();
- final View stateDefinitionView = (View) viewDescriptor.getAdapter(View.class);
+ final ViewDescriptor viewDescriptor = (ViewDescriptor)superCommandResult.getReturnValue();
+ final View stateDefinitionView = (View)viewDescriptor.getAdapter(View.class);
// create the annotation for the StateDefinition
StateDefinitionUtils.initNewStateDefinitionName(stateDefinitionView);
- if (first) {
+ if(first) {
final String id = StateDefinitionUtils.getStateDefinitionViewID(stateDefinitionView);
StateInvariantUtils.createStateInvariant(id, lifelineEditPart, -1, -1, -1);
- final View lifelineView = (View) lifelineEditPart.getModel();
- final Lifeline lifeline = (Lifeline) lifelineView.getElement();
+ final View lifelineView = (View)lifelineEditPart.getModel();
+ final Lifeline lifeline = (Lifeline)lifelineView.getElement();
LifelineUtils.updateFragmentNames(lifeline, lifelineView);
}
return CommandResult.newOKCommandResult();
@@ -102,7 +101,7 @@ public class CustomFullLifelineStateDefinitionCompartmentCreationEditPolicy exte
}
protected FullLifelineEditPartCN getLifelineEditPart() {
- return (FullLifelineEditPartCN) EditPartUtils.findParentEditPartWithId(getHost(), FullLifelineEditPartCN.VISUAL_ID);
+ return (FullLifelineEditPartCN)EditPartUtils.findParentEditPartWithId(getHost(), FullLifelineEditPartCN.VISUAL_ID);
}
}

Back to the top