API consolidation for org.eclipse.objectteams.otdt.debug
- redefine the line between API and non-API
- add javadoc to API
- removed some unused stuff
Also:
- implemented clearing the TeamView when a launch terminates
- removed redundant sort mode "activation order"
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/sort_by_activationtime.gif b/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/sort_by_activationtime.gif
deleted file mode 100644
index 3d7a794..0000000
--- a/plugins/org.eclipse.objectteams.otdt.debug.ui/icons/sort_by_activationtime.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/OTDebugImages.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/OTDebugImages.java
index a04871e..c120b56 100644
--- a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/OTDebugImages.java
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/OTDebugImages.java
@@ -39,9 +39,8 @@
     public static final String TEAM_ACTIVATED           = "icons/team_act.gif";
     public static final String TEAM_IMPLICIT_ACTIVATED  = "icons/team_act_implicit.gif";
     public static final String TEAM_INACTIVATED         = "icons/team_inact.gif";
-    public static final String SORT_TEAMS_BY_ACTIVATION_TIME = "icons/sort_by_activationtime.gif";
-    public static final String SORT_TEAMS_BY_ACTIVATION_ORDER = "icons/sort_by_activation.gif";
-    public static final String SORT_TEAMS_BY_NAME = "icons/sort_by_name.gif";
+    public static final String SORT_TEAMS_BY_ACTIVATION_TIME = "icons/sort_by_activation.gif";
+    public static final String SORT_TEAMS_BY_NAME 		= "icons/sort_by_name.gif";
     public static final String SORT_TEAMS_BY_INSTANTIATION = "icons/sort_by_instantiation.gif";
     public static final String UPDATE_TEAM_VIEW_ACTION = "icons/refresh.gif";
 
@@ -58,7 +57,6 @@
         register(TEAM_IMPLICIT_ACTIVATED, bundle, registry);
         register(TEAM_INACTIVATED, bundle, registry);
         register(SORT_TEAMS_BY_ACTIVATION_TIME, bundle, registry);
-        register(SORT_TEAMS_BY_ACTIVATION_ORDER, bundle, registry);
         register(SORT_TEAMS_BY_NAME, bundle, registry);
         register(SORT_TEAMS_BY_INSTANTIATION, bundle, registry);
         register(UPDATE_TEAM_VIEW_ACTION, bundle, registry);
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/SortTeamAction.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/SortTeamAction.java
index f91a469..b988cf6 100644
--- a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/SortTeamAction.java
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/actions/SortTeamAction.java
@@ -47,20 +47,12 @@
 			setText(TeamViewMessages.SortTeamByActivation_0);
 			setImageDescriptor(OTDebugImages.get(OTDebugImages.SORT_TEAMS_BY_ACTIVATION_TIME));
 		}
-
-		if (sortMode == IOTDTDebugPreferenceConstants.TEAMS_BY_ACTIVATION_ORDER)
-		{
-			setText(TeamViewMessages.SortTeamByActivation_1);
-			setImageDescriptor(OTDebugImages.get(OTDebugImages.SORT_TEAMS_BY_ACTIVATION_ORDER));
-		}
-
-		if (sortMode == IOTDTDebugPreferenceConstants.TEAMS_BY_INSTANTIATION)
+		else if (sortMode == IOTDTDebugPreferenceConstants.TEAMS_BY_INSTANTIATION)
 		{
 			setText(TeamViewMessages.SortTeamByInstantiation_0);
 			setImageDescriptor(OTDebugImages.get(OTDebugImages.SORT_TEAMS_BY_INSTANTIATION));
 		}
-
-		if (sortMode == IOTDTDebugPreferenceConstants.TEAMS_BY_NAME)
+		else if (sortMode == IOTDTDebugPreferenceConstants.TEAMS_BY_NAME)
 		{
 			setText(TeamViewMessages.SortTeamByName_0);  
 			setImageDescriptor(OTDebugImages.get(OTDebugImages.SORT_TEAMS_BY_NAME));  
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/model/OTDefaultVariableViewModelProxy.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/model/OTDefaultVariableViewModelProxy.java
index 143057c..29f4ff8 100644
--- a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/model/OTDefaultVariableViewModelProxy.java
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/internal/model/OTDefaultVariableViewModelProxy.java
@@ -57,10 +57,6 @@
 		OTDebugPlugin.getDefault().addOTDebugEventListener(this);
 	}
 
