summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkwilk2011-07-10 19:11:24 (EDT)
committerRyan D. Brooks2011-07-10 19:11:24 (EDT)
commit2cf4bbad2f769d6b24c512439b5a6d5a43bf205c (patch)
treed9fc2f8b88658f4410e196c75586e277f73de985
parent30a05b3b7560a2653294a35128138754b4ea0f0f (diff)
downloadorg.eclipse.osee-2cf4bbad2f769d6b24c512439b5a6d5a43bf205c.zip
org.eclipse.osee-2cf4bbad2f769d6b24c512439b5a6d5a43bf205c.tar.gz
org.eclipse.osee-2cf4bbad2f769d6b24c512439b5a6d5a43bf205c.tar.bz2
refactor: Performance improvements to ATS classes
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/util/AtsXWidgetsExampleBlamTest.java21
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeStatus.java6
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java11
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamContributionManager.java30
4 files changed, 25 insertions, 43 deletions
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/util/AtsXWidgetsExampleBlamTest.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/util/AtsXWidgetsExampleBlamTest.java
index 5aaa212..f84b303 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/util/AtsXWidgetsExampleBlamTest.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/util/AtsXWidgetsExampleBlamTest.java
@@ -10,9 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.ats.util;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
+import java.util.Map;
import org.eclipse.osee.framework.logging.SevereLoggingMonitor;
import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItem;
@@ -40,16 +38,13 @@ public class AtsXWidgetsExampleBlamTest {
SevereLoggingMonitor monitorLog = TestUtil.severeLoggingStart();
XNavigateItemBlam item = null;
- Collection<AbstractBlam> blams = BlamContributionManager.getBlamOperations();
- List<String> namesIveSeenSoFar = new ArrayList<String>(blams.size());
- boolean foundBlam = false;
- for (AbstractBlam blam : blams) {
- namesIveSeenSoFar.add(blam.getName());
- if (blam.getName().equals(NAME_OF_ATS_ITEM)) {
- item = new XNavigateItemBlam(new XNavigateItem(null, "Blam Operations", FrameworkImage.BLAM), blam);
- foundBlam = true;
- break;
- }
+ Map<String, AbstractBlam> blams = BlamContributionManager.getBlamMap();
+
+ boolean foundBlam = blams.containsKey(NAME_OF_ATS_ITEM);
+ if (foundBlam) {
+ item =
+ new XNavigateItemBlam(new XNavigateItem(null, "Blam Operations", FrameworkImage.BLAM),
+ blams.get(NAME_OF_ATS_ITEM));
}
Assert.assertTrue(String.format("%s not found from list of provided Blams.", NAME_OF_ATS_ITEM), foundBlam);
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeStatus.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeStatus.java
index 5aac8ed..9a5c4e4 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeStatus.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeStatus.java
@@ -57,9 +57,8 @@ public class SMAPromptChangeStatus {
"Can not status a cancelled " + awa.getArtifactTypeName() + ".\n\nTransition out of cancelled first.";
return new Result(error);
}
- }
- // If task status is being changed, make sure tasks belong to current state
- for (AbstractWorkflowArtifact awa : awas) {
+
+ // If task status is being changed, make sure tasks belong to current state
if (awa.isOfType(AtsArtifactTypes.Task)) {
TaskArtifact taskArt = (TaskArtifact) awa;
if (!taskArt.isRelatedToParentWorkflowCurrentState()) {
@@ -75,6 +74,7 @@ public class SMAPromptChangeStatus {
taskArt.getParentAWA().getStateMgr().getCurrentStateName()));
}
}
+
}
return Result.TrueResult;
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java
index ba12736..cc50199 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java
@@ -13,10 +13,10 @@ package org.eclipse.osee.ats.navigate;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.TreeMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Level;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -310,7 +310,7 @@ public final class AtsNavigateViewItems implements XNavigateViewItems, IXNavigat
return;
}
IExtension[] extensions = point.getExtensions();
- Map<String, XNavigateItem> nameToNavItem = new HashMap<String, XNavigateItem>();
+ Map<String, XNavigateItem> nameToNavItem = new TreeMap<String, XNavigateItem>();
for (IExtension extension : extensions) {
IConfigurationElement[] elements = extension.getConfigurationElements();
String classname = null;
@@ -334,12 +334,7 @@ public final class AtsNavigateViewItems implements XNavigateViewItems, IXNavigat
}
}
}
- // Put in alpha order
- String[] names = nameToNavItem.keySet().toArray(new String[nameToNavItem.size()]);
- Arrays.sort(names);
- for (String name : names) {
- items.add(nameToNavItem.get(name));
- }
+ items.addAll(nameToNavItem.values());
}
private static final class MultipleHridSearchOperationFactory implements IOperationFactory {
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamContributionManager.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamContributionManager.java
index 320046e..01ffd12 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamContributionManager.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/BlamContributionManager.java
@@ -11,12 +11,11 @@
package org.eclipse.osee.framework.ui.skynet.blam;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.TreeMap;
import java.util.logging.Level;
import org.eclipse.osee.framework.access.AccessControlManager;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
@@ -34,20 +33,10 @@ import org.eclipse.osee.framework.ui.skynet.widgets.xnavigate.XNavigateItemBlam;
*/
public class BlamContributionManager implements IXNavigateCommonItem {
- private static Collection<AbstractBlam> blams;
+ private static TreeMap<String, AbstractBlam> blams;
- public static Collection<AbstractBlam> getBlamOperationsNameSort() {
- ArrayList<AbstractBlam> blamsSortedByName = new ArrayList<AbstractBlam>();
- Map<String, AbstractBlam> blamMap = new HashMap<String, AbstractBlam>();
- for (AbstractBlam blam : getBlamOperations()) {
- blamMap.put(blam.getName(), blam);
- }
- String names[] = blamMap.keySet().toArray(new String[blamMap.keySet().size()]);
- Arrays.sort(names);
- for (String name : names) {
- blamsSortedByName.add(blamMap.get(name));
- }
- return blamsSortedByName;
+ public static Map<String, AbstractBlam> getBlamMap() {
+ return blams;
}
public static Collection<AbstractBlam> getBlamOperations() {
@@ -55,9 +44,12 @@ public class BlamContributionManager implements IXNavigateCommonItem {
ExtensionDefinedObjects<AbstractBlam> definedObjects =
new ExtensionDefinedObjects<AbstractBlam>("org.eclipse.osee.framework.ui.skynet.BlamOperation",
"Operation", "className");
- blams = definedObjects.getObjects();
+ blams = new TreeMap<String, AbstractBlam>();
+ for (AbstractBlam blam : definedObjects.getObjects()) {
+ blams.put(blam.getName(), blam);
+ }
}
- return blams;
+ return blams.values();
}
private static void createCategories(String[] categoryElements, int index, XNavigateItem parentItem, Map<String, XNavigateItem> nameToParent) throws OseeCoreException {
@@ -93,7 +85,7 @@ public class BlamContributionManager implements IXNavigateCommonItem {
public void createCommonSection(List<XNavigateItem> items, List<String> excludeSectionIds) {
Map<String, XNavigateItem> nameToParent = new HashMap<String, XNavigateItem>();
XNavigateItem blamOperationItems = new XNavigateItem(null, "Blam Operations", FrameworkImage.BLAM);
- for (AbstractBlam blamOperation : BlamContributionManager.getBlamOperationsNameSort()) {
+ for (AbstractBlam blamOperation : BlamContributionManager.getBlamOperations()) {
// Create categories first (so can have them up top)
for (String category : blamOperation.getCategories()) {
@@ -107,7 +99,7 @@ public class BlamContributionManager implements IXNavigateCommonItem {
}
}
// Add blams to categories
- for (AbstractBlam blamOperation : BlamContributionManager.getBlamOperationsNameSort()) {
+ for (AbstractBlam blamOperation : BlamContributionManager.getBlamOperations()) {
// If categories not specified, add to top level
if (blamOperation.getCategories().isEmpty()) {
new XNavigateItemBlam(blamOperationItems, blamOperation);