Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTill Brychcy2018-02-12 17:43:44 -0500
committerTill Brychcy2018-02-19 16:43:59 -0500
commit86b105d1761e70cf1cca4f74c60ede1ff3f77520 (patch)
treefb39f9a1d3a763b9a70d044cb351e44b837b2504 /org.eclipse.jdt.apt.ui
parente603dedfdfd718d3d302f1cd90c78085d81e98f0 (diff)
downloadeclipse.jdt.core-86b105d1761e70cf1cca4f74c60ede1ff3f77520.tar.gz
eclipse.jdt.core-86b105d1761e70cf1cca4f74c60ede1ff3f77520.tar.xz
eclipse.jdt.core-86b105d1761e70cf1cca4f74c60ede1ff3f77520.zip
Bug 531072 - [testsources][apt] classes generated for test sources need
to be put in a test source folder Change-Id: Ieb06760c55d8fe3bd04954ca13d1b9fb4f67d846
Diffstat (limited to 'org.eclipse.jdt.apt.ui')
-rw-r--r--org.eclipse.jdt.apt.ui/.settings/.api_filters11
-rw-r--r--org.eclipse.jdt.apt.ui/META-INF/MANIFEST.MF8
-rw-r--r--org.eclipse.jdt.apt.ui/pom.xml2
-rw-r--r--org.eclipse.jdt.apt.ui/src/org/eclipse/jdt/apt/ui/internal/preferences/AptConfigurationBlock.java52
-rw-r--r--org.eclipse.jdt.apt.ui/src/org/eclipse/jdt/apt/ui/internal/preferences/Messages.java6
-rw-r--r--org.eclipse.jdt.apt.ui/src/org/eclipse/jdt/apt/ui/internal/preferences/messages.properties4
6 files changed, 73 insertions, 10 deletions
diff --git a/org.eclipse.jdt.apt.ui/.settings/.api_filters b/org.eclipse.jdt.apt.ui/.settings/.api_filters
new file mode 100644
index 0000000000..1752455cc3
--- /dev/null
+++ b/org.eclipse.jdt.apt.ui/.settings/.api_filters
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<component id="org.eclipse.jdt.apt.ui" version="2">
+ <resource path="META-INF/MANIFEST.MF">
+ <filter comment="increased to match org.eclipse.jdt.apt.core" id="926941240">
+ <message_arguments>
+ <message_argument value="3.6.0"/>
+ <message_argument value="3.5.0"/>
+ </message_arguments>
+ </filter>
+ </resource>
+</component>
diff --git a/org.eclipse.jdt.apt.ui/META-INF/MANIFEST.MF b/org.eclipse.jdt.apt.ui/META-INF/MANIFEST.MF
index 4a30354518..2b64d27fc7 100644
--- a/org.eclipse.jdt.apt.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.apt.ui/META-INF/MANIFEST.MF
@@ -2,12 +2,12 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.apt.ui; singleton:=true
-Bundle-Version: 3.5.100.qualifier
+Bundle-Version: 3.6.0.qualifier
Bundle-Activator: org.eclipse.jdt.apt.ui.internal.AptUIPlugin
Bundle-Localization: plugin
-Require-Bundle: org.eclipse.jdt.apt.core;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.jdt.ui;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.jdt.core;bundle-version="[3.2.0,4.0.0)",
+Require-Bundle: org.eclipse.jdt.apt.core;bundle-version="[3.6.0,4.0.0)",
+ org.eclipse.jdt.ui;bundle-version="[3.14.0,4.0.0)",
+ org.eclipse.jdt.core;bundle-version="[3.14.0,4.0.0)",
org.eclipse.ui;bundle-version="[3.5.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
diff --git a/org.eclipse.jdt.apt.ui/pom.xml b/org.eclipse.jdt.apt.ui/pom.xml
index ea45edcf06..eb7bebb8a0 100644
--- a/org.eclipse.jdt.apt.ui/pom.xml
+++ b/org.eclipse.jdt.apt.ui/pom.xml
@@ -18,6 +18,6 @@
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.apt.ui</artifactId>
- <version>3.5.100-SNAPSHOT</version>
+ <version>3.6.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/org.eclipse.jdt.apt.ui/src/org/eclipse/jdt/apt/ui/internal/preferences/AptConfigurationBlock.java b/org.eclipse.jdt.apt.ui/src/org/eclipse/jdt/apt/ui/internal/preferences/AptConfigurationBlock.java
index 4824e3dbb4..2527f2c53f 100644
--- a/org.eclipse.jdt.apt.ui/src/org/eclipse/jdt/apt/ui/internal/preferences/AptConfigurationBlock.java
+++ b/org.eclipse.jdt.apt.ui/src/org/eclipse/jdt/apt/ui/internal/preferences/AptConfigurationBlock.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2015 BEA Systems, Inc. and others.
+ * Copyright (c) 2005, 2018 BEA Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -77,6 +77,7 @@ public class AptConfigurationBlock extends BaseConfigurationBlock {
private static final Key KEY_APTENABLED= getKey(AptPlugin.PLUGIN_ID, AptPreferenceConstants.APT_ENABLED);
private static final Key KEY_RECONCILEENABLED= getKey(AptPlugin.PLUGIN_ID, AptPreferenceConstants.APT_RECONCILEENABLED);
private static final Key KEY_GENSRCDIR= getKey(AptPlugin.PLUGIN_ID, AptPreferenceConstants.APT_GENSRCDIR);
+ private static final Key KEY_GENTESTSRCDIR= getKey(AptPlugin.PLUGIN_ID, AptPreferenceConstants.APT_GENTESTSRCDIR);
private static Key[] getAllKeys() {
return new Key[] {
@@ -93,6 +94,7 @@ public class AptConfigurationBlock extends BaseConfigurationBlock {
private SelectionButtonDialogField fAptEnabledField;
private SelectionButtonDialogField fReconcileEnabledField;
private StringDialogField fGenSrcDirField;
+ private StringDialogField fGenTestSrcDirField;
private ListDialogField<ProcessorOption> fProcessorOptionsField;
private PixelConverter fPixelConverter;
@@ -100,6 +102,7 @@ public class AptConfigurationBlock extends BaseConfigurationBlock {
private Map<String, String> fOriginalProcOptions; // cache of saved values
private String fOriginalGenSrcDir;
+ private String fOriginalGenTestSrcDir;
private boolean fOriginalAptEnabled;
private boolean fOriginalReconcileEnabled;
@@ -218,7 +221,11 @@ public class AptConfigurationBlock extends BaseConfigurationBlock {
fGenSrcDirField = new StringDialogField();
fGenSrcDirField.setDialogFieldListener(adapter);
fGenSrcDirField.setLabelText(Messages.AptConfigurationBlock_generatedSrcDir);
-
+
+ fGenTestSrcDirField = new StringDialogField();
+ fGenTestSrcDirField.setDialogFieldListener(adapter);
+ fGenTestSrcDirField.setLabelText(Messages.AptConfigurationBlock_generatedTestSrcDir);
+
String[] buttons= new String[] {
Messages.AptConfigurationBlock_add,
Messages.AptConfigurationBlock_edit,
@@ -254,7 +261,8 @@ public class AptConfigurationBlock extends BaseConfigurationBlock {
if (workspaceSettings)
return null;
// if the only thing that changed was the reconcile setting, return null: a rebuild is not necessary
- if (fOriginalGenSrcDir.equals(fGenSrcDirField.getText())) {
+ if (fOriginalGenSrcDir.equals(fGenSrcDirField.getText())
+ && fOriginalGenTestSrcDir.equals(fGenTestSrcDirField.getText())) {
if (fOriginalAptEnabled == fAptEnabledField.isSelected()) {
if (!procOptionsChanged()) {
return null;
@@ -311,11 +319,13 @@ public class AptConfigurationBlock extends BaseConfigurationBlock {
fAptEnabledField,
fReconcileEnabledField,
fGenSrcDirField,
+ fGenTestSrcDirField,
fProcessorOptionsField,
} :
new DialogField[] {
fReconcileEnabledField,
fGenSrcDirField,
+ fGenTestSrcDirField,
fProcessorOptionsField,
};
LayoutUtil.doDefaultLayout(fBlockControl, fields, true, SWT.DEFAULT, SWT.DEFAULT);
@@ -337,6 +347,7 @@ public class AptConfigurationBlock extends BaseConfigurationBlock {
super.cacheOriginalValues();
fOriginalProcOptions= AptConfig.getRawProcessorOptions(fJProj);
fOriginalGenSrcDir = AptConfig.getGenSrcDir(fJProj);
+ fOriginalGenTestSrcDir = AptConfig.getGenTestSrcDir(fJProj);
fOriginalAptEnabled = AptConfig.isEnabled(fJProj);
fOriginalReconcileEnabled = AptConfig.shouldProcessDuringReconcile(fJProj);
fPerProjSettingsEnabled = hasProjectSpecificOptionsNoCache(fProject);
@@ -366,6 +377,9 @@ public class AptConfigurationBlock extends BaseConfigurationBlock {
if (!fOriginalGenSrcDir.equals(AptConfig.getGenSrcDir(null))) {
fAptProject.preferenceChanged(AptPreferenceConstants.APT_GENSRCDIR);
}
+ if (!fOriginalGenTestSrcDir.equals(AptConfig.getGenTestSrcDir(null))) {
+ fAptProject.preferenceChanged(AptPreferenceConstants.APT_GENTESTSRCDIR);
+ }
if (fOriginalAptEnabled != AptConfig.isEnabled(null)) {
// make JDT "processingEnabled" setting track APT "enabled" setting.
setJDTProcessAnnotationsSetting(fAptEnabledField.isSelected());
@@ -379,6 +393,8 @@ public class AptConfigurationBlock extends BaseConfigurationBlock {
else { // compare against current settings
if (!fOriginalGenSrcDir.equals(fGenSrcDirField.getText()))
fAptProject.preferenceChanged(AptPreferenceConstants.APT_GENSRCDIR);
+ if (!fOriginalGenTestSrcDir.equals(fGenTestSrcDirField.getText()))
+ fAptProject.preferenceChanged(AptPreferenceConstants.APT_GENTESTSRCDIR);
boolean isAptEnabled = fAptEnabledField.isSelected();
if (fOriginalAptEnabled != isAptEnabled) {
// make JDT "processingEnabled" setting track APT "enabled" setting.
@@ -460,6 +476,11 @@ public class AptConfigurationBlock extends BaseConfigurationBlock {
IStatus status = null;
status = validateGenSrcDir();
+
+ if (status.getSeverity() == IStatus.OK) {
+ status = validateGenTestSrcDir();
+ }
+
if (status.getSeverity() == IStatus.OK) {
status = validateProcessorOptions();
}
@@ -487,6 +508,26 @@ public class AptConfigurationBlock extends BaseConfigurationBlock {
}
/**
+ * Validate "generated test source directory" setting. It must be a valid
+ * pathname relative to a project, and must not be a source directory.
+ * @return true if current field value is valid
+ */
+ private IStatus validateGenTestSrcDir() {
+ String dirName = fGenTestSrcDirField.getText();
+ if (!AptConfig.validateGenSrcDir(fJProj, dirName)) {
+ return new StatusInfo(IStatus.ERROR, Messages.AptConfigurationBlock_genTestSrcDirMustBeValidRelativePath);
+ }
+ boolean TODO; // check it is not same as validateGenSrcDir, make sure it has its own output folder
+ if (fJProj != null && !dirName.equals(fOriginalGenTestSrcDir)) {
+ IFolder folder = fJProj.getProject().getFolder( dirName );
+ if (folder != null && folder.exists() && !folder.isDerived()) {
+ return new StatusInfo(IStatus.WARNING, Messages.AptConfigurationBlock_warningContentsMayBeDeleted);
+ }
+ }
+ return new StatusInfo();
+ }
+
+ /**
* Validate the currently set processor options. We do this by
* looking at the table contents rather than the packed string,
* just because it's easier.
@@ -516,6 +557,8 @@ public class AptConfigurationBlock extends BaseConfigurationBlock {
fReconcileEnabledField.setSelection(reconcileEnabled);
String str= getValue(KEY_GENSRCDIR);
fGenSrcDirField.setText(str == null ? "" : str); //$NON-NLS-1$
+ String teststr= getValue(KEY_GENTESTSRCDIR);
+ fGenTestSrcDirField.setText(teststr == null ? "" : teststr); //$NON-NLS-1$
}
/**
@@ -529,6 +572,9 @@ public class AptConfigurationBlock extends BaseConfigurationBlock {
} else if (field == fGenSrcDirField) {
String newVal = fGenSrcDirField.getText();
setValue(KEY_GENSRCDIR, newVal);
+ } else if (field == fGenTestSrcDirField) {
+ String newVal = fGenTestSrcDirField.getText();
+ setValue(KEY_GENTESTSRCDIR, newVal);
} else if (field == fReconcileEnabledField) {
String newVal = String.valueOf(fReconcileEnabledField.isSelected());
setValue(KEY_RECONCILEENABLED, newVal);
diff --git a/org.eclipse.jdt.apt.ui/src/org/eclipse/jdt/apt/ui/internal/preferences/Messages.java b/org.eclipse.jdt.apt.ui/src/org/eclipse/jdt/apt/ui/internal/preferences/Messages.java
index c4bf99358e..e73517ea15 100644
--- a/org.eclipse.jdt.apt.ui/src/org/eclipse/jdt/apt/ui/internal/preferences/Messages.java
+++ b/org.eclipse.jdt.apt.ui/src/org/eclipse/jdt/apt/ui/internal/preferences/Messages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 BEA Systems, Inc and others.
+ * Copyright (c) 2005, 2018 BEA Systems, Inc and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -31,6 +31,8 @@ public class Messages extends NLS {
public static String AptConfigurationBlock_generatedSrcDir;
+ public static String AptConfigurationBlock_generatedTestSrcDir;
+
public static String AptConfigurationBlock_options;
public static String FactoryPathConfigurationBlock_up;
@@ -99,6 +101,8 @@ public class Messages extends NLS {
public static String AptConfigurationBlock_genSrcDirMustBeValidRelativePath;
+ public static String AptConfigurationBlock_genTestSrcDirMustBeValidRelativePath;
+
public static String FactoryPathConfigurationBlock_advanced;
public static String AdvancedFactoryPathOptionsDialog_advancedOptions;
diff --git a/org.eclipse.jdt.apt.ui/src/org/eclipse/jdt/apt/ui/internal/preferences/messages.properties b/org.eclipse.jdt.apt.ui/src/org/eclipse/jdt/apt/ui/internal/preferences/messages.properties
index d07f4d9523..c297b97f63 100644
--- a/org.eclipse.jdt.apt.ui/src/org/eclipse/jdt/apt/ui/internal/preferences/messages.properties
+++ b/org.eclipse.jdt.apt.ui/src/org/eclipse/jdt/apt/ui/internal/preferences/messages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2005, 2007 BEA Systems, Inc.
+# Copyright (c) 2005, 2018 BEA Systems, Inc.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -12,10 +12,12 @@ AptConfigurationBlock_edit=&Edit...
AptConfigurationBlock_remove=&Remove
AptConfigurationBlock_value=Value
AptConfigurationBlock_generatedSrcDir=&Generated source directory:
+AptConfigurationBlock_generatedTestSrcDir=&Generated test source directory:
AptConfigurationBlock_warningIgnoredOptions=An automatically set option will override this option
AptConfigurationBlock_warningContentsMayBeDeleted=Contents of generated source directory may be deleted
AptConfigurationBlock_enableReconcileProcessing=Enable processing in edito&r
AptConfigurationBlock_genSrcDirMustBeValidRelativePath=Generated source directory must be a valid relative path
+AptConfigurationBlock_genTestSrcDirMustBeValidRelativePath=Generated test source directory must be a valid relative path
AptConfigurationBlock_options=Processor options (-Akey=value):
AptPreferencePage_preferences=Specify the default annotation processor settings for new projects:
AptPreferencePage_preferencesTitle=Java Annotation Processing Preferences

Back to the top