-	public void launched(ILaunch launch) {
-		// TODO Auto-generated method stub
-	}
-
 	public void teamInstantiated(TeamInstance newTeam) 
 	{
 		int idx= container.getIndexOfTeamInstance(newTeam);
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/views/TeamView.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/views/TeamView.java
index 076ab48..5073606 100644
--- a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/views/TeamView.java
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/views/TeamView.java
@@ -87,7 +87,7 @@
 	
 	public String getDefaultSortMode()
 	{
-		return IOTDTDebugPreferenceConstants.TEAMS_BY_ACTIVATION_ORDER;
+		return IOTDTDebugPreferenceConstants.TEAMS_BY_ACTIVATION_TIME;
 	}
 
 	@Override // COPY_AND_PASTE from super, edited:
@@ -185,8 +185,21 @@
 	
 	public void launchesTerminated(ILaunch[] launches)
 	{
-		//clear TeamView
-		;
+		for (ILaunch launch : launches) {
+			if (launch.isTerminated()) {
+				OTDebugElementsContainer current = (OTDebugElementsContainer)getViewer().getInput();
+				IDebugTarget currentTarget = current.getContext().getDebugTarget();
+				if (launch.getDebugTarget() == currentTarget) { 
+					current.dispose(); // clear all previous team instances
+					getViewer().getControl().getDisplay().asyncExec(new Runnable() {
+						public void run() {
+							getViewer().setInput(null);							
+						}						
+					});
+					return;
+				}
+			}
+		}
 	}
 
 	public void launchesRemoved(ILaunch[] launches) {}
@@ -224,17 +237,15 @@
 
 	private void createSortActions(IMenuManager viewMenu)
 	{
-		final SortTeamAction sortAction1 = new SortTeamAction(this, IOTDTDebugPreferenceConstants.TEAMS_BY_ACTIVATION_ORDER);
-		final SortTeamAction sortAction2 = new SortTeamAction(this, IOTDTDebugPreferenceConstants.TEAMS_BY_ACTIVATION_TIME);
-		final SortTeamAction sortAction3 = new SortTeamAction(this, IOTDTDebugPreferenceConstants.TEAMS_BY_INSTANTIATION);
-		final SortTeamAction sortAction4 = new SortTeamAction(this, IOTDTDebugPreferenceConstants.TEAMS_BY_NAME);
+		final SortTeamAction sortAction1 = new SortTeamAction(this, IOTDTDebugPreferenceConstants.TEAMS_BY_ACTIVATION_TIME);
+		final SortTeamAction sortAction2 = new SortTeamAction(this, IOTDTDebugPreferenceConstants.TEAMS_BY_INSTANTIATION);
+		final SortTeamAction sortAction3 = new SortTeamAction(this, IOTDTDebugPreferenceConstants.TEAMS_BY_NAME);
 		
 		final MenuManager layoutSubMenu = new MenuManager(TeamViewMessages.TeamView_0);
 		layoutSubMenu.setRemoveAllWhenShown(true);
 		layoutSubMenu.add(sortAction1);
 		layoutSubMenu.add(sortAction2);
 		layoutSubMenu.add(sortAction3);
-		layoutSubMenu.add(sortAction4);
 		viewMenu.add(layoutSubMenu);
 		viewMenu.add(new Separator());
 
@@ -245,7 +256,6 @@
 				layoutSubMenu.add(sortAction1);
 				layoutSubMenu.add(sortAction2);
 				layoutSubMenu.add(sortAction3);
-				layoutSubMenu.add(sortAction4);
 			}
 		});
 	}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/views/TeamViewMessages.java b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/views/TeamViewMessages.java
index 4332777..24d0ab1 100644
--- a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/views/TeamViewMessages.java
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/views/TeamViewMessages.java
@@ -29,8 +29,6 @@
 	public static String SortTeamByName_0;

 

 	public static String SortTeamByActivation_0;

-

-	public static String SortTeamByActivation_1;

 	

 	public static String SortTeamByInstantiation_0;

 

diff --git a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/views/TeamViewMessages.properties b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/views/TeamViewMessages.properties
index 4c3538c..5f0b935 100644
--- a/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/views/TeamViewMessages.properties
+++ b/plugins/org.eclipse.objectteams.otdt.debug.ui/src/org/eclipse/objectteams/otdt/debug/ui/views/TeamViewMessages.properties
@@ -23,6 +23,5 @@
 TeamView_1=Team View Only

 SortTeamByName_0=Sort Teams by Name

 SortTeamByActivation_0=Sort Teams by Activation Time

-SortTeamByActivation_1=Sort Teams by Activation Order

 SortTeamByInstantiation_0=Sort Teams by Instantiation Time

-SortTeamDescription_0=By Default Teams are sorted by Activation Order.

+SortTeamDescription_0=By Default Teams are sorted by Activation Time.