Skip to content

Commit

Permalink
Fixup: Complete removal of attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
alshamams committed Sep 28, 2023
1 parent 1c38149 commit 12d47f7
Show file tree
Hide file tree
Showing 13 changed files with 2 additions and 246 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -460,12 +459,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);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -61,10 +59,4 @@ protected boolean shouldAddPlugin(BundleDescription bundle, Dictionary<String, S
// always include plug-ins, even ones with environment conflicts
return true;
}

@Override
protected void setAdditionalAttributes(Element plugin, BundleDescription bundle) {
plugin.setAttribute("unpack", Boolean.toString(CoreUtility.guessUnpack(bundle))); //$NON-NLS-1$
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
import org.eclipse.pde.internal.core.iproduct.ILauncherInfo;
import org.eclipse.pde.internal.core.iproduct.IProduct;
import org.eclipse.pde.internal.core.util.CoreUtility;
import org.w3c.dom.Element;

public class ProductExportOperation extends FeatureExportOperation {
private static final String STATUS_MESSAGE = "!MESSAGE"; //$NON-NLS-1$
Expand Down Expand Up @@ -489,9 +488,4 @@ private String createMacInfoPList() {
}
return null;
}

@Override
protected void setAdditionalAttributes(Element plugin, BundleDescription bundle) {
plugin.setAttribute("unpack", Boolean.toString(CoreUtility.guessUnpack(bundle))); //$NON-NLS-1$
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ public class FeatureData extends IdentifiableObject implements IFeatureData {
private String nl;
private String arch;
private String filter;
private long downloadSize;
private long installSize;

public FeatureData() {
}
Expand All @@ -42,8 +40,6 @@ protected void reset() {
ws = null;
nl = null;
arch = null;
downloadSize = 0;
installSize = 0;
}

@Override
Expand All @@ -64,8 +60,6 @@ protected void parse(Node node) {
nl = getNodeAttribute(node, "nl"); //$NON-NLS-1$
arch = getNodeAttribute(node, "arch"); //$NON-NLS-1$
filter = getNodeAttribute(node, "filter"); //$NON-NLS-1$
downloadSize = getIntegerAttribute(node, "download-size"); //$NON-NLS-1$
installSize = getIntegerAttribute(node, "install-size"); //$NON-NLS-1$
}

protected void writeAttributes(String indent2, PrintWriter writer) {
Expand All @@ -75,14 +69,6 @@ protected void writeAttributes(String indent2, PrintWriter writer) {
writeAttribute("nl", getNL(), indent2, writer); //$NON-NLS-1$
writeAttribute("arch", getArch(), indent2, writer); //$NON-NLS-1$
writeAttribute("filter", getFilter(), indent2, writer); //$NON-NLS-1$
if (getDownloadSize() > 0) {
writer.println();
writer.print(indent2 + "download-size=\"" + getDownloadSize() + "\""); //$NON-NLS-1$ //$NON-NLS-2$
}
if (getInstallSize() > 0) {
writer.println();
writer.print(indent2 + "install-size=\"" + getInstallSize() + "\""); //$NON-NLS-1$ //$NON-NLS-2$
}
}

private void writeAttribute(String attribute, String value, String indent2, PrintWriter writer) {
Expand Down Expand Up @@ -209,48 +195,6 @@ public void setFilter(String filter) throws CoreException {
firePropertyChanged(P_FILTER, oldValue, filter);
}

/**
* Gets the downloadSize.
* @return Returns a int
*/
@Override
public long getDownloadSize() {
return downloadSize;
}

/**
* Sets the downloadSize.
* @param downloadSize The downloadSize to set
*/
@Override
public void setDownloadSize(long downloadSize) throws CoreException {
ensureModelEditable();
Object oldValue = Long.valueOf(this.downloadSize);
this.downloadSize = downloadSize;
firePropertyChanged(P_DOWNLOAD_SIZE, oldValue, Long.valueOf(downloadSize));
}

/**
* Gets the installSize.
* @return Returns a int
*/
@Override
public long getInstallSize() {
return installSize;
}

/**
* Sets the installSize.
* @param installSize The installSize to set
*/
@Override
public void setInstallSize(long installSize) throws CoreException {
ensureModelEditable();
Object oldValue = Long.valueOf(this.installSize);
this.installSize = installSize;
firePropertyChanged(P_INSTALL_SIZE, oldValue, Long.valueOf(installSize));
}

@Override
public void restoreProperty(String name, Object oldValue, Object newValue) throws CoreException {
switch (name) {
Expand All @@ -266,12 +210,6 @@ public void restoreProperty(String name, Object oldValue, Object newValue) throw
case P_ARCH:
setArch((String) newValue);
break;
case P_DOWNLOAD_SIZE:
setDownloadSize(newValue != null ? ((Integer) newValue).intValue() : 0);
break;
case P_INSTALL_SIZE:
setInstallSize(newValue != null ? ((Integer) newValue).intValue() : 0);
break;
default:
super.restoreProperty(name, oldValue, newValue);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public class FeaturePlugin extends FeatureData implements IFeaturePlugin {
private static final long serialVersionUID = 1L;
private boolean fFragment;
private String fVersion;
private boolean fUnpack = true;

public FeaturePlugin() {
}
Expand Down Expand Up @@ -84,11 +83,6 @@ public String getVersion() {
return fVersion;
}

@Override
public boolean isUnpack() {
return fUnpack;
}

@Override
public void setVersion(String version) throws CoreException {
ensureModelEditable();
Expand All @@ -97,14 +91,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)) {
Expand All @@ -127,10 +113,6 @@ protected void parse(Node node) {
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 <samp>true</samp> if this is a fragment, <samp>false</samp> otherwise.
*/
public boolean isFragment();

public boolean isUnpack();

public void setUnpack(boolean unpack) throws CoreException;
boolean isFragment();
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,11 @@
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 {

Expand Down Expand Up @@ -162,7 +159,7 @@ public static void deleteContent(File fileToDelete, IProgressMonitor monitor) {
}
}

public static boolean guessUnpack(BundleDescription bundle) {
public static boolean guessUnpack1(BundleDescription bundle) {
if (bundle == null) {
return true;
}
Expand Down Expand Up @@ -210,18 +207,6 @@ public static boolean guessUnpack(BundleDescription bundle) {
}
}

// 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ 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
Expand All @@ -76,7 +75,6 @@ private FeatureData newFeatureData() throws CoreException {
data.setLabel("Feature1");
data.setArch("x86_64");
data.setOS("win32");
data.setDownloadSize(1000);
return data;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Loading

0 comments on commit 12d47f7

Please sign in to comment.