Skip to content

Commit

Permalink
Bug 568466 - Remove Activator from MPC UI
Browse files Browse the repository at this point in the history
Start off the removals by refactoring the names of the icons into the
MarketplaceClientUiResources, which is where they are mostly referenced
from and defined in any case.

Change-Id: I52c1974bb65c0aa2e286c89a373e122fcb0e1f74
Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
  • Loading branch information
alblue authored and l3-g5 committed Nov 5, 2020
1 parent 41cd18a commit 446fce5
Show file tree
Hide file tree
Showing 18 changed files with 113 additions and 127 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010, 2019 The Eclipse Foundation and others.
* Copyright (c) 2010, 2020 The Eclipse Foundation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -29,65 +29,6 @@
*/
public class MarketplaceClientUiPlugin implements BundleActivator {

/**
* image registry key
*/
public static final String IU_ICON_UPDATE = "IU_ICON_UPDATE"; //$NON-NLS-1$

/**
* image registry key
*/
public static final String IU_ICON_INSTALL = "IU_ICON_INSTALL"; //$NON-NLS-1$

/**
* image registry key
*/
public static final String IU_ICON_UNINSTALL = "IU_ICON_UNINSTALL"; //$NON-NLS-1$

/**
* image registry key
*/
public static final String IU_ICON_DISABLED = "IU_ICON_DISABLED"; //$NON-NLS-1$

/**
* image registry key
*/
public static final String IU_ICON = "IU_ICON"; //$NON-NLS-1$

/**
* image registry key
*/
public static final String IU_ICON_ERROR = "IU_ICON_ERROR"; //$NON-NLS-1$

/**
* image registry key
*/
public static final String NEWS_ICON_UPDATE = "NEWS_ICON_UPDATE"; //$NON-NLS-1$

/**
* image registry key
*/
public static final String NO_ICON_PROVIDED = "NO_ICON_PROVIDED"; //$NON-NLS-1$

public static final String NO_ICON_PROVIDED_CATALOG = "NO_ICON_PROVIDED_CATALOG"; //$NON-NLS-1$

public static final String DEFAULT_MARKETPLACE_ICON = "DEFAULT_MARKETPLACE_ICON"; //$NON-NLS-1$

public static final String ACTION_ICON_FAVORITES = "ACTION_ICON_FAVORITES"; //$NON-NLS-1$

public static final String ACTION_ICON_LOGIN = "ACTION_ICON_LOGIN"; //$NON-NLS-1$

public static final String ACTION_ICON_WARNING = "ACTION_ICON_WARNING"; //$NON-NLS-1$

public static final String ACTION_ICON_UPDATE = "ACTION_ICON_UPDATE"; //$NON-NLS-1$

public static final String FAVORITES_LIST_ICON = "FAVORITES_LIST_ICON"; //$NON-NLS-1$

public static final String ITEM_ICON_STAR = "ITEM_ICON_STAR"; //$NON-NLS-1$

public static final String ITEM_ICON_STAR_SELECTED = "ITEM_ICON_STAR_SELECTED"; //$NON-NLS-1$

public static final String ITEM_ICON_SHARE = "ITEM_ICON_SHARE"; //$NON-NLS-1$

public static final String DEBUG_OPTION = "/debug"; //$NON-NLS-1$

Expand All @@ -110,13 +51,6 @@ public void stop(BundleContext context) throws Exception {
debugTrace = null;
}

public static void trace(String option, String message) {
final DebugTrace trace = debugTrace;
if (DEBUG && trace != null) {
trace.trace(option, message);
}
}

public static void trace(String option, String message, Object... parameters) {
final DebugTrace trace = debugTrace;
if (DEBUG && trace != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,66 @@
@Component(name = "org.eclipse.epp.mpc.ui.resources", service = { MarketplaceClientUiResources.class })
public class MarketplaceClientUiResources {

/**
* image registry key
*/
public static final String IU_ICON_UPDATE = "IU_ICON_UPDATE"; //$NON-NLS-1$

/**
* image registry key
*/
public static final String IU_ICON_INSTALL = "IU_ICON_INSTALL"; //$NON-NLS-1$

/**
* image registry key
*/
public static final String IU_ICON_UNINSTALL = "IU_ICON_UNINSTALL"; //$NON-NLS-1$

/**
* image registry key
*/
public static final String IU_ICON_DISABLED = "IU_ICON_DISABLED"; //$NON-NLS-1$

/**
* image registry key
*/
public static final String IU_ICON = "IU_ICON"; //$NON-NLS-1$

/**
* image registry key
*/
public static final String IU_ICON_ERROR = "IU_ICON_ERROR"; //$NON-NLS-1$

/**
* image registry key
*/
public static final String NEWS_ICON_UPDATE = "NEWS_ICON_UPDATE"; //$NON-NLS-1$

/**
* image registry key
*/
public static final String NO_ICON_PROVIDED = "NO_ICON_PROVIDED"; //$NON-NLS-1$

public static final String NO_ICON_PROVIDED_CATALOG = "NO_ICON_PROVIDED_CATALOG"; //$NON-NLS-1$

public static final String DEFAULT_MARKETPLACE_ICON = "DEFAULT_MARKETPLACE_ICON"; //$NON-NLS-1$

public static final String ACTION_ICON_FAVORITES = "ACTION_ICON_FAVORITES"; //$NON-NLS-1$

public static final String ACTION_ICON_LOGIN = "ACTION_ICON_LOGIN"; //$NON-NLS-1$

public static final String ACTION_ICON_WARNING = "ACTION_ICON_WARNING"; //$NON-NLS-1$

public static final String ACTION_ICON_UPDATE = "ACTION_ICON_UPDATE"; //$NON-NLS-1$

public static final String FAVORITES_LIST_ICON = "FAVORITES_LIST_ICON"; //$NON-NLS-1$

public static final String ITEM_ICON_STAR = "ITEM_ICON_STAR"; //$NON-NLS-1$

public static final String ITEM_ICON_STAR_SELECTED = "ITEM_ICON_STAR_SELECTED"; //$NON-NLS-1$

public static final String ITEM_ICON_SHARE = "ITEM_ICON_SHARE"; //$NON-NLS-1$

private static MarketplaceClientUiResources instance;

private ResourceProvider resourceProvider;
Expand Down Expand Up @@ -95,50 +155,50 @@ public IDialogSettings getDialogSettings() {

protected void initializeImageRegistry(ImageRegistry imageRegistry) {

imageRegistry.put(MarketplaceClientUiPlugin.NO_ICON_PROVIDED,
imageRegistry.put(NO_ICON_PROVIDED,
imageDescriptorFromBundle(MarketplaceClientUiResources.class, "icons/noiconprovided.png") //$NON-NLS-1$
.get());
imageRegistry.put(MarketplaceClientUiPlugin.NO_ICON_PROVIDED_CATALOG,
imageRegistry.put(NO_ICON_PROVIDED_CATALOG,
imageDescriptorFromBundle(MarketplaceClientUiResources.class, "icons/noiconprovided32.png").get()); //$NON-NLS-1$
imageRegistry.put(MarketplaceClientUiPlugin.DEFAULT_MARKETPLACE_ICON,
imageRegistry.put(DEFAULT_MARKETPLACE_ICON,
imageDescriptorFromBundle(MarketplaceClientUiResources.class, "icons/marketplace_banner.png").get()); //$NON-NLS-1$
imageRegistry.put(MarketplaceClientUiPlugin.IU_ICON,
imageRegistry.put(IU_ICON,
imageDescriptorFromBundle(MarketplaceClientUiResources.class, "icons/iu_obj.png").get()); //$NON-NLS-1$
imageRegistry.put(MarketplaceClientUiPlugin.IU_ICON_UPDATE,
imageRegistry.put(IU_ICON_UPDATE,
imageDescriptorFromBundle(MarketplaceClientUiResources.class, "icons/iu_update_obj.png").get()); //$NON-NLS-1$
imageRegistry.put(MarketplaceClientUiPlugin.IU_ICON_INSTALL,
imageRegistry.put(IU_ICON_INSTALL,
imageDescriptorFromBundle(MarketplaceClientUiResources.class, "icons/iu_install_obj.png").get()); //$NON-NLS-1$
imageRegistry.put(MarketplaceClientUiPlugin.IU_ICON_UNINSTALL,
imageRegistry.put(IU_ICON_UNINSTALL,
imageDescriptorFromBundle(MarketplaceClientUiResources.class, "icons/iu_uninstall_obj.png").get()); //$NON-NLS-1$
imageRegistry.put(MarketplaceClientUiPlugin.IU_ICON_DISABLED,
imageRegistry.put(IU_ICON_DISABLED,
imageDescriptorFromBundle(MarketplaceClientUiResources.class, "icons/iu_disabled_obj.png").get()); //$NON-NLS-1$
{
ImageDescriptor errorOverlay = PlatformUI.getWorkbench()
.getSharedImages()
.getImageDescriptor(ISharedImages.IMG_DEC_FIELD_ERROR);
Image iuImage = imageRegistry.get(MarketplaceClientUiPlugin.IU_ICON);
Image iuImage = imageRegistry.get(IU_ICON);
DecorationOverlayIcon iuErrorIcon = new DecorationOverlayIcon(iuImage, errorOverlay,
IDecoration.BOTTOM_RIGHT);
imageRegistry.put(MarketplaceClientUiPlugin.IU_ICON_ERROR, iuErrorIcon);
imageRegistry.put(IU_ICON_ERROR, iuErrorIcon);
}

imageRegistry.put(MarketplaceClientUiPlugin.NEWS_ICON_UPDATE,
imageRegistry.put(NEWS_ICON_UPDATE,
imageDescriptorFromBundle(MarketplaceClientUiResources.class, "icons/news_update.png").get()); //$NON-NLS-1$
imageRegistry.put(MarketplaceClientUiPlugin.ITEM_ICON_STAR,
imageRegistry.put(ITEM_ICON_STAR,
imageDescriptorFromBundle(MarketplaceClientUiResources.class, "icons/star.png").get()); //$NON-NLS-1$
imageRegistry.put(MarketplaceClientUiPlugin.ITEM_ICON_STAR_SELECTED,
imageRegistry.put(ITEM_ICON_STAR_SELECTED,
imageDescriptorFromBundle(MarketplaceClientUiResources.class, "icons/star-selected.png").get()); //$NON-NLS-1$
imageRegistry.put(MarketplaceClientUiPlugin.ITEM_ICON_SHARE,
imageRegistry.put(ITEM_ICON_SHARE,
imageDescriptorFromBundle(MarketplaceClientUiResources.class, "icons/share.png").get()); //$NON-NLS-1$
imageRegistry.put(MarketplaceClientUiPlugin.ACTION_ICON_FAVORITES,
imageRegistry.put(ACTION_ICON_FAVORITES,
imageDescriptorFromBundle(MarketplaceClientUiResources.class, "icons/action-item-favorites.png").get()); //$NON-NLS-1$
imageRegistry.put(MarketplaceClientUiPlugin.ACTION_ICON_LOGIN,
imageRegistry.put(ACTION_ICON_LOGIN,
imageDescriptorFromBundle(MarketplaceClientUiResources.class, "icons/action-item-login.png").get()); //$NON-NLS-1$
imageRegistry.put(MarketplaceClientUiPlugin.ACTION_ICON_WARNING,
imageRegistry.put(ACTION_ICON_WARNING,
imageDescriptorFromBundle(MarketplaceClientUiResources.class, "icons/action-item-warning.png").get()); //$NON-NLS-1$
imageRegistry.put(MarketplaceClientUiPlugin.ACTION_ICON_UPDATE,
imageRegistry.put(ACTION_ICON_UPDATE,
imageDescriptorFromBundle(MarketplaceClientUiResources.class, "icons/action-item-update.png").get()); //$NON-NLS-1$
imageRegistry.put(MarketplaceClientUiPlugin.FAVORITES_LIST_ICON,
imageRegistry.put(FAVORITES_LIST_ICON,
imageDescriptorFromBundle(MarketplaceClientUiResources.class, "icons/favorites-list.png").get()); //$NON-NLS-1$
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.util.List;

import org.eclipse.epp.internal.mpc.core.util.TextUtil;
import org.eclipse.epp.internal.mpc.ui.MarketplaceClientUiPlugin;
import org.eclipse.epp.internal.mpc.ui.MarketplaceClientUiResources;
import org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceCatalogSource;
import org.eclipse.epp.internal.mpc.ui.css.StyleHelper;
Expand Down Expand Up @@ -431,7 +430,7 @@ protected void createIconControl(Composite checkboxContainer) {
}

protected String getDefaultIconResourceId() {
return MarketplaceClientUiPlugin.NO_ICON_PROVIDED;
return MarketplaceClientUiResources.NO_ICON_PROVIDED;
}

protected Icon getIcon() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.epp.internal.mpc.ui.MarketplaceClientUiPlugin;
import org.eclipse.epp.internal.mpc.ui.MarketplaceClientUiResources;
import org.eclipse.epp.internal.mpc.ui.css.StyleHelper;
import org.eclipse.epp.mpc.ui.CatalogDescriptor;
Expand Down Expand Up @@ -132,7 +131,7 @@ private Image getCatalogIcon(final CatalogDescriptor catalogDescriptor) {

private Image getDefaultCatalogImage() {
return MarketplaceClientUiResources.getInstance().getImageRegistry().get(
MarketplaceClientUiPlugin.NO_ICON_PROVIDED_CATALOG);
MarketplaceClientUiResources.NO_ICON_PROVIDED_CATALOG);
}

public void setSelected(boolean selected) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
package org.eclipse.epp.internal.mpc.ui.wizards;

import org.eclipse.epp.internal.mpc.core.util.TextUtil;
import org.eclipse.epp.internal.mpc.ui.MarketplaceClientUiPlugin;
import org.eclipse.epp.internal.mpc.ui.MarketplaceClientUiResources;
import org.eclipse.epp.mpc.ui.CatalogDescriptor;
import org.eclipse.equinox.internal.p2.ui.discovery.util.GradientToolTip;
Expand Down Expand Up @@ -89,7 +88,7 @@ private void createIcon(Composite parent) {
image = label.getImage();
if (image == null) {
ImageRegistry registry = MarketplaceClientUiResources.getInstance().getImageRegistry();
image = registry.get(MarketplaceClientUiPlugin.NO_ICON_PROVIDED_CATALOG);
image = registry.get(MarketplaceClientUiResources.NO_ICON_PROVIDED_CATALOG);
}
Label iconLabel = new Label(parent, SWT.NULL);
iconLabel.setImage(image);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*******************************************************************************/
package org.eclipse.epp.internal.mpc.ui.wizards;

import org.eclipse.epp.internal.mpc.ui.MarketplaceClientUiPlugin;
import org.eclipse.epp.internal.mpc.ui.MarketplaceClientUiResources;
import org.eclipse.epp.internal.mpc.ui.catalog.UserActionCatalogItem;
import org.eclipse.equinox.internal.p2.discovery.model.Icon;
import org.eclipse.equinox.internal.p2.ui.discovery.wizards.CatalogViewer;
Expand All @@ -37,7 +37,7 @@ protected String getNameLabelText() {

@Override
protected Icon getIcon() {
String path = REGISTRY_SCHEME + MarketplaceClientUiPlugin.ACTION_ICON_FAVORITES;
String path = REGISTRY_SCHEME + MarketplaceClientUiResources.ACTION_ICON_FAVORITES;
return createIcon(path);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.eclipse.epp.internal.mpc.core.service.AbstractDataStorageService.NotAuthorizedException;
import org.eclipse.epp.internal.mpc.core.util.URLUtil;
import org.eclipse.epp.internal.mpc.ui.MarketplaceClientUi;
import org.eclipse.epp.internal.mpc.ui.MarketplaceClientUiPlugin;
import org.eclipse.epp.internal.mpc.ui.MarketplaceClientUiResources;
import org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceCatalogSource;
import org.eclipse.epp.internal.mpc.ui.catalog.MarketplaceNodeCatalogItem;
Expand Down Expand Up @@ -326,8 +325,8 @@ private void refreshFavoriteButton() {
Object lastFavorited = favoriteButton.getData(FAVORITED_BUTTON_STATE_DATA);
if (lastFavorited == null || (favorited != Boolean.TRUE.equals(lastFavorited))) {
favoriteButton.setData(FAVORITED_BUTTON_STATE_DATA, lastFavorited);
String imageId = favorited ? MarketplaceClientUiPlugin.ITEM_ICON_STAR_SELECTED
: MarketplaceClientUiPlugin.ITEM_ICON_STAR;
String imageId = favorited ? MarketplaceClientUiResources.ITEM_ICON_STAR_SELECTED
: MarketplaceClientUiResources.ITEM_ICON_STAR;
favoriteButton.setImage(MarketplaceClientUiResources.getInstance().getImageRegistry().get(imageId));

IUserFavoritesService userFavoritesService = getUserFavoritesService();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*******************************************************************************/
package org.eclipse.epp.internal.mpc.ui.wizards;

import org.eclipse.epp.internal.mpc.ui.MarketplaceClientUiPlugin;
import org.eclipse.epp.internal.mpc.ui.MarketplaceClientUiResources;
import org.eclipse.epp.internal.mpc.ui.catalog.FavoriteListCatalogItem;
import org.eclipse.equinox.internal.p2.discovery.model.Icon;
import org.eclipse.equinox.internal.p2.ui.discovery.util.WorkbenchUtil;
Expand All @@ -26,7 +26,7 @@

public class FavoriteListDiscoveryItem extends AbstractSimpleDiscoveryItem<FavoriteListCatalogItem> {
private static final Icon DEFAULT_LIST_ICON = createIcon(
REGISTRY_SCHEME + MarketplaceClientUiPlugin.FAVORITES_LIST_ICON);
REGISTRY_SCHEME + MarketplaceClientUiResources.FAVORITES_LIST_ICON);

public FavoriteListDiscoveryItem(Composite parent, MarketplaceDiscoveryResources resources,
FavoriteListCatalogItem connector, FavoritesViewer viewer) {
Expand Down Expand Up @@ -59,7 +59,7 @@ protected Icon getIcon() {

@Override
protected String getDefaultIconResourceId() {
return MarketplaceClientUiPlugin.FAVORITES_LIST_ICON;
return MarketplaceClientUiResources.FAVORITES_LIST_ICON;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.epp.internal.mpc.core.MarketplaceClientCore;
import org.eclipse.epp.internal.mpc.ui.MarketplaceClientUi;
import org.eclipse.epp.internal.mpc.ui.MarketplaceClientUiPlugin;
import org.eclipse.epp.internal.mpc.ui.MarketplaceClientUiResources;
import org.eclipse.epp.internal.mpc.ui.operations.FeatureDescriptor;
import org.eclipse.epp.internal.mpc.ui.operations.ResolveFeatureNamesOperation;
Expand Down Expand Up @@ -115,23 +114,23 @@ public Image getImage(Object element) {
switch (entry.computeChangeOperation()) {
case UPDATE:
return MarketplaceClientUiResources.getInstance().getImageRegistry()
.get(MarketplaceClientUiPlugin.IU_ICON_UPDATE);
.get(MarketplaceClientUiResources.IU_ICON_UPDATE);
case INSTALL:
return MarketplaceClientUiResources.getInstance().getImageRegistry()
.get(MarketplaceClientUiPlugin.IU_ICON_INSTALL);
.get(MarketplaceClientUiResources.IU_ICON_INSTALL);
case UNINSTALL:
return MarketplaceClientUiResources.getInstance().getImageRegistry()
.get(MarketplaceClientUiPlugin.IU_ICON_UNINSTALL);
.get(MarketplaceClientUiResources.IU_ICON_UNINSTALL);
case NONE:
return MarketplaceClientUiResources.getInstance().getImageRegistry()
.get(MarketplaceClientUiPlugin.IU_ICON_DISABLED);
.get(MarketplaceClientUiResources.IU_ICON_DISABLED);
default:
return MarketplaceClientUiResources.getInstance().getImageRegistry()
.get(MarketplaceClientUiPlugin.IU_ICON);
.get(MarketplaceClientUiResources.IU_ICON);
}
} else if (element instanceof CatalogItemEntry) {
return MarketplaceClientUiResources.getInstance().getImageRegistry()
.get(MarketplaceClientUiPlugin.IU_ICON);
.get(MarketplaceClientUiResources.IU_ICON);
}
return null;
}
Expand Down Expand Up @@ -472,7 +471,7 @@ void updateMessage() {
if (profileChangeOperation instanceof RemediationOperation
&& (((RemediationOperation) profileChangeOperation).getResolutionResult() == Status.OK_STATUS)
&& (getWizard().getAdditionalVerificationPlan() == null
|| getWizard().getAdditionalVerificationPlan().getStatus().isOK())) {
|| getWizard().getAdditionalVerificationPlan().getStatus().isOK())) {
if (remediationGroup == null) {
remediationGroup = new RemediationGroup(this);
remediationGroup.createRemediationControl(container);
Expand Down
Loading

0 comments on commit 446fce5

Please sign in to comment.