Map optionsToSet = new HashMap();
LangUtil.throwIaxIfNull(optionsToSet, "javaOptions");
- if (options.getSourceOnePointFourMode()) {
- optionsToSet.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_4);
+ if (options.getSourceCompatibilityLevel() != null && options.getSourceCompatibilityLevel().equals(CompilerOptions.VERSION_1_5)) {
+ optionsToSet.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
+ optionsToSet.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
+ } else if (options.getSourceOnePointFourMode()
+ || options.getSourceCompatibilityLevel() != null && options.getSourceCompatibilityLevel().equals(CompilerOptions.VERSION_1_4)) {
+ optionsToSet.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_4);
optionsToSet.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_4);
}
slVersion = CompilerOptions.VERSION_1_3;
}
// never set a lower source level than compliance level
- String setCompliance = (String) optionsToSet.get( CompilerOptions.OPTION_Compliance);
- if ( ! (setCompliance.equals( CompilerOptions.VERSION_1_4 )
+ // Mik: prepended with 1.5 check
+ if (sourceLevel.equals(CompilerOptions.VERSION_1_5)) {
+ optionsToSet.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
+ } else {
+ String setCompliance = (String) optionsToSet.get( CompilerOptions.OPTION_Compliance);
+ if ( ! (setCompliance.equals(CompilerOptions.VERSION_1_4 )
&& slVersion.equals(CompilerOptions.VERSION_1_3)) ) {
- optionsToSet.put(CompilerOptions.OPTION_Source, slVersion);
+ optionsToSet.put(CompilerOptions.OPTION_Source, slVersion);
+ }
}
}
import javax.swing.border.TitledBorder;
import org.aspectj.ajde.Ajde;
+import org.aspectj.org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+
import javax.swing.*;
import java.awt.*;
JTextArea incrementalNote = new JTextArea();
JLabel spacer_label = new JLabel();
JCheckBox assertions_checkBox = new JCheckBox();
+ JCheckBox oneFive_checkBox = new JCheckBox();
Box options_box = Box.createVerticalBox();
JCheckBox incremental_checkBox = new JCheckBox();
JCheckBox useJavac_checkBox = new JCheckBox();
}
}
- public void loadOptions() throws IOException {
- assertions_checkBox.setSelected(
- Ajde.getDefault().getBuildManager().getBuildOptions().getSourceOnePointFourMode()
- );
+ public void loadOptions() throws IOException {
+ if (Ajde.getDefault().getBuildManager().getBuildOptions().getSourceCompatibilityLevel() != null) {
+ oneFive_checkBox.setSelected(
+ Ajde.getDefault().getBuildManager().getBuildOptions().getSourceCompatibilityLevel().equals(CompilerOptions.VERSION_1_5)
+ );
+ }
+ if (Ajde.getDefault().getBuildManager().getBuildOptions().getSourceCompatibilityLevel() != null) {
+ assertions_checkBox.setSelected(
+ Ajde.getDefault().getBuildManager().getBuildOptions().getSourceCompatibilityLevel().equals(CompilerOptions.VERSION_1_4)
+ );
+ }
preprocess_checkBox.setSelected(
Ajde.getDefault().getBuildManager().getBuildOptions().getPreprocessMode()
);
}
public void saveOptions() throws IOException {
- AjdeUIManager.getDefault().getBuildOptions().setSourceOnePointFourMode(
- assertions_checkBox.isSelected()
- );
+ if (oneFive_checkBox.isSelected()) {
+ AjdeUIManager.getDefault().getBuildOptions().setSourceCompatibilityLevel(CompilerOptions.VERSION_1_5);
+ } else if (assertions_checkBox.isSelected()) {
+ AjdeUIManager.getDefault().getBuildOptions().setSourceOnePointFourMode(true);
+ AjdeUIManager.getDefault().getBuildOptions().setSourceCompatibilityLevel(CompilerOptions.VERSION_1_4);
+ } else {
+ AjdeUIManager.getDefault().getBuildOptions().setSourceCompatibilityLevel(CompilerOptions.VERSION_1_3);
+ }
AjdeUIManager.getDefault().getBuildOptions().setPreprocessMode(
preprocess_checkBox.isSelected()
);
incrementalNote.setText(INCREMENTAL_NOTE);
spacer_label.setText(" ");
assertions_checkBox.setFont(new java.awt.Font("Dialog", 0, 11));
- assertions_checkBox.setText("Support assertions from 1.4 Java specification");
+ assertions_checkBox.setText("Java 1.4 source compatibility mode");
+ oneFive_checkBox.setFont(new java.awt.Font("Dialog", 0, 11));
+ oneFive_checkBox.setText("Java 1.5 source compatibility mode");
incremental_checkBox.setText("Incremental compile");
incremental_checkBox.setToolTipText("Only recompile necessary sources.");
incremental_checkBox.setFont(new java.awt.Font("Dialog", 0, 11));
options_box2.add(spacer_label1, null);
compileOptions_panel.add(options_box, BorderLayout.NORTH);
options_box.add(assertions_checkBox, null);
+ options_box.add(oneFive_checkBox, null);
options_box.add(preprocess_checkBox, null);
options_box.add(useJavac_checkBox, null);
options_box.add(incremental_checkBox, null);