Skip to content

Commit

Permalink
511215: Make Favorites a central element
Browse files Browse the repository at this point in the history
"Deselct all" action

Bug: 511215
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=511215
  • Loading branch information
creckord committed Apr 6, 2017
1 parent 194d4bd commit 62151f9
Showing 1 changed file with 22 additions and 0 deletions.
Expand Up @@ -156,6 +156,8 @@ private static void registerSearchControlIcons() {

private ActionLink selectionLink;

private ActionLink deselectLink;

private TabFolder tabFolder;

private TabItem searchTabItem;
Expand Down Expand Up @@ -691,20 +693,34 @@ private void updateSelectionLink() {
if (selectionLink != null) {
removeActionLink(selectionLink);
selectionLink = null;
removeActionLink(deselectLink);
deselectLink = null;
}
} else {
ActionLink newSelectionLink = createSelectionLink(text);
if (selectionLink != null) {
updateActionLink(selectionLink, newSelectionLink);
} else {
addActionLink(0, newSelectionLink);
deselectLink = createDeselectionLink();
addActionLink(1, deselectLink);
}
selectionLink = newSelectionLink;
}
}
}
}

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) {

Expand All @@ -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();
Expand Down

0 comments on commit 62151f9

Please sign in to comment.