$MODULE_DIR$ as default working directory for app, junit, testng - anyway once chosen it won't disappear after module switch to <no module>; inspired by IDEA-71694

This commit is contained in:
anna
2011-07-11 09:40:43 +04:00
parent 9a34cd0ae9
commit a369775242
4 changed files with 11 additions and 1 deletions
@@ -45,6 +45,7 @@ public class ApplicationConfigurable extends SettingsEditor<ApplicationConfigura
public ApplicationConfigurable(final Project project) {
myModuleSelector = new ConfigurationModuleSelector(project, myModule.getComponent());
myCommonProgramParameters.setModuleContext(myModuleSelector.getModule());
myModule.getComponent().addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
myCommonProgramParameters.setModuleContext(myModuleSelector.getModule());
@@ -51,6 +51,7 @@ public class CommonProgramParametersPanel extends JPanel {
private EnvironmentVariablesComponent myEnvVariablesComponent;
private Module myModuleContext = null;
private boolean myHaveModuleContext = false;
public CommonProgramParametersPanel() {
super();
@@ -83,7 +84,7 @@ public class CommonProgramParametersPanel extends JPanel {
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
final List<String> macros = new ArrayList<String>(PathMacros.getInstance().getUserMacroNames());
if (myModuleContext != null) macros.add("MODULE_DIR");
if (myHaveModuleContext) macros.add("MODULE_DIR");
final JList list = new JBList(ArrayUtil.toStringArray(macros));
final JBPopup popup = JBPopupFactory.getInstance().createListPopupBuilder(list).setItemChoosenCallback(new Runnable() {
@@ -138,6 +139,7 @@ public class CommonProgramParametersPanel extends JPanel {
public void setModuleContext(Module moduleContext) {
myModuleContext = moduleContext;
myHaveModuleContext = true;
}
public LabeledComponent<RawCommandLineEditor> getProgramParametersComponent() {
@@ -111,6 +111,7 @@ public class JUnitConfigurable extends SettingsEditor<JUnitConfiguration> {
public JUnitConfigurable(final Project project) {
myModel = new JUnitConfigurationModel(project);
myModuleSelector = new ConfigurationModuleSelector(project, getModulesComponent());
myCommonJavaParameters.setModuleContext(myModuleSelector.getModule());
myModule.getComponent().addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
myCommonJavaParameters.setModuleContext(myModuleSelector.getModule());
@@ -108,6 +108,12 @@ public class TestNGConfigurationEditor extends SettingsEditor<TestNGConfiguratio
model.setListener(this);
createView();
moduleSelector = new ConfigurationModuleSelector(project, getModulesComponent());
commonJavaParameters.setModuleContext(moduleSelector.getModule());
moduleClasspath.getComponent().addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
commonJavaParameters.setModuleContext(moduleSelector.getModule());
}
});
registerListener(new JRadioButton[] {packageTest, classTest, methodTest, groupTest, suiteTest}, new ChangeListener()
{
public void stateChanged(ChangeEvent e) {