summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault (JBoss)2013-04-04 15:20:34 (EDT)
committerPascal Rapicault2013-04-09 08:03:06 (EDT)
commit56134fa584ab0cca4ab16dd948fffe484b9e4588 (patch)
treecdc49c607e80000af966bc2414aef38023f23b7f
parentb21015a993c391bf2f6d68204b24b89e06f02511 (diff)
downloadrt.equinox.p2-56134fa584ab0cca4ab16dd948fffe484b9e4588.zip
rt.equinox.p2-56134fa584ab0cca4ab16dd948fffe484b9e4588.tar.gz
rt.equinox.p2-56134fa584ab0cca4ab16dd948fffe484b9e4588.tar.bz2
* overlay icon to show an addition, a removal, a downgrade or an upgrade * selectedRemedy were both in remediationPage and remediationOperation. Remove from the remediationPage.
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemediationOperation.java19
-rwxr-xr-xbundles/org.eclipse.equinox.p2.ui/icons/obj/added_overlay.gifbin0 -> 169 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/icons/obj/downgraded_overlay.jpgbin0 -> 11540 bytes
-rwxr-xr-xbundles/org.eclipse.equinox.p2.ui/icons/obj/removed_overlay.gifbin0 -> 176 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/icons/obj/upgraded_overlay.jpgbin0 -> 11535 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIActivator.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIImages.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/UpdateAction.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RemediationPage.java46
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java59
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProvElement.java20
12 files changed, 110 insertions, 60 deletions
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemediationOperation.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemediationOperation.java
index db3d608..56ef6f3 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemediationOperation.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RemediationOperation.java
@@ -29,7 +29,16 @@ public class RemediationOperation extends ProfileChangeOperation {
private List<Remedy> remedies;
private Remedy bestSolutionChangingTheRequest;
private Remedy bestSolutionChangingWhatIsInstalled;
- private Remedy userSelectedRemedy;
+ private Remedy currentRemedy;
+
+ public Remedy getCurrentRemedy() {
+ return currentRemedy;
+ }
+
+ public void setCurrentRemedy(Remedy currentRemedy) {
+ this.currentRemedy = currentRemedy;
+ }
+
private IProfileChangeRequest originalRequest;
private boolean isCheckForUpdates;
@@ -67,8 +76,8 @@ public class RemediationOperation extends ProfileChangeOperation {
@Override
protected void computeProfileChangeRequest(MultiStatus status, IProgressMonitor monitor) {
- if (userSelectedRemedy != null) {
- request = userSelectedRemedy.getRequest();
+ if (currentRemedy != null) {
+ request = currentRemedy.getRequest();
return;
}
@@ -191,10 +200,6 @@ public class RemediationOperation extends ProfileChangeOperation {
return Messages.RemediationOperation_RemediationJobName;
}
- public void setSelectedRemedy(Remedy remedy) {
- this.userSelectedRemedy = remedy;
- }
-
public ProvisioningJob getProvisioningJob(IProgressMonitor monitor) {
IStatus status = getResolutionResult();
// planner.resolve();
diff --git a/bundles/org.eclipse.equinox.p2.ui/icons/obj/added_overlay.gif b/bundles/org.eclipse.equinox.p2.ui/icons/obj/added_overlay.gif
new file mode 100755
index 0000000..c65d16a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/icons/obj/added_overlay.gif
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui/icons/obj/downgraded_overlay.jpg b/bundles/org.eclipse.equinox.p2.ui/icons/obj/downgraded_overlay.jpg
new file mode 100644
index 0000000..fd8c470
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/icons/obj/downgraded_overlay.jpg
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui/icons/obj/removed_overlay.gif b/bundles/org.eclipse.equinox.p2.ui/icons/obj/removed_overlay.gif
new file mode 100755
index 0000000..8aaadfb
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/icons/obj/removed_overlay.gif
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui/icons/obj/upgraded_overlay.jpg b/bundles/org.eclipse.equinox.p2.ui/icons/obj/upgraded_overlay.jpg
new file mode 100644
index 0000000..3b15be0
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/icons/obj/upgraded_overlay.jpg
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIActivator.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIActivator.java
index b1dbad8..27e7196 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIActivator.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIActivator.java
@@ -109,8 +109,10 @@ public class ProvUIActivator extends AbstractUIPlugin {
createImageDescriptor(ProvUIImages.IMG_IU, reg);
createImageDescriptor(ProvUIImages.IMG_DISABLED_IU, reg);
createImageDescriptor(ProvUIImages.IMG_UPDATED_IU, reg);
- createImageDescriptor(ProvUIImages.IMG_ADDED_IU, reg);
- createImageDescriptor(ProvUIImages.IMG_REMOVED_IU, reg);
+ createImageDescriptor(ProvUIImages.IMG_ADDED_OVERLAY, reg);
+ createImageDescriptor(ProvUIImages.IMG_REMOVED_OVERLAY, reg);
+ createImageDescriptor(ProvUIImages.IMG_DOWNGRADE_OVERLAY, reg);
+ createImageDescriptor(ProvUIImages.IMG_UPGRADE_OVERLAY, reg);
createImageDescriptor(ProvUIImages.IMG_PATCH_IU, reg);
createImageDescriptor(ProvUIImages.IMG_DISABLED_PATCH_IU, reg);
createImageDescriptor(ProvUIImages.IMG_CATEGORY, reg);
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIImages.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIImages.java
index 02f64dd..8927610 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIImages.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIImages.java
@@ -40,10 +40,10 @@ public class ProvUIImages {
public final static String IMG_IU = "obj/iu_obj.gif"; //$NON-NLS-1$
public final static String IMG_DISABLED_IU = "obj/iu_disabled_obj.gif"; //$NON-NLS-1$
public final static String IMG_UPDATED_IU = "obj/iu_update_obj.gif"; //$NON-NLS-1$
- public final static String IMG_UPGRADE_IU = "obj/iu_upgrade_obj.gif"; //$NON-NLS-1$
- public final static String IMG_DOWNGRADE_IU = "obj/iu_downgrade_obj.gif"; //$NON-NLS-1$
- public final static String IMG_ADDED_IU = "obj/iu_add.gif"; //$NON-NLS-1$
- public final static String IMG_REMOVED_IU = "obj/iu_remove.gif"; //$NON-NLS-1$
+ public final static String IMG_UPGRADE_OVERLAY = "obj/upgraded_overlay.jpg"; //$NON-NLS-1$
+ public final static String IMG_DOWNGRADE_OVERLAY = "obj/downgraded_overlay.jpg"; //$NON-NLS-1$
+ public final static String IMG_ADDED_OVERLAY = "obj/added_overlay.gif"; //$NON-NLS-1$
+ public final static String IMG_REMOVED_OVERLAY = "obj/removed_overlay.gif"; //$NON-NLS-1$
public final static String IMG_PATCH_IU = "obj/iu_patch_obj.gif"; //$NON-NLS-1$
public final static String IMG_DISABLED_PATCH_IU = "obj/iu_disabled_patch_obj.gif"; //$NON-NLS-1$
public final static String IMG_PROFILE = "obj/profile_obj.gif"; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/UpdateAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/UpdateAction.java
index 2fcc0f0..7736b06 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/UpdateAction.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/UpdateAction.java
@@ -89,16 +89,6 @@ public class UpdateAction extends ExistingIUInProfileAction {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
ui.openUpdateWizard(skipSelectionPage, (UpdateOperation) operation, remediationOperation, null);
- // UpdateWizard wizard = new UpdateWizard(ui, (UpdateOperation) operation, ((UpdateOperation) operation).getSelectedUpdates(), null);
- // wizard.setSkipSelectionsPage(skipSelectionPage);
- // wizard.setRemediationOperation(remediationOperation);
- // WizardDialog dialog = new ProvisioningWizardDialog(ProvUI.getDefaultParentShell(), wizard);
- // dialog.create();
- // PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(), IProvHelpContextIds.UPDATE_WIZARD);
- // if (wizard.getCurrentStatus().getSeverity() == IStatus.ERROR) {
- // wizard.deselectLockedIUs();
- // }
- // dialog.open();
}
});
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java
index 6df089c..8580e68 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java
@@ -131,7 +131,6 @@ public abstract class ProvisioningOperationWizard extends Wizard {
// advancing.
if (page == remediationPage) {
- remediationOperation.setSelectedRemedy(remediationPage.getSelectedRemedy());
try {
getContainer().run(true, false, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
@@ -164,7 +163,6 @@ public abstract class ProvisioningOperationWizard extends Wizard {
if (page == mainPage) {
if (remediationOperation != null && remediationOperation.hasRemedies() && remediationOperation.getRemedies().size() == 1) {
planChanged();
- remediationPage.setSelectedRemedy(remediationOperation.getRemedies().get(0));
return getNextPage(remediationPage);
} else if (remediationOperation != null && remediationOperation.hasRemedies()) {
planChanged();
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RemediationPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RemediationPage.java
index cdd0673..068b347c 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RemediationPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RemediationPage.java
@@ -37,7 +37,6 @@ public class RemediationPage extends ResolutionStatusPage {
private Composite resultFoundComposite;
protected IUElementListRoot input;
private TreeViewer treeViewer;
- private Remedy selectedRemedy;
private IUDetailsGroup iuDetailsGroup;
private Listener bestSolutionlistener;
@@ -186,6 +185,7 @@ public class RemediationPage extends ResolutionStatusPage {
if (remediationOperation.bestSolutionChangingTheRequest() != null) {
bestBeingInstalledRelaxedButton.setData(remediationOperation.bestSolutionChangingTheRequest());
bestBeingInstalledRelaxedButton.setSelection(true);
+ remediationOperation.setCurrentRemedy(remediationOperation.bestSolutionChangingTheRequest());
bestBeingInstalledRelaxedButton.notifyListeners(SWT.Selection, new Event());
isSelected = true;
}
@@ -194,14 +194,19 @@ public class RemediationPage extends ResolutionStatusPage {
if (remediationOperation.bestSolutionChangingWhatIsInstalled() != null) {
bestInstalledRelaxedButton.setData(remediationOperation.bestSolutionChangingWhatIsInstalled());
bestInstalledRelaxedButton.setSelection(isSelected == false);
- if (!isSelected)
+ if (!isSelected) {
+ remediationOperation.setCurrentRemedy(remediationOperation.bestSolutionChangingWhatIsInstalled());
bestInstalledRelaxedButton.notifyListeners(SWT.Selection, new Event());
+ }
isSelected = true;
}
bestInstalledRelaxedButton.setEnabled(remediationOperation.bestSolutionChangingWhatIsInstalled() != null);
buildMyOwnSolution.setSelection(isSelected == false);
- if (!isSelected)
+ if (!isSelected) {
+ remediationOperation.setCurrentRemedy(remediationOperation.getRemedies().get(0));
+ buildMyOwnSolution.setData(remediationOperation.getRemedies().get(0));
buildMyOwnSolution.notifyListeners(SWT.Selection, new Event());
+ }
}
@Override
@@ -235,24 +240,26 @@ public class RemediationPage extends ResolutionStatusPage {
ArrayList<AvailableIUElement> temp = new ArrayList<AvailableIUElement>();
ArrayList<String> updateIds = new ArrayList<String>();
IUElementListRoot root = new IUElementListRoot();
- for (IInstallableUnit addedIU : selectedRemedy.getRequest().getAdditions()) {
+ Remedy currentRemedy = ((ProvisioningOperationWizard) getWizard()).remediationOperation.getCurrentRemedy();
+ for (IInstallableUnit addedIU : currentRemedy.getRequest().getAdditions()) {
AvailableIUElement element = new AvailableIUElement(root, addedIU, getProfileId(), true);
- for (IInstallableUnit removedIU : selectedRemedy.getRequest().getRemovals()) {
+ for (IInstallableUnit removedIU : currentRemedy.getRequest().getRemovals()) {
if (removedIU.getId().equals(addedIU.getId())) {
int addedComparedToRemoved = addedIU.getVersion().compareTo(removedIU.getVersion());
- element.setDowngrade(addedComparedToRemoved < 0);
- element.setUpgrade(addedComparedToRemoved > 0);
- element.setIsUpdate(true);
+ element.setBeingDowngraded(addedComparedToRemoved < 0);
+ element.setBeingUpgraded(addedComparedToRemoved > 0);
updateIds.add(addedIU.getId());
break;
}
}
+ if (!updateIds.contains(addedIU.getId()))
+ element.setBeingAdded(true);
temp.add(element);
}
- for (IInstallableUnit removedIU : selectedRemedy.getRequest().getRemovals()) {
+ for (IInstallableUnit removedIU : currentRemedy.getRequest().getRemovals()) {
if (!updateIds.contains(removedIU.getId())) {
AvailableIUElement element = new AvailableIUElement(root, removedIU, getProfileId(), false);
- element.setIsUninstall(true);
+ element.setBeingRemoved(true);
temp.add(element);
}
}
@@ -265,7 +272,8 @@ public class RemediationPage extends ResolutionStatusPage {
public void refreshResultComposite() {
resultComposite.setVisible(true);
- selectedRemedy = null;
+ Remedy currentRemedy = ((ProvisioningOperationWizard) getWizard()).remediationOperation.getCurrentRemedy();
+ currentRemedy = null;
if (!checkboxes.get(ALLOWPARTIALINSTALL_INDEX).getSelection() && !checkboxes.get(ALLOWDIFFERENTVERSION_INDEX).getSelection() && !checkboxes.get(ALLOWINSTALLEDUPDATE_INDEX).getSelection() && !checkboxes.get(ALLOWINSTALLEDREMOVAL_INDEX).getSelection()) {
switchResultLayout.topControl = resultErrorComposite;
} else {
@@ -275,12 +283,12 @@ public class RemediationPage extends ResolutionStatusPage {
Remedy remedy = iterator.next();
if (isContraintOK(ALLOWPARTIALINSTALL_INDEX, remedy.getConfig().allowPartialInstall) && isContraintOK(ALLOWDIFFERENTVERSION_INDEX, remedy.getConfig().allowDifferentVersion) && isContraintOK(ALLOWINSTALLEDUPDATE_INDEX, remedy.getConfig().allowInstalledUpdate) && isContraintOK(ALLOWINSTALLEDREMOVAL_INDEX, remedy.getConfig().allowInstalledRemoval)) {
if (remedy.getRequest() != null) {
- selectedRemedy = remedy;
+ currentRemedy = remedy;
break;
}
}
}
- if (selectedRemedy == null) {
+ if (currentRemedy == null) {
switchResultLayout.topControl = resultNotFoundComposite;
} else {
input = new IUElementListRoot();
@@ -288,7 +296,7 @@ public class RemediationPage extends ResolutionStatusPage {
ius.addAll(transformIUstoIUElements());
if (ius.size() == 0) {
switchResultLayout.topControl = resultNotFoundComposite;
- selectedRemedy = null;
+ currentRemedy = null;
} else {
input.setChildren(ius.toArray());
treeViewer.setInput(input);
@@ -296,7 +304,7 @@ public class RemediationPage extends ResolutionStatusPage {
}
}
}
- setPageComplete(selectedRemedy != null);
+ setPageComplete(currentRemedy != null);
resultComposite.layout();
}
@@ -327,12 +335,4 @@ public class RemediationPage extends ResolutionStatusPage {
protected Collection<IInstallableUnit> getIUs() {
return ElementUtils.elementsToIUs(input.getChildren(input));
}
-
- public Remedy getSelectedRemedy() {
- return selectedRemedy;
- }
-
- public void setSelectedRemedy(Remedy selectedRemedy) {
- this.selectedRemedy = selectedRemedy;
- }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java
index 21499f3..3404e4f 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java
@@ -39,7 +39,10 @@ public class AvailableIUElement extends QueriedElement implements IIUElement {
boolean isInstalled = false;
boolean isUpdate = false;
boolean isPatch = false;
- boolean isUninstall = false;
+ boolean beingAdded = false;
+ boolean beingDowngraded = false;
+ boolean beingUpgraded = false;
+ boolean beingRemoved = false;
// Currently this variable is not settable due to the
// poor performance of sizing, but it is kept here for future improvement.
@@ -70,11 +73,21 @@ public class AvailableIUElement extends QueriedElement implements IIUElement {
return isInstalled ? ProvUIImages.IMG_DISABLED_PATCH_IU : ProvUIImages.IMG_PATCH_IU;
else if (isInstalled)
return ProvUIImages.IMG_DISABLED_IU;
- else if (isUninstall)
- return ProvUIImages.IMG_REMOVED_IU;
return ProvUIImages.IMG_IU;
}
+ protected String getImageOverlayId(Object obj) {
+ if (beingDowngraded)
+ return ProvUIImages.IMG_DOWNGRADE_OVERLAY;
+ if (beingUpgraded)
+ return ProvUIImages.IMG_UPGRADE_OVERLAY;
+ if (beingRemoved)
+ return ProvUIImages.IMG_REMOVED_OVERLAY;
+ if (beingAdded)
+ return ProvUIImages.IMG_ADDED_OVERLAY;
+ return null;
+ }
+
public String getLabel(Object o) {
return iu.getId();
}
@@ -203,14 +216,6 @@ public class AvailableIUElement extends QueriedElement implements IIUElement {
return isUpdate;
}
- public void setIsUninstall(boolean isUninstall) {
- this.isUninstall = isUninstall;
- }
-
- public boolean isUninstall() {
- return isUninstall;
- }
-
public void setIsPatch(boolean isPatch) {
this.isPatch = isPatch;
}
@@ -226,4 +231,36 @@ public class AvailableIUElement extends QueriedElement implements IIUElement {
}
return context;
}
+
+ public boolean isBeingAdded() {
+ return beingAdded;
+ }
+
+ public void setBeingAdded(boolean beingAdded) {
+ this.beingAdded = beingAdded;
+ }
+
+ public boolean isBeingDowngraded() {
+ return beingDowngraded;
+ }
+
+ public void setBeingDowngraded(boolean beingDowngraded) {
+ this.beingDowngraded = beingDowngraded;
+ }
+
+ public boolean isBeingUpgraded() {
+ return beingUpgraded;
+ }
+
+ public void setBeingUpgraded(boolean beingUpgraded) {
+ this.beingUpgraded = beingUpgraded;
+ }
+
+ public boolean isBeingRemoved() {
+ return beingRemoved;
+ }
+
+ public void setBeingRemoved(boolean beingRemoved) {
+ this.beingRemoved = beingRemoved;
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProvElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProvElement.java
index 5f5b156..b9c58c6 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProvElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProvElement.java
@@ -14,6 +14,8 @@ import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.ui.*;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.DecorationOverlayIcon;
+import org.eclipse.jface.viewers.IDecoration;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.model.IWorkbenchAdapter;
import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
@@ -56,6 +58,10 @@ public abstract class ProvElement implements IWorkbenchAdapter, IAdaptable {
return null;
}
+ protected String getImageOverlayId(Object obj) {
+ return null;
+ }
+
/*
* (non-Javadoc)
*
@@ -89,7 +95,19 @@ public abstract class ProvElement implements IWorkbenchAdapter, IAdaptable {
Image img = ProvUIImages.getImage(id);
if (img == null)
img = JFaceResources.getImageRegistry().get(id);
- return img;
+ String overlayId = getImageOverlayId(object);
+ if (overlayId == null)
+ return img;
+ ImageDescriptor overlay = ProvUIActivator.getDefault().getImageRegistry().getDescriptor(overlayId);
+ String decoratedImageId = id.concat(overlayId);
+ if (ProvUIActivator.getDefault().getImageRegistry().get(decoratedImageId) == null) {
+ DecorationOverlayIcon decoratedImage = new DecorationOverlayIcon(img, overlay, IDecoration.BOTTOM_RIGHT);
+ ProvUIActivator.getDefault().getImageRegistry().put(decoratedImageId, decoratedImage);
+ }
+ Image decoratedImg = ProvUIActivator.getDefault().getImageRegistry().get(decoratedImageId);
+ if (decoratedImg == null)
+ return img;
+ return decoratedImg;
}
protected void handleException(Exception e, String message) {