blob: 5ff9453f03267a29728e0ec8fcd67fdbd0f2ebf4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
/*****************************************************************************
* Copyright (c) 2017 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.preferences;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.papyrus.uml.diagram.common.preferences.AbstractAutomatedModelCompletionPreferencesPage;
import org.eclipse.papyrus.uml.diagram.common.preferences.AutomatedModelCompletionPreferenceDescriptor;
import org.eclipse.uml2.uml.AcceptCallAction;
import org.eclipse.uml2.uml.AcceptEventAction;
import org.eclipse.uml2.uml.ActivityNode;
import org.eclipse.uml2.uml.AddStructuralFeatureValueAction;
import org.eclipse.uml2.uml.CreateObjectAction;
import org.eclipse.uml2.uml.ReadStructuralFeatureAction;
import org.eclipse.uml2.uml.ValueSpecificationAction;
/**
*
* Automated pin derivation for AcceptEventAction and AcceptCallAction
*
*/
public class ActivityAutomatedModelCompletionPreferencePage extends AbstractAutomatedModelCompletionPreferencesPage {
/**
* Constructor.
*
*/
public ActivityAutomatedModelCompletionPreferencePage() {
super();
initContentProvider(getActionList());
}
/**
* This method initialize the automatedModelCompletionDescriptorsList property
*/
protected void initContentProvider(List<Class<? extends ActivityNode>> actionList) {
List<String> automatedModelCompletionList = new ArrayList<>();
automatedModelCompletionList.add(AutomatedModelCompletionPreferencesInitializer.PIN_SYNCHRONIZATION);
automatedModelCompletionList.add(AutomatedModelCompletionPreferencesInitializer.NONE);
for (Class<? extends ActivityNode> action : actionList) {
// get only the name of the action
// initial form : interface org.eclipse.uml2.uml.<ActionName>
String actionName = action.toString();
actionName = actionName.replaceAll("org.eclipse.uml2.uml.", "");
actionName = actionName.replaceFirst("interface\\s", "");
actionName = actionName.substring(0, 1).toLowerCase() + actionName.substring(1);
// get preference constant like : org.eclipse.papyrus.uml.diagram.activity.preferences.<ActionName>
String prefConst = "org.eclipse.papyrus.uml.diagram.activity.preferences.";
prefConst = prefConst.concat(actionName);
automatedModelCompletionDescriptorsList.add(new AutomatedModelCompletionPreferenceDescriptor(action, automatedModelCompletionList, prefConst));
}
}
/**
* This method create a list of actions which will be display in the preference page
*
* @return the list of actions
*/
protected List<Class<? extends ActivityNode>> getActionList() {
List<Class<? extends ActivityNode>> actionList = new ArrayList<>();
actionList.add(AcceptCallAction.class);
actionList.add(AcceptEventAction.class);
actionList.add(AddStructuralFeatureValueAction.class);
actionList.add(CreateObjectAction.class);
actionList.add(ReadStructuralFeatureAction.class);
actionList.add(ValueSpecificationAction.class);
return actionList;
}
}
|