Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary 'fragment' attribute of plugin-elements in products #882

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}

}
Loading