Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 166985 Details for
Bug 276214
[target] unable to remove things from target platform
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Fix
clipboard.txt (text/plain), 10.11 KB, created by
Curtis Windatt
on 2010-05-04 12:34:00 EDT
(
hide
)
Description:
Fix
Filename:
MIME Type:
Creator:
Curtis Windatt
Created:
2010-05-04 12:34:00 EDT
Size:
10.11 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.core >Index: src/org/eclipse/pde/internal/core/target/AbstractBundleContainer.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/target/AbstractBundleContainer.java,v >retrieving revision 1.5 >diff -u -r1.5 AbstractBundleContainer.java >--- src/org/eclipse/pde/internal/core/target/AbstractBundleContainer.java 22 Mar 2010 19:44:09 -0000 1.5 >+++ src/org/eclipse/pde/internal/core/target/AbstractBundleContainer.java 4 May 2010 16:24:17 -0000 >@@ -206,6 +206,13 @@ > public abstract boolean isContentEqual(AbstractBundleContainer container); > > /** >+ * Sets the resolution status to null. This container will be considered unresolved. >+ */ >+ protected void clearResolutionStatus() { >+ fResolutionStatus = null; >+ } >+ >+ /** > * Parses a bunlde's manifest into a dictionary. The bundle may be in a jar > * or in a directory at the specified location. > * >Index: src/org/eclipse/pde/internal/core/target/IUBundleContainer.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/target/IUBundleContainer.java,v >retrieving revision 1.21 >diff -u -r1.21 IUBundleContainer.java >--- src/org/eclipse/pde/internal/core/target/IUBundleContainer.java 1 Apr 2010 18:03:06 -0000 1.21 >+++ src/org/eclipse/pde/internal/core/target/IUBundleContainer.java 4 May 2010 16:24:17 -0000 >@@ -843,6 +843,29 @@ > } > > /** >+ * Removes an installable unit from this container. The container will no longer be resolved. >+ * >+ * @param unit unit to remove from the list of root IUs >+ */ >+ public void removeInstallableUnit(IInstallableUnit unit) { >+ List newUnits = new ArrayList(fUnits.length); >+ for (int i = 0; i < fUnits.length; i++) { >+ if (!fUnits[i].equals(unit)) { >+ newUnits.add(fUnits[i]); >+ } >+ } >+ fUnits = (IInstallableUnit[]) newUnits.toArray(new IInstallableUnit[newUnits.size()]); >+ fIds = new String[fUnits.length]; >+ fVersions = new Version[fUnits.length]; >+ for (int i = 0; i < fUnits.length; i++) { >+ fIds[i] = fUnits[i].getId(); >+ fVersions[i] = fUnits[i].getVersion(); >+ } >+ // Need to mark the container as unresolved >+ clearResolutionStatus(); >+ } >+ >+ /** > * Returns installable unit identifiers. > * > * @return IU id's >#P org.eclipse.pde.ui >Index: src/org/eclipse/pde/internal/ui/shared/target/StyledBundleLabelProvider.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/shared/target/StyledBundleLabelProvider.java,v >retrieving revision 1.8 >diff -u -r1.8 StyledBundleLabelProvider.java >--- src/org/eclipse/pde/internal/ui/shared/target/StyledBundleLabelProvider.java 12 Mar 2010 17:35:03 -0000 1.8 >+++ src/org/eclipse/pde/internal/ui/shared/target/StyledBundleLabelProvider.java 4 May 2010 16:24:18 -0000 >@@ -23,6 +23,7 @@ > import org.eclipse.pde.internal.core.target.provisional.*; > import org.eclipse.pde.internal.ui.PDEPlugin; > import org.eclipse.pde.internal.ui.PDEPluginImages; >+import org.eclipse.pde.internal.ui.shared.target.TargetLocationsGroup.IUWrapper; > import org.eclipse.pde.internal.ui.util.SharedLabelProvider; > import org.eclipse.swt.graphics.Image; > import org.eclipse.ui.ISharedImages; >@@ -140,6 +141,8 @@ > styledString.append(repos[0].toString()); > } > appendBundleCount(styledString, container); >+ } else if (element instanceof IUWrapper) { >+ styledString = getStyledString(((IUWrapper) element).getIU()); > } else if (element instanceof IInstallableUnit) { > IInstallableUnit iu = (IInstallableUnit) element; > String name = fTranslations.getIUProperty(iu, IInstallableUnit.PROP_NAME); >@@ -272,6 +275,8 @@ > } else if (element instanceof IUBundleContainer) { > return PDEPlugin.getDefault().getLabelProvider().get(PDEPluginImages.DESC_REPOSITORY_OBJ, flag); > } >+ } else if (element instanceof IUWrapper) { >+ return getImage(((IUWrapper) element).getIU()); > } else if (element instanceof IInstallableUnit) { > return PDEPlugin.getDefault().getLabelProvider().get(PDEPluginImages.DESC_NOREF_FEATURE_OBJ); > } >Index: src/org/eclipse/pde/internal/ui/shared/target/TargetLocationsGroup.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/shared/target/TargetLocationsGroup.java,v >retrieving revision 1.15 >diff -u -r1.15 TargetLocationsGroup.java >--- src/org/eclipse/pde/internal/ui/shared/target/TargetLocationsGroup.java 5 Mar 2010 20:22:58 -0000 1.15 >+++ src/org/eclipse/pde/internal/ui/shared/target/TargetLocationsGroup.java 4 May 2010 16:24:18 -0000 >@@ -11,8 +11,10 @@ > package org.eclipse.pde.internal.ui.shared.target; > > import java.util.*; >+import java.util.List; > import org.eclipse.core.runtime.*; > import org.eclipse.equinox.p2.engine.IProfile; >+import org.eclipse.equinox.p2.metadata.IInstallableUnit; > import org.eclipse.jface.viewers.*; > import org.eclipse.jface.window.Window; > import org.eclipse.jface.wizard.WizardDialog; >@@ -278,6 +280,8 @@ > IBundleContainer oldContainer = null; > if (selected instanceof IBundleContainer) { > oldContainer = (IBundleContainer) selected; >+ } else if (selected instanceof IUWrapper) { >+ oldContainer = ((IUWrapper) selected).getParent(); > } else if (selected instanceof IResolvedBundle) { > TreeItem[] treeSelection = fTreeViewer.getTree().getSelection(); > if (treeSelection.length > 0) { >@@ -320,40 +324,64 @@ > IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection(); > IBundleContainer[] containers = fTarget.getBundleContainers(); > if (!selection.isEmpty() && containers != null && containers.length > 0) { >- Set newContainers = new HashSet(); >- newContainers.addAll(Arrays.asList(fTarget.getBundleContainers())); >- Iterator iterator = selection.iterator(); >+ List toRemove = new ArrayList(); > boolean removedSite = false; >- while (iterator.hasNext()) { >+ boolean removedContainer = false; >+ for (Iterator iterator = selection.iterator(); iterator.hasNext();) { > Object currentSelection = iterator.next(); > if (currentSelection instanceof IBundleContainer) { > if (currentSelection instanceof IUBundleContainer) { > removedSite = true; > } >- newContainers.remove(currentSelection); >+ removedContainer = true; >+ toRemove.add(currentSelection); >+ } >+ if (currentSelection instanceof IUWrapper) { >+ toRemove.add(currentSelection); > } > } >- if (newContainers.size() > 0) { >- fTarget.setBundleContainers((IBundleContainer[]) newContainers.toArray(new IBundleContainer[newContainers.size()])); >+ >+ if (removedContainer) { >+ Set newContainers = new HashSet(); >+ newContainers.addAll(Arrays.asList(fTarget.getBundleContainers())); >+ newContainers.removeAll(toRemove); >+ if (newContainers.size() > 0) { >+ fTarget.setBundleContainers((IBundleContainer[]) newContainers.toArray(new IBundleContainer[newContainers.size()])); >+ } else { >+ fTarget.setBundleContainers(null); >+ } >+ >+ // If we remove a site container, the content change update must force a re-resolve bug 275458 / bug 275401 >+ contentsChanged(removedSite); >+ fTreeViewer.refresh(false); >+ updateButtons(); > } else { >- fTarget.setBundleContainers(null); >+ for (Iterator iterator = toRemove.iterator(); iterator.hasNext();) { >+ Object current = iterator.next(); >+ if (current instanceof IUWrapper) { >+ ((IUWrapper) current).getParent().removeInstallableUnit(((IUWrapper) current).getIU()); >+ } >+ } >+ contentsChanged(removedSite); >+ fTreeViewer.refresh(false); >+ updateButtons(); > } >- >- // If we remove a site container, the content change update must force a re-resolve bug 275458 / bug 275401 >- contentsChanged(removedSite); >- fTreeViewer.refresh(false); >- updateButtons(); > } > } > > private void updateButtons() { > IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection(); >- fEditButton.setEnabled(!selection.isEmpty() && selection.getFirstElement() instanceof IBundleContainer); >+ fEditButton.setEnabled(!selection.isEmpty() && (selection.getFirstElement() instanceof IBundleContainer || selection.getFirstElement() instanceof IUWrapper)); > // If any container is selected, allow the remove (the remove ignores non-container entries) > boolean removeAllowed = false; > Iterator iter = selection.iterator(); > while (iter.hasNext()) { >- if (iter.next() instanceof IBundleContainer) { >+ Object current = iter.next(); >+ if (current instanceof IBundleContainer) { >+ removeAllowed = true; >+ break; >+ } >+ if (current instanceof IUWrapper) { > removeAllowed = true; > break; > } >@@ -400,7 +428,13 @@ > // TODO See if we can get the profile using API > try { > IProfile profile = ((TargetDefinition) fTarget).getProfile(); >- return ((IUBundleContainer) parentElement).getInstallableUnits(profile); >+ IInstallableUnit[] units = ((IUBundleContainer) parentElement).getInstallableUnits(profile); >+ // Wrap the units so that they remember their parent container >+ List wrappedUnits = new ArrayList(units.length); >+ for (int i = 0; i < units.length; i++) { >+ wrappedUnits.add(new IUWrapper(units[i], (IUBundleContainer) parentElement)); >+ } >+ return wrappedUnits.toArray(); > } catch (CoreException e) { > return new Object[] {e.getStatus()}; > } >@@ -413,6 +447,9 @@ > } > > public Object getParent(Object element) { >+ if (element instanceof IUWrapper) { >+ return ((IUWrapper) element).getParent(); >+ } > return null; > } > >@@ -456,4 +493,26 @@ > > } > >+ /** >+ * Wraps an installable unit so that it knows what bundle container parent it belongs to >+ * in the tree. >+ */ >+ class IUWrapper { >+ private IInstallableUnit fIU; >+ private IUBundleContainer fParent; >+ >+ public IUWrapper(IInstallableUnit unit, IUBundleContainer parent) { >+ fIU = unit; >+ fParent = parent; >+ } >+ >+ public IInstallableUnit getIU() { >+ return fIU; >+ } >+ >+ public IUBundleContainer getParent() { >+ return fParent; >+ } >+ } >+ > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 276214
:
141136
|
141137
| 166985