Skip to content

Commit

Permalink
Remove unnecessary 'fragment' attribute of plugin-elements in products
Browse files Browse the repository at this point in the history
The PDE Product Editor used to add a 'fragment' attribute to plugin
elements in *.product files, but the attribute is unused for a long
time.

Relates to eclipse-equinox/p2#378
  • Loading branch information
HannesWell authored and Dinesh0723 committed Nov 7, 2023
1 parent 9a7e6b8 commit 3cff2bc
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,4 @@ public interface IProductPlugin extends IProductObject {
String getVersion();

void setVersion(String version);

/**
* @return whether this product plug-in is a fragment. <code>false</code> by default.
* @see #setFragment(boolean)
*/
boolean isFragment();

/**
* Sets whether this product plug-in is a fragment. <code>false</code> by default.
* @param isFragment whether this product is a fragment
* @see #isFragment()
*/
void setFragment(boolean isFragment);
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

import java.io.PrintWriter;

import org.eclipse.pde.core.plugin.IFragmentModel;
import org.eclipse.pde.core.plugin.PluginRegistry;
import org.eclipse.pde.internal.core.ICoreConstants;
import org.eclipse.pde.internal.core.iproduct.IProductModel;
import org.eclipse.pde.internal.core.iproduct.IProductPlugin;
Expand All @@ -32,12 +30,6 @@ public class ProductPlugin extends ProductObject implements IProductPlugin {
private String fId;
private String fVersion;

/**
* Used to cache the fragment attribute value internally in order to not lose it in case the current
* plugin/fragment is not in the target platform anymore (see bug 264462)
*/
private boolean fFragment;

public ProductPlugin(IProductModel model) {
super(model);
}
Expand All @@ -48,8 +40,6 @@ public void parse(Node node) {
Element element = (Element) node;
fId = element.getAttribute("id"); //$NON-NLS-1$
fVersion = element.getAttribute("version"); //$NON-NLS-1$
String fragment = element.getAttribute("fragment"); //$NON-NLS-1$
fFragment = Boolean.parseBoolean(fragment);
}
}

Expand All @@ -59,16 +49,6 @@ public void write(String indent, PrintWriter writer) {
if (fVersion != null && fVersion.length() > 0 && !fVersion.equals(ICoreConstants.DEFAULT_VERSION)) {
writer.print(" version=\"" + fVersion + "\""); //$NON-NLS-1$ //$NON-NLS-2$
}

// If the plugin is a known fragment or has a cached fragment setting, mark it as a fragment
if (PluginRegistry.findModel(fId) != null) {
if (PluginRegistry.findModel(fId) instanceof IFragmentModel) {
writer.print(" fragment=\"" + Boolean.TRUE + "\""); //$NON-NLS-1$ //$NON-NLS-2$
}
} else if (fFragment) {
writer.print(" fragment=\"" + Boolean.TRUE + "\""); //$NON-NLS-1$ //$NON-NLS-2$
}

writer.println("/>"); //$NON-NLS-1$
}

Expand Down Expand Up @@ -96,14 +76,4 @@ public void setVersion(String version) {
}
}

@Override
public boolean isFragment() {
return fFragment;
}

@Override
public void setFragment(boolean isFragment) {
fFragment = isFragment;
}

}

0 comments on commit 3cff2bc

Please sign in to comment.