Skip to content
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 @@ -40,7 +40,7 @@ public class FeatureErrorReporter extends ManifestErrorReporter {

static HashSet<String> attrs = new HashSet<>();

static String[] attrNames = {"id", "version", "label", "provider-name", "image", "os", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
static String[] attrNames = { "id", "version", "include-sources", "label", "provider-name", "image", "os", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
"ws", "arch", "nl", "colocation-affinity", "primary", "exclusive", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
"plugin", "application", "license-feature", "license-feature-version"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public class Feature extends VersionableObject implements IFeature {
private String fCopyright;
private String fLicenseFeatureID;
private String fLicenseFeatureVersion;
private boolean fIncludeSources;

@Override
public void addPlugins(IFeaturePlugin[] newPlugins) throws CoreException {
Expand Down Expand Up @@ -213,6 +214,7 @@ protected void parse(Node node) {
fApplication = getNodeAttribute(node, "application"); //$NON-NLS-1$
fPrimary = getBooleanAttribute(node, "primary"); //$NON-NLS-1$
fExclusive = getBooleanAttribute(node, "exclusive"); //$NON-NLS-1$
fIncludeSources = getBooleanAttribute(node, "include-sources"); //$NON-NLS-1$
NodeList children = node.getChildNodes();
fValid = true;

Expand Down Expand Up @@ -372,6 +374,11 @@ public String getApplication() {
return fApplication;
}

@Override
public boolean isIncludingSources() {
return fIncludeSources;
}

@Override
public void setOS(String os) throws CoreException {
ensureModelEditable();
Expand Down Expand Up @@ -442,6 +449,13 @@ public void setApplication(String newValue) throws CoreException {
firePropertyChanged(P_APPLICATION, oldValue, newValue);
}

@Override
public void setIncludingSources(boolean includesSources) {
Object oldValue = fIncludeSources;
this.fIncludeSources = includesSources;
firePropertyChanged(this, P_SOURCES, oldValue, includesSources);
}

@Override
public void setProviderName(String providerName) throws CoreException {
ensureModelEditable();
Expand Down Expand Up @@ -570,6 +584,9 @@ public void restoreProperty(String name, Object oldValue, Object newValue) throw
case P_IMAGE:
setImageName((String) newValue);
break;
case P_SOURCES:
setIncludingSources(newValue != null ? ((Boolean) newValue).booleanValue() : false);
break;
default:
super.restoreProperty(name, oldValue, newValue);
break;
Expand All @@ -581,6 +598,7 @@ public void reset() {
super.reset();
fData.clear();
fPlugins.clear();
fIncludeSources = false;
fImports.clear();
fChildren.clear();
fUrl = null;
Expand Down Expand Up @@ -654,6 +672,8 @@ public void write(String indent, PrintWriter writer) {
writeIfDefined(indenta, writer, "id", getId()); //$NON-NLS-1$
writeIfDefined(indenta, writer, "label", getWritableString(getLabel())); //$NON-NLS-1$
writeIfDefined(indenta, writer, "version", getVersion()); //$NON-NLS-1$
writeIfDefined(indenta, writer, "include-sources", //$NON-NLS-1$
isIncludingSources() ? String.valueOf(isIncludingSources()) : null);
writeIfDefined(indenta, writer, "provider-name", //$NON-NLS-1$
getWritableString(fProviderName));
writeIfDefined(indenta, writer, "plugin", //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public interface IFeature extends IFeatureObject, IVersionable, IEnvironment {

public static final String P_COLLOCATION_AFFINITY = "colocation-affinity"; //$NON-NLS-1$
public static final String P_APPLICATION = "application"; //$NON-NLS-1$
public static final String P_SOURCES = "include-sources"; //$NON-NLS-1$

public static final int INFO_DESCRIPTION = 0;
public static final int INFO_COPYRIGHT = 1;
Expand Down Expand Up @@ -257,6 +258,10 @@ public interface IFeature extends IFeatureObject, IVersionable, IEnvironment {
void setApplication(String value) throws CoreException;

boolean isValid();

public boolean isIncludingSources();

void setIncludingSources(boolean b);

public void swap(IFeatureChild feature1, IFeatureChild feature2);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2233,6 +2233,8 @@ public class PDEUIMessages extends NLS {
public static String FeatureSection_addRequired;
public static String FeatureSection_toggleRoot;

public static String FeatureSpecSection_addSources0;

public static String ImportPackageSection_desc;
public static String ImportPackageSection_descFragment;
public static String ExportPackageSection_desc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,15 @@
import org.eclipse.pde.internal.ui.parts.FormEntry;
import org.eclipse.pde.internal.ui.util.SWTUtil;
import org.eclipse.pde.internal.ui.wizards.plugin.NewPluginProjectWizard;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.RTFTransfer;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.dnd.TransferData;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.widgets.FormToolkit;
Expand Down Expand Up @@ -75,6 +78,8 @@

private boolean fPatch = false;

private Button fIncludesSourcesCheckbox;

public FeatureSpecSection(FeatureFormPage page, Composite parent) {
super(page, parent, Section.DESCRIPTION);
getSection().setText(PDEUIMessages.FeatureEditor_SpecSection_title);
Expand Down Expand Up @@ -113,7 +118,7 @@
try {
IFeatureURLElement updateElement = urlElement.getUpdate();
if (value.length() > 0) {
URL siteUrl = new URL(value);

Check warning on line 121 in ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/FeatureSpecSection.java

View check run for this annotation

Jenkins - eclipse-pde / Compiler

Deprecation

NORMAL: The constructor URL(String) is deprecated since version 20
if (updateElement == null) {
// element needed, create it
updateElement = model.getFactory().createURLElement(urlElement, IFeatureURLElement.UPDATE);
Expand Down Expand Up @@ -380,6 +385,14 @@
}
});

fIncludesSourcesCheckbox = toolkit.createButton(container, PDEUIMessages.FeatureSpecSection_addSources0, SWT.CHECK);
fIncludesSourcesCheckbox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

fIncludesSourcesCheckbox.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
boolean isSelected = fIncludesSourcesCheckbox.getSelection();
feature.setIncludingSources(isSelected);
}));

GridData gd = (GridData) fIdText.getText().getLayoutData();
gd.widthHint = 150;

Expand Down Expand Up @@ -412,7 +425,7 @@

private boolean verifySiteUrl(IFeature feature, String value) {
try {
new URL(value);

Check warning on line 428 in ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/FeatureSpecSection.java

View check run for this annotation

Jenkins - eclipse-pde / Compiler

Deprecation

NORMAL: The constructor URL(String) is deprecated since version 20
} catch (MalformedURLException e) {
return false;
}
Expand Down Expand Up @@ -503,6 +516,7 @@
setIfDefined(fTitleText, feature.getLabel());
getPage().getManagedForm().getForm().setText(model.getResourceString(feature.getLabel()));
setIfDefined(fVersionText, feature.getVersion());
fIncludesSourcesCheckbox.setSelection(feature.isIncludingSources());
setIfDefined(fProviderText, feature.getProviderName());
setIfDefined(fPluginText, feature.getPlugin());
if (isPatch()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1256,6 +1256,7 @@ FeatureImportWizard_messages_updating = Updating...
FeatureImportWizard_title = Import Features
FeatureSection_addRequired=Add Required
FeatureSection_toggleRoot=Toggle Install Mode
FeatureSpecSection_addSources0=Include sources automatically
FeatureImportWizard_noToAll = No to A&ll
FeatureImportWizard_messages_noFeatures = No features found. Ensure that the chosen directory contains 'features' folder.
FeatureImportWizard_messages_title = Feature Import
Expand Down
Loading