Added a toolbar to the Capra Selection View

A toolbar has been added that offers buttons for trace creation and for
clearing the selection. This patch also cleans up the plugin.xml file
significantly and introduces consistent naming conventions for all
commands, views, etc. A category for commands has been added as well to
make it easier to assign keys to the different Eclipse Capra commands.

Change-Id: Ie96ead24584da2afce17148d46dbdff1cce35e5a
diff --git a/bundles/org.eclipse.capra.ui.plantuml/plugin.xml b/bundles/org.eclipse.capra.ui.plantuml/plugin.xml
index 1a783a9..02b978e 100644
--- a/bundles/org.eclipse.capra.ui.plantuml/plugin.xml
+++ b/bundles/org.eclipse.capra.ui.plantuml/plugin.xml
@@ -24,7 +24,7 @@
    <extension
          point="org.eclipse.ui.views">
       <view
-            category="org.eclipse.capra.generic.views"
+            category="org.eclipse.capra.ui.views"
             class="org.eclipse.capra.ui.plantuml.views.CapraPlantUmlView"
             icon="platform:/plugin/org.eclipse.capra.ui/icons/capra.png"
             id="org.eclipse.capra.ui.plantuml.views.CapraPlantUmlView"
@@ -131,7 +131,7 @@
                minimized="false"
                ratio="0.25"
                relationship="right"
-               relative="org.eclipse.capra.generic.views.SelectionView">
+               relative="org.eclipse.capra.ui.views.SelectionView">
          </view>
       </perspectiveExtension>
    </extension>
diff --git a/bundles/org.eclipse.capra.ui/OSGI-INF/l10n/bundle.properties b/bundles/org.eclipse.capra.ui/OSGI-INF/l10n/bundle.properties
index 0041d37..a504e8c 100644
--- a/bundles/org.eclipse.capra.ui/OSGI-INF/l10n/bundle.properties
+++ b/bundles/org.eclipse.capra.ui/OSGI-INF/l10n/bundle.properties
@@ -12,19 +12,20 @@
 #      Chalmers | University of Gothenburg - additional features, updated API
 ###############################################################################
 #Properties file for org.eclipse.capra.ui
-command.name = Create Trace
-command.label = Create Trace
-command.tooltip = Gives you a list of available trace types
-command.mnemonic = S
-command.name.0 = Remove from Selection
-command.label.0 = Remove from Selection
-command.tooltip.0 = Remove the selected item from the current selection
-command.name.1 = Clear Selection
-command.label.1 = Clear Selection
-command.tooltip.1 = Clears the current selection of elements
-command.name.2 = Add to Selection
-command.label.2 = Add to Selection
-command.tooltip.2 = Add selected item(s) to selection view
+command.createtrace.name = Create Trace
+command.createtrace.label = Create Trace
+command.createtrace.tooltip = Gives you a list of available trace types
+command.createtrace.mnemonic = C
+command.removefromselection.name = Remove from Selection
+command.removefromselection.label = Remove from Selection
+command.removefromselection.tooltip = Remove the selected item from the current selection
+command.clearselection.name = Clear Selection
+command.clearselection.label = Clear Selection
+command.clearselection.tooltip = Clears the current selection of elements
+command.addtoselection.name = Add to Selection
+command.addtoselection.label = Add to Selection
+command.addtoselection.tooltip = Add selected item(s) to selection view
+command.category = Capra Traceability
 view.name = Trace Creation
 extension-point.name = Transfers
 Bundle-Vendor = Capra Development Team
diff --git a/bundles/org.eclipse.capra.ui/plugin.xml b/bundles/org.eclipse.capra.ui/plugin.xml
index 5e3a1a4..cff3b48 100644
--- a/bundles/org.eclipse.capra.ui/plugin.xml
+++ b/bundles/org.eclipse.capra.ui/plugin.xml
@@ -19,46 +19,55 @@
    <extension
          point="org.eclipse.ui.commands">
       <command
-            id="org.eclipse.capra.generic.tracecreation.commands.createTrace"
-            name="%command.name">
+            categoryId="org.eclipse.capra.ui.commands.category"
+            id="org.eclipse.capra.ui.commands.createTrace"
+            name="%command.createtrace.name">
       </command>
       <command
+            categoryId="org.eclipse.capra.ui.commands.category"
             helpContextId="Remove currently selected item from the  list of selection"
-            id="org.eclipse.capra.generic.tracecreation.commands.removefromselection"
-            name="%command.name.0">
+            id="org.eclipse.capra.ui.commands.removefromselection"
+            name="%command.removefromselection.name">
       </command>
       <command
-            id="org.eclipse.capra.generic.tracecreation.clearselection"
-            name="%command.name.1">
+            categoryId="org.eclipse.capra.ui.commands.category"
+            id="org.eclipse.capra.ui.commands.clearselection"
+            name="%command.clearselection.name">
       </command>
       <command
-            id="org.eclipse.capra.generic.addtoselection"
-            name="%command.name.2">
+            categoryId="org.eclipse.capra.ui.commands.category"
+            id="org.eclipse.capra.ui.addtoselection"
+            name="%command.addtoselection.name">
       </command>
+      <category
+            id="org.eclipse.capra.ui.commands.category"
+            name="%command.category">
+      </category>
    </extension>
    <extension
          point="org.eclipse.ui.handlers">
       <handler
             class="org.eclipse.capra.ui.handlers.TraceCreationHandler"
-            commandId="org.eclipse.capra.generic.tracecreation.commands.createTrace">
+            commandId="org.eclipse.capra.ui.commands.createTrace">
+         <enabledWhen></enabledWhen>
       </handler>
       <handler
             class="org.eclipse.capra.ui.handlers.selection.RemoveSelectionHandler"
-            commandId="org.eclipse.capra.generic.tracecreation.commands.removefromselection">
+            commandId="org.eclipse.capra.ui.commands.removefromselection">
       </handler>
       <handler
             class="org.eclipse.capra.ui.handlers.selection.ClearSelectionHandler"
-            commandId="org.eclipse.capra.generic.tracecreation.clearselection">
+            commandId="org.eclipse.capra.ui.commands.clearselection">
       </handler>
       <handler
             class="org.eclipse.capra.ui.handlers.selection.AddtoSelection"
-            commandId="org.eclipse.capra.generic.addtoselection">
+            commandId="org.eclipse.capra.ui.addtoselection">
       </handler>
    </extension>
    <extension
          point="org.eclipse.ui.menus">
       <menuContribution
-            locationURI="popup:org.eclipse.capra.generic.views.SelectionView?after=additions">
+            locationURI="popup:org.eclipse.capra.ui.views.SelectionView?after=additions">
          <separator
                name="org.eclipse.capra.tracecreation.separator2"
                visible="true">
@@ -66,21 +75,21 @@
          <command
                commandId="org.eclipse.capra.generic.tracecreation.commands.createTrace"
                id="org.eclipse.capra.tracecreation.menus.createTrace"
-               label="%command.label"
-               mnemonic="%command.mnemonic"
-               tooltip="%command.tooltip">
+               label="%command.createtrace.label"
+               mnemonic="%command.createtrace.mnemonic"
+               tooltip="%command.createtrace.tooltip">
          </command>
          <command
                commandId="org.eclipse.capra.generic.tracecreation.commands.removefromselection"
-               label="%command.label.0"
+               label="%command.removefromselection.label"
                style="push"
-               tooltip="%command.tooltip.0">
+               tooltip="%command.removefromselection.tooltip">
          </command>
          <command
                commandId="org.eclipse.capra.generic.tracecreation.clearselection"
-               label="%command.label.1"
+               label="%command.clearselection.label"
                style="push"
-               tooltip="%command.tooltip.1">
+               tooltip="%command.clearselection.tooltip">
          </command>
          <separator
                name="org.eclipse.capra.generic.tracecreation.separator1"
@@ -98,27 +107,47 @@
                id="org.eclipse.capra.ui.contextsubmenu">
             <command
                   commandId="org.eclipse.capra.generic.addtoselection"
-                  label="%command.label.2"
+                  label="%command.addtoselection.label"
                   style="push"
-                  tooltip="%command.tooltip.2">
+                  tooltip="%command.addtoselection.tooltip">
             </command>
          </menu>
          <separator
                name="org.eclipse.capra.generic.separator1">
          </separator>
       </menuContribution>
+      <menuContribution
+            allPopups="false"
+            locationURI="toolbar:org.eclipse.capra.ui.views.SelectionView">
+         <command
+               commandId="org.eclipse.capra.ui.commands.createTrace"
+               disabledIcon="platform:/plugin/org.eclipse.pde.ui/icons/dlcl16/add_att.png"
+               icon="platform:/plugin/org.eclipse.ui/icons/full/obj16/add_obj.png"
+               label="%command.createtrace.name"
+               mnemonic="%command.createtrace.mnemonic"
+               style="push"
+               tooltip="%command.createtrace.tooltip">
+         </command>
+         <command
+               commandId="org.eclipse.capra.ui.commands.clearselection"
+               icon="platform:/plugin/org.eclipse.ui/icons/full/etool16/clear.png"
+               label="%command.clearselection.name"
+               style="push"
+               tooltip="%command.clearselection.tooltip">
+         </command>
+      </menuContribution>
    </extension>
    <extension
          point="org.eclipse.ui.views">
       <category
-            id="org.eclipse.capra.generic.views"
+            id="org.eclipse.capra.ui.views"
             name="%category.name">
       </category>
       <view
-            category="org.eclipse.capra.generic.views"
+            category="org.eclipse.capra.ui.views"
             class="org.eclipse.capra.ui.views.SelectionView"
             icon="icons/selectionView.png"
-            id="org.eclipse.capra.generic.views.SelectionView"
+            id="org.eclipse.capra.ui.views.SelectionView"
             name="%view.name">
       </view>
    </extension>
@@ -142,9 +171,9 @@
    <extension
          point="org.eclipse.ui.bindings">
       <key
-            commandId="org.eclipse.capra.generic.tracecreation.commands.createTrace"
+            commandId="org.eclipse.capra.ui.commands.createTrace"
             schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
-            sequence="M2+1">
+            sequence="%command.createtrace.mnemonic">
       </key>
    </extension>
    <extension
@@ -154,7 +183,7 @@
   			replace="BS"
   			platforms="cocoa"/>
       <key
-            commandId="org.eclipse.capra.generic.tracecreation.commands.removefromselection"
+            commandId="org.eclipse.capra.ui.commands.removefromselection"
             schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
             sequence="DEL">
       </key>
@@ -166,7 +195,7 @@
   			replace="M2+BS"
   			platforms="cocoa"/>
          <key
-            commandId="org.eclipse.capra.generic.tracecreation.clearselection"
+            commandId="org.eclipse.capra.ui.commands.clearselection"
             schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
             sequence="M2+DEL">
       </key> 
diff --git a/bundles/org.eclipse.capra.ui/src/org/eclipse/capra/ui/perspective/CapraPerspective.java b/bundles/org.eclipse.capra.ui/src/org/eclipse/capra/ui/perspective/CapraPerspective.java
index 2ca8377..1c292d9 100644
--- a/bundles/org.eclipse.capra.ui/src/org/eclipse/capra/ui/perspective/CapraPerspective.java
+++ b/bundles/org.eclipse.capra.ui/src/org/eclipse/capra/ui/perspective/CapraPerspective.java
@@ -24,21 +24,23 @@
  */
 public class CapraPerspective implements IPerspectiveFactory {
 
-	private IPageLayout factory;
+	private IPageLayout layout;
 
-	public void createInitialLayout(IPageLayout factory) {
-		this.factory = factory;
+	@Override
+	public void createInitialLayout(IPageLayout layout) {
+		this.layout = layout;
 		addViews();
 	}
 
 	private void addViews() {
-		IFolderLayout bottom = factory.createFolder("bottomRight", IPageLayout.BOTTOM, 0.6f, factory.getEditorArea());
+		IFolderLayout bottom = layout.createFolder("bottomRight", IPageLayout.BOTTOM, 0.6f, layout.getEditorArea());
 		bottom.addView(SelectionView.ID);
 
-		IFolderLayout topLeft = factory.createFolder("topLeft", IPageLayout.LEFT, 0.25f, factory.getEditorArea());
+		IFolderLayout topLeft = layout.createFolder("topLeft", IPageLayout.LEFT, 0.25f, layout.getEditorArea());
 		topLeft.addView(IPageLayout.ID_PROJECT_EXPLORER);
 
-		IFolderLayout topRight = factory.createFolder("topRight", IPageLayout.RIGHT, 0.75f, factory.getEditorArea());
+		IFolderLayout topRight = layout.createFolder("topRight", IPageLayout.RIGHT, 0.75f, layout.getEditorArea());
 		topRight.addView(IPageLayout.ID_OUTLINE);
 	}
+
 }
diff --git a/bundles/org.eclipse.capra.ui/src/org/eclipse/capra/ui/views/SelectionView.java b/bundles/org.eclipse.capra.ui/src/org/eclipse/capra/ui/views/SelectionView.java
index 8412102..9048fde 100644
--- a/bundles/org.eclipse.capra.ui/src/org/eclipse/capra/ui/views/SelectionView.java
+++ b/bundles/org.eclipse.capra.ui/src/org/eclipse/capra/ui/views/SelectionView.java
@@ -72,7 +72,7 @@
 public class SelectionView extends ViewPart {
 
 	/** The ID of the view as specified by the extension. */
-	public static final String ID = "org.eclipse.capra.generic.views.SelectionView";
+	public static final String ID = "org.eclipse.capra.ui.views.SelectionView";
 
 	/**
 	 * Identifier of the extension point that contains the transfer definitions.