From 62151f9b0c545c6af329e4fab6a476a91a50d72a Mon Sep 17 00:00:00 2001 From: Carsten Reckord Date: Thu, 6 Apr 2017 17:23:11 +0200 Subject: [PATCH] 511215: Make Favorites a central element "Deselct all" action Bug: 511215 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=511215 --- .../mpc/ui/wizards/MarketplacePage.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplacePage.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplacePage.java index 8e85098f..43db091f 100644 --- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplacePage.java +++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/wizards/MarketplacePage.java @@ -156,6 +156,8 @@ private static void registerSearchControlIcons() { private ActionLink selectionLink; + private ActionLink deselectLink; + private TabFolder tabFolder; private TabItem searchTabItem; @@ -691,6 +693,8 @@ private void updateSelectionLink() { if (selectionLink != null) { removeActionLink(selectionLink); selectionLink = null; + removeActionLink(deselectLink); + deselectLink = null; } } else { ActionLink newSelectionLink = createSelectionLink(text); @@ -698,6 +702,8 @@ private void updateSelectionLink() { updateActionLink(selectionLink, newSelectionLink); } else { addActionLink(0, newSelectionLink); + deselectLink = createDeselectionLink(); + addActionLink(1, deselectLink); } selectionLink = newSelectionLink; } @@ -705,6 +711,16 @@ private void updateSelectionLink() { } } + private ActionLink createDeselectionLink() { + return new ActionLink("clearSelection", "Deselect all", "Clear selected items") { + + @Override + public void selected() { + deselectionLinkActivated(); + } + }; + } + private ActionLink createSelectionLink(String text) { return new ActionLink("showSelection", text, Messages.MarketplacePage_showSelection) { @@ -721,6 +737,12 @@ protected void selectionLinkActivated() { setActiveTab(ContentType.SELECTION); } + protected void deselectionLinkActivated() { + SelectionModel selectionModel = getWizard().getSelectionModel(); + selectionModel.clear(); + getWizard().updateSelection(); + } + @Override public IWizardPage getPreviousPage() { return super.getPreviousPage();