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 141136 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]
Work in progress
clipboard.txt (text/plain), 9.19 KB, created by
Curtis Windatt
on 2009-07-08 16:44:23 EDT
(
hide
)
Description:
Work in progress
Filename:
MIME Type:
Creator:
Curtis Windatt
Created:
2009-07-08 16:44:23 EDT
Size:
9.19 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.ui >Index: src/org/eclipse/pde/internal/ui/shared/target/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/shared/target/messages.properties,v >retrieving revision 1.22 >diff -u -r1.22 messages.properties >--- src/org/eclipse/pde/internal/ui/shared/target/messages.properties 7 Jul 2009 14:30:56 -0000 1.22 >+++ src/org/eclipse/pde/internal/ui/shared/target/messages.properties 8 Jul 2009 20:44:17 -0000 >@@ -73,7 +73,7 @@ > EditFeatureContainerPage_3=Feature Version: > EditFeatureContainerPage_4=Unspecified > EditFeatureContainerPage_5=Location: >-EditIUContainerPage_0=At least one item must be selected >+EditIUContainerPage_0=No items have been selected > EditIUContainerPage_1=Included Software > EditIUContainerPage_10=Select a site or enter the location of a site. > EditIUContainerPage_11=Check the content that you wish to add to your target platform >Index: src/org/eclipse/pde/internal/ui/shared/target/EditIUContainerPage.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/shared/target/EditIUContainerPage.java,v >retrieving revision 1.9 >diff -u -r1.9 EditIUContainerPage.java >--- src/org/eclipse/pde/internal/ui/shared/target/EditIUContainerPage.java 28 May 2009 15:19:29 -0000 1.9 >+++ src/org/eclipse/pde/internal/ui/shared/target/EditIUContainerPage.java 8 Jul 2009 20:44:17 -0000 >@@ -45,7 +45,7 @@ > public class EditIUContainerPage extends WizardPage implements IEditBundleContainerPage { > > // Status for any errors on the page >- private static final IStatus BAD_IU_SELECTION = new Status(IStatus.ERROR, PDEPlugin.getPluginId(), Messages.EditIUContainerPage_0); >+ private static final IStatus BAD_IU_SELECTION = new Status(IStatus.WARNING, PDEPlugin.getPluginId(), Messages.EditIUContainerPage_0); > private IStatus fSelectedIUStatus = Status.OK_STATUS; > > // Dialog settings >@@ -150,10 +150,9 @@ > createDetailsArea(composite); > createCheckboxArea(composite); > >- setPageComplete(false); > restoreWidgetState(); > setControl(composite); >- setPageComplete(false); >+ setPageComplete(true); > if (fEditContainer == null) { > PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.LOCATION_ADD_SITE_WIZARD); > } else { >@@ -379,6 +378,11 @@ > setPageComplete(false); > } else { > setErrorMessage(null); >+ if (fSelectedIUStatus.getSeverity() == IStatus.WARNING) { >+ setMessage(fSelectedIUStatus.getMessage(), IStatus.WARNING); >+ } else { >+ setMessage(Messages.EditIUContainerPage_6); >+ } > setPageComplete(true); > } > } >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.9 >diff -u -r1.9 TargetLocationsGroup.java >--- src/org/eclipse/pde/internal/ui/shared/target/TargetLocationsGroup.java 30 Jun 2009 20:02:23 -0000 1.9 >+++ src/org/eclipse/pde/internal/ui/shared/target/TargetLocationsGroup.java 8 Jul 2009 20:44:17 -0000 >@@ -13,6 +13,7 @@ > import java.util.*; > import org.eclipse.core.runtime.*; > import org.eclipse.equinox.internal.provisional.p2.engine.IProfile; >+import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit; > import org.eclipse.jface.viewers.*; > import org.eclipse.jface.window.Window; > import org.eclipse.jface.wizard.WizardDialog; >@@ -311,27 +312,65 @@ > 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())); >+ >+ // Check if we are removing containers or IUs > Iterator iterator = selection.iterator(); >- boolean removedSite = false; >+ boolean removingIUs = true; > while (iterator.hasNext()) { >- Object currentSelection = iterator.next(); >- if (currentSelection instanceof IBundleContainer) { >- if (currentSelection instanceof IUBundleContainer) { >- removedSite = true; >- } >- newContainers.remove(currentSelection); >+ if (!(iterator.next() instanceof IInstallableUnit)) { >+ removingIUs = false; >+ break; > } > } >- if (newContainers.size() > 0) { >- fTarget.setBundleContainers((IBundleContainer[]) newContainers.toArray(new IBundleContainer[newContainers.size()])); >+ >+ boolean forceResolve = false; >+ >+ if (removingIUs) { >+// forceResolve = true; >+// Map newContainers >+// iterator = selection.iterator(); >+// while (iterator.hasNext()) { >+// IInstallableUnit toRemove = (IInstallableUnit) iterator.next(); >+// IUBundleContainer container = (IUBundleContainer) ((ITreeContentProvider) fTreeViewer.getContentProvider()).getParent(toRemove); >+// if (container != null) { >+// try { >+// // TODO Can we use API instead of internal to get the profile? >+// IInstallableUnit[] units = container.getInstallableUnits(null); >+// List unitList = new ArrayList(units.length); >+// for (int i = 0; i < units.length; i++) { >+// if (!toRemove.equals(units[i])) { >+// unitList.add(units[i]); >+// } >+// } >+// container.setInstallableUnits((IInstallableUnit[]) unitList.toArray(new IInstallableUnit[units.length])); >+// } catch (CoreException e) { >+// PDEPlugin.log(e); >+// } >+// } >+// } >+ > } else { >- fTarget.setBundleContainers(null); >+ Set newContainers = new HashSet(); >+ newContainers.addAll(Arrays.asList(fTarget.getBundleContainers())); >+ iterator = selection.iterator(); >+ while (iterator.hasNext()) { >+ Object currentSelection = iterator.next(); >+ if (currentSelection instanceof IBundleContainer) { >+ if (currentSelection instanceof IUBundleContainer) { >+ forceResolve = true; >+ } >+ newContainers.remove(currentSelection); >+ } >+ } >+ 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); >+ contentsChanged(forceResolve); > fTreeViewer.refresh(false); > updateButtons(); > } >@@ -340,16 +379,23 @@ > private void updateButtons() { > IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection(); > fEditButton.setEnabled(!selection.isEmpty() && selection.getFirstElement() instanceof IBundleContainer); >- // If any container is selected, allow the remove (the remove ignores non-container entries) >- boolean removeAllowed = false; >+ // If any container is selected, or only installable units, allow the remove (the remove ignores non-container entries) >+ boolean removeContainers = false; >+ boolean removeUnits = true; > Iterator iter = selection.iterator(); > while (iter.hasNext()) { >- if (iter.next() instanceof IBundleContainer) { >- removeAllowed = true; >+ Object next = iter.next(); >+ if (next instanceof IBundleContainer) { >+ removeContainers = true; >+ // If one or more containers are selected just remove the containers ignoring everything else > break; > } >+ if (!(next instanceof IInstallableUnit)) { >+ // Only allow removal of IUs if only IUs are selected >+ removeUnits = false; >+ } > } >- fRemoveButton.setEnabled(removeAllowed); >+ fRemoveButton.setEnabled(removeContainers || removeUnits); > } > > /** >@@ -368,6 +414,12 @@ > */ > class BundleContainerContentProvider implements ITreeContentProvider { > >+ /** >+ * Maps installable units to their parent container >+ * TODO Could cause problems if multiple site containers have the same IUs >+ */ >+ private Map iuParents = new HashMap(); >+ > public Object[] getChildren(Object parentElement) { > if (parentElement instanceof ITargetDefinition) { > IBundleContainer[] containers = ((ITargetDefinition) parentElement).getBundleContainers(); >@@ -388,10 +440,15 @@ > } > } else if (parentElement instanceof IUBundleContainer) { > // Show the IUs as children >- // TODO See if we can get the profile using API >+ // TODO See if we can get the profile using API instead of internal > try { > IProfile profile = ((TargetDefinition) fTarget).getProfile(); >- return ((IUBundleContainer) parentElement).getInstallableUnits(profile); >+ IInstallableUnit[] units = ((IUBundleContainer) parentElement).getInstallableUnits(profile); >+ // Store the unit parents so we can support removal >+ for (int i = 0; i < units.length; i++) { >+ iuParents.put(units[i], parentElement); >+ } >+ return units; > } catch (CoreException e) { > return new Object[] {e.getStatus()}; > } >@@ -402,6 +459,9 @@ > } > > public Object getParent(Object element) { >+ if (element instanceof IInstallableUnit) { >+ return iuParents.get(element); >+ } > return null; > } >
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