185850: Authoring: creating child elements under process does no...
diff --git a/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/editors/ProcessEditor.java b/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/editors/ProcessEditor.java
index 47030a5..484d9f3 100644
--- a/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/editors/ProcessEditor.java
+++ b/org.eclipse.epf.authoring.ui/src/org/eclipse/epf/authoring/ui/editors/ProcessEditor.java
@@ -103,7 +103,6 @@
import org.eclipse.epf.diagram.model.util.GraphicalDataHelper;
import org.eclipse.epf.diagram.model.util.GraphicalDataManager;
import org.eclipse.epf.diagram.ui.DiagramUIPlugin;
-import org.eclipse.epf.diagram.ui.service.DiagramUIService;
import org.eclipse.epf.diagram.wpdd.part.WPDDiagramEditorPlugin;
import org.eclipse.epf.library.ILibraryManager;
import org.eclipse.epf.library.ILibraryServiceListener;
@@ -355,7 +354,7 @@
// duplicate definition for now, will need to merge together later
// see PreferenceConstants.org.eclipse.epf.library.prefs
- public static final List DEFAULT_TBS_COLUMNS = Arrays
+ public static final List<ColumnDescriptor> DEFAULT_TBS_COLUMNS = Arrays
.asList(new ColumnDescriptor[] {
COL_DESC_PRESENTATION_NAME,
// COL_DESC_ID,
@@ -364,7 +363,7 @@
COL_DESC_IS_PLANNED,
COL_DESC_HAS_MULTIPLE_OCCURRENCES, COL_DESC_IS_OPTIONAL });
- public static final List DEFAULT_WPBS_COLUMNS = Arrays
+ public static final List<ColumnDescriptor> DEFAULT_WPBS_COLUMNS = Arrays
.asList(new ColumnDescriptor[] {
COL_DESC_PRESENTATION_NAME,
// COL_DESC_ID,
@@ -374,7 +373,7 @@
COL_DESC_DELIVERABLE, COL_DESC_TYPE,
COL_DESC_IS_PLANNED, COL_DESC_HAS_MULTIPLE_OCCURRENCES, COL_DESC_IS_OPTIONAL });
- public static final List DEFAULT_WBS_COLUMNS = Arrays
+ public static final List<ColumnDescriptor> DEFAULT_WBS_COLUMNS = Arrays
.asList(new ColumnDescriptor[] { COL_DESC_PRESENTATION_NAME,
COL_DESC_ID,
//COL_DESC_PREFIX,
@@ -385,16 +384,16 @@
});
- public static final List ALL_WBS_COLUMNS = new ArrayList(
+ public static final List<ColumnDescriptor> ALL_WBS_COLUMNS = new ArrayList<ColumnDescriptor>(
DEFAULT_WBS_COLUMNS);
- public static final List ALL_TBS_COLUMNS = new ArrayList(
+ public static final List<ColumnDescriptor> ALL_TBS_COLUMNS = new ArrayList<ColumnDescriptor>(
DEFAULT_TBS_COLUMNS);
- public static final List ALL_WPBS_COLUMNS = new ArrayList(
+ public static final List<ColumnDescriptor> ALL_WPBS_COLUMNS = new ArrayList<ColumnDescriptor>(
DEFAULT_WPBS_COLUMNS);
- public static final Map idToColumnDescriptorMap = new HashMap();
+ public static final Map<String, ColumnDescriptor> idToColumnDescriptorMap = new HashMap<String, ColumnDescriptor>();
static {
ALL_WBS_COLUMNS.add(COL_DESC_PREFIX);
ALL_TBS_COLUMNS.add(COL_DESC_PREFIX);
@@ -3246,21 +3245,19 @@
Command mostRecentCommand = ((CommandStack) event
.getSource()).getMostRecentCommand();
if (mostRecentCommand != null) {
- if (mostRecentCommand instanceof CreateChildCommand
- && currentViewer instanceof ProcessViewer) {
- Object[] arr = mostRecentCommand
- .getAffectedObjects().toArray();
- if (arr.length == 1) {
- ProcessViewer viewer = (ProcessViewer) currentViewer;
- viewer.editElement(arr[0], 0);
- }
- } else {
if (!(TngUtil.unwrap(mostRecentCommand) instanceof SetCommand)) {
setSelectionToViewer(mostRecentCommand
.getAffectedObjects());
}
-
- }
+ if (mostRecentCommand instanceof CreateChildCommand
+ && currentViewer instanceof ProcessViewer) {
+ Object[] arr = mostRecentCommand
+ .getAffectedObjects().toArray();
+ if (arr.length == 1) {
+ ProcessViewer viewer = (ProcessViewer) currentViewer;
+ viewer.editElement(arr[0], 0);
+ }
+ }
}
// if (propertySheetPage != null) {
// propertySheetPage.refresh();
@@ -3381,31 +3378,12 @@
*
*/
public void setSelectionToViewer(Collection collection) {
- // System.out.println(getClass().getName() + ".setSelectionToViewer:
- // selection="+collection);
- final Collection theSelection = collection;
- // Make sure it's okay.
- //
- if (theSelection != null && !theSelection.isEmpty()) {
- // I don't know if this should be run this deferred
- // because we might have to give the editor a chance to process the
- // viewer update events
- // and hence to update the views first.
- //
- //
- Runnable runnable = new Runnable() {
- public void run() {
+ if (currentViewer != null && collection != null && !collection.isEmpty()) {
// Try to select the items in the current content viewer of
// the editor.
//
- if (currentViewer != null) {
- currentViewer.setSelection(new StructuredSelection(
- theSelection.toArray()), true);
-
- }
- }
- };
- runnable.run();
+ currentViewer.setSelection(new StructuredSelection(
+ collection.toArray()), true);
}
}