diff --git a/.idea/libraries/Kryo.xml b/.idea/libraries/Kryo.xml
new file mode 100644
index 000000000000..b11f03b83ef2
--- /dev/null
+++ b/.idea/libraries/Kryo.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
index ca7b52d58ab5..2805b881df85 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -65,6 +65,7 @@
+
diff --git a/build/scripts/layouts.gant b/build/scripts/layouts.gant
index b0315724e8e7..f91ac85d7449 100644
--- a/build/scripts/layouts.gant
+++ b/build/scripts/layouts.gant
@@ -336,6 +336,10 @@ public def layoutCommunityPlugins(String home) {
}
layoutPlugin("gradle") {
+ jar("gradle-jps-plugin.jar") {
+ module("gradle-jps-plugin")
+ }
+
jar("gradle-tooling-extension-api.jar") {
module("gradle-tooling-extension-api")
}
@@ -344,6 +348,13 @@ public def layoutCommunityPlugins(String home) {
module("gradle-tooling-extension-impl")
}
fileset(dir: "$home/plugins/gradle/lib") { include(name: "*.jar") }
+ // add kryo lib
+ fileset(dir: "$home/lib/") {
+ include(name: "kryo-*.jar")
+ include(name: "reflectasm-*.jar")
+ include(name: "objenesis-*.jar")
+ include(name: "minlog-*.jar")
+ }
}
layoutPlugin("git4idea") {
@@ -753,6 +764,7 @@ def layoutJps(String home, String targetDir, String buildNumber, Closure additio
jar("maven-jps-plugin.jar") { module("maven-jps-plugin") }
+ jar("gradle-jps-plugin.jar") { module("gradle-jps-plugin") }
fileset(dir: "$home/plugins/maven/maven3-server-impl/lib/maven3/lib") {include(name: "plexus-utils-*.jar")}
jar("eclipse-jps-plugin.jar") {
diff --git a/java/compiler/impl/compiler-impl.iml b/java/compiler/impl/compiler-impl.iml
index 08d3ca179fc0..c6e3e4f81eab 100644
--- a/java/compiler/impl/compiler-impl.iml
+++ b/java/compiler/impl/compiler-impl.iml
@@ -28,6 +28,7 @@
+
diff --git a/java/compiler/impl/src/org/jetbrains/builtInWebServer/ArtifactProjectRootsProvider.java b/java/compiler/impl/src/org/jetbrains/builtInWebServer/ArtifactProjectRootsProvider.java
new file mode 100644
index 000000000000..c8d253141180
--- /dev/null
+++ b/java/compiler/impl/src/org/jetbrains/builtInWebServer/ArtifactProjectRootsProvider.java
@@ -0,0 +1,40 @@
+package org.jetbrains.builtInWebServer;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Pair;
+import com.intellij.openapi.vfs.VfsUtilCore;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.packaging.artifacts.Artifact;
+import com.intellij.packaging.artifacts.ArtifactManager;
+import com.intellij.util.PairFunction;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+final class ArtifactProjectRootsProvider extends ProjectRootsProvider.PrefixlessProjectRootsProvider {
+ @Nullable
+ @Override
+ public Pair> resolve(@NotNull String path, @NotNull Project project, @NotNull PairFunction resolver) {
+ for (Artifact artifact : ArtifactManager.getInstance(project).getArtifacts()) {
+ VirtualFile root = artifact.getOutputFile();
+ if (root != null) {
+ VirtualFile file = root.findFileByRelativePath(path);
+ if (file != null) {
+ return Pair.create(file, new Pair(root, null));
+ }
+ }
+ }
+ return null;
+ }
+
+ @Nullable
+ @Override
+ public Pair getRoot(@NotNull VirtualFile file, @NotNull Project project) {
+ for (Artifact artifact : ArtifactManager.getInstance(project).getArtifacts()) {
+ VirtualFile root = artifact.getOutputFile();
+ if (root != null && VfsUtilCore.isAncestor(root, file, true)) {
+ return Pair.create(root, null);
+ }
+ }
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/java/debugger/impl/src/com/intellij/debugger/settings/CompoundRendererConfigurable.java b/java/debugger/impl/src/com/intellij/debugger/settings/CompoundRendererConfigurable.java
index 58b1be02b18f..a4484cccc1fe 100644
--- a/java/debugger/impl/src/com/intellij/debugger/settings/CompoundRendererConfigurable.java
+++ b/java/debugger/impl/src/com/intellij/debugger/settings/CompoundRendererConfigurable.java
@@ -25,13 +25,10 @@ import com.intellij.debugger.impl.DebuggerUtilsEx;
import com.intellij.debugger.ui.DebuggerExpressionTextField;
import com.intellij.debugger.ui.JavaDebuggerSupport;
import com.intellij.debugger.ui.tree.render.*;
-import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.options.UnnamedConfigurable;
import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Pair;
import com.intellij.psi.*;
import com.intellij.psi.search.GlobalSearchScope;
@@ -51,54 +48,33 @@ import java.awt.event.*;
import java.util.ArrayList;
import java.util.List;
-/**
- * @author Eugene Zhuravlev
- * Date: Feb 24, 2005
- */
-public class CompoundRendererConfigurable implements UnnamedConfigurable {
+class CompoundRendererConfigurable extends JPanel {
private CompoundReferenceRenderer myRenderer;
private CompoundReferenceRenderer myOriginalRenderer;
private Project myProject;
- private ClassNameEditorWithBrowseButton myClassNameField;
- private JRadioButton myRbDefaultLabel;
- private JRadioButton myRbExpressionLabel;
- private JRadioButton myRbDefaultChildrenRenderer;
- private JRadioButton myRbExpressionChildrenRenderer;
- private JRadioButton myRbListChildrenRenderer;
- private DebuggerExpressionTextField myLabelEditor;
- private DebuggerExpressionTextField myChildrenEditor;
- private DebuggerExpressionTextField myChildrenExpandedEditor;
+ private final ClassNameEditorWithBrowseButton myClassNameField;
+ private final JRadioButton myRbDefaultLabel;
+ private final JRadioButton myRbExpressionLabel;
+ private final JRadioButton myRbDefaultChildrenRenderer;
+ private final JRadioButton myRbExpressionChildrenRenderer;
+ private final JRadioButton myRbListChildrenRenderer;
+ private final DebuggerExpressionTextField myLabelEditor;
+ private final DebuggerExpressionTextField myChildrenEditor;
+ private final DebuggerExpressionTextField myChildrenExpandedEditor;
private DebuggerExpressionTextField myListChildrenEditor;
- private JLabel myExpandedLabel;
- private JPanel myMainPanel;
+ private final JLabel myExpandedLabel;
private JBTable myTable;
@NonNls private static final String EMPTY_PANEL_ID = "EMPTY";
@NonNls private static final String DATA_PANEL_ID = "DATA";
private static final int NAME_TABLE_COLUMN = 0;
private static final int EXPRESSION_TABLE_COLUMN = 1;
- public void setRenderer(NodeRenderer renderer) {
- if (renderer instanceof CompoundReferenceRenderer) {
- myRenderer = (CompoundReferenceRenderer)renderer;
- myOriginalRenderer = (CompoundReferenceRenderer)renderer.clone();
- }
- else {
- myRenderer = myOriginalRenderer = null;
- }
- reset();
- }
+ public CompoundRendererConfigurable() {
+ super(new CardLayout());
- public CompoundReferenceRenderer getRenderer() {
- return myRenderer;
- }
-
- @Override
- @NotNull
- public JComponent createComponent() {
if (myProject == null) {
myProject = JavaDebuggerSupport.getContextProjectForEditorFieldsInDebuggerConfigurables();
}
- final JPanel panel = new JPanel(new GridBagLayout());
myRbDefaultLabel = new JRadioButton(DebuggerBundle.message("label.compound.renderer.configurable.use.default.renderer"));
myRbExpressionLabel = new JRadioButton(DebuggerBundle.message("label.compound.renderer.configurable.use.expression"));
@@ -141,21 +117,14 @@ public class CompoundRendererConfigurable implements UnnamedConfigurable {
}
}
}, myProject);
- final EditorTextField textField = myClassNameField.getEditorTextField();
- final FocusAdapter updateContextListener = new FocusAdapter() {
+ myClassNameField.getEditorTextField().addFocusListener(new FocusAdapter() {
@Override
public void focusLost(@NotNull FocusEvent e) {
updateContext(myClassNameField.getText());
}
- };
- textField.addFocusListener(updateContextListener);
- Disposer.register(myClassNameField, new Disposable() {
- @Override
- public void dispose() {
- textField.removeFocusListener(updateContextListener);
- }
});
+ JPanel panel = new JPanel(new GridBagLayout());
panel.add(new JLabel(DebuggerBundle.message("label.compound.renderer.configurable.apply.to")),
new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
@@ -196,11 +165,23 @@ public class CompoundRendererConfigurable implements UnnamedConfigurable {
panel.add(myChildrenListEditor,
new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH,
new Insets(4, 30, 0, 0), 0, 0));
+ add(new JPanel(), EMPTY_PANEL_ID);
+ add(panel, DATA_PANEL_ID);
+ }
- myMainPanel = new JPanel(new CardLayout());
- myMainPanel.add(new JPanel(), EMPTY_PANEL_ID);
- myMainPanel.add(panel, DATA_PANEL_ID);
- return myMainPanel;
+ public void setRenderer(NodeRenderer renderer) {
+ if (renderer instanceof CompoundReferenceRenderer) {
+ myRenderer = (CompoundReferenceRenderer)renderer;
+ myOriginalRenderer = (CompoundReferenceRenderer)renderer.clone();
+ }
+ else {
+ myRenderer = myOriginalRenderer = null;
+ }
+ reset();
+ }
+
+ public CompoundReferenceRenderer getRenderer() {
+ return myRenderer;
}
private void updateContext(final String qName) {
@@ -305,7 +286,6 @@ public class CompoundRendererConfigurable implements UnnamedConfigurable {
}).createPanel();
}
- @Override
public boolean isModified() {
if (myRenderer == null) {
return false;
@@ -315,7 +295,6 @@ public class CompoundRendererConfigurable implements UnnamedConfigurable {
return !DebuggerUtilsEx.externalizableEqual(cloned, myOriginalRenderer);
}
- @Override
public void apply() {
if (myRenderer == null) {
return;
@@ -347,10 +326,9 @@ public class CompoundRendererConfigurable implements UnnamedConfigurable {
renderer.setClassName(myClassNameField.getText());
}
- @Override
public void reset() {
final TextWithImports emptyExpressionFragment = new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, "");
- ((CardLayout)myMainPanel.getLayout()).show(myMainPanel, myRenderer == null ? EMPTY_PANEL_ID : DATA_PANEL_ID);
+ ((CardLayout)getLayout()).show(this, myRenderer == null ? EMPTY_PANEL_ID : DATA_PANEL_ID);
if (myRenderer == null) {
return;
}
@@ -398,23 +376,6 @@ public class CompoundRendererConfigurable implements UnnamedConfigurable {
updateContext(className);
}
- @Override
- public void disposeUIResources() {
- myRenderer = null;
- myOriginalRenderer = null;
- myLabelEditor.dispose();
- myChildrenEditor.dispose();
- myChildrenExpandedEditor.dispose();
- myListChildrenEditor.dispose();
- Disposer.dispose(myClassNameField);
- myLabelEditor = null;
- myChildrenEditor = null;
- myChildrenExpandedEditor = null;
- myListChildrenEditor = null;
- myClassNameField = null;
- myProject = null;
- }
-
private MyTableModel getTableModel() {
return (MyTableModel)myTable.getModel();
}
diff --git a/java/debugger/impl/src/com/intellij/debugger/settings/UserRenderersConfigurable.java b/java/debugger/impl/src/com/intellij/debugger/settings/UserRenderersConfigurable.java
index a9197da82568..3967d2239455 100644
--- a/java/debugger/impl/src/com/intellij/debugger/settings/UserRenderersConfigurable.java
+++ b/java/debugger/impl/src/com/intellij/debugger/settings/UserRenderersConfigurable.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -35,10 +35,6 @@ import java.awt.*;
import java.util.ArrayList;
import java.util.List;
-/**
- * @author Eugene Zhuravlev
- * Date: Feb 19, 2005
- */
public class UserRenderersConfigurable implements ConfigurableUi {
private static final Icon ADD_ICON = IconUtil.getAddIcon();
private static final Icon REMOVE_ICON = IconUtil.getRemoveIcon();
@@ -55,16 +51,9 @@ public class UserRenderersConfigurable implements ConfigurableUi
Breakpoint javaBreakpoint = BreakpointManager.getJavaBreakpoint(breakpoint);
if (javaBreakpoint != null) {
PsiClass aClass = javaBreakpoint.getPsiClass();
- if (aClass != null && aClass.getContainingFile() != null) {
+ if (aClass != null && aClass.getContainingFile() != null && aClass.getTextOffset() >= 0) {
return XDebuggerUtil.getInstance().createPositionByOffset(aClass.getContainingFile().getVirtualFile(), aClass.getTextOffset());
}
}
diff --git a/java/java-impl/src/com/intellij/psi/codeStyle/arrangement/JavaArrangementVisitor.java b/java/java-impl/src/com/intellij/psi/codeStyle/arrangement/JavaArrangementVisitor.java
index 3651fa1afe3a..ff1170b64bef 100644
--- a/java/java-impl/src/com/intellij/psi/codeStyle/arrangement/JavaArrangementVisitor.java
+++ b/java/java-impl/src/com/intellij/psi/codeStyle/arrangement/JavaArrangementVisitor.java
@@ -280,6 +280,7 @@ public class JavaArrangementVisitor extends JavaRecursiveElementVisitor {
if (ref instanceof PsiField && containingClassFields.contains(ref)) {
referencedElements.add((PsiField)ref);
}
+ super.visitReferenceExpression(expression);
}
});
diff --git a/java/java-impl/src/com/intellij/psi/impl/search/JspIndexPatternBuilder.java b/java/java-impl/src/com/intellij/psi/impl/search/JspIndexPatternBuilder.java
index a8316f8dc0ee..eaa93875ba15 100644
--- a/java/java-impl/src/com/intellij/psi/impl/search/JspIndexPatternBuilder.java
+++ b/java/java-impl/src/com/intellij/psi/impl/search/JspIndexPatternBuilder.java
@@ -18,6 +18,7 @@ package com.intellij.psi.impl.search;
import com.intellij.lang.LanguageParserDefinitions;
import com.intellij.lang.ParserDefinition;
import com.intellij.lexer.Lexer;
+import com.intellij.openapi.editor.impl.EditorHighlighterCache;
import com.intellij.psi.JspPsiUtil;
import com.intellij.psi.PsiFile;
import com.intellij.psi.impl.source.tree.StdTokenSets;
@@ -34,7 +35,7 @@ public class JspIndexPatternBuilder implements IndexPatternBuilder {
@Override
public Lexer getIndexingLexer(@NotNull final PsiFile file) {
if (JspPsiUtil.isInJspFile(file)) {
- return LexerEditorHighlighterLexer.getLexerBasedOnLexerHighlighter(file.getText(), file.getVirtualFile(), file.getProject());
+ return EditorHighlighterCache.getLexerBasedOnLexerHighlighter(file.getText(), file.getVirtualFile(), file.getProject());
}
return null;
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/PsiImplUtil.java b/java/java-psi-impl/src/com/intellij/psi/impl/PsiImplUtil.java
index bcf0decb69b7..938b40f51bb8 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/PsiImplUtil.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/PsiImplUtil.java
@@ -687,4 +687,33 @@ public class PsiImplUtil {
return element instanceof LeafElement && tokenSet.contains(((LeafElement)element).getElementType());
}
+ public static PsiType buildTypeFromTypeString(@NotNull final String typeName, @NotNull final PsiElement context, @NotNull final PsiFile psiFile) {
+ PsiType resultType;
+ final PsiManager psiManager = psiFile.getManager();
+
+ if (typeName.indexOf('<') != -1 || typeName.indexOf('[') != -1 || typeName.indexOf('.') == -1) {
+ try {
+ return JavaPsiFacade.getInstance(psiManager.getProject()).getElementFactory().createTypeFromText(typeName, context);
+ } catch(Exception ex) {} // invalid syntax will produce unresolved class type
+ }
+
+ PsiClass aClass = JavaPsiFacade.getInstance(psiManager.getProject()).findClass(typeName, context.getResolveScope());
+
+ if (aClass == null) {
+ final LightClassReference ref = new LightClassReference(
+ psiManager,
+ PsiNameHelper.getShortClassName(typeName),
+ typeName,
+ PsiSubstitutor.EMPTY,
+ psiFile
+ );
+ resultType = new PsiClassReferenceType(ref, null);
+ } else {
+ PsiElementFactory factory = JavaPsiFacade.getInstance(psiManager.getProject()).getElementFactory();
+ PsiSubstitutor substitutor = factory.createRawSubstitutor(aClass);
+ resultType = factory.createType(aClass, substitutor);
+ }
+
+ return resultType;
+ }
}
diff --git a/java/java-tests/testData/find/findInEditor/BasicFind.gold b/java/java-tests/testData/find/findInEditor/BasicFind.gold
index f1ea3fa66d4c..46486765486d 100644
--- a/java/java-tests/testData/find/findInEditor/BasicFind.gold
+++ b/java/java-tests/testData/find/findInEditor/BasicFind.gold
@@ -3,8 +3,7 @@ myStringToFind =a
myStringToReplace =
isReplaceState =false
isWholeWordsOnly =false
-isInStringLiterals =false
-isInComments =false
+searchContext =ANY
isFromCursor =true
isForward =true
isGlobal =true
diff --git a/java/java-tests/testData/find/findInEditor/EmacsLikeFallback.gold b/java/java-tests/testData/find/findInEditor/EmacsLikeFallback.gold
index c7676944b8da..bfda616a3ac1 100644
--- a/java/java-tests/testData/find/findInEditor/EmacsLikeFallback.gold
+++ b/java/java-tests/testData/find/findInEditor/EmacsLikeFallback.gold
@@ -3,8 +3,7 @@ myStringToFind =a
myStringToReplace =
isReplaceState =false
isWholeWordsOnly =false
-isInStringLiterals =false
-isInComments =false
+searchContext =ANY
isFromCursor =true
isForward =true
isGlobal =true
@@ -38,8 +37,7 @@ myStringToFind =ab
myStringToReplace =
isReplaceState =false
isWholeWordsOnly =false
-isInStringLiterals =false
-isInComments =false
+searchContext =ANY
isFromCursor =true
isForward =true
isGlobal =true
@@ -72,8 +70,7 @@ myStringToFind =a
myStringToReplace =
isReplaceState =false
isWholeWordsOnly =false
-isInStringLiterals =false
-isInComments =false
+searchContext =ANY
isFromCursor =true
isForward =true
isGlobal =true
diff --git a/java/java-tests/testData/find/findInEditor/ReplacementWithEmptyString.gold b/java/java-tests/testData/find/findInEditor/ReplacementWithEmptyString.gold
index eb2cdb2c1240..a4d44cbfa445 100644
--- a/java/java-tests/testData/find/findInEditor/ReplacementWithEmptyString.gold
+++ b/java/java-tests/testData/find/findInEditor/ReplacementWithEmptyString.gold
@@ -3,8 +3,7 @@ myStringToFind =
myStringToReplace =
isReplaceState =false
isWholeWordsOnly =false
-isInStringLiterals =false
-isInComments =false
+searchContext =ANY
isFromCursor =true
isForward =true
isGlobal =true
@@ -34,8 +33,7 @@ myStringToFind =a
myStringToReplace =
isReplaceState =false
isWholeWordsOnly =false
-isInStringLiterals =false
-isInComments =false
+searchContext =ANY
isFromCursor =true
isForward =true
isGlobal =true
@@ -67,8 +65,7 @@ myStringToFind =a
myStringToReplace =
isReplaceState =true
isWholeWordsOnly =false
-isInStringLiterals =false
-isInComments =false
+searchContext =ANY
isFromCursor =true
isForward =true
isGlobal =true
@@ -102,8 +99,7 @@ myStringToFind =a
myStringToReplace =
isReplaceState =true
isWholeWordsOnly =false
-isInStringLiterals =false
-isInComments =false
+searchContext =ANY
isFromCursor =true
isForward =true
isGlobal =true
diff --git a/java/java-tests/testSrc/com/intellij/find/FindManagerTest.java b/java/java-tests/testSrc/com/intellij/find/FindManagerTest.java
index 33f43ef93fa7..f83d836bb55a 100644
--- a/java/java-tests/testSrc/com/intellij/find/FindManagerTest.java
+++ b/java/java-tests/testSrc/com/intellij/find/FindManagerTest.java
@@ -615,7 +615,7 @@ public class FindManagerTest extends DaemonAnalyzerTestCase {
FindModel findModel = FindManagerTestUtils.configureFindModel("^done$");
findModel.setRegularExpressions(true);
- findModel.setSearchContext(FindModel.SearchContext.IN_STRINGS);
+ findModel.setSearchContext(FindModel.SearchContext.IN_STRING_LITERALS);
String text = "\"done\"; 'done'; 'done' \"done2\"";
FindManagerTestUtils.runFindForwardAndBackward(myFindManager, findModel, text, "java");
@@ -650,4 +650,42 @@ public class FindManagerTest extends DaemonAnalyzerTestCase {
findModel.setWholeWordsOnly(true);
assertSize(1, findUsages(findModel));
}
+
+ public void testFindExceptComments() {
+ FindModel findModel = FindManagerTestUtils.configureFindModel("done");
+
+ String prefix = "/*";
+ String text = prefix + "done*/done";
+
+ findModel.setSearchContext(FindModel.SearchContext.EXCEPT_COMMENTS);
+ LightVirtualFile file = new LightVirtualFile("A.java", text);
+
+ FindResult findResult = myFindManager.findString(text, prefix.length(), findModel, file);
+ assertTrue(findResult.isStringFound());
+ assertTrue(findResult.getStartOffset() > prefix.length());
+
+ findModel.setRegularExpressions(true);
+ findResult = myFindManager.findString(text, prefix.length(), findModel, file);
+ assertTrue(findResult.isStringFound());
+ assertTrue(findResult.getStartOffset() > prefix.length());
+ }
+
+ public void testFindExceptLiterals() {
+ FindModel findModel = FindManagerTestUtils.configureFindModel("done");
+
+ String prefix = "\"";
+ String text = prefix + "done\"done";
+
+ findModel.setSearchContext(FindModel.SearchContext.EXCEPT_STRING_LITERALS);
+ LightVirtualFile file = new LightVirtualFile("A.java", text);
+
+ FindResult findResult = myFindManager.findString(text, prefix.length(), findModel, file);
+ assertTrue(findResult.isStringFound());
+ assertTrue(findResult.getStartOffset() > prefix.length());
+
+ findModel.setRegularExpressions(true);
+ findResult = myFindManager.findString(text, prefix.length(), findModel, file);
+ assertTrue(findResult.isStringFound());
+ assertTrue(findResult.getStartOffset() > prefix.length());
+ }
}
diff --git a/java/java-tests/testSrc/com/intellij/psi/codeStyle/arrangement/JavaRearrangerFieldReferenceTest.groovy b/java/java-tests/testSrc/com/intellij/psi/codeStyle/arrangement/JavaRearrangerFieldReferenceTest.groovy
index d11a34f6e376..7b1861b9daec 100644
--- a/java/java-tests/testSrc/com/intellij/psi/codeStyle/arrangement/JavaRearrangerFieldReferenceTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/psi/codeStyle/arrangement/JavaRearrangerFieldReferenceTest.groovy
@@ -385,4 +385,28 @@ public class test {
]
)
}
+
+ void "test IDEA-128071"() {
+ doTest(
+ initial: '''
+public class FormatTest {
+ public int a = 3;
+ private static final String FACEBOOK_CLIENT_ID = "";
+ public static final String FACEBOOK_OAUTH_URL = "".concat(FACEBOOK_CLIENT_ID).concat("");
+}
+''',
+ expected: '''
+public class FormatTest {
+ private static final String FACEBOOK_CLIENT_ID = "";
+ public static final String FACEBOOK_OAUTH_URL = "".concat(FACEBOOK_CLIENT_ID).concat("");
+ public int a = 3;
+}
+''',
+ rules: [
+ rule(PUBLIC, STATIC, FINAL),
+ rule(PRIVATE, STATIC, FINAL),
+ rule(PUBLIC)
+ ]
+ )
+ }
}
diff --git a/java/testFramework/src/com/intellij/find/FindManagerTestUtils.java b/java/testFramework/src/com/intellij/find/FindManagerTestUtils.java
index ea08e96427c0..b65b58b8638c 100644
--- a/java/testFramework/src/com/intellij/find/FindManagerTestUtils.java
+++ b/java/testFramework/src/com/intellij/find/FindManagerTestUtils.java
@@ -24,7 +24,7 @@ public class FindManagerTestUtils {
}
public static void runFindInCommentsAndLiterals(FindManager findManager, FindModel findModel, String text, String ext) {
- findModel.setSearchContext(FindModel.SearchContext.IN_STRINGS);
+ findModel.setSearchContext(FindModel.SearchContext.IN_STRING_LITERALS);
runFindForwardAndBackward(findManager, findModel, text, ext);
findModel.setSearchContext(FindModel.SearchContext.IN_COMMENTS);
diff --git a/jps/model-serialization/src/org/jetbrains/jps/model/serialization/PathMacroUtil.java b/jps/model-serialization/src/org/jetbrains/jps/model/serialization/PathMacroUtil.java
index 6214412c4a52..cf87eb5744b3 100644
--- a/jps/model-serialization/src/org/jetbrains/jps/model/serialization/PathMacroUtil.java
+++ b/jps/model-serialization/src/org/jetbrains/jps/model/serialization/PathMacroUtil.java
@@ -16,16 +16,19 @@
package org.jetbrains.jps.model.serialization;
import com.intellij.openapi.application.PathManager;
-import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.util.ObjectUtils;
import com.intellij.util.SystemProperties;
-import com.intellij.util.containers.HashMap;
+import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.util.Map;
+import static com.intellij.openapi.util.io.FileUtil.toSystemIndependentName;
+
/**
* @author nik
*/
@@ -34,9 +37,16 @@ public class PathMacroUtil {
@NonNls public static final String MODULE_DIR_MACRO_NAME = "MODULE_DIR";
@NonNls public static final String DIRECTORY_STORE_NAME = ".idea";
@NonNls public static final String APPLICATION_HOME_DIR = "APPLICATION_HOME_DIR";
+ @NonNls public static final String APPLICATION_CONFIG_DIR = "APPLICATION_CONFIG_DIR";
@NonNls public static final String APPLICATION_PLUGINS_DIR = "APPLICATION_PLUGINS_DIR";
@NonNls public static final String USER_HOME_NAME = "USER_HOME";
+ private static final Map ourGlobalMacros = ContainerUtil.immutableMapBuilder()
+ .put(APPLICATION_HOME_DIR, toSystemIndependentName(PathManager.getHomePath()))
+ .put(APPLICATION_CONFIG_DIR, toSystemIndependentName(PathManager.getConfigPath()))
+ .put(APPLICATION_PLUGINS_DIR, toSystemIndependentName(PathManager.getPluginsPath()))
+ .put(USER_HOME_NAME, StringUtil.trimEnd(toSystemIndependentName(SystemProperties.getUserHome()), "/")).build();
+
@Nullable
public static String getModuleDir(String moduleFilePath) {
File moduleDirFile = new File(moduleFilePath).getParentFile();
@@ -57,31 +67,18 @@ public class PathMacroUtil {
return moduleDir;
}
+ @NotNull
public static String getUserHomePath() {
- return StringUtil.trimEnd(FileUtil.toSystemIndependentName(SystemProperties.getUserHome()), "/");
+ return ObjectUtils.assertNotNull(getGlobalSystemMacroValue(USER_HOME_NAME));
}
+ @NotNull
public static Map getGlobalSystemMacros() {
- final Map map = new HashMap();
- map.put(APPLICATION_HOME_DIR, getApplicationHomeDirPath());
- map.put(APPLICATION_PLUGINS_DIR, getApplicationPluginsDirPath());
- map.put(USER_HOME_NAME, getUserHomePath());
- return map;
- }
-
- private static String getApplicationHomeDirPath() {
- return FileUtil.toSystemIndependentName(PathManager.getHomePath());
- }
-
- private static String getApplicationPluginsDirPath() {
- return FileUtil.toSystemIndependentName(PathManager.getPluginsPath());
+ return ourGlobalMacros;
}
@Nullable
public static String getGlobalSystemMacroValue(String name) {
- if (APPLICATION_HOME_DIR.equals(name)) return getApplicationHomeDirPath();
- if (APPLICATION_PLUGINS_DIR.equals(name)) return getApplicationPluginsDirPath();
- if (USER_HOME_NAME.equals(name)) return getUserHomePath();
- return null;
+ return ourGlobalMacros.get(name);
}
}
diff --git a/platform/dvcs/src/com/intellij/dvcs/ui/VcsLogAction.java b/platform/dvcs/src/com/intellij/dvcs/ui/VcsLogAction.java
new file mode 100644
index 000000000000..d8f4012f1b0e
--- /dev/null
+++ b/platform/dvcs/src/com/intellij/dvcs/ui/VcsLogAction.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2000-2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.dvcs.ui;
+
+import com.intellij.dvcs.repo.Repository;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.CommonDataKeys;
+import com.intellij.openapi.project.DumbAwareAction;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Condition;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.containers.MultiMap;
+import com.intellij.vcs.log.VcsFullCommitDetails;
+import com.intellij.vcs.log.VcsLog;
+import com.intellij.vcs.log.VcsLogDataKeys;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+public abstract class VcsLogAction extends DumbAwareAction {
+
+ protected enum Mode {
+ SINGLE_COMMIT,
+ SINGLE_PER_REPO
+ }
+
+ @Override
+ public void actionPerformed(AnActionEvent e) {
+ Project project = e.getRequiredData(CommonDataKeys.PROJECT);
+ VcsLog log = e.getRequiredData(VcsLogDataKeys.VSC_LOG);
+ List details = log.getSelectedDetails();
+ MultiMap grouped = groupByRoot(project, details);
+ assert grouped != null;
+ Map singleElementMap = convertToSingleElementMap(grouped);
+ assert singleElementMap != null;
+ actionPerformed(project, singleElementMap);
+ }
+
+ @Override
+ public void update(AnActionEvent e) {
+ Project project = e.getProject();
+ VcsLog log = e.getData(VcsLogDataKeys.VSC_LOG);
+ if (project == null || log == null) {
+ e.getPresentation().setEnabledAndVisible(false);
+ return;
+ }
+
+ List details = log.getSelectedDetails();
+ MultiMap grouped = groupByRoot(project, details);
+ if (grouped == null) {
+ e.getPresentation().setEnabledAndVisible(false);
+ }
+ else {
+ e.getPresentation().setVisible(true);
+ e.getPresentation().setEnabled(isEnabled(grouped));
+ }
+ }
+
+ private boolean isEnabled(@NotNull MultiMap grouped) {
+ Mode mode = getMode();
+ if (mode == Mode.SINGLE_COMMIT) {
+ return grouped.size() == 1;
+ }
+ if (mode == Mode.SINGLE_PER_REPO) {
+ return allValuesAreSingletons(grouped);
+ }
+ return false;
+ }
+
+ @Nullable
+ protected abstract Repo getRepositoryForRoot(@NotNull Project project, @NotNull VirtualFile root);
+
+ protected abstract void actionPerformed(@NotNull Project project, @NotNull Map commits);
+
+ @NotNull
+ protected abstract Mode getMode();
+
+ @Nullable
+ private MultiMap groupByRoot(@NotNull Project project, @NotNull List commits) {
+ MultiMap map = MultiMap.create();
+ for (VcsFullCommitDetails commit : commits) {
+ Repo root = getRepositoryForRoot(project, commit.getRoot());
+ if (root == null) { // commit from some other VCS
+ return null;
+ }
+ map.putValue(root, commit);
+ }
+ return map;
+ }
+
+ private boolean allValuesAreSingletons(@NotNull MultiMap grouped) {
+ return !ContainerUtil.exists(grouped.entrySet(), new Condition>>() {
+ @Override
+ public boolean value(Map.Entry> entry) {
+ return entry.getValue().size() != 1;
+ }
+ });
+ }
+
+ @Nullable
+ private Map convertToSingleElementMap(@NotNull MultiMap groupedCommits) {
+ Map map = ContainerUtil.newHashMap();
+ for (Map.Entry> entry : groupedCommits.entrySet()) {
+ Collection commits = entry.getValue();
+ if (commits.size() != 1) {
+ return null;
+ }
+ map.put(entry.getKey(), commits.iterator().next());
+ }
+ return map;
+ }
+
+}
diff --git a/platform/dvcs/src/com/intellij/dvcs/ui/VcsLogSingleCommitAction.java b/platform/dvcs/src/com/intellij/dvcs/ui/VcsLogSingleCommitAction.java
deleted file mode 100644
index 1e20f2ceac11..000000000000
--- a/platform/dvcs/src/com/intellij/dvcs/ui/VcsLogSingleCommitAction.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2000-2014 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.dvcs.ui;
-
-import com.intellij.dvcs.repo.Repository;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.CommonDataKeys;
-import com.intellij.openapi.project.DumbAwareAction;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Condition;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.containers.ContainerUtil;
-import com.intellij.vcs.log.VcsFullCommitDetails;
-import com.intellij.vcs.log.VcsLog;
-import com.intellij.vcs.log.VcsLogDataKeys;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.List;
-
-public abstract class VcsLogSingleCommitAction extends DumbAwareAction {
-
- @Override
- public void actionPerformed(AnActionEvent e) {
- Project project = e.getRequiredData(CommonDataKeys.PROJECT);
- VcsLog log = e.getRequiredData(VcsLogDataKeys.VSC_LOG);
- List details = log.getSelectedDetails();
- assert details.size() == 1;
- VcsFullCommitDetails commit = details.get(0);
- Repo repository = getRepositoryForRoot(project, commit.getRoot());
- assert repository != null;
-
- actionPerformed(repository, commit);
- }
-
- @Override
- public void update(AnActionEvent e) {
- Project project = e.getProject();
- VcsLog log = e.getData(VcsLogDataKeys.VSC_LOG);
- if (project == null || log == null) {
- e.getPresentation().setEnabledAndVisible(false);
- return;
- }
-
- List details = log.getSelectedDetails();
- if (containsCommitFromOtherVcs(project, details)) {
- e.getPresentation().setEnabledAndVisible(false);
- }
- else {
- e.getPresentation().setVisible(true);
- e.getPresentation().setEnabled(details.size() == 1);
- }
- }
-
- @Nullable
- protected abstract Repo getRepositoryForRoot(@NotNull Project project, @NotNull VirtualFile root);
-
- protected abstract void actionPerformed(@NotNull Repo repository, @NotNull VcsFullCommitDetails commit);
-
- private boolean containsCommitFromOtherVcs(@NotNull final Project project, @NotNull List details) {
- return ContainerUtil.exists(details, new Condition() {
- @Override
- public boolean value(VcsFullCommitDetails details) {
- return getRepositoryForRoot(project, details.getRoot()) == null;
- }
- });
- }
-
-}
diff --git a/platform/lang-impl/src/com/intellij/psi/impl/search/LexerEditorHighlighterLexer.java b/platform/editor-ui-ex/src/com/intellij/psi/impl/search/LexerEditorHighlighterLexer.java
similarity index 61%
rename from platform/lang-impl/src/com/intellij/psi/impl/search/LexerEditorHighlighterLexer.java
rename to platform/editor-ui-ex/src/com/intellij/psi/impl/search/LexerEditorHighlighterLexer.java
index 2add3ed1b3c5..a966d831b71a 100644
--- a/platform/lang-impl/src/com/intellij/psi/impl/search/LexerEditorHighlighterLexer.java
+++ b/platform/editor-ui-ex/src/com/intellij/psi/impl/search/LexerEditorHighlighterLexer.java
@@ -15,23 +15,12 @@
*/
package com.intellij.psi.impl.search;
-import com.intellij.lexer.Lexer;
import com.intellij.lexer.LexerBase;
-import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.highlighter.EditorHighlighter;
-import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory;
import com.intellij.openapi.editor.highlighter.HighlighterIterator;
-import com.intellij.openapi.editor.impl.EditorHighlighterCache;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.PsiDocumentManager;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.PsiManager;
-import com.intellij.psi.impl.cache.impl.id.PlatformIdTableBuilding;
import com.intellij.psi.tree.IElementType;
import com.intellij.util.text.CharSequenceSubSequence;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
/**
* @author Sergey Evdokimov
@@ -49,31 +38,6 @@ public class LexerEditorHighlighterLexer extends LexerBase {
myAlreadyInitializedHighlighter = alreadyInitializedHighlighter;
}
- @Nullable
- public static Lexer getLexerBasedOnLexerHighlighter(CharSequence text, VirtualFile virtualFile, Project project) {
- EditorHighlighter highlighter = null;
-
- PsiFile psiFile = virtualFile != null ? PsiManager.getInstance(project).findFile(virtualFile) : null;
- final Document document = psiFile != null ? PsiDocumentManager.getInstance(project).getDocument(psiFile) : null;
- final EditorHighlighter cachedEditorHighlighter;
- boolean alreadyInitializedHighlighter = false;
-
- if (document != null &&
- (cachedEditorHighlighter = EditorHighlighterCache.getEditorHighlighterForCachesBuilding(document)) != null &&
- PlatformIdTableBuilding.checkCanUseCachedEditorHighlighter(text, cachedEditorHighlighter)) {
- highlighter = cachedEditorHighlighter;
- alreadyInitializedHighlighter = true;
- }
- else if (virtualFile != null) {
- highlighter = EditorHighlighterFactory.getInstance().createEditorHighlighter(project, virtualFile);
- }
-
- if (highlighter != null) {
- return new LexerEditorHighlighterLexer(highlighter, alreadyInitializedHighlighter);
- }
- return null;
- }
-
@Override
public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int state) {
if (myAlreadyInitializedHighlighter) {
diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DataNode.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DataNode.java
index 4efac184c2ee..10fc11acbf5f 100644
--- a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DataNode.java
+++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DataNode.java
@@ -68,6 +68,18 @@ public class DataNode implements Serializable {
return result;
}
+ @NotNull
+ public DataNode createOrReplaceChild(@NotNull Key key, @NotNull T data) {
+ for (Iterator> iterator = myChildren.iterator(); iterator.hasNext(); ) {
+ DataNode> child = iterator.next();
+ if (child.getKey().equals(key)) {
+ iterator.remove();
+ break;
+ }
+ }
+ return createChild(key, data);
+ }
+
@NotNull
public Key getKey() {
return myKey;
diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalFilter.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalFilter.java
new file mode 100644
index 000000000000..6bc9cf9aed94
--- /dev/null
+++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalFilter.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2000-2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.externalSystem.model;
+
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Vladislav.Soroka
+ * @since 7/22/2014
+ */
+public class DefaultExternalFilter implements ExternalFilter {
+ private static final long serialVersionUID = 1L;
+
+ @NotNull
+ private String myFilterType;
+ @NotNull
+ private String myPropertiesAsJsonMap;
+
+ public DefaultExternalFilter() {
+ myPropertiesAsJsonMap = "";
+ myFilterType = "";
+ }
+
+
+ public DefaultExternalFilter(ExternalFilter filter) {
+ myPropertiesAsJsonMap = filter.getPropertiesAsJsonMap();
+ myFilterType = filter.getFilterType();
+ }
+
+ @NotNull
+ @Override
+ public String getFilterType() {
+ return myFilterType;
+ }
+
+ public void setFilterType(@NotNull String filterType) {
+ myFilterType = filterType;
+ }
+
+ @Override
+ @NotNull
+ public String getPropertiesAsJsonMap() {
+ return myPropertiesAsJsonMap;
+ }
+
+ public void setPropertiesAsJsonMap(@NotNull String propertiesAsJsonMap) {
+ myPropertiesAsJsonMap = propertiesAsJsonMap;
+ }
+}
diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalPlugin.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalPlugin.java
new file mode 100644
index 000000000000..8b7991b1d88c
--- /dev/null
+++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalPlugin.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2000-2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.externalSystem.model;
+
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Vladislav.Soroka
+ * @since 7/16/2014
+ */
+public class DefaultExternalPlugin implements ExternalPlugin {
+ private static final long serialVersionUID = 1L;
+
+ @NotNull
+ private String myId;
+
+ public DefaultExternalPlugin() {
+ }
+
+ public DefaultExternalPlugin(ExternalPlugin plugin) {
+ myId = plugin.getId();
+ }
+
+ @NotNull
+ @Override
+ public String getId() {
+ return myId;
+ }
+
+ public void setId(@NotNull String id) {
+ myId = id;
+ }
+}
diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalProject.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalProject.java
new file mode 100644
index 000000000000..cecb9ad33c12
--- /dev/null
+++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalProject.java
@@ -0,0 +1,243 @@
+/*
+ * Copyright 2000-2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.externalSystem.model;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Vladislav.Soroka
+ * @since 7/14/2014
+ */
+public class DefaultExternalProject implements ExternalProject {
+
+ private static final long serialVersionUID = 1L;
+
+ @NotNull
+ private String myName;
+ @NotNull
+ private String myQName;
+ @Nullable
+ private String myDescription;
+ @NotNull
+ private String myGroup;
+ @NotNull
+ private String myVersion;
+ @NotNull
+ private Map myChildProjects;
+ @NotNull
+ private File myProjectDir;
+ @NotNull
+ private File myBuildDir;
+ @Nullable
+ private File myBuildFile;
+ @NotNull
+ private Map myTasks;
+ @NotNull
+ private Map myProperties;
+ @NotNull
+ private Map mySourceSets;
+ @NotNull
+ private String myExternalSystemId;
+ @NotNull
+ private Map myPlugins;
+
+ public DefaultExternalProject() {
+ myChildProjects = new HashMap();
+ myTasks = new HashMap();
+ myProperties = new HashMap();
+ mySourceSets = new HashMap();
+ myPlugins = new HashMap();
+ }
+
+ public DefaultExternalProject(@NotNull ExternalProject externalProject) {
+ this();
+ myName = externalProject.getName();
+ myQName = externalProject.getQName();
+ myVersion = externalProject.getVersion();
+ myGroup = externalProject.getGroup();
+ myDescription = externalProject.getDescription();
+ myProjectDir = externalProject.getProjectDir();
+ myBuildDir = externalProject.getBuildDir();
+ myBuildFile = externalProject.getBuildFile();
+ myExternalSystemId = externalProject.getExternalSystemId();
+
+ for (Map.Entry entry : externalProject.getChildProjects().entrySet()) {
+ myChildProjects.put(entry.getKey(), new DefaultExternalProject(entry.getValue()));
+ }
+
+ for (Map.Entry entry : externalProject.getTasks().entrySet()) {
+ myTasks.put(entry.getKey(), new DefaultExternalTask(entry.getValue()));
+ }
+ for (Map.Entry entry : externalProject.getSourceSets().entrySet()) {
+ mySourceSets.put(entry.getKey(), new DefaultExternalSourceSet(entry.getValue()));
+ }
+ for (Map.Entry entry : externalProject.getPlugins().entrySet()) {
+ myPlugins.put(entry.getKey(), new DefaultExternalPlugin(entry.getValue()));
+ }
+ }
+
+
+ @NotNull
+ @Override
+ public String getExternalSystemId() {
+ return myExternalSystemId;
+ }
+
+ public void setExternalSystemId(@NotNull String externalSystemId) {
+ myExternalSystemId = externalSystemId;
+ }
+
+ @NotNull
+ @Override
+ public String getName() {
+ return myName;
+ }
+
+ public void setName(@NotNull String name) {
+ myName = name;
+ }
+
+ @NotNull
+ @Override
+ public String getQName() {
+ return myQName;
+ }
+
+ public void setQName(@NotNull String QName) {
+ myQName = QName;
+ }
+
+ @Nullable
+ @Override
+ public String getDescription() {
+ return myDescription;
+ }
+
+ public void setDescription(@Nullable String description) {
+ myDescription = description;
+ }
+
+ @NotNull
+ @Override
+ public String getGroup() {
+ return myGroup;
+ }
+
+ public void setGroup(@NotNull String group) {
+ myGroup = group;
+ }
+
+ @NotNull
+ @Override
+ public String getVersion() {
+ return myVersion;
+ }
+
+ public void setVersion(@NotNull String version) {
+ myVersion = version;
+ }
+
+ @NotNull
+ @Override
+ public Map getChildProjects() {
+ return myChildProjects;
+ }
+
+ public void setChildProjects(@NotNull Map childProjects) {
+ myChildProjects = childProjects;
+ }
+
+ @NotNull
+ @Override
+ public File getProjectDir() {
+ return myProjectDir;
+ }
+
+ public void setProjectDir(@NotNull File projectDir) {
+ myProjectDir = projectDir;
+ }
+
+ @NotNull
+ @Override
+ public File getBuildDir() {
+ return myBuildDir;
+ }
+
+ public void setBuildDir(@NotNull File buildDir) {
+ myBuildDir = buildDir;
+ }
+
+ @Nullable
+ @Override
+ public File getBuildFile() {
+ return myBuildFile;
+ }
+
+ public void setBuildFile(@Nullable File buildFile) {
+ myBuildFile = buildFile;
+ }
+
+ @NotNull
+ @Override
+ public Map getTasks() {
+ return myTasks;
+ }
+
+ public void setTasks(@NotNull Map tasks) {
+ myTasks = tasks;
+ }
+
+ @NotNull
+ @Override
+ public Map getPlugins() {
+ return myPlugins;
+ }
+
+ public void setPlugins(@NotNull Map plugins) {
+ myPlugins = plugins;
+ }
+
+ @NotNull
+ @Override
+ public Map getProperties() {
+ return myProperties;
+ }
+
+ public void setProperties(@NotNull Map properties) {
+ myProperties = properties;
+ }
+
+ @Nullable
+ @Override
+ public Object getProperty(String name) {
+ return myProperties.get(name);
+ }
+
+ @NotNull
+ @Override
+ public Map getSourceSets() {
+ return mySourceSets;
+ }
+
+ public void setSourceSets(@NotNull Map sourceSets) {
+ mySourceSets = sourceSets;
+ }
+}
diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalSourceDirectorySet.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalSourceDirectorySet.java
new file mode 100644
index 000000000000..d6a8d7aa6291
--- /dev/null
+++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalSourceDirectorySet.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2000-2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.externalSystem.model;
+
+import org.jetbrains.annotations.NotNull;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author Vladislav.Soroka
+ * @since 7/14/2014
+ */
+public class DefaultExternalSourceDirectorySet implements ExternalSourceDirectorySet {
+ private static final long serialVersionUID = 1L;
+
+ @NotNull
+ private String myName;
+ @NotNull
+ private Set mySrcDirs;
+ @NotNull
+ private File myOutputDir;
+ @NotNull
+ private Set myExcludes;
+ @NotNull
+ private Set myIncludes;
+ @NotNull
+ private List myFilters;
+
+ public DefaultExternalSourceDirectorySet() {
+ mySrcDirs = new HashSet();
+ myExcludes = new HashSet();
+ myIncludes = new HashSet();
+ myFilters = new ArrayList();
+ }
+
+ public DefaultExternalSourceDirectorySet(ExternalSourceDirectorySet sourceDirectorySet) {
+ this();
+ myName = sourceDirectorySet.getName();
+ mySrcDirs = new HashSet(sourceDirectorySet.getSrcDirs());
+ myOutputDir = sourceDirectorySet.getOutputDir();
+ myExcludes = new HashSet(sourceDirectorySet.getExcludes());
+ myIncludes = new HashSet(sourceDirectorySet.getIncludes());
+ for (ExternalFilter filter : sourceDirectorySet.getFilters()) {
+ myFilters.add(new DefaultExternalFilter(filter));
+ }
+ }
+
+ @NotNull
+ @Override
+ public String getName() {
+ return myName;
+ }
+
+ public void setName(@NotNull String name) {
+ myName = name;
+ }
+
+ @NotNull
+ @Override
+ public Set getSrcDirs() {
+ return mySrcDirs;
+ }
+
+ public void setSrcDirs(@NotNull Set srcDirs) {
+ mySrcDirs = srcDirs;
+ }
+
+ @NotNull
+ @Override
+ public File getOutputDir() {
+ return myOutputDir;
+ }
+
+ @NotNull
+ @Override
+ public Set getIncludes() {
+ return myIncludes;
+ }
+
+ public void setIncludes(@NotNull Set includes) {
+ myIncludes = includes;
+ }
+
+ @NotNull
+ @Override
+ public Set getExcludes() {
+ return myExcludes;
+ }
+
+ public void setExcludes(@NotNull Set excludes) {
+ myExcludes = excludes;
+ }
+
+ @NotNull
+ @Override
+ public List getFilters() {
+ return myFilters;
+ }
+
+ public void setFilters(@NotNull List filters) {
+ myFilters = filters;
+ }
+
+ public void setOutputDir(@NotNull File outputDir) {
+ myOutputDir = outputDir;
+ }
+}
diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalSourceSet.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalSourceSet.java
new file mode 100644
index 000000000000..19d692dd1985
--- /dev/null
+++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalSourceSet.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2000-2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.externalSystem.model;
+
+import com.intellij.openapi.externalSystem.model.project.ExternalSystemSourceType;
+import com.intellij.openapi.externalSystem.model.project.IExternalSystemSourceType;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Vladislav.Soroka
+ * @since 7/14/2014
+ */
+public class DefaultExternalSourceSet implements ExternalSourceSet {
+ private static final long serialVersionUID = 1L;
+
+ private String myName;
+ private Map mySources;
+
+ public DefaultExternalSourceSet() {
+ mySources = new HashMap();
+ }
+
+ public DefaultExternalSourceSet(ExternalSourceSet sourceSet) {
+ this();
+ myName = sourceSet.getName();
+ for (Map.Entry entry : sourceSet.getSources().entrySet()) {
+ mySources.put(ExternalSystemSourceType.from(entry.getKey()), new DefaultExternalSourceDirectorySet(entry.getValue()));
+ }
+ }
+
+ @NotNull
+ @Override
+ public String getName() {
+ return myName;
+ }
+
+ public void setName(String name) {
+ myName = name;
+ }
+
+ @NotNull
+ @Override
+ public Map getSources() {
+ return mySources;
+ }
+
+ public void setSources(Map sources) {
+ mySources = sources;
+ }
+}
diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalTask.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalTask.java
new file mode 100644
index 000000000000..e9392eb52e84
--- /dev/null
+++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/DefaultExternalTask.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2000-2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.externalSystem.model;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author Vladislav.Soroka
+ * @since 7/14/2014
+ */
+public class DefaultExternalTask implements ExternalTask {
+ private static final long serialVersionUID = 1L;
+
+ @NotNull
+ private String myName;
+ @NotNull
+ private String myQName;
+ @Nullable
+ private String myDescription;
+ @Nullable
+ private String myGroup;
+
+ public DefaultExternalTask() {
+ }
+
+ public DefaultExternalTask(ExternalTask externalTask) {
+ myName = externalTask.getName();
+ myQName = externalTask.getQName();
+ myDescription = externalTask.getDescription();
+ myGroup = externalTask.getGroup();
+ }
+
+ @NotNull
+ @Override
+ public String getName() {
+ return myName;
+ }
+
+ public void setName(@NotNull String name) {
+ myName = name;
+ }
+
+ @NotNull
+ @Override
+ public String getQName() {
+ return myQName;
+ }
+
+ public void setQName(@NotNull String QName) {
+ myQName = QName;
+ }
+
+ @Nullable
+ @Override
+ public String getDescription() {
+ return myDescription;
+ }
+
+ public void setDescription(@Nullable String description) {
+ myDescription = description;
+ }
+
+ @Nullable
+ @Override
+ public String getGroup() {
+ return myGroup;
+ }
+
+ public void setGroup(@Nullable String group) {
+ myGroup = group;
+ }
+}
diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalFilter.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalFilter.java
new file mode 100644
index 000000000000..98fc003cb645
--- /dev/null
+++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalFilter.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2000-2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.externalSystem.model;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.Serializable;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author Vladislav.Soroka
+ * @since 7/14/2014
+ */
+public interface ExternalFilter extends Serializable {
+ @NotNull
+ String getFilterType();
+ @NotNull
+ String getPropertiesAsJsonMap();
+}
diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalPlugin.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalPlugin.java
new file mode 100644
index 000000000000..edd3db771b3f
--- /dev/null
+++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalPlugin.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2000-2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.externalSystem.model;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.Serializable;
+
+/**
+ * @author Vladislav.Soroka
+ * @since 7/14/2014
+ */
+public interface ExternalPlugin extends Serializable {
+ @NotNull
+ String getId();
+}
diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalProject.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalProject.java
new file mode 100644
index 000000000000..6df2d413d0fd
--- /dev/null
+++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalProject.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2000-2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.externalSystem.model;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.File;
+import java.io.Serializable;
+import java.util.Map;
+
+/**
+ * @author Vladislav.Soroka
+ * @since 7/14/2014
+ */
+public interface ExternalProject extends Serializable {
+
+ @NotNull
+ String getExternalSystemId();
+
+ @NotNull
+ String getName();
+
+ @NotNull
+ String getQName();
+
+ @Nullable
+ String getDescription();
+
+ @NotNull
+ String getGroup();
+
+ @NotNull
+ String getVersion();
+
+ @NotNull
+ Map getChildProjects();
+
+ @NotNull
+ File getProjectDir();
+
+ @NotNull
+ File getBuildDir();
+
+ @Nullable
+ File getBuildFile();
+
+ @NotNull
+ Map getTasks();
+
+ //@NotNull
+ //Map getConfigurations();
+
+ //@NotNull
+ //List getRepositories();
+
+ //@NotNull
+ //List getDependencies();
+
+ @NotNull
+ Map getPlugins();
+
+ //@NotNull
+ //ExternalProjectBuild getBuild();
+
+ @NotNull
+ Map getProperties();
+
+ @Nullable
+ Object getProperty(String name);
+
+ @NotNull
+ Map getSourceSets();
+}
diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalSourceDirectorySet.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalSourceDirectorySet.java
new file mode 100644
index 000000000000..70f0bed3d177
--- /dev/null
+++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalSourceDirectorySet.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2000-2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.externalSystem.model;
+
+import org.jetbrains.annotations.NotNull;
+
+import java.io.File;
+import java.io.Serializable;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author Vladislav.Soroka
+ * @since 7/14/2014
+ */
+public interface ExternalSourceDirectorySet extends Serializable {
+ @NotNull
+ String getName();
+
+ @NotNull
+ Set getSrcDirs();
+
+ @NotNull
+ File getOutputDir();
+
+ @NotNull
+ Set getExcludes();
+ @NotNull
+ Set getIncludes();
+
+ @NotNull
+ List getFilters();
+}
diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalSourceSet.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalSourceSet.java
new file mode 100644
index 000000000000..b23c07bbafa6
--- /dev/null
+++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalSourceSet.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2000-2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.externalSystem.model;
+
+import com.intellij.openapi.externalSystem.model.project.IExternalSystemSourceType;
+import org.jetbrains.annotations.NotNull;
+
+import java.io.Serializable;
+import java.util.Map;
+
+/**
+ * @author Vladislav.Soroka
+ * @since 7/14/2014
+ */
+public interface ExternalSourceSet extends Serializable {
+ @NotNull
+ String getName();
+ //@NotNull
+ //ClasspathContainer getCompileClasspath();
+
+ //@NotNull
+ //ClasspathContainer getRuntimeClasspath();
+
+ @NotNull
+ Map getSources();
+}
diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalTask.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalTask.java
new file mode 100644
index 000000000000..b4c61c662acc
--- /dev/null
+++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/ExternalTask.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2000-2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.externalSystem.model;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.Serializable;
+
+/**
+ * @author Vladislav.Soroka
+ * @since 7/14/2014
+ */
+public interface ExternalTask extends Serializable {
+ @NotNull
+ String getName();
+ @NotNull
+ String getQName();
+ @Nullable
+ String getDescription();
+ @Nullable
+ String getGroup();
+}
diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ExternalSystemSourceType.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ExternalSystemSourceType.java
index ffe8a52d4a06..0e112b1c2b14 100644
--- a/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ExternalSystemSourceType.java
+++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/ExternalSystemSourceType.java
@@ -1,52 +1,62 @@
package com.intellij.openapi.externalSystem.model.project;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.Serializable;
-
/**
* Enumerates module source types.
*
* @author Denis Zhdanov
* @since 8/10/11 5:21 PM
*/
-public class ExternalSystemSourceType implements Serializable {
+public enum ExternalSystemSourceType implements IExternalSystemSourceType {
- @NotNull public static final ExternalSystemSourceType SOURCE = new ExternalSystemSourceType("SOURCE");
- @NotNull public static final ExternalSystemSourceType TEST = new ExternalSystemSourceType("TEST");
- @NotNull public static final ExternalSystemSourceType EXCLUDED = new ExternalSystemSourceType("EXCLUDED");
- @NotNull public static final ExternalSystemSourceType SOURCE_GENERATED = new ExternalSystemSourceType("SOURCE_GENERATED");
- @NotNull public static final ExternalSystemSourceType TEST_GENERATED = new ExternalSystemSourceType("TEST_GENERATED");
- @NotNull public static final ExternalSystemSourceType RESOURCE = new ExternalSystemSourceType("RESOURCE");
- @NotNull public static final ExternalSystemSourceType TEST_RESOURCE = new ExternalSystemSourceType("TEST_RESOURCE");
-
- private static final long serialVersionUID = 1L;
+ SOURCE(false, false, false, false),
+ TEST(true, false, false, false),
+ EXCLUDED(false, false, false, true),
+ SOURCE_GENERATED(true, true, false, false),
+ TEST_GENERATED(true, true, false, false),
+ RESOURCE(false, false, true, false),
+ TEST_RESOURCE(true, false, true, false);
- @NotNull private final String myId;
+ private final boolean isTest;
+ private final boolean isGenerated;
+ private final boolean isResource;
+ private final boolean isExcluded;
- public ExternalSystemSourceType(@NotNull String id) {
- myId = id;
+ ExternalSystemSourceType(boolean test, boolean generated, boolean resource, boolean excluded) {
+ isTest = test;
+ isGenerated = generated;
+ isResource = resource;
+ isExcluded = excluded;
}
@Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- ExternalSystemSourceType type = (ExternalSystemSourceType)o;
-
- if (!myId.equals(type.myId)) return false;
-
- return true;
+ public boolean isTest() {
+ return isTest;
}
@Override
- public int hashCode() {
- return myId.hashCode();
+ public boolean isGenerated() {
+ return isGenerated;
}
@Override
- public String toString() {
- return myId;
+ public boolean isResource() {
+ return isResource;
+ }
+
+ @Override
+ public boolean isExcluded() {
+ return isExcluded;
+ }
+
+ public static ExternalSystemSourceType from(IExternalSystemSourceType sourceType) {
+ for (ExternalSystemSourceType systemSourceType : ExternalSystemSourceType.values()) {
+ if (systemSourceType.isGenerated == sourceType.isGenerated() &&
+ systemSourceType.isResource == sourceType.isResource() &&
+ systemSourceType.isTest == sourceType.isTest() &&
+ systemSourceType.isExcluded == sourceType.isExcluded()) {
+ return systemSourceType;
+ }
+ }
+ throw new IllegalArgumentException("Invalid source type: " + sourceType);
}
}
diff --git a/plugins/properties/resources/icons/PropertiesIcons.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/IExternalSystemSourceType.java
similarity index 56%
rename from plugins/properties/resources/icons/PropertiesIcons.java
rename to platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/IExternalSystemSourceType.java
index 156d14467707..2ad8821b06cd 100644
--- a/plugins/properties/resources/icons/PropertiesIcons.java
+++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/model/project/IExternalSystemSourceType.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -13,20 +13,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package icons;
+package com.intellij.openapi.externalSystem.model.project;
-import com.intellij.openapi.util.IconLoader;
-
-import javax.swing.*;
+import java.io.Serializable;
/**
- * NOTE THIS FILE IS AUTO-GENERATED
- * DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
+ * @author Vladislav.Soroka
+ * @since 7/17/2014
*/
-public class PropertiesIcons {
- private static Icon load(String path) {
- return IconLoader.getIcon(path, PropertiesIcons.class);
- }
+public interface IExternalSystemSourceType extends Serializable {
+ boolean isTest();
- public static final Icon XmlProperties = load("/icons/xmlProperties.png"); // 16x16
+ boolean isGenerated();
+
+ boolean isResource();
+
+ boolean isExcluded();
}
diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/util/ExternalSystemApiUtil.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/util/ExternalSystemApiUtil.java
index a6cfc65eb759..fd3493447ced 100644
--- a/platform/external-system-api/src/com/intellij/openapi/externalSystem/util/ExternalSystemApiUtil.java
+++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/util/ExternalSystemApiUtil.java
@@ -681,4 +681,9 @@ public class ExternalSystemApiUtil {
public static String getExternalProjectPath(@Nullable Module module) {
return module != null ? module.getOptionValue(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY) : null;
}
+
+ @Nullable
+ public static String getExternalProjectId(@Nullable Module module) {
+ return module != null ? module.getOptionValue(ExternalSystemConstants.LINKED_PROJECT_ID_KEY) : null;
+ }
}
diff --git a/platform/external-system-api/src/com/intellij/openapi/externalSystem/util/ExternalSystemConstants.java b/platform/external-system-api/src/com/intellij/openapi/externalSystem/util/ExternalSystemConstants.java
index 283067810bb0..160c95938378 100644
--- a/platform/external-system-api/src/com/intellij/openapi/externalSystem/util/ExternalSystemConstants.java
+++ b/platform/external-system-api/src/com/intellij/openapi/externalSystem/util/ExternalSystemConstants.java
@@ -27,6 +27,7 @@ public class ExternalSystemConstants {
@NonNls @NotNull public static final String EXTERNAL_SYSTEM_ID_KEY = "external.system.id";
@NonNls @NotNull public static final String LINKED_PROJECT_PATH_KEY = "external.linked.project.path";
@NonNls @NotNull public static final String ROOT_PROJECT_PATH_KEY = "external.root.project.path";
+ @NonNls @NotNull public static final String LINKED_PROJECT_ID_KEY = "external.linked.project.id";
@NonNls @NotNull public static final String EXTERNAL_SYSTEM_MODULE_GROUP_KEY = "external.system.module.group";
@NonNls @NotNull public static final String EXTERNAL_SYSTEM_MODULE_VERSION_KEY = "external.system.module.version";
diff --git a/platform/external-system-impl/external-system-impl.iml b/platform/external-system-impl/external-system-impl.iml
index aa68fdc4d7b6..1cbf68f907f9 100644
--- a/platform/external-system-impl/external-system-impl.iml
+++ b/platform/external-system-impl/external-system-impl.iml
@@ -24,6 +24,7 @@
+
diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/ProjectStructureServices.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/ProjectStructureServices.java
deleted file mode 100644
index 1e6dadd0d3b8..000000000000
--- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/ProjectStructureServices.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.intellij.openapi.externalSystem.service.project;
-
-import org.jetbrains.annotations.NotNull;
-
-/**
- * Facades all services necessary for the 'sync project changes' processing.
- *
- * Thread-safe.
- *
- * @author Denis Zhdanov
- * @since 2/14/12 1:26 PM
- */
-public class ProjectStructureServices {
-
- @NotNull private final ProjectStructureHelper myProjectStructureHelper;
- @NotNull private final PlatformFacade myPlatformFacade;
- @NotNull private final ExternalLibraryPathTypeMapper myLibraryPathTypeMapper;
-
- public ProjectStructureServices(@NotNull ProjectStructureHelper projectStructureHelper,
- @NotNull PlatformFacade platformFacade,
- @NotNull ExternalLibraryPathTypeMapper mapper)
- {
- myProjectStructureHelper = projectStructureHelper;
- myPlatformFacade = platformFacade;
- myLibraryPathTypeMapper = mapper;
- }
-
- @NotNull
- public ProjectStructureHelper getProjectStructureHelper() {
- return myProjectStructureHelper;
- }
-
- @NotNull
- public PlatformFacade getPlatformFacade() {
- return myPlatformFacade;
- }
-
- @NotNull
- public ExternalLibraryPathTypeMapper getLibraryPathTypeMapper() {
- return myLibraryPathTypeMapper;
- }
-}
diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ModuleDataService.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ModuleDataService.java
index 4b1e3b13a22f..32919794eca4 100644
--- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ModuleDataService.java
+++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ModuleDataService.java
@@ -274,6 +274,7 @@ public class ModuleDataService implements ProjectDataService
module.putUserData(MODULE_DATA_KEY, moduleData);
module.setOption(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY, moduleData.getOwner().toString());
+ module.setOption(ExternalSystemConstants.LINKED_PROJECT_ID_KEY, moduleData.getId());
module.setOption(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY, moduleData.getLinkedExternalProjectPath());
final ProjectData projectData = moduleDataNode.getData(ProjectKeys.PROJECT);
module.setOption(ExternalSystemConstants.ROOT_PROJECT_PATH_KEY, projectData != null ? projectData.getLinkedExternalProjectPath() : "");
diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ProjectDataManager.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ProjectDataManager.java
index 6575ffb107f0..c2dcfe57b010 100644
--- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ProjectDataManager.java
+++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ProjectDataManager.java
@@ -25,6 +25,7 @@ import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.ContainerUtilRt;
import com.intellij.util.containers.Stack;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.util.Collection;
import java.util.List;
@@ -40,8 +41,10 @@ public class ProjectDataManager {
private static final Logger LOG = Logger.getInstance("#" + ProjectDataManager.class.getName());
- @NotNull private final NotNullLazyValue