mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -182,7 +182,7 @@ public class JavaLexer extends LexerBase {
|
||||
}
|
||||
catch (IOException e) { /* impossible */ }
|
||||
catch (Error e) {
|
||||
throw new IllegalArgumentException("Non-parsable text `" + myBuffer + "`");
|
||||
throw new IllegalArgumentException("Non-parsable text `" + myBuffer + "`", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,6 +24,7 @@ import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -51,7 +52,7 @@ public class CanonicalTypes {
|
||||
private abstract static class AnnotatedType extends Type {
|
||||
protected final PsiAnnotation[] myAnnotations;
|
||||
|
||||
protected AnnotatedType(PsiAnnotation[] annotations) {
|
||||
protected AnnotatedType(@NotNull PsiAnnotation[] annotations) {
|
||||
myAnnotations = annotations;
|
||||
}
|
||||
}
|
||||
@@ -59,7 +60,7 @@ public class CanonicalTypes {
|
||||
private static class Primitive extends AnnotatedType {
|
||||
private final PsiPrimitiveType myType;
|
||||
|
||||
private Primitive(PsiPrimitiveType type) {
|
||||
private Primitive(@NotNull PsiPrimitiveType type) {
|
||||
super(type.getAnnotations());
|
||||
myType = type;
|
||||
}
|
||||
@@ -79,7 +80,7 @@ public class CanonicalTypes {
|
||||
private static class Array extends AnnotatedType {
|
||||
protected final Type myComponentType;
|
||||
|
||||
private Array(PsiType original, Type componentType) {
|
||||
private Array(@NotNull PsiType original, @NotNull Type componentType) {
|
||||
super(original.getAnnotations());
|
||||
myComponentType = componentType;
|
||||
}
|
||||
@@ -107,7 +108,7 @@ public class CanonicalTypes {
|
||||
}
|
||||
|
||||
private static class Ellipsis extends Array {
|
||||
private Ellipsis(PsiType original, Type componentType) {
|
||||
private Ellipsis(@NotNull PsiType original, @NotNull Type componentType) {
|
||||
super(original, componentType);
|
||||
}
|
||||
|
||||
@@ -127,7 +128,7 @@ public class CanonicalTypes {
|
||||
private final boolean myIsExtending;
|
||||
private final Type myBound;
|
||||
|
||||
private WildcardType(PsiType original, boolean isExtending, Type bound) {
|
||||
private WildcardType(@NotNull PsiType original, boolean isExtending, @Nullable Type bound) {
|
||||
super(original.getAnnotations());
|
||||
myIsExtending = isExtending;
|
||||
myBound = bound;
|
||||
@@ -176,7 +177,7 @@ public class CanonicalTypes {
|
||||
private final String myPresentableText;
|
||||
private final String myCanonicalText;
|
||||
|
||||
private UnresolvedType(PsiType original) {
|
||||
private UnresolvedType(@NotNull PsiType original) {
|
||||
myPresentableText = original.getPresentableText();
|
||||
myCanonicalText = original.getCanonicalText(true);
|
||||
}
|
||||
@@ -203,7 +204,7 @@ public class CanonicalTypes {
|
||||
private final String myClassQName;
|
||||
private final Map<String, Type> mySubstitutor;
|
||||
|
||||
private ClassType(PsiType original, String classQName, Map<String, Type> substitutor) {
|
||||
private ClassType(@NotNull PsiType original, @NotNull String classQName, @NotNull Map<String, Type> substitutor) {
|
||||
super(original.getAnnotations());
|
||||
myPresentableText = original.getPresentableText();
|
||||
myClassQName = classQName;
|
||||
|
||||
@@ -27,11 +27,12 @@ import com.intellij.testFramework.ProjectRule
|
||||
import com.intellij.testFramework.TemporaryDirectory
|
||||
import com.intellij.util.SmartList
|
||||
import com.intellij.util.lang.CompoundRuntimeException
|
||||
import com.intellij.util.xmlb.SerializationFilter
|
||||
import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters
|
||||
import com.intellij.util.xmlb.XmlSerializer
|
||||
import com.intellij.util.xmlb.annotations.Attribute
|
||||
import com.intellij.util.xmlb.annotations.Tag
|
||||
import com.intellij.util.xmlb.annotations.Transient
|
||||
import com.intellij.util.xmlb.serialize
|
||||
import com.intellij.util.xmlb.toByteArray
|
||||
import gnu.trove.THashMap
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
@@ -146,7 +147,7 @@ class SchemeManagerTest {
|
||||
}
|
||||
|
||||
fun TestScheme.save(file: File) {
|
||||
FileUtil.writeToFile(file, serialize().toByteArray())
|
||||
FileUtil.writeToFile(file, _serialize().toByteArray())
|
||||
}
|
||||
|
||||
public Test fun `different extensions`() {
|
||||
@@ -389,11 +390,13 @@ public data class TestScheme(@Attribute private var name: String = "", @Attribut
|
||||
public open class TestSchemesProcessor : BaseSchemeProcessor<TestScheme>() {
|
||||
override fun readScheme(element: Element) = XmlSerializer.deserialize(element, javaClass<TestScheme>())
|
||||
|
||||
override fun writeScheme(scheme: TestScheme) = scheme.serialize()
|
||||
override fun writeScheme(scheme: TestScheme) = scheme._serialize()
|
||||
}
|
||||
|
||||
fun SchemeManagerImpl<*, *>.save() {
|
||||
val errors = SmartList<Throwable>()
|
||||
save(errors)
|
||||
CompoundRuntimeException.doThrow(errors)
|
||||
}
|
||||
}
|
||||
|
||||
public fun <T : Any> T._serialize(filter: SerializationFilter? = SkipDefaultValuesSerializationFilters()): Element = XmlSerializer.serialize(this, filter)
|
||||
@@ -624,6 +624,13 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx {
|
||||
myGuardsSuppressed = true;
|
||||
}
|
||||
|
||||
// This data is used during the immediate editor painting to detect whether PSI synchronization is in progress.
|
||||
// PsiToDocumentSynchronizer.doCommitTransaction should probably perform bulk document updates.
|
||||
// TODO Remove this getter later
|
||||
public boolean isGuardsSuppressed() {
|
||||
return myGuardsSuppressed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unSuppressGuardedExceptions() {
|
||||
myGuardsSuppressed = false;
|
||||
|
||||
@@ -242,7 +242,7 @@ public abstract class GotoTargetHandler implements CodeInsightActionHandler {
|
||||
};
|
||||
}
|
||||
|
||||
protected static PsiElementListCellRenderer createRenderer(GotoData gotoData, PsiElement eachTarget) {
|
||||
public static PsiElementListCellRenderer createRenderer(GotoData gotoData, PsiElement eachTarget) {
|
||||
PsiElementListCellRenderer renderer = null;
|
||||
for (GotoTargetRendererProvider eachProvider : Extensions.getExtensions(GotoTargetRendererProvider.EP_NAME)) {
|
||||
renderer = eachProvider.getRenderer(eachTarget, gotoData);
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.intellij.find.FindSettings;
|
||||
import com.intellij.find.actions.ShowUsagesAction;
|
||||
import com.intellij.ide.util.scopeChooser.ScopeChooserCombo;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
@@ -647,7 +648,7 @@ public class FindDialog extends DialogWrapper {
|
||||
pane.insertTab("Options", null, optionsPanel, null, 0);
|
||||
pane.insertTab(PREVIEW_TITLE, null, myPreviewSplitter, null, RESULTS_PREVIEW_TAB_INDEX);
|
||||
myContent = pane;
|
||||
AnAction anAction = new AnAction() {
|
||||
final AnAction anAction = new AnAction() {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
int selectedIndex = myContent.getSelectedIndex();
|
||||
@@ -656,7 +657,16 @@ public class FindDialog extends DialogWrapper {
|
||||
};
|
||||
|
||||
final ShortcutSet shortcutSet = ActionManager.getInstance().getAction(IdeActions.ACTION_SWITCHER).getShortcutSet();
|
||||
anAction.registerCustomShortcutSet(shortcutSet, getRootPane());
|
||||
final JRootPane rootPane = getRootPane();
|
||||
|
||||
anAction.registerCustomShortcutSet(shortcutSet, rootPane);
|
||||
Disposer.register(myDisposable, new Disposable() {
|
||||
@Override
|
||||
public void dispose() {
|
||||
anAction.unregisterCustomShortcutSet(rootPane);
|
||||
}
|
||||
});
|
||||
|
||||
if (myPreviewResultsTabWasSelected) myContent.setSelectedIndex(RESULTS_PREVIEW_TAB_INDEX);
|
||||
|
||||
return pane.getComponent();
|
||||
|
||||
@@ -37,6 +37,7 @@ import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.command.UndoConfirmationPolicy;
|
||||
import com.intellij.openapi.command.undo.UndoManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.*;
|
||||
import com.intellij.openapi.editor.actionSystem.*;
|
||||
@@ -2174,8 +2175,13 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
print(g, newText, point, ascent, font, color);
|
||||
}
|
||||
|
||||
private static boolean canPaintImmediately(@NotNull DocumentEvent e) {
|
||||
return !contains(e.getOldFragment(), '\n') &&
|
||||
private boolean canPaintImmediately(@NotNull DocumentEvent e) {
|
||||
UndoManager undoManager = UndoManager.getInstance(myProject);
|
||||
return !undoManager.isUndoInProgress() && // Undo / Redo actions might start multiple write actions and make multiple document changes.
|
||||
!undoManager.isRedoInProgress() && // Can we optimize the subsystem to start only one write action and do a single update?
|
||||
myDocument instanceof DocumentImpl &&
|
||||
!((DocumentImpl)myDocument).isGuardsSuppressed() && // Heuristics. Can PsiToDocumentSynchronizer perform bulk document updates?
|
||||
!contains(e.getOldFragment(), '\n') &&
|
||||
!contains(e.getNewFragment(), '\n') &&
|
||||
!(e.getNewLength() == 1 && DOCUMENT_CHARS_TO_SKIP.contains(e.getNewFragment().charAt(0)));
|
||||
}
|
||||
|
||||
@@ -235,7 +235,8 @@ public final class NettyUtil {
|
||||
|
||||
public static void addHttpServerCodec(@NotNull ChannelPipeline pipeline) {
|
||||
pipeline.addLast("httpRequestEncoder", new HttpResponseEncoder());
|
||||
pipeline.addLast("httpRequestDecoder", new HttpRequestDecoder(16 * 1024, 8192, 8192));
|
||||
// https://jetbrains.zendesk.com/agent/tickets/68315
|
||||
pipeline.addLast("httpRequestDecoder", new HttpRequestDecoder(16 * 1024, 16 * 1024, 8192));
|
||||
pipeline.addLast("httpObjectAggregator", new HttpObjectAggregator(MAX_CONTENT_LENGTH));
|
||||
// could be added earlier if HTTPS
|
||||
if (pipeline.get(ChunkedWriteHandler.class) == null) {
|
||||
|
||||
+2
@@ -41,6 +41,7 @@ import com.intellij.openapi.progress.util.ColorProgressBar;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.Pass;
|
||||
import com.intellij.openapi.util.io.FileUtilRt;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
@@ -808,6 +809,7 @@ public class SMTestRunnerResultsForm extends TestResultsPanel
|
||||
new SimpleDateFormat(HISTORY_DATE_FORMAT).format(new Date());
|
||||
|
||||
myOutputFile = new File(AbstractImportTestsAction.getTestHistoryRoot(myProject), configurationNameIncludedDate + ".xml");
|
||||
FileUtilRt.createParentDirs(myOutputFile);
|
||||
handler.setResult(new StreamResult(new FileWriter(myOutputFile)));
|
||||
final SMTestProxy.SMRootTestProxy root = myRoot;
|
||||
final RunConfiguration configuration = myConfiguration;
|
||||
|
||||
+1
-1
@@ -209,7 +209,7 @@ public class StringBufferReplaceableByStringInspection extends BaseInspection {
|
||||
}
|
||||
|
||||
if (element instanceof PsiWhiteSpace) {
|
||||
if (element.getText().contains("\n")) {
|
||||
if (element.getText().contains("\n") && result.length() > 0) {
|
||||
result.append('\n'); // keep line break structure
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class Linebreaks {
|
||||
|
||||
void m(String code) {
|
||||
String controlDigit = String.valueOf(code.charAt(5)) +
|
||||
code.charAt(7) +
|
||||
code.charAt(9) +
|
||||
code.charAt(11);
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class Linebreaks {
|
||||
|
||||
void m(String code) {
|
||||
String controlDigit = new Stri<caret>ngBuilder()
|
||||
.append(code.charAt(5))
|
||||
.append(code.charAt(7))
|
||||
.append(code.charAt(9))
|
||||
.append(code.charAt(11)).toString();
|
||||
}
|
||||
}
|
||||
+1
@@ -35,4 +35,5 @@ public class StringBufferReplaceableByStringFixTest extends IGQuickFixesTestCase
|
||||
public void testMethodCallOnString() { doTest(InspectionGadgetsBundle.message("string.builder.replaceable.by.string.quickfix")); }
|
||||
public void testComplex1() { doTest(InspectionGadgetsBundle.message("string.builder.replaceable.by.string.quickfix")); }
|
||||
public void testComplex2() { doTest(InspectionGadgetsBundle.message("string.builder.replaceable.by.string.quickfix")); }
|
||||
public void testLinebreaks() { doTest(InspectionGadgetsBundle.message("string.builder.replaceable.by.string.quickfix")); }
|
||||
}
|
||||
|
||||
+94
@@ -16,26 +16,43 @@
|
||||
package org.jetbrains.jps.maven.compiler;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.io.StreamUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.Base64;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.builders.BuildRootDescriptor;
|
||||
import org.jetbrains.jps.builders.artifacts.ArtifactBuildTaskProvider;
|
||||
import org.jetbrains.jps.builders.storage.BuildDataPaths;
|
||||
import org.jetbrains.jps.cmdline.ProjectDescriptor;
|
||||
import org.jetbrains.jps.incremental.BuildTask;
|
||||
import org.jetbrains.jps.incremental.CompileContext;
|
||||
import org.jetbrains.jps.incremental.ProjectBuildException;
|
||||
import org.jetbrains.jps.incremental.artifacts.impl.JpsArtifactUtil;
|
||||
import org.jetbrains.jps.maven.model.JpsMavenExtensionService;
|
||||
import org.jetbrains.jps.maven.model.impl.MavenModuleResourceConfiguration;
|
||||
import org.jetbrains.jps.maven.model.impl.MavenProjectConfiguration;
|
||||
import org.jetbrains.jps.model.artifact.JpsArtifact;
|
||||
import org.jetbrains.jps.model.artifact.elements.JpsArtifactRootElement;
|
||||
import org.jetbrains.jps.model.artifact.elements.JpsFileCopyPackagingElement;
|
||||
import org.jetbrains.jps.model.artifact.elements.JpsPackagingElement;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.jar.Attributes;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
@@ -72,6 +89,7 @@ public class MavenManifestGenerationBuildTaskProvider extends ArtifactBuildTaskP
|
||||
try {
|
||||
File output = new File(myArtifact.getOutputPath(), JarFile.MANIFEST_NAME);
|
||||
FileUtil.writeToFile(output, Base64.decode(moduleResourceConfiguration.manifest));
|
||||
handleSkinnyWars(context, projectConfiguration, moduleResourceConfiguration);
|
||||
}
|
||||
// do not fail the whole 'Make' if there is an invalid manifest cached (e.g. non encoded string generated by previous IDEA version)
|
||||
catch (Exception e) {
|
||||
@@ -80,6 +98,82 @@ public class MavenManifestGenerationBuildTaskProvider extends ArtifactBuildTaskP
|
||||
}
|
||||
}
|
||||
|
||||
private void handleSkinnyWars(final CompileContext context,
|
||||
final MavenProjectConfiguration projectConfiguration,
|
||||
MavenModuleResourceConfiguration moduleResourceConfiguration) {
|
||||
if (!"ear".equals(moduleResourceConfiguration.modelMap.get("packaging"))) return;
|
||||
if (!Boolean.parseBoolean(moduleResourceConfiguration.modelMap.get("build.plugin.maven-ear-plugin.skinnyWars"))) return;
|
||||
|
||||
final String earClasspath = moduleResourceConfiguration.classpath;
|
||||
if (earClasspath == null) return;
|
||||
|
||||
final Map<String, String> earClasspathMap = ContainerUtil.map2Map(
|
||||
StringUtil.split(earClasspath, " "), new Function<String, Pair<String, String>>() {
|
||||
@Override
|
||||
public Pair<String, String> fun(String s) {
|
||||
final int idx = s.lastIndexOf("/");
|
||||
return Pair.create(s.substring(idx == -1 ? 0 : idx + 1), s);
|
||||
}
|
||||
});
|
||||
|
||||
JpsArtifactUtil.processPackagingElements(myArtifact.getRootElement(), new Processor<JpsPackagingElement>() {
|
||||
@Override
|
||||
public boolean process(JpsPackagingElement element) {
|
||||
if (!(element instanceof JpsFileCopyPackagingElement)) return true;
|
||||
|
||||
final String filePath = ((JpsFileCopyPackagingElement)element).getFilePath();
|
||||
final File skinnyManifest = new File(filePath);
|
||||
if (!"SKINNY_MANIFEST.MF".equals(skinnyManifest.getName())) return true;
|
||||
|
||||
final String skinnyWarModuleName = skinnyManifest.getParentFile().getParentFile().getName();
|
||||
final MavenModuleResourceConfiguration warConfiguration = projectConfiguration.moduleConfigurations.get(skinnyWarModuleName);
|
||||
if (warConfiguration == null || warConfiguration.classpath == null) return true;
|
||||
|
||||
try {
|
||||
final byte[] warManifestData = Base64.decode(warConfiguration.manifest);
|
||||
Manifest warManifest = new Manifest(new ByteArrayInputStream(warManifestData));
|
||||
|
||||
List<String> skinnyWarClasspath = ContainerUtil.newArrayList();
|
||||
for (String entry : StringUtil.split(warConfiguration.classpath, " ")) {
|
||||
final int idx = entry.lastIndexOf("/");
|
||||
final String entryName = entry.substring(idx == -1 ? 0 : idx + 1);
|
||||
final String earEntryPath = earClasspathMap.get(entryName);
|
||||
skinnyWarClasspath.add(earEntryPath == null ? entry : earEntryPath);
|
||||
}
|
||||
|
||||
final Attributes warManifestMainAttributes = warManifest.getMainAttributes();
|
||||
warManifestMainAttributes.putValue("Class-Path", StringUtil.join(skinnyWarClasspath, " "));
|
||||
|
||||
FileUtil.createParentDirs(skinnyManifest);
|
||||
FileOutputStream outputStream = new FileOutputStream(skinnyManifest);
|
||||
try {
|
||||
warManifest.write(outputStream);
|
||||
|
||||
final ProjectDescriptor projectDescriptor = context.getProjectDescriptor();
|
||||
final Collection<BuildRootDescriptor> descriptors =
|
||||
projectDescriptor.getBuildRootIndex().findAllParentDescriptors(skinnyManifest, context);
|
||||
for (BuildRootDescriptor descriptor : descriptors) {
|
||||
try {
|
||||
projectDescriptor.fsState.markDirty(context, skinnyManifest, descriptor, projectDescriptor.timestamps.getStorage());
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.debug(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
StreamUtil.closeStream(outputStream);
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.debug(e);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static String getModuleName(@NotNull String artifactName) {
|
||||
return StringUtil.substringBefore(artifactName, ":");
|
||||
|
||||
+5
@@ -45,6 +45,10 @@ public class MavenModuleResourceConfiguration {
|
||||
@Tag("manifest")
|
||||
public String manifest;
|
||||
|
||||
@Nullable
|
||||
@Tag("classpath")
|
||||
public String classpath;
|
||||
|
||||
@NotNull
|
||||
@Tag("delimiters-pattern")
|
||||
public String delimitersPattern;
|
||||
@@ -110,6 +114,7 @@ public class MavenModuleResourceConfiguration {
|
||||
result = 31 * result + (parentId != null ? parentId.hashCode() : 0);
|
||||
result = 31 * result + directory.hashCode();
|
||||
result = 31 * result + (manifest != null ? manifest.hashCode() : 0);
|
||||
result = 31 * result + (classpath != null ? classpath.hashCode() : 0);
|
||||
result = 31 * result + delimitersPattern.hashCode();
|
||||
result = 31 * result + modelMap.hashCode();
|
||||
result = 31 * result + properties.hashCode();
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ public abstract class ManifestImporter {
|
||||
String classpathPrefix = getClasspathPrefix(manifestConfiguration);
|
||||
for (MavenArtifact mavenArtifact : mavenProject.getDependencies()) {
|
||||
final DependencyScope scope = MavenModuleImporter.selectScope(mavenArtifact.getScope());
|
||||
if (scope.isForProductionRuntime()) {
|
||||
if (scope.isForProductionCompile() || scope.isForProductionRuntime()) {
|
||||
if (classpath.length() > 0) {
|
||||
classpath.append(" ");
|
||||
}
|
||||
|
||||
@@ -149,6 +149,12 @@ public abstract class MavenImporter {
|
||||
Map<MavenProject, String> mavenProjectToModuleName,
|
||||
List<MavenProjectsProcessorTask> postTasks);
|
||||
|
||||
public void postProcess(Module module,
|
||||
MavenProject mavenProject,
|
||||
MavenProjectChanges changes,
|
||||
MavenModifiableModelsProvider modifiableModelsProvider) {
|
||||
}
|
||||
|
||||
public boolean processChangedModulesOnly() {
|
||||
return true;
|
||||
}
|
||||
|
||||
+25
@@ -159,6 +159,31 @@ public class MavenModuleImporter {
|
||||
});
|
||||
}
|
||||
|
||||
public void postConfigFacets() {
|
||||
MavenUtil.invokeAndWaitWriteAction(myModule.getProject(), new Runnable() {
|
||||
public void run() {
|
||||
if (myModule.isDisposed()) return;
|
||||
|
||||
final ModuleType moduleType = ModuleType.get(myModule);
|
||||
|
||||
for (final MavenImporter importer : getSuitableImporters()) {
|
||||
final MavenProjectChanges changes;
|
||||
if (myMavenProjectChanges == null) {
|
||||
if (importer.processChangedModulesOnly()) continue;
|
||||
changes = MavenProjectChanges.NONE;
|
||||
}
|
||||
else {
|
||||
changes = myMavenProjectChanges;
|
||||
}
|
||||
|
||||
if (importer.getModuleType() == moduleType) {
|
||||
importer.postProcess(myModule, myMavenProject, changes, myModifiableModelsProvider);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private List<MavenImporter> getSuitableImporters() {
|
||||
return myMavenProject.getSuitableImporters();
|
||||
}
|
||||
|
||||
+6
-2
@@ -431,7 +431,7 @@ public class MavenProjectImporter {
|
||||
javacOptions.ADDITIONAL_OPTIONS_STRING = options;
|
||||
}
|
||||
|
||||
private void importModules(final List<MavenProjectsProcessorTask> postTasks) {
|
||||
private void importModules(final List<MavenProjectsProcessorTask> tasks) {
|
||||
Map<MavenProject, MavenProjectChanges> projectsWithChanges = myProjectsToImportWithChanges;
|
||||
|
||||
Set<MavenProject> projectsWithNewlyCreatedModules = new THashSet<MavenProject>();
|
||||
@@ -471,7 +471,11 @@ public class MavenProjectImporter {
|
||||
}
|
||||
|
||||
for (MavenModuleImporter importer : importers) {
|
||||
importer.configFacets(postTasks);
|
||||
importer.configFacets(tasks);
|
||||
}
|
||||
|
||||
for (MavenModuleImporter importer : importers) {
|
||||
importer.postConfigFacets();
|
||||
}
|
||||
|
||||
setMavenizedModules(modulesToMavenize, true);
|
||||
|
||||
+9
@@ -129,6 +129,8 @@ public class MavenResourceCompilerConfigurationGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
addEarModelMapEntries(mavenProject, resourceConfig.modelMap);
|
||||
|
||||
Element pluginConfiguration = mavenProject.getPluginConfiguration("org.apache.maven.plugins", "maven-resources-plugin");
|
||||
|
||||
resourceConfig.outputDirectory = getResourcesPluginGoalOutputDirectory(mavenProject, pluginConfiguration, "resources");
|
||||
@@ -190,6 +192,12 @@ public class MavenResourceCompilerConfigurationGenerator {
|
||||
});
|
||||
}
|
||||
|
||||
private static void addEarModelMapEntries(@NotNull MavenProject mavenProject, @NotNull Map<String, String> modelMap) {
|
||||
Element pluginConfiguration = mavenProject.getPluginConfiguration("org.apache.maven.plugins", "maven-ear-plugin");
|
||||
final String skinnyWars = MavenJDOMUtil.findChildValueByPath(pluginConfiguration, "skinnyWars", "false");
|
||||
modelMap.put("build.plugin.maven-ear-plugin.skinnyWars", skinnyWars);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static String getResourcesPluginGoalOutputDirectory(@NotNull MavenProject mavenProject,
|
||||
@Nullable Element pluginConfiguration,
|
||||
@@ -234,6 +242,7 @@ public class MavenResourceCompilerConfigurationGenerator {
|
||||
finally {
|
||||
StreamUtil.closeStream(outputStream);
|
||||
}
|
||||
resourceConfig.classpath = ManifestBuilder.getClasspath(mavenProject);
|
||||
}
|
||||
catch (ManifestBuilder.ManifestBuilderException e) {
|
||||
LOG.warn("Unable to generate artifact manifest", e);
|
||||
|
||||
@@ -67,18 +67,7 @@ public class ManifestBuilder {
|
||||
@NotNull
|
||||
public java.util.jar.Manifest build() throws ManifestBuilderException {
|
||||
try {
|
||||
Element mavenPackagingPluginConfiguration = null;
|
||||
final String packaging = myMavenProject.getPackaging();
|
||||
if (StringUtil.isEmpty(packaging)) {
|
||||
mavenPackagingPluginConfiguration = myMavenProject.getPluginConfiguration("org.apache.maven.plugins", "maven-jar-plugin");
|
||||
}
|
||||
else {
|
||||
final String pluginArtifactId = PACKAGING_PLUGINS.get(StringUtil.toLowerCase(packaging));
|
||||
if (pluginArtifactId != null) {
|
||||
mavenPackagingPluginConfiguration = myMavenProject.getPluginConfiguration("org.apache.maven.plugins", pluginArtifactId);
|
||||
}
|
||||
}
|
||||
|
||||
Element mavenPackagingPluginConfiguration = getMavenPackagingPluginConfiguration(myMavenProject);
|
||||
final Element mavenArchiveConfiguration =
|
||||
mavenPackagingPluginConfiguration != null ? mavenPackagingPluginConfiguration.getChild("archive") : null;
|
||||
|
||||
@@ -110,6 +99,16 @@ public class ManifestBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getClasspath(@NotNull MavenProject mavenProject) {
|
||||
Element mavenPackagingPluginConfiguration = getMavenPackagingPluginConfiguration(mavenProject);
|
||||
final Element mavenArchiveConfiguration =
|
||||
mavenPackagingPluginConfiguration != null ? mavenPackagingPluginConfiguration.getChild("archive") : null;
|
||||
final Element manifestConfiguration = mavenArchiveConfiguration != null ? mavenArchiveConfiguration.getChild("manifest") : null;
|
||||
final ManifestImporter manifestImporter = ManifestImporter.getManifestImporter(mavenProject.getPackaging());
|
||||
return manifestImporter.getClasspath(mavenProject, manifestConfiguration);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getClasspathPrefix(@Nullable Element manifestConfiguration) {
|
||||
String classpathPrefix = MavenJDOMUtil.findChildValueByPath(manifestConfiguration, "classpathPrefix", "").replaceAll("\\\\", "/");
|
||||
@@ -119,6 +118,22 @@ public class ManifestBuilder {
|
||||
return classpathPrefix;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Element getMavenPackagingPluginConfiguration(@NotNull MavenProject mavenProject) {
|
||||
Element mavenPackagingPluginConfiguration = null;
|
||||
final String packaging = mavenProject.getPackaging();
|
||||
if (StringUtil.isEmpty(packaging)) {
|
||||
mavenPackagingPluginConfiguration = mavenProject.getPluginConfiguration("org.apache.maven.plugins", "maven-jar-plugin");
|
||||
}
|
||||
else {
|
||||
final String pluginArtifactId = PACKAGING_PLUGINS.get(StringUtil.toLowerCase(packaging));
|
||||
if (pluginArtifactId != null) {
|
||||
mavenPackagingPluginConfiguration = mavenProject.getPluginConfiguration("org.apache.maven.plugins", pluginArtifactId);
|
||||
}
|
||||
}
|
||||
return mavenPackagingPluginConfiguration;
|
||||
}
|
||||
|
||||
|
||||
private static Map<String, String> getManifestEntries(Element manifestEntries) {
|
||||
boolean hasManifestEntries = manifestEntries != null && manifestEntries.getContentSize() > 0;
|
||||
|
||||
@@ -110,7 +110,7 @@ public class EscapeEntitiesAction extends BaseCodeInsightAction implements CodeI
|
||||
|
||||
@Override
|
||||
protected boolean isValidForFile(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
|
||||
return ApplicationManager.getApplication().isInternal() && file instanceof XmlFile;
|
||||
return file instanceof XmlFile;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user