Skip to content

Commit d7257d0

Browse files
committed
Correction for existing feature.xml changes
1 parent 63536ed commit d7257d0

3 files changed

Lines changed: 31 additions & 34 deletions

File tree

ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/feature/Feature.java

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public class Feature extends VersionableObject implements IFeature {
5858
private String fCopyright;
5959
private String fLicenseFeatureID;
6060
private String fLicenseFeatureVersion;
61-
private boolean fSources;
61+
private boolean fIncludeSources;
6262

6363
@Override
6464
public void addPlugins(IFeaturePlugin[] newPlugins) throws CoreException {
@@ -214,7 +214,7 @@ protected void parse(Node node) {
214214
fApplication = getNodeAttribute(node, "application"); //$NON-NLS-1$
215215
fPrimary = getBooleanAttribute(node, "primary"); //$NON-NLS-1$
216216
fExclusive = getBooleanAttribute(node, "exclusive"); //$NON-NLS-1$
217-
fSources = getBooleanAttribute(node, "include-sources"); //$NON-NLS-1$
217+
fIncludeSources = getBooleanAttribute(node, "include-sources"); //$NON-NLS-1$
218218
NodeList children = node.getChildNodes();
219219
fValid = true;
220220

@@ -374,6 +374,12 @@ public String getApplication() {
374374
return fApplication;
375375
}
376376

377+
@Override
378+
public boolean isIncludingSources() {
379+
return fIncludeSources;
380+
}
381+
382+
377383
@Override
378384
public void setOS(String os) throws CoreException {
379385
ensureModelEditable();
@@ -444,6 +450,13 @@ public void setApplication(String newValue) throws CoreException {
444450
firePropertyChanged(P_APPLICATION, oldValue, newValue);
445451
}
446452

453+
@Override
454+
public void setIncludingSources(boolean includesSources) {
455+
Object oldValue = fIncludeSources;
456+
this.fIncludeSources = includesSources;
457+
firePropertyChanged(this, P_SOURCES, oldValue, includesSources);
458+
}
459+
447460
@Override
448461
public void setProviderName(String providerName) throws CoreException {
449462
ensureModelEditable();
@@ -586,7 +599,7 @@ public void reset() {
586599
super.reset();
587600
fData.clear();
588601
fPlugins.clear();
589-
fSources = false;
602+
fIncludeSources = false;
590603
fImports.clear();
591604
fChildren.clear();
592605
fUrl = null;
@@ -660,7 +673,8 @@ public void write(String indent, PrintWriter writer) {
660673
writeIfDefined(indenta, writer, "id", getId()); //$NON-NLS-1$
661674
writeIfDefined(indenta, writer, "label", getWritableString(getLabel())); //$NON-NLS-1$
662675
writeIfDefined(indenta, writer, "version", getVersion()); //$NON-NLS-1$
663-
writeIfDefined(indenta, writer, "include-sources", String.valueOf(isIncludingSources())); //$NON-NLS-1$ )
676+
writeIfDefined(indenta, writer, "include-sources", //$NON-NLS-1$
677+
isIncludingSources() ? String.valueOf(isIncludingSources()) : null);
664678
writeIfDefined(indenta, writer, "provider-name", //$NON-NLS-1$
665679
getWritableString(fProviderName));
666680
writeIfDefined(indenta, writer, "plugin", //$NON-NLS-1$
@@ -779,16 +793,4 @@ public String toString() {
779793
return getId() + " (" + getVersion() + ")"; //$NON-NLS-1$//$NON-NLS-2$
780794
}
781795

782-
@Override
783-
public boolean isIncludingSources() {
784-
return fSources;
785-
}
786-
787-
@Override
788-
public void setIncludingSources(boolean b) {
789-
Object oldValue = fSources;
790-
this.fSources = b;
791-
firePropertyChanged(this, "include-sources", oldValue, b); //$NON-NLS-1$
792-
}
793-
794796
}

ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ifeature/IFeature.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ public interface IFeature extends IFeatureObject, IVersionable, IEnvironment {
5959

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

6364
public static final int INFO_DESCRIPTION = 0;
6465
public static final int INFO_COPYRIGHT = 1;
6566
public static final int INFO_LICENSE = 2;
66-
67-
public static final String P_SOURCES = "false"; //$NON-NLS-1$
67+
6868

6969
static final String[] INFO_TAGS = {"description", "copyright", "license"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
7070

ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/FeatureSpecSection.java

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@
4848
import org.eclipse.swt.dnd.TextTransfer;
4949
import org.eclipse.swt.dnd.Transfer;
5050
import org.eclipse.swt.dnd.TransferData;
51-
import org.eclipse.swt.events.SelectionAdapter;
52-
import org.eclipse.swt.events.SelectionEvent;
51+
import org.eclipse.swt.events.SelectionListener;
5352
import org.eclipse.swt.layout.GridData;
5453
import org.eclipse.swt.widgets.Button;
5554
import org.eclipse.swt.widgets.Composite;
@@ -79,7 +78,7 @@ public class FeatureSpecSection extends PDESection {
7978

8079
private boolean fPatch = false;
8180

82-
private Button fSourcesCheckbox;
81+
private Button fIncludesSourcesCheckbox;
8382

8483
public FeatureSpecSection(FeatureFormPage page, Composite parent) {
8584
super(page, parent, Section.DESCRIPTION);
@@ -386,17 +385,14 @@ public void textValueChanged(FormEntry text) {
386385
}
387386
});
388387

389-
fSourcesCheckbox = toolkit.createButton(container, PDEUIMessages.FeatureSpecSection_addSources0, SWT.CHECK);
390-
fSourcesCheckbox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
391-
fSourcesCheckbox.addSelectionListener(new SelectionAdapter() {
392-
@Override
393-
public void widgetSelected(SelectionEvent e) {
394-
boolean isSelected = fSourcesCheckbox.getSelection();
395-
IFeatureModel model = (IFeatureModel) getPage().getModel();
396-
IFeature feature = model.getFeature();
397-
feature.setIncludingSources(isSelected);
398-
}
399-
});
388+
fIncludesSourcesCheckbox = toolkit.createButton(container, PDEUIMessages.FeatureSpecSection_addSources0,
389+
SWT.CHECK);
390+
fIncludesSourcesCheckbox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
391+
392+
fIncludesSourcesCheckbox.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
393+
boolean isSelected = fIncludesSourcesCheckbox.getSelection();
394+
feature.setIncludingSources(isSelected);
395+
}));
400396

401397
GridData gd = (GridData) fIdText.getText().getLayoutData();
402398
gd.widthHint = 150;
@@ -513,7 +509,6 @@ private void setIfDefined(FormEntry formText, String value) {
513509
}
514510
}
515511

516-
517512
@Override
518513
public void refresh() {
519514
IFeatureModel model = (IFeatureModel) getPage().getModel();
@@ -522,7 +517,7 @@ public void refresh() {
522517
setIfDefined(fTitleText, feature.getLabel());
523518
getPage().getManagedForm().getForm().setText(model.getResourceString(feature.getLabel()));
524519
setIfDefined(fVersionText, feature.getVersion());
525-
fSourcesCheckbox.setSelection(feature.isIncludingSources());
520+
fIncludesSourcesCheckbox.setSelection(feature.isIncludingSources());
526521
setIfDefined(fProviderText, feature.getProviderName());
527522
setIfDefined(fPluginText, feature.getPlugin());
528523
if (isPatch()) {

0 commit comments

Comments
 (0)