Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -1537,6 +1537,8 @@ public class PDEUIMessages extends NLS {

public static String PluginContentPage_enable_api_analysis;

public static String PluginContentPage_enable_ds_processing;

public static String ImportWizard_title;
public static String ImportWizard_FirstPage_title;
public static String ImportWizard_FirstPage_desc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1187,6 +1187,7 @@ PluginImportWizardFirstPage_2=A target definition must be selected
PluginImportWizardFirstPage_3=Projects from a &repository
PluginContentPage_appQuestion=Create a rich client application?
PluginContentPage_enable_api_analysis=Enable A&PI analysis
PluginContentPage_enable_ds_processing=Enable Declarative Services Processing
PluginContentMergeViewer_title=Plug-in Source Compare
PluginDevelopmentPage_equinox=&Show sections specific to the Equinox OSGi framework

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@
// Set required EE
String exeEnvironment = ((AbstractFieldData) fData).getExecutionEnvironment();
if (exeEnvironment != null) {
bundle.setHeader(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, exeEnvironment);

Check warning on line 275 in ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/plugin/NewProjectCreationOperation.java

View check run for this annotation

Jenkins - eclipse-pde / Compiler

Deprecation

NORMAL: The field Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT is deprecated
}

String framework = ((AbstractFieldData) fData).getOSGiFramework();
Expand Down Expand Up @@ -423,6 +423,11 @@
if (data.doEnableAPITooling()) {
addApiAnalysisNature();
}

// enable Declarative Services processing if requested
if (data.doEnableDSProcessing()) {
setDSProcessingPreference(project);
}
}
if (isAutomaticMetadata()) {
subMonitor.subTask(PDEUIMessages.NewProjectCreationOperation_manifestFile);
Expand Down Expand Up @@ -735,4 +740,20 @@
}
}

/**
* Enable Declarative Services processing for the project
*
* @param project the project to enable DS processing for
*/
private void setDSProcessingPreference(IProject project) {
IScopeContext context = new ProjectScope(project);

Check warning on line 749 in ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/plugin/NewProjectCreationOperation.java

View check run for this annotation

Jenkins - eclipse-pde / Compiler

Type

ERROR: IScopeContext cannot be resolved to a type
IEclipsePreferences node = context.getNode("org.eclipse.pde.ds.annotations"); //$NON-NLS-1$
node.putBoolean("enabled", true); //$NON-NLS-1$
try {
node.flush();
} catch (BackingStoreException e) {
PDEPlugin.log(e);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,20 @@ public class PluginContentPage extends ContentPage {
*/
private Button fApiAnalysisButton;

/**
* Button to enable Declarative Services processing for the project during
* project creation
*/
private Button fDsProcessingButton;

/**
* Dialog settings constants
*/
private final static String S_GENERATE_ACTIVATOR = "generatePluginActivator"; //$NON-NLS-1$
private final static String S_UI_PLUGIN = "uiPlugin"; //$NON-NLS-1$
private final static String S_RCP_PLUGIN = "rcpPlugin"; //$NON-NLS-1$
private final static String S_API_ANALYSIS = "apiAnalysis"; //$NON-NLS-1$
private final static String S_DS_PROCESSING = "dsProcessing"; //$NON-NLS-1$

protected final static int P_CLASS_GROUP = 2;
private final static String NO_EXECUTION_ENVIRONMENT = PDEUIMessages.PluginContentPage_noEE;
Expand Down Expand Up @@ -235,6 +242,13 @@ protected void createPluginClassGroup(Composite container) {
updateData();
validatePage();
}));

fDsProcessingButton = SWTFactory.createCheckButton(classGroup, PDEUIMessages.PluginContentPage_enable_ds_processing, null, false, 2);
fDsProcessingButton.setSelection((settings != null) ? settings.getBoolean(S_DS_PROCESSING) : false);
fDsProcessingButton.addSelectionListener(widgetSelectedAdapter(e -> {
updateData();
validatePage();
}));
}

@Override
Expand All @@ -247,6 +261,8 @@ public void updateData() {
data.setRCPApplicationPlugin(!fData.isSimple() && !isPureOSGi() && fYesButton.getSelection());
// Don't turn on API analysis if disabled (no java project available)
data.setEnableAPITooling(fApiAnalysisButton.isEnabled() && fApiAnalysisButton.getSelection());
// Don't turn on DS processing if disabled
data.setEnableDSProcessing(fDsProcessingButton.isEnabled() && fDsProcessingButton.getSelection());
if (fEEChoice.isEnabled() && !fEEChoice.getText().equals(NO_EXECUTION_ENVIRONMENT)) {
fData.setExecutionEnvironment(fEEChoice.getText().trim());
} else {
Expand Down Expand Up @@ -335,6 +351,7 @@ else if (!wasUIPluginEnabled) {
fExeEnvButton.setEnabled(allowEESelection);
// API Tools only works for osgi bundles with java natures
fApiAnalysisButton.setEnabled(allowEESelection);
fDsProcessingButton.setEnabled(allowEESelection);

fRCPGroup.setVisible(!fData.isSimple() && !isPureOSGi());
}
Expand Down Expand Up @@ -388,6 +405,9 @@ public void saveSettings(IDialogSettings settings) {
if (fApiAnalysisButton.isEnabled()) {
settings.put(S_API_ANALYSIS, fApiAnalysisButton.getSelection());
}
if (fDsProcessingButton.isEnabled()) {
settings.put(S_DS_PROCESSING, fDsProcessingButton.getSelection());
}
settings.put(S_RCP_PLUGIN, fYesButton.getSelection());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class PluginFieldData extends AbstractFieldData implements IPluginFieldDa
private boolean fDoGenerateActivator = false;
private boolean fRCPAppPlugin = false;
private boolean fSetupAPITooling = false;
private boolean fEnableDSProcessing = false;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a nit, and more an observation because and I see the existing fields are initialized with an explicit false. But that's actually pointless because it's the default value, and is actually even a little worse than pointless because it generates pointless byte code that much set the value that is already false to false.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, do you want me to change it in just my field or in the existing ones as well?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, there is also value in consistency in the code.

@laeubi

Maybe we eventfully add a cleanup to remove pointless default assignment of null, 0 (including all primitive zero defaults), and false...

private boolean fE4Plugin = false;
private final ArrayList<ITemplateSection> templates = new ArrayList<>();

Expand Down Expand Up @@ -89,6 +90,24 @@ public void setEnableAPITooling(boolean enable) {
fSetupAPITooling = enable;
}

/**
* @return whether Declarative Services processing should be enabled in the
* plugin when created
*/
public boolean doEnableDSProcessing() {
return fEnableDSProcessing;
}

/**
* Set whether Declarative Services processing should be enabled in the plugin
* when created
*
* @param enable whether to enable DS processing
*/
public void setEnableDSProcessing(boolean enable) {
fEnableDSProcessing = enable;
}

public boolean isE4Plugin() {
return fE4Plugin;
}
Expand Down
Loading