IDEA-111616 External System: Run Configurations: project selector passes selected project to default run configurations

This commit is contained in:
Denis.Zhdanov
2013-08-07 12:33:47 +04:00
parent 7cae3485cc
commit fd582aadbf
3 changed files with 18 additions and 4 deletions
@@ -405,11 +405,22 @@ public class ExternalSystemApiUtil {
@NotNull
public static String getProjectRepresentationName(@NotNull String targetProjectPath, @Nullable String rootProjectPath) {
if (rootProjectPath == null) {
return new File(targetProjectPath).getParentFile().getName();
File rootProjectDir = new File(targetProjectPath);
if (rootProjectDir.isFile()) {
rootProjectDir = rootProjectDir.getParentFile();
}
return rootProjectDir.getName();
}
File rootProjectDir = new File(rootProjectPath);
if (rootProjectDir.isFile()) {
rootProjectDir = rootProjectDir.getParentFile();
}
File targetProjectDir = new File(targetProjectPath);
if (targetProjectDir.isFile()) {
targetProjectDir = targetProjectDir.getParentFile();
}
File rootProjectDir = new File(rootProjectPath).getParentFile();
StringBuilder buffer = new StringBuilder();
for (File f = new File(targetProjectPath).getParentFile(); f != null && !FileUtil.filesEqual(f, rootProjectDir); f = f.getParentFile()) {
for (File f = targetProjectDir; f != null && !FileUtil.filesEqual(f, rootProjectDir); f = f.getParentFile()) {
buffer.insert(0, f.getName()).insert(0, ":");
}
buffer.insert(0, rootProjectDir.getName());
@@ -117,7 +117,7 @@ public class ExternalSystemTaskSettingsControl implements ExternalSystemSettings
String path = myOriginalSettings.getExternalProjectPath();
if (StringUtil.isEmpty(path)) {
path = ExternalSystemApiUtil.getLastUsedExternalProjectPath(myExternalSystemId);
path = "";
}
myProjectPathField.setText(path);
myTasksTextField.setText(StringUtil.join(myOriginalSettings.getTaskNames(), " "));
@@ -241,6 +241,9 @@ public class ExternalProjectPathField extends ComponentWithBrowseButton<External
foldingModel.runBatchFoldingOperation(new Runnable() {
@Override
public void run() {
for (FoldRegion region : foldingModel.getAllFoldRegions()) {
foldingModel.removeFoldRegion(region);
}
FoldRegion region = foldingModel.addFoldRegion(0, editor.getDocument().getTextLength(), placeholder);
if (region != null) {
region.setExpanded(false);