442340: make UI legend easily discoverable (new protected method
createAdditionalControls)

Change-Id: I31cc3eba46ae63e783e5b82c07ff4002885d4da5
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=442340
diff --git a/org.eclipse.mylyn.commons.workbench/src/org/eclipse/mylyn/commons/workbench/AbstractFilteredTree.java b/org.eclipse.mylyn.commons.workbench/src/org/eclipse/mylyn/commons/workbench/AbstractFilteredTree.java
index 06f11e2..15303f0 100644
--- a/org.eclipse.mylyn.commons.workbench/src/org/eclipse/mylyn/commons/workbench/AbstractFilteredTree.java
+++ b/org.eclipse.mylyn.commons.workbench/src/org/eclipse/mylyn/commons/workbench/AbstractFilteredTree.java
@@ -32,7 +32,7 @@
 
 /**
  * A filtered tree with additional controls below the filter text field.
- * 
+ *
  * @author Mik Kersten
  * @since 3.7
  */
@@ -61,7 +61,7 @@
 
 	/**
 	 * XXX: using reflection to gain access
-	 * 
+	 *
 	 * @param parent
 	 * @param treeStyle
 	 * @param filter
@@ -73,9 +73,8 @@
 			refreshPolicy = new AdaptiveRefreshPolicy(refreshJob);
 
 		} catch (Exception e) {
-			CommonsWorkbenchPlugin.getDefault()
-					.getLog()
-					.log(new Status(IStatus.ERROR, CommonsWorkbenchPlugin.ID_PLUGIN, "Could not get refresh job", e)); //$NON-NLS-1$
+			CommonsWorkbenchPlugin.getDefault().getLog().log(
+					new Status(IStatus.ERROR, CommonsWorkbenchPlugin.ID_PLUGIN, "Could not get refresh job", e)); //$NON-NLS-1$
 		}
 		setInitialText(LABEL_FIND);
 	}
@@ -186,6 +185,14 @@
 					.applyTo(activeTaskComposite);
 		}
 
+		Composite additionalComposite = createAdditionalControls(filterComposite);
+		if (additionalComposite != null) {
+			GridDataFactory.fillDefaults()
+					.align(SWT.BEGINNING, SWT.CENTER)
+					.grab(true, false)
+					.applyTo(additionalComposite);
+		}
+
 		gridLayout.numColumns = filterComposite.getChildren().length;
 		return parent;
 	}
@@ -200,11 +207,18 @@
 		return null;
 	}
 
+	/**
+	 * @since 3.18
+	 */
+	protected Composite createAdditionalControls(Composite container) {
+		return null;
+	}
+
 	@Override
 	protected void textChanged() {
 		// this call allows the filtered tree to preserve the selection when the clear button is used.
-		// It is necessary to correctly set the private narrowingDown flag in the super class. 
-		// Note that the scheduling of the refresh job that is done in the super class will be overridden 
+		// It is necessary to correctly set the private narrowingDown flag in the super class.
+		// Note that the scheduling of the refresh job that is done in the super class will be overridden
 		// by the call to refreshPolicy.textChanged().
 		String text = getFilterString();
 		if (text == null || text.equals(previousFilterText)) {