From 67a7a83e42354644979ba543c2942bcacf45cd50 Mon Sep 17 00:00:00 2001 From: Alshama M S Date: Wed, 27 Sep 2023 10:57:36 +0530 Subject: [PATCH] Remove unnecessary attributes of plugin element in feature.xml This commit removes some of the unused attributes of plugin element, which are redundant and are never read from a feature.xml file: install-size, fragment, download size and unpack attributes. --- .../core/builders/FeatureErrorReporter.java | 18 ++-- .../core/exports/FeatureExportOperation.java | 10 +-- .../core/exports/PluginExportOperation.java | 8 -- .../core/exports/ProductExportOperation.java | 6 -- .../internal/core/feature/FeatureData.java | 58 ------------ .../internal/core/feature/FeaturePlugin.java | 62 ++----------- .../internal/core/ifeature/IFeatureEntry.java | 19 ---- .../core/ifeature/IFeaturePlugin.java | 14 +-- .../pde/internal/core/util/CoreUtility.java | 88 ------------------ .../internal/feature/FeatureDataTestCase.java | 11 +-- .../pde/ui/tests/util/ProjectUtils.java | 1 - .../pde/internal/ui/PDEUIMessages.java | 3 - .../editor/feature/PluginDetailsSection.java | 90 ------------------- .../ui/editor/feature/PluginSection.java | 2 - .../pde/internal/ui/pderesources.properties | 3 - .../CreateFeatureProjectOperation.java | 2 - 16 files changed, 16 insertions(+), 379 deletions(-) diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/FeatureErrorReporter.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/FeatureErrorReporter.java index a30e3443cc..a5ee71e591 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/FeatureErrorReporter.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/FeatureErrorReporter.java @@ -31,7 +31,6 @@ import org.eclipse.pde.internal.core.ibundle.IBundlePluginModel; import org.eclipse.pde.internal.core.ibundle.IManifestHeader; import org.eclipse.pde.internal.core.ifeature.IFeatureModel; -import org.eclipse.pde.internal.core.util.CoreUtility; import org.eclipse.pde.internal.core.util.IdUtil; import org.w3c.dom.Attr; import org.w3c.dom.Element; @@ -110,12 +109,11 @@ private void validatePlugins(Element parent) { assertAttributeDefined(plugin, "id", CompilerFlags.ERROR); //$NON-NLS-1$ assertAttributeDefined(plugin, "version", CompilerFlags.ERROR); //$NON-NLS-1$ NamedNodeMap attributes = plugin.getAttributes(); - boolean isFragment = plugin.getAttribute("fragment").equals("true"); //$NON-NLS-1$ //$NON-NLS-2$ for (int j = 0; j < attributes.getLength(); j++) { Attr attr = (Attr) attributes.item(j); String name = attr.getName(); if (name.equals("id")) { //$NON-NLS-1$ - validatePluginExists(plugin, attr, isFragment); + validatePluginExists(plugin, attr); } else if (name.equals("version")) { //$NON-NLS-1$ validateVersionAttribute(plugin, attr); validateVersion(plugin, attr); @@ -153,7 +151,7 @@ private void validateImports(Element parent) { } else if (plugin != null && feature != null) { reportExclusiveAttributes(element, "plugin", "feature", CompilerFlags.ERROR); //$NON-NLS-1$//$NON-NLS-2$ } else if (plugin != null) { - validatePluginExists(element, plugin, false); + validatePluginExists(element, plugin); } else if (feature != null) { validateFeatureExists(element, feature); } @@ -382,7 +380,7 @@ private void validateFeatureAttributes(Element element) { if (name.equals("primary")) { //$NON-NLS-1$ reportDeprecatedAttribute(element, (Attr) attributes.item(i)); } else if (name.equals("plugin")) { //$NON-NLS-1$ - validatePluginExists(element, (Attr) attributes.item(i), false); + validatePluginExists(element, (Attr) attributes.item(i)); } } } @@ -405,12 +403,12 @@ protected boolean validateFeatureID(Element element, Attr attr) { return true; } - private void validatePluginExists(Element element, Attr attr, boolean isFragment) { + private void validatePluginExists(Element element, Attr attr) { String id = attr.getValue(); int severity = CompilerFlags.getFlag(fProject, CompilerFlags.F_UNRESOLVED_PLUGINS); if (severity != CompilerFlags.IGNORE) { IPluginModelBase model = PluginRegistry.findModel(id); - if (model == null || !model.isEnabled() || (isFragment && !model.isFragmentModel()) || (!isFragment && model.isFragmentModel())) { + if (model == null || !model.isEnabled() || model.isFragmentModel()) { VirtualMarker marker = report(NLS.bind(PDECoreMessages.Builders_Feature_reference, id), getLine(element, attr.getName()), severity, PDEMarkerFactory.CAT_OTHER); addMarkerAttribute(marker, PDEMarkerFactory.compilerKey, CompilerFlags.F_UNRESOLVED_PLUGINS); } @@ -460,12 +458,6 @@ private void validateUnpack(Element parent) { } } } - - if ("true".equals(unpack) && !CoreUtility.guessUnpack(pModel.getBundleDescription())) {//$NON-NLS-1$ - String message = NLS.bind(PDECoreMessages.Builders_Feature_missingUnpackFalse, (new String[] {parent.getAttribute("id"), "unpack=\"false\""})); //$NON-NLS-1$ //$NON-NLS-2$ - VirtualMarker marker = report(message, getLine(parent), severity, PDEMarkerFactory.CAT_OTHER); - addMarkerAttribute(marker, PDEMarkerFactory.compilerKey, CompilerFlags.F_UNRESOLVED_PLUGINS); - } } /** diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/exports/FeatureExportOperation.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/exports/FeatureExportOperation.java index 90e474fe5c..c022ea12f5 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/exports/FeatureExportOperation.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/exports/FeatureExportOperation.java @@ -118,8 +118,8 @@ public class FeatureExportOperation extends Job { protected State fStateCopy; - protected static String FEATURE_POST_PROCESSING = "features.postProcessingSteps.properties"; //$NON-NLS-1$ - protected static String PLUGIN_POST_PROCESSING = "plugins.postProcessingSteps.properties"; //$NON-NLS-1$ + protected static final String FEATURE_POST_PROCESSING = "features.postProcessingSteps.properties"; //$NON-NLS-1$ + protected static final String PLUGIN_POST_PROCESSING = "plugins.postProcessingSteps.properties"; //$NON-NLS-1$ private static final String[] GENERIC_CONFIG = new String[] {"*", "*", "*", ""}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ protected FeatureExportInfo fInfo; @@ -1159,7 +1159,6 @@ protected void createFeature(String featureID, String featureLocation, String[][ plugin.setAttribute("id", bundle.getSymbolicName()); //$NON-NLS-1$ plugin.setAttribute("version", bundle.getVersion().toString()); //$NON-NLS-1$ setFilterAttributes(plugin, currentConfig); - setAdditionalAttributes(plugin, bundle); root.appendChild(plugin); if (fInfo.exportSource && fInfo.exportSourceBundle) { @@ -1168,7 +1167,6 @@ protected void createFeature(String featureID, String featureLocation, String[][ plugin.setAttribute("id", bundle.getSymbolicName() + ".source"); //$NON-NLS-1$ //$NON-NLS-2$ plugin.setAttribute("version", bundle.getVersion().toString()); //$NON-NLS-1$ setFilterAttributes(plugin, currentConfig); - setAdditionalAttributes(plugin, bundle); root.appendChild(plugin); } else // include the .source plugin, if available { @@ -1179,7 +1177,6 @@ protected void createFeature(String featureID, String featureLocation, String[][ plugin.setAttribute("id", bundle.getSymbolicName()); //$NON-NLS-1$ plugin.setAttribute("version", bundle.getVersion().toString()); //$NON-NLS-1$ setFilterAttributes(plugin, currentConfig); - setAdditionalAttributes(plugin, bundle); root.appendChild(plugin); } } @@ -1203,9 +1200,6 @@ static boolean isWorkspacePlugin(BundleDescription bundle) { return entry != null && Arrays.asList(entry.getWorkspaceModels()).contains(PluginRegistry.findModel(bundle)); } - protected void setAdditionalAttributes(Element plugin, BundleDescription bundle) { - } - public static void errorFound() { fHasErrors = true; } diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/exports/PluginExportOperation.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/exports/PluginExportOperation.java index d63a8256ab..849739b819 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/exports/PluginExportOperation.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/exports/PluginExportOperation.java @@ -20,8 +20,6 @@ import org.eclipse.osgi.service.resolver.State; import org.eclipse.pde.core.plugin.TargetPlatform; import org.eclipse.pde.internal.core.TargetPlatformHelper; -import org.eclipse.pde.internal.core.util.CoreUtility; -import org.w3c.dom.Element; public class PluginExportOperation extends FeatureBasedExportOperation { @@ -61,10 +59,4 @@ protected boolean shouldAddPlugin(BundleDescription bundle, Dictionary base.getPluginBase().getVersion().equals(version)) + .findFirst().orElse(null); } } - if (fFragment && model instanceof IFragmentModel) { - return model.getPluginBase(); - } - if (!fFragment && model instanceof IPluginModel) { + if (model != null) { return model.getPluginBase(); } return null; @@ -84,11 +70,6 @@ public String getVersion() { return fVersion; } - @Override - public boolean isUnpack() { - return fUnpack; - } - @Override public void setVersion(String version) throws CoreException { ensureModelEditable(); @@ -97,14 +78,6 @@ public void setVersion(String version) throws CoreException { firePropertyChanged(this, P_VERSION, oldValue, version); } - @Override - public void setUnpack(boolean unpack) throws CoreException { - ensureModelEditable(); - boolean oldValue = fUnpack; - this.fUnpack = unpack; - firePropertyChanged(this, P_UNPACK, Boolean.valueOf(oldValue), Boolean.valueOf(unpack)); - } - @Override public void restoreProperty(String name, Object oldValue, Object newValue) throws CoreException { if (name.equals(P_VERSION)) { @@ -114,30 +87,16 @@ public void restoreProperty(String name, Object oldValue, Object newValue) throw } } - public void setFragment(boolean fragment) throws CoreException { - ensureModelEditable(); - this.fFragment = fragment; - } - @Override protected void parse(Node node) { super.parse(node); fVersion = getNodeAttribute(node, "version"); //$NON-NLS-1$ - String f = getNodeAttribute(node, "fragment"); //$NON-NLS-1$ - if (f != null && f.equalsIgnoreCase("true")) { //$NON-NLS-1$ - fFragment = true; - } - String unpack = getNodeAttribute(node, "unpack"); //$NON-NLS-1$ - if (unpack != null && unpack.equalsIgnoreCase("false")) { //$NON-NLS-1$ - fUnpack = false; - } } public void loadFrom(IPluginBase plugin) { id = plugin.getId(); label = plugin.getTranslatedName(); fVersion = plugin.getVersion(); - fFragment = plugin instanceof IFragment; } @Override @@ -149,16 +108,7 @@ public void write(String indent, PrintWriter writer) { writer.println(); writer.print(indent2 + "version=\"" + getVersion() + "\""); //$NON-NLS-1$ //$NON-NLS-2$ } - if (isFragment()) { - writer.println(); - writer.print(indent2 + "fragment=\"true\""); //$NON-NLS-1$ - } - if (!isUnpack()) { - writer.println(); - writer.print(indent2 + "unpack=\"false\""); //$NON-NLS-1$ - } writer.println("/>"); //$NON-NLS-1$ - //writer.println(indent + ""); } @Override diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ifeature/IFeatureEntry.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ifeature/IFeatureEntry.java index 0afc0d6b3f..76ff01f0d7 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ifeature/IFeatureEntry.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ifeature/IFeatureEntry.java @@ -26,24 +26,11 @@ public interface IFeatureEntry extends IFeatureObject, IIdentifiable, IEnvironme String P_NL = "p_nl"; //$NON-NLS-1$ String P_ARCH = "p_arch"; //$NON-NLS-1$ String P_FILTER = "p_filter"; //$NON-NLS-1$ - String P_DOWNLOAD_SIZE = "p_download_size"; //$NON-NLS-1$ - String P_INSTALL_SIZE = "p_install_size"; //$NON-NLS-1$ /** * Returns an LDAP filter that must be satisfied for this entry */ String getFilter(); - - /** - * Returns estimated download size of this plug-in. - */ - long getDownloadSize(); - - /** - * Returns estimated size of this plug-in when installed. - */ - long getInstallSize(); - /** * Sets an LDAP filter on this plugin */ @@ -52,10 +39,4 @@ public interface IFeatureEntry extends IFeatureObject, IIdentifiable, IEnvironme /** * Sets the estimated download size of this plug-in. */ - void setDownloadSize(long size) throws CoreException; - - /** - * Sets the estimated size of this plug-in when installed. - */ - void setInstallSize(long size) throws CoreException; } diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ifeature/IFeaturePlugin.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ifeature/IFeaturePlugin.java index 77a7221899..a04b68c6d8 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ifeature/IFeaturePlugin.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ifeature/IFeaturePlugin.java @@ -13,25 +13,13 @@ *******************************************************************************/ package org.eclipse.pde.internal.core.ifeature; -import org.eclipse.core.runtime.CoreException; - /** * A base class for plug-in and data entires */ public interface IFeaturePlugin extends IFeatureObject, IVersionable, IFeatureEntry { - /** - * A property that will be carried by the change event - * if 'unpack' field of this object is changed. - */ - public static final String P_UNPACK = "unpack"; //$NON-NLS-1$ - /** * Returns whether this is a reference to a fragment. * @return true if this is a fragment, false otherwise. */ - public boolean isFragment(); - - public boolean isUnpack(); - - public void setUnpack(boolean unpack) throws CoreException; + boolean isFragment(); } diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/util/CoreUtility.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/util/CoreUtility.java index 00168d8885..dc20b62ddd 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/util/CoreUtility.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/util/CoreUtility.java @@ -30,27 +30,12 @@ import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.osgi.service.resolver.BundleDescription; -import org.eclipse.osgi.service.resolver.HostSpecification; -import org.eclipse.pde.core.plugin.IPluginLibrary; -import org.eclipse.pde.core.plugin.IPluginModelBase; -import org.eclipse.pde.core.plugin.PluginRegistry; -import org.eclipse.pde.internal.build.IPDEBuildConstants; -import org.eclipse.pde.internal.core.FeatureModelManager; -import org.eclipse.pde.internal.core.ICoreConstants; import org.eclipse.pde.internal.core.PDECore; -import org.eclipse.pde.internal.core.ibundle.IBundle; -import org.eclipse.pde.internal.core.ibundle.IBundleModel; -import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelBase; -import org.eclipse.pde.internal.core.ifeature.IFeatureModel; -import org.eclipse.pde.internal.core.ifeature.IFeaturePlugin; public class CoreUtility { @@ -162,79 +147,6 @@ public static void deleteContent(File fileToDelete, IProgressMonitor monitor) { } } - public static boolean guessUnpack(BundleDescription bundle) { - if (bundle == null) { - return true; - } - - if (new File(bundle.getLocation()).isFile()) { - return false; - } - - // at this point always make sure launcher fragments are flat; or else you will have launching problems - HostSpecification host = bundle.getHost(); - if (host != null && host.getName().equals(IPDEBuildConstants.BUNDLE_EQUINOX_LAUNCHER)) { - return true; - } - - IWorkspaceRoot root = PDECore.getWorkspace().getRoot(); - IContainer container = root.getContainerForLocation(IPath.fromOSString(bundle.getLocation())); - if (container == null) { - return true; - } - - if (container instanceof IProject) { - try { - if (!((IProject) container).hasNature(JavaCore.NATURE_ID)) { - return true; - } - } catch (CoreException e) { - PDECore.logException(e); - } - } - - IPluginModelBase model = PluginRegistry.findModel(bundle); - if (model == null) { - return true; - } - - // check bundle header - if (model instanceof IBundlePluginModelBase) { - IBundleModel bundleModel = ((IBundlePluginModelBase) model).getBundleModel(); - if (bundleModel != null) { - IBundle b = bundleModel.getBundle(); - String header = b.getHeader(ICoreConstants.ECLIPSE_BUNDLE_SHAPE); - if (header != null) { - return ICoreConstants.SHAPE_DIR.equals(header); - } - } - } - - // check features - FeatureModelManager manager = PDECore.getDefault().getFeatureModelManager(); - IFeatureModel[] models = manager.getModels(); - for (IFeatureModel featureModel : models) { - IFeaturePlugin[] plugins = featureModel.getFeature().getPlugins(); - for (IFeaturePlugin featurePlugin : plugins) { - if (featurePlugin.getId().equals(bundle.getSymbolicName())) { - return featurePlugin.isUnpack(); - } - } - } - - IPluginLibrary[] libraries = model.getPluginBase().getLibraries(); - if (libraries.length == 0) { - return false; - } - - for (IPluginLibrary library : libraries) { - if (library.getName().equals(".")) { //$NON-NLS-1$ - return false; - } - } - return true; - } - public static boolean jarContainsResource(File file, String resource, boolean directory) { try (ZipFile jarFile = new ZipFile(file, ZipFile.OPEN_READ);) { ZipEntry resourceEntry = jarFile.getEntry(resource); diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/core/tests/internal/feature/FeatureDataTestCase.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/core/tests/internal/feature/FeatureDataTestCase.java index bda388d715..15907b4b83 100644 --- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/core/tests/internal/feature/FeatureDataTestCase.java +++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/core/tests/internal/feature/FeatureDataTestCase.java @@ -41,10 +41,7 @@ public class FeatureDataTestCase { public void testSerialization() throws Exception { String expected = String.format("%n" - ); + + "arch=\"x86_64\"/>%n"); FeatureData data = newFeatureData(); String actual = toXml(data); assertEquals(expected, actual); @@ -54,16 +51,13 @@ public void testSerialization() throws Exception { assertEquals(data.getOS(), data2.getOS()); assertEquals(data.getArch(), data2.getArch()); assertEquals(data.getFilter(), data2.getFilter()); - assertEquals(data.getDownloadSize(), data2.getDownloadSize()); } @Test public void testSerializationWithLdapFilter() throws CoreException { String expected = String.format("%n"); + + "filter=\"(& (osgi.ws=win32) (osgi.os=win32) (osgi.arch=x86))\"/>%n"); FeatureData data = newFeatureData(); data.setFilter("(& (osgi.ws=win32) (osgi.os=win32) (osgi.arch=x86))"); String actual = toXml(data); @@ -79,7 +73,6 @@ private FeatureData newFeatureData() throws CoreException { data.setLabel("Feature1"); data.setArch("x86_64"); data.setOS("win32"); - data.setDownloadSize(1000); return data; } diff --git a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/util/ProjectUtils.java b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/util/ProjectUtils.java index 6c55b160ab..843a69be97 100644 --- a/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/util/ProjectUtils.java +++ b/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/util/ProjectUtils.java @@ -369,7 +369,6 @@ public static IFeaturePlugin addIncludedPlugin(IFeature feature, String id, Stri IFeaturePlugin featurePlugin = feature.getModel().getFactory().createPlugin(); featurePlugin.setId(id); featurePlugin.setVersion(version); - featurePlugin.setUnpack(false); feature.addPlugins(new IFeaturePlugin[] { featurePlugin }); return featurePlugin; } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java index 04299c5383..0aefe437c5 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java @@ -850,9 +850,6 @@ public class PDEUIMessages extends NLS { public static String SiteEditor_PluginDetailsSection_title; public static String SiteEditor_PluginDetailsSection_desc; public static String SiteEditor_PluginDetailsSection_pluginLabel; - public static String SiteEditor_PluginDetailsSection_downloadSize; - public static String SiteEditor_PluginDetailsSection_installSize; - public static String SiteEditor_PluginDetailsSection_unpack; public static String FeatureEditor_DataDetailsSection_title; public static String FeatureEditor_DataDetailsSection_desc; diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/PluginDetailsSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/PluginDetailsSection.java index 40df518292..7916b52b65 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/PluginDetailsSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/PluginDetailsSection.java @@ -13,8 +13,6 @@ *******************************************************************************/ package org.eclipse.pde.internal.ui.editor.feature; -import static org.eclipse.swt.events.SelectionListener.widgetSelectedAdapter; - import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; @@ -30,7 +28,6 @@ import org.eclipse.pde.internal.ui.parts.FormEntry; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.forms.IFormPart; import org.eclipse.ui.forms.IManagedForm; @@ -45,14 +42,6 @@ public class PluginDetailsSection extends PDESection implements IPartSelectionLi private FormEntry fVersionText; - private FormEntry fdownloadSizeText; - - private FormEntry fInstallSizeText; - - private Button fUnpackButton; - - private boolean fBlockNotification; - public PluginDetailsSection(PDEFormPage page, Composite parent) { this(page, parent, PDEUIMessages.SiteEditor_PluginDetailsSection_title, PDEUIMessages.SiteEditor_PluginDetailsSection_desc, SWT.NULL); } @@ -67,16 +56,12 @@ public PluginDetailsSection(PDEFormPage page, Composite parent, String title, St @Override public void cancelEdit() { fVersionText.cancelEdit(); - fdownloadSizeText.cancelEdit(); - fInstallSizeText.cancelEdit(); super.cancelEdit(); } @Override public void commit(boolean onSave) { fVersionText.commit(); - fdownloadSizeText.commit(); - fInstallSizeText.commit(); super.commit(onSave); } @@ -110,52 +95,6 @@ public void textValueChanged(FormEntry text) { }); limitTextWidth(fVersionText); fVersionText.setEditable(isEditable()); - - fdownloadSizeText = new FormEntry(container, toolkit, PDEUIMessages.SiteEditor_PluginDetailsSection_downloadSize, null, false); - fdownloadSizeText.setFormEntryListener(new FormEntryAdapter(this) { - - @Override - public void textValueChanged(FormEntry text) { - if (fInput != null) - try { - fInput.setDownloadSize(getLong(text.getValue())); - } catch (CoreException e) { - PDEPlugin.logException(e); - } - } - }); - limitTextWidth(fdownloadSizeText); - fdownloadSizeText.setEditable(isEditable()); - - fInstallSizeText = new FormEntry(container, toolkit, PDEUIMessages.SiteEditor_PluginDetailsSection_installSize, null, false); - fInstallSizeText.setFormEntryListener(new FormEntryAdapter(this) { - - @Override - public void textValueChanged(FormEntry text) { - if (fInput != null) - try { - fInput.setInstallSize(getLong(text.getValue())); - } catch (CoreException e) { - PDEPlugin.logException(e); - } - } - }); - limitTextWidth(fInstallSizeText); - fInstallSizeText.setEditable(isEditable()); - - fUnpackButton = toolkit.createButton(container, PDEUIMessages.SiteEditor_PluginDetailsSection_unpack, SWT.CHECK); - GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - gd.horizontalSpan = 2; - fUnpackButton.setLayoutData(gd); - fUnpackButton.addSelectionListener(widgetSelectedAdapter(e -> { - try { - if (!fBlockNotification) - fInput.setUnpack(fUnpackButton.getSelection()); - } catch (CoreException ex) { - PDEPlugin.logException(ex); - } - })); - toolkit.paintBordersFor(container); section.setClient(container); } @@ -207,45 +146,16 @@ public void selectionChanged(IFormPart part, ISelection selection) { update(); } - @Override - public void setFocus() { - if (fdownloadSizeText != null) - fdownloadSizeText.getText().setFocus(); - } - private void update() { if (fInput != null) { fNameText.setValue(fInput.getLabel()); fVersionText.setValue(fInput.getVersion(), true); - fdownloadSizeText.setValue(fInput.getDownloadSize() >= 0 ? "" + fInput.getDownloadSize() : null, true); //$NON-NLS-1$ - fInstallSizeText.setValue(fInput.getInstallSize() >= 0 ? "" + fInput.getInstallSize() : null, true); //$NON-NLS-1$ - fBlockNotification = true; - fUnpackButton.setSelection(fInput.isUnpack()); - fBlockNotification = false; } else { fNameText.setValue(null); fVersionText.setValue(null, true); - fdownloadSizeText.setValue(null, true); - fInstallSizeText.setValue(null, true); - fBlockNotification = true; - fUnpackButton.setSelection(true); - fBlockNotification = false; } boolean editable = fInput != null && isEditable(); fVersionText.setEditable(editable); - fdownloadSizeText.setEditable(editable); - fInstallSizeText.setEditable(editable); - fUnpackButton.setEnabled(editable); - } - - private long getLong(String svalue) { - if (svalue == null) - return 0; - try { - return Long.parseLong(svalue); - } catch (NumberFormatException e) { - return 0; - } } } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/PluginSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/PluginSection.java index 246cb156a7..b09638ab20 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/PluginSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/PluginSection.java @@ -45,7 +45,6 @@ import org.eclipse.pde.internal.core.ifeature.IFeature; import org.eclipse.pde.internal.core.ifeature.IFeatureModel; import org.eclipse.pde.internal.core.ifeature.IFeaturePlugin; -import org.eclipse.pde.internal.core.util.CoreUtility; import org.eclipse.pde.internal.ui.PDEPlugin; import org.eclipse.pde.internal.ui.PDEUIMessages; import org.eclipse.pde.internal.ui.dialogs.PluginSelectionDialog; @@ -221,7 +220,6 @@ private void doAdd(Object[] candidates) throws CoreException { FeaturePlugin fplugin = (FeaturePlugin) model.getFactory().createPlugin(); fplugin.loadFrom(candidate.getPluginBase()); fplugin.setVersion(ICoreConstants.DEFAULT_VERSION); - fplugin.setUnpack(CoreUtility.guessUnpack(candidate.getBundleDescription())); added[i] = fplugin; } feature.addPlugins(added); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties index 2fdc63bda5..e17b84b1b8 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties @@ -231,9 +231,6 @@ Leave blank if the plug-in does not contain platform-specific code. SiteEditor_PluginDetailsSection_title = Plug-in Details SiteEditor_PluginDetailsSection_desc = Specify installation details for the selected plug-in. SiteEditor_PluginDetailsSection_pluginLabel = Name: -SiteEditor_PluginDetailsSection_downloadSize = Download Size (kB): -SiteEditor_PluginDetailsSection_installSize = Installation Size (kB): -SiteEditor_PluginDetailsSection_unpack = Unpack the plug-in archive after the installation FeatureEditor_DataDetailsSection_title = Data Archive Environments FeatureEditor_DataDetailsSection_desc = Specify environment combinations in which the selected archive can be installed. \ diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/feature/CreateFeatureProjectOperation.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/feature/CreateFeatureProjectOperation.java index 843fba3f84..486fc65e29 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/feature/CreateFeatureProjectOperation.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/feature/CreateFeatureProjectOperation.java @@ -23,7 +23,6 @@ import org.eclipse.pde.internal.core.feature.WorkspaceFeatureModel; import org.eclipse.pde.internal.core.ifeature.IFeature; import org.eclipse.pde.internal.core.ifeature.IFeaturePlugin; -import org.eclipse.pde.internal.core.util.CoreUtility; import org.eclipse.swt.widgets.Shell; public class CreateFeatureProjectOperation extends AbstractCreateFeatureOperation { @@ -43,7 +42,6 @@ protected void configureFeature(IFeature feature, WorkspaceFeatureModel model) t FeaturePlugin fplugin = (FeaturePlugin) model.getFactory().createPlugin(); fplugin.loadFrom(plugin); fplugin.setVersion(ICoreConstants.DEFAULT_VERSION); - fplugin.setUnpack(CoreUtility.guessUnpack(plugin.getPluginModel().getBundleDescription())); added[i] = fplugin; } feature.addPlugins(added);