Merge branch 'master' of git.labs.intellij.net:idea/community

This commit is contained in:
alexey.chmutov
2009-10-21 11:45:33 +04:00
18 changed files with 594 additions and 128 deletions
@@ -134,7 +134,7 @@ public class ManifestFileUtil {
}
}
public static void updateManifest(VirtualFile file, ManifestFileConfiguration configuration) {
public static void updateManifest(VirtualFile file, ManifestFileConfiguration configuration, final boolean replaceValues) {
final Manifest manifest = readManifest(file);
final Attributes mainAttributes = manifest.getMainAttributes();
@@ -142,17 +142,34 @@ public class ManifestFileUtil {
if (mainClass != null) {
mainAttributes.put(Attributes.Name.MAIN_CLASS, mainClass);
}
else {
else if (replaceValues) {
mainAttributes.remove(Attributes.Name.MAIN_CLASS);
}
final List<String> classpath = configuration.getClasspath();
if (classpath != null && !classpath.isEmpty()) {
mainAttributes.put(Attributes.Name.CLASS_PATH, StringUtil.join(classpath, " "));
List<String> updatedClasspath;
if (replaceValues) {
updatedClasspath = classpath;
}
else {
updatedClasspath = new ArrayList<String>();
final String oldClasspath = (String)mainAttributes.get(Attributes.Name.CLASS_PATH);
if (!StringUtil.isEmpty(oldClasspath)) {
updatedClasspath.addAll(StringUtil.split(oldClasspath, " "));
}
for (String path : classpath) {
if (!updatedClasspath.contains(path)) {
updatedClasspath.add(path);
}
}
}
mainAttributes.put(Attributes.Name.CLASS_PATH, StringUtil.join(updatedClasspath, " "));
}
else {
else if (replaceValues) {
mainAttributes.remove(Attributes.Name.CLASS_PATH);
}
ManifestBuilder.setVersionAttribute(mainAttributes);
try {
@@ -67,7 +67,7 @@ public class ManifestFilesInfo {
}
}
ManifestFileUtil.updateManifest(file, configuration);
ManifestFileUtil.updateManifest(file, configuration, true);
}
}
@@ -56,12 +56,15 @@ public class PutSourceItemIntoParentAndLinkViaManifestAction extends PutIntoDefa
}
boolean enable = parentInfo != null;
boolean isProvideElements = false;
for (PackagingSourceItem item : mySourceItemsTree.getSelectedItems()) {
isProvideElements |= item.isProvideElements();
if (!item.getKindOfProducedElements().containsJarFiles()) {
enable = false;
break;
}
}
enable &= isProvideElements;
presentation.setVisible(enable);
presentation.setEnabled(enable);
}
@@ -256,7 +256,10 @@ public class UnscrambleDialog extends DialogWrapper{
static String normalizeText(@NonNls String text) {
StringBuilder builder = new StringBuilder(text.length());
text = text.replaceAll("(\\S[ \\t\\x0B\\f\\r]+)(at\\s+)", "$1\n$2");
String[] lines = text.split("\n");
boolean first = true;
boolean inAuxInfo = false;
for (String line : lines) {