Merge remote-tracking branch 'origin/master'

This commit is contained in:
Kirill Likhodedov
2011-12-28 19:44:46 +03:00
52 changed files with 409 additions and 170 deletions
+27
View File
@@ -0,0 +1,27 @@
<component name="ArtifactManager">
<artifact type="jar" name="jps">
<output-path>$PROJECT_DIR$/out/artifacts/jps</output-path>
<root id="archive" name="jps.jar">
<element id="module-output" name="jps" />
<element id="module-output" name="antlayout" />
<element id="module-output" name="jps-model" />
<element id="module-output" name="util" />
<element id="module-output" name="platform-resources-en" />
<element id="module-output" name="annotations" />
<element id="module-output" name="javac2" />
<element id="module-output" name="forms-compiler" />
<element id="module-output" name="forms_rt" />
<element id="module-output" name="notNull" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/jna-utils.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/jna.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/jdom.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/picocontainer.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/trove4j.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/asm.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/asm-commons.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/oromatcher.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/jgoodies-forms.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/guava-r09.jar" path-in-jar="/" />
</root>
</artifact>
</component>
+12
View File
@@ -0,0 +1,12 @@
<component name="ArtifactManager">
<artifact type="jar" name="jps-plugins">
<output-path>$PROJECT_DIR$/out/artifacts/jps</output-path>
<root id="archive" name="jps-plugins.jar">
<element id="module-output" name="jps-appLauncher" />
<element id="module-output" name="jps-gwt" />
<element id="module-output" name="jps-javaee" />
<element id="module-output" name="jps-jpa" />
<element id="module-output" name="jps-scala" />
</root>
</artifact>
</component>
+15
View File
@@ -0,0 +1,15 @@
<component name="ArtifactManager">
<artifact type="jar" name="jps-sources">
<output-path>$PROJECT_DIR$/out/artifacts/jps</output-path>
<root id="archive" name="jps-sources.zip">
<element id="dir-copy" path="$PROJECT_DIR$/jps/antLayout/src" />
<element id="dir-copy" path="$PROJECT_DIR$/jps/model/src" />
<element id="dir-copy" path="$PROJECT_DIR$/jps/plugins/appLauncher/src" />
<element id="dir-copy" path="$PROJECT_DIR$/jps/plugins/gwt/src" />
<element id="dir-copy" path="$PROJECT_DIR$/jps/plugins/javaee/src" />
<element id="dir-copy" path="$PROJECT_DIR$/jps/plugins/jpa/src" />
<element id="dir-copy" path="$PROJECT_DIR$/jps/plugins/scala/src" />
<element id="dir-copy" path="$PROJECT_DIR$/jps/src" />
</root>
</artifact>
</component>
+9 -3
View File
@@ -56,9 +56,15 @@
<module fileurl="file://$PROJECT_DIR$/plugins/cvs/javacvs-src/javacvs-src.iml" filepath="$PROJECT_DIR$/plugins/cvs/javacvs-src/javacvs-src.iml" group="plugins/VCS/cvs" />
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/jetgroovy.iml" filepath="$PROJECT_DIR$/plugins/groovy/jetgroovy.iml" group="plugins/Groovy" />
<module fileurl="file://$PROJECT_DIR$/plugins/tasks/jira-connector/jira-connector.iml" filepath="$PROJECT_DIR$/plugins/tasks/jira-connector/jira-connector.iml" group="plugins/tasks" />
<module fileurl="file://$PROJECT_DIR$/jps/jps.iml" filepath="$PROJECT_DIR$/jps/jps.iml" />
<module fileurl="file://$PROJECT_DIR$/jps/jps-builders/jps-builders.iml" filepath="$PROJECT_DIR$/jps/jps-builders/jps-builders.iml" />
<module fileurl="file://$PROJECT_DIR$/jps/model/jps-model.iml" filepath="$PROJECT_DIR$/jps/model/jps-model.iml" />
<module fileurl="file://$PROJECT_DIR$/jps/jps.iml" filepath="$PROJECT_DIR$/jps/jps.iml" group="jps" />
<module fileurl="file://$PROJECT_DIR$/jps/plugins/appLauncher/jps-appLauncher.iml" filepath="$PROJECT_DIR$/jps/plugins/appLauncher/jps-appLauncher.iml" group="jps" />
<module fileurl="file://$PROJECT_DIR$/jps/jps-builders/jps-builders.iml" filepath="$PROJECT_DIR$/jps/jps-builders/jps-builders.iml" group="jps" />
<module fileurl="file://$PROJECT_DIR$/jps/plugins/gwt/jps-gwt.iml" filepath="$PROJECT_DIR$/jps/plugins/gwt/jps-gwt.iml" group="jps" />
<module fileurl="file://$PROJECT_DIR$/jps/plugins/javaee/jps-javaee.iml" filepath="$PROJECT_DIR$/jps/plugins/javaee/jps-javaee.iml" group="jps" />
<module fileurl="file://$PROJECT_DIR$/jps/plugins/jpa/jps-jpa.iml" filepath="$PROJECT_DIR$/jps/plugins/jpa/jps-jpa.iml" group="jps" />
<module fileurl="file://$PROJECT_DIR$/jps/model/jps-model.iml" filepath="$PROJECT_DIR$/jps/model/jps-model.iml" group="jps" />
<module fileurl="file://$PROJECT_DIR$/jps/plugins/scala/jps-scala.iml" filepath="$PROJECT_DIR$/jps/plugins/scala/jps-scala.iml" group="jps" />
<module fileurl="file://$PROJECT_DIR$/jps/jps-tests.iml" filepath="$PROJECT_DIR$/jps/jps-tests.iml" group="jps" />
<module fileurl="file://$PROJECT_DIR$/java/jsp-base-openapi/jsp-base-openapi.iml" filepath="$PROJECT_DIR$/java/jsp-base-openapi/jsp-base-openapi.iml" group="java" />
<module fileurl="file://$PROJECT_DIR$/java/jsp-openapi/jsp-openapi.iml" filepath="$PROJECT_DIR$/java/jsp-openapi/jsp-openapi.iml" group="java" />
<module fileurl="file://$PROJECT_DIR$/java/jsp-spi/jsp-spi.iml" filepath="$PROJECT_DIR$/java/jsp-spi/jsp-spi.iml" group="java" />
+33
View File
@@ -0,0 +1,33 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="JPS tests" type="JUnit" factoryName="JUnit">
<extension name="coverage" enabled="false" merge="false" runner="idea">
<pattern>
<option name="PATTERN" value="org.jetbrains.jps.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<module name="jps-tests" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" value="" />
<option name="PACKAGE_NAME" value="org.jetbrains.jps" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/jps" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="moduleWithDependencies" />
</option>
<envs />
<patterns />
<RunnerSettings RunnerId="Profile ">
<option name="myExternalizedOptions" value="&#10;additional-options2=onexit\=snapshot&#10;" />
</RunnerSettings>
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Run" />
<method />
</configuration>
</component>
@@ -246,7 +246,7 @@ public class JavaMoveClassesOrPackagesHandler extends MoveHandlerDelegate {
final Module module = LangDataKeys.TARGET_MODULE.getData(dataContext);
if (module != null) {
final PsiDirectory[] directories = ((PsiPackage)targetContainer).getDirectories(GlobalSearchScope.moduleScope(module));
if (directories.length > 0) {
if (directories.length == 1) {
return directories[0];
}
}
@@ -21,6 +21,7 @@
package com.intellij.refactoring.util;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.resolve.FileContextUtil;
import com.intellij.psi.util.PsiFormatUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.refactoring.RefactoringBundle;
@@ -37,9 +38,16 @@ public class ConflictsUtil {
public static PsiElement getContainer(PsiElement place) {
PsiElement parent = place;
while (true) {
if (parent instanceof PsiMember && !(parent instanceof PsiTypeParameter))
if (parent instanceof PsiMember && !(parent instanceof PsiTypeParameter)) {
return parent;
if (parent instanceof PsiFile) return parent;
}
if (parent instanceof PsiFile) {
PsiElement host = FileContextUtil.getFileContext((PsiFile)parent);
if (host == null) {
return parent;
}
parent = host;
}
parent = parent.getParent();
}
}
@@ -901,7 +901,7 @@ public class RefactoringUtil {
@Nullable
public static PsiMethod getChainedConstructor(PsiMethod constructor) {
final PsiCodeBlock constructorBody = constructor.getBody();
LOG.assertTrue(constructorBody != null);
if (constructorBody == null) return null;
final PsiStatement[] statements = constructorBody.getStatements();
if (statements.length == 1 && statements[0] instanceof PsiExpressionStatement) {
final PsiExpression expression = ((PsiExpressionStatement)statements[0]).getExpression();
@@ -0,0 +1,11 @@
// "Add constructor parameter" "true"
public enum La {
;
private String s;
private La(String s) {
this.s = s;
}
private La(int a, String s);
}
@@ -0,0 +1,10 @@
// "Add constructor parameter" "true"
public enum La {
;
private String s<caret>;
private La() {
}
private La(int a);
}
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="jps" />
<orderEntry type="module" module-name="jps-appLauncher" />
<orderEntry type="module" module-name="jps-gwt" />
<orderEntry type="module" module-name="jps-javaee" />
<orderEntry type="module" module-name="jps-jpa" />
<orderEntry type="module" module-name="jps-model" />
<orderEntry type="module" module-name="jps-scala" />
</component>
</module>
@@ -23,11 +23,11 @@ class Library extends LazyInitializeableObject implements ClasspathItem {
Closure lazyInit = {
def meta = new InitializingExpando()
meta.classpath = {Object[] arg ->
arg.each { classpath << it }
arg.each { classpath << it.toString() }
}
meta.src = {Object[] arg ->
arg.each { sourceRoots << it }
arg.each { sourceRoots << it.toString() }
}
initializer.delegate = meta
@@ -58,19 +58,19 @@ class Module extends LazyInitializeableObject implements ClasspathItem {//}, Com
}
meta.content = {Object[] arg ->
arg.each { contentRoots << it}
arg.each { contentRoots << it.toString() }
}
meta.src = {Object[] arg ->
arg.each { sourceRoots << it }
arg.each { sourceRoots << it.toString() }
}
meta.testSrc = {Object[] arg ->
arg.each { testRoots << it }
arg.each { testRoots << it.toString() }
}
meta.exclude = {Object[] arg ->
arg.each { excludes << it }
arg.each { excludes << it.toString() }
}
initializer.delegate = meta
+1 -9
View File
@@ -11,15 +11,7 @@
<orderEntry type="module" module-name="jps" />
<orderEntry type="library" name="Groovy" level="project" />
<orderEntry type="module" module-name="jps-javaee" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$APPLICATION_HOME_DIR$/lib/junit.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="JUnit4" level="project" />
</component>
</module>
@@ -5,7 +5,6 @@ import junit.framework.TestCase;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* @author nik
+1
View File
@@ -4,6 +4,7 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/testSrc" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
@@ -5,7 +5,7 @@ package org.jetbrains.jps
*/
class JpaTest extends JpsBuildTestCase {
public void testOverwriteArtifacts() throws Exception {
doTest("testData/jpaTest/jpaTest.ipr", null, {
doTest("plugins/jpa/testData/jpaTest/jpaTest.ipr", null, {
dir("artifacts") {
dir("jpaTest") {
dir("WEB-INF") {
@@ -94,11 +94,12 @@ class ProjectBuilder {
if (chunk.elements.size() > 1) {
File outputDir
if (targetFolder != null) {
def basePath = tests ? new File(targetFolder, "test").absolutePath : new File(targetFolder, "production").absolutePath
def basePath = forTests ? new File(targetFolder, "test").absolutePath : new File(targetFolder, "production").absolutePath
def name = chunk.name
if (name.length() > 100) {
name = name.substring(0, 100) + "_etc"
}
outputDir = new File(basePath, name).absolutePath
outputDir = new File(basePath, name)
}
else {
outputDir = new File(forTests ? chunk.representativeModule().testOutputPath : chunk.representativeModule().outputPath)
@@ -60,7 +60,9 @@ class JavacBuilder implements ModuleBuilder, ModuleCycleBuilder {
params.debug = String.valueOf(debugInfo);
params.nowarn = String.valueOf(nowarn);
params.deprecation = String.valueOf(deprecation);
params.verbose = "true"
if (state.projectWrapper != null) {
params.verbose = "true"
}
def javacExecutable = getJavacExecutable(module)
if (javacExecutable != null) {
@@ -279,9 +281,9 @@ class GroovyStubGenerator implements ModuleBuilder {
}
class JetBrainsInstrumentations implements ModuleBuilder {
class CustomFormInstrumenter extends
static class CustomFormInstrumenter extends
FormInstrumenter {
final List<String> formFiles;
final List<File> formFiles;
final ModuleBuildState state;
@Override
@@ -304,7 +306,7 @@ class JetBrainsInstrumentations implements ModuleBuilder {
throw new RuntimeException(msg);
}
CustomFormInstrumenter(final File destDir, final List<String> nestedFormPathList, final List<String> ff, final ModuleBuildState s) {
CustomFormInstrumenter(final File destDir, final List<PrefixedPath> nestedFormPathList, final List<File> ff, final ModuleBuildState s) {
super(destDir, nestedFormPathList);
formFiles = ff;
state = s;
@@ -4,7 +4,7 @@ class ModuleInitTest extends JpsBuildTestCase {
public void testBasePath() {
Project project = loadProject("testData/moduleCycle/moduleCycle.ipr", [:]);
for (def name: ['module1', 'module2']) {
assertTrue(project.modules[name].basePath.endsWith(File.separator + name));
assertTrue(project.modules[name].basePath.endsWith("/" + name));
}
}
}
@@ -76,7 +76,7 @@ public class StubBasedPsiElementBase<T extends StubElement> extends ASTDelegateP
FileElement treeElement = file.getTreeElement();
StubTree stubTree = file.getStubTree();
if (treeElement != null) {
throw new AssertionError("this="+this+"; file.isPhysical="+file.isPhysical() + "; node=" + myNode + "; file=" + file + "; tree=" + treeElement + "; stubTree=" + stubTree);
return notBoundInExistingAst(file, treeElement, stubTree);
}
final FileElement fileElement = file.loadTreeElement();
node = myNode;
@@ -104,6 +104,26 @@ public class StubBasedPsiElementBase<T extends StubElement> extends ASTDelegateP
return node;
}
private ASTNode notBoundInExistingAst(PsiFileImpl file, FileElement treeElement, StubTree stubTree) {
String message = "this=" + this +
"; file.isPhysical=" + file.isPhysical() +
"; node=" + myNode +
"; file=" + file +
"; tree=" + treeElement +
"; stubTree=" + stubTree;
PsiElement each = this;
while (each != null) {
message += "\n each=" + each + " of class " + each.getClass();
if (each instanceof StubBasedPsiElementBase) {
message += "; node=" + ((StubBasedPsiElementBase)each).myNode + "; stub=" + ((StubBasedPsiElementBase)each).myStub;
each = ((StubBasedPsiElementBase)each).getParentByStub();
} else {
break;
}
}
throw new AssertionError(message);
}
public void setNode(final ASTNode node) {
myNode = node;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1004 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -21,6 +21,7 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.WriteExternalException;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.ResourceUtil;
import com.intellij.util.xmlb.SerializationFilter;
import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters;
@@ -66,12 +67,20 @@ public abstract class InspectionProfileEntry {
public abstract String getDisplayName();
/**
* This method is not supposed to be overridden.
* @return short name that is used in two cases: \inspectionDescriptions\&lt;short_name&gt;.html resource may contain short inspection
* description to be shown in "Inspect Code..." dialog and also provide some file name convention when using offline
* inspection or export to HTML function. Should be unique among all inspections.
* @see InspectionEP#shortName
*/
@NonNls @NotNull
public abstract String getShortName();
public String getShortName() {
return getShortName(getClass());
}
public static String getShortName(Class<? extends InspectionProfileEntry> aClass) {
return StringUtil.trimEnd(aClass.getSimpleName(), "Inspection");
}
/**
* @return highlighting level for this inspection tool that is used in default settings.
@@ -192,7 +192,7 @@ public class TemplateBuilderImpl implements TemplateBuilder {
int start = 0;
for (final RangeMarker element : myElements) {
int offset = element.getStartOffset() - containerStart;
LOG.assertTrue(start <= offset,"container: " + myContainerElement.getClass() + " markers: " +
LOG.assertTrue(start <= offset,"container: " + myContainerElement + " markers: " +
StringUtil.join(myElements, new Function<RangeMarker, String>() {
@Override
public String fun(RangeMarker rangeMarker) {
@@ -40,12 +40,16 @@ public abstract class InspectionToolWrapper<T extends InspectionProfileEntry, E
protected final E myEP;
protected InspectionToolWrapper(E ep) {
myEP = ep;
this(null, ep);
}
protected InspectionToolWrapper(T tool) {
this(tool, null);
}
protected InspectionToolWrapper(@Nullable T tool, @Nullable E ep) {
myEP = ep;
myTool = tool;
myEP = null;
}
@NotNull
@@ -51,6 +51,10 @@ public final class LocalInspectionToolWrapper extends InspectionToolWrapper<Loca
super(ep);
}
public LocalInspectionToolWrapper(@Nullable LocalInspectionTool tool, @Nullable LocalInspectionEP ep) {
super(tool, ep);
}
public void processFile(PsiFile file, final boolean filterSuppressed, final InspectionManager manager) {
processFile(file, filterSuppressed, manager, false);
}
@@ -21,6 +21,7 @@ import com.intellij.history.LocalHistory;
import com.intellij.history.LocalHistoryAction;
import com.intellij.ide.*;
import com.intellij.ide.FileEditorProvider;
import com.intellij.ide.actions.CollapseAllToolbarAction;
import com.intellij.ide.impl.ProjectViewSelectInTarget;
import com.intellij.ide.projectView.HelpID;
import com.intellij.ide.projectView.ProjectView;
@@ -69,6 +70,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.*;
import com.intellij.openapi.wm.ex.ToolWindowManagerAdapter;
import com.intellij.openapi.wm.ex.ToolWindowManagerEx;
import com.intellij.openapi.wm.impl.InternalDecorator;
import com.intellij.openapi.wm.impl.ToolWindowImpl;
import com.intellij.openapi.wm.impl.content.ToolWindowContentUi;
import com.intellij.psi.*;
@@ -471,6 +473,7 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo
myViewContentPanel.revalidate();
myViewContentPanel.repaint();
createToolbarActions();
updateTitleActions();
newPane.setTreeChangeListener(myTreeChangeListener);
myAutoScrollToSourceHandler.install(newPane.myTree);
@@ -506,6 +509,25 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo
myAutoScrollToSourceHandler.onMouseClicked(newPane.myTree);
}
private void updateTitleActions() {
final ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow("Project");
if (window == null) return;
final InternalDecorator decorator = ((ToolWindowImpl)window).getDecorator();
ScrollFromSourceAction scrollAction = null;
CollapseAllToolbarAction collapseAction = null;
for (AnAction action : myActionGroup.getChildren(null)) {
if (action instanceof ScrollFromSourceAction) {
scrollAction = (ScrollFromSourceAction)action;
myActionGroup.remove(scrollAction);
}
if (action instanceof CollapseAllToolbarAction) {
collapseAction = (CollapseAllToolbarAction)action;
myActionGroup.remove(collapseAction);
}
}
decorator.setTitleActions(new AnAction[] {scrollAction, collapseAction});
}
// public for tests
public synchronized void setupImpl(final ToolWindow toolWindow) {
setupImpl(toolWindow, true);
@@ -670,7 +692,7 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo
return true;
}
}, getComponent());
myActionGroup.add(collapseAllAction);
//myActionGroup.add(collapseAllAction);
getCurrentProjectViewPane().addToolbarActions(myActionGroup);
}
@@ -1732,7 +1754,7 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo
private class ScrollFromSourceAction extends AnAction implements DumbAware {
private ScrollFromSourceAction() {
super("Scroll from Source", "Select the file open in the active editor", IconLoader.getIcon("/general/autoscrollFromSource.png"));
super("Scroll from Source", "Select the file open in the active editor", IconLoader.getIcon("/general/locate.png"));
}
@Override
@@ -16,6 +16,8 @@
package com.intellij.packageDependencies.ui;
import com.intellij.openapi.util.Comparing;
import java.util.Comparator;
public class DependencyNodeComparator implements Comparator<PackageDependenciesNode>{
@@ -36,6 +38,6 @@ public class DependencyNodeComparator implements Comparator<PackageDependenciesN
return ((Comparable)p1).compareTo(p2);
}
}
return p1.toString().compareTo(p2.toString());
return Comparing.compare(p1.toString(), p2.toString());
}
}
@@ -149,6 +149,7 @@ public abstract class BaseRefactoringProcessor {
final Ref<Language> refErrorLanguage = new Ref<Language>();
final Ref<Boolean> refProcessCanceled = new Ref<Boolean>();
final Ref<Boolean> dumbModeOccurred = new Ref<Boolean>();
final Ref<Boolean> anyException = new Ref<Boolean>();
final Runnable findUsagesRunnable = new Runnable() {
@Override
@@ -170,6 +171,9 @@ public abstract class BaseRefactoringProcessor {
catch (IndexNotReadyException e) {
dumbModeOccurred.set(Boolean.TRUE);
}
catch (Throwable e) {
anyException.set(Boolean.TRUE);
}
}
};
@@ -191,6 +195,10 @@ public abstract class BaseRefactoringProcessor {
return;
}
if (!anyException.isNull()) {
//do not proceed if find usages fails
return;
}
assert !refUsages.isNull(): "Null usages from processor " + this;
if (!preprocessUsages(refUsages)) return;
final UsageInfo[] usages = refUsages.get();
@@ -83,7 +83,7 @@ public class MoveFilesOrDirectoriesUtil {
try {
final VirtualFile virtualFile = file.getVirtualFile();
assert virtualFile != null;
LOG.assertTrue(virtualFile != null, file);
virtualFile.move(manager, newDirectory.getVirtualFile());
}
catch (IOException e) {
@@ -3261,16 +3261,6 @@ public class AbstractTreeUi {
}
private boolean isValid(DefaultMutableTreeNode node) {
if (node == null) return false;
final Object object = node.getUserObject();
if (object instanceof NodeDescriptor) {
return isValid((NodeDescriptor)object);
}
return false;
}
private boolean isValid(NodeDescriptor descriptor) {
return descriptor != null && isValid(getElementFromDescriptor(descriptor));
}
@@ -334,6 +334,10 @@ public final class InternalDecorator extends JPanel implements Queryable, TypeSa
}, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
}
public void setTitleActions(AnAction[] actions) {
myHeader.setAdditionalTitleActions(actions);
}
private static class InnerPanelBorder implements Border {
private final ToolWindow myWindow;
@@ -63,6 +63,7 @@ public abstract class ToolWindowHeader extends JPanel implements Disposable {
private static final Icon ourHideDownIcon = IconLoader.getIcon("/general/hideDownPart.png");
private static final Icon ourSettingsIcon = IconLoader.getIcon("/general/gear.png");
private static final Icon ourSeparatorIcon = IconLoader.getIcon("/general/divider.png");
private ToolWindow myToolWindow;
private WindowInfoImpl myInfo;
@@ -70,6 +71,8 @@ public abstract class ToolWindowHeader extends JPanel implements Disposable {
private BufferedImage myImage;
private BufferedImage myActiveImage;
private ToolWindowType myImageType;
private JPanel myButtonPanel;
private final ToolWindowHeader.ActionButton myGearButton;
public ToolWindowHeader(final ToolWindowImpl toolWindow, WindowInfoImpl info, @NotNull final Producer<ActionGroup> gearProducer) {
setLayout(new BorderLayout());
@@ -106,12 +109,13 @@ public abstract class ToolWindowHeader extends JPanel implements Disposable {
eastPanel.setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 3));
add(eastPanel, BorderLayout.EAST);
eastPanel.add(new ActionButton(new AnAction() {
myGearButton = new ActionButton(new AnAction() {
@Override
public void actionPerformed(AnActionEvent e) {
final InputEvent inputEvent = e.getInputEvent();
final ActionPopupMenu popupMenu =
((ActionManagerImpl)ActionManager.getInstance()).createActionPopupMenu(ToolWindowContentUi.POPUP_PLACE, gearProducer.produce(), new MenuItemPresentationFactory(true));
((ActionManagerImpl)ActionManager.getInstance())
.createActionPopupMenu(ToolWindowContentUi.POPUP_PLACE, gearProducer.produce(), new MenuItemPresentationFactory(true));
int x = 0;
int y = 0;
@@ -122,9 +126,7 @@ public abstract class ToolWindowHeader extends JPanel implements Disposable {
popupMenu.getComponent().show(inputEvent.getComponent(), x, y);
}
}, ourSettingsIcon));
eastPanel.add(Box.createHorizontalStrut(3));
}, ourSettingsIcon);
myHideButton = new ActionButton(new HideAction() {
@Override
@@ -137,7 +139,7 @@ public abstract class ToolWindowHeader extends JPanel implements Disposable {
sideHidden();
}
},
ourHideLeftSideIcon, null, null
ourHideLeftSideIcon, null, null
) {
@Override
protected Icon getActiveIcon() {
@@ -150,7 +152,8 @@ public abstract class ToolWindowHeader extends JPanel implements Disposable {
}
};
eastPanel.add(myHideButton);
addDefaultActions(eastPanel);
myButtonPanel = eastPanel;
addMouseListener(new PopupHandler() {
public void invokePopup(final Component comp, final int x, final int y) {
@@ -180,6 +183,13 @@ public abstract class ToolWindowHeader extends JPanel implements Disposable {
setBorder(BorderFactory.createEmptyBorder(TabsUtil.TABS_BORDER, 1, TabsUtil.TABS_BORDER, 1));
}
private void addDefaultActions(JPanel eastPanel) {
eastPanel.add(myGearButton);
eastPanel.add(Box.createHorizontalStrut(6));
eastPanel.add(myHideButton);
eastPanel.add(Box.createHorizontalStrut(1));
}
@Override
public void dispose() {
removeAll();
@@ -192,7 +202,23 @@ public abstract class ToolWindowHeader extends JPanel implements Disposable {
myHideButton.updateTooltip();
}
}
public void setAdditionalTitleActions(AnAction[] actions) {
myButtonPanel.removeAll();
boolean actionAdded = false;
for (AnAction action : actions) {
if (action == null) continue;
myButtonPanel.add(new ActionButton(action, action.getTemplatePresentation().getIcon()));
myButtonPanel.add(Box.createHorizontalStrut(7));
actionAdded = true;
}
if (actionAdded) {
myButtonPanel.add(new JLabel(ourSeparatorIcon));
myButtonPanel.add(Box.createHorizontalStrut(6));
}
addDefaultActions(myButtonPanel);
}
private static Icon getHideToolWindowIcon(ToolWindow toolWindow) {
ToolWindowAnchor anchor = toolWindow.getAnchor();
if (anchor == ToolWindowAnchor.BOTTOM) {
@@ -434,7 +434,7 @@ public final class ToolWindowImpl implements ToolWindowEx {
}
public void showContentPopup(InputEvent inputEvent) {
myContentUI.showContentPopup(inputEvent);
myContentUI.toggleContentPopup(inputEvent);
}
@Override
@@ -52,7 +52,7 @@ public class ContentComboLabel extends BaseLabel {
super.processMouseEvent(e);
if (UIUtil.isActionClick(e)) {
myUi.showContentPopup(e);
myUi.toggleContentPopup(e);
}
}
@@ -21,7 +21,7 @@ import com.intellij.ide.actions.ShowContentAction;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.actionSystem.impl.ActionManagerImpl;
import com.intellij.openapi.actionSystem.impl.MenuItemPresentationFactory;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.ui.popup.ListPopup;
import com.intellij.openapi.ui.popup.ListSeparator;
import com.intellij.openapi.ui.popup.PopupStep;
import com.intellij.openapi.ui.popup.util.BaseListPopupStep;
@@ -34,6 +34,7 @@ import com.intellij.ui.awt.RelativeRectangle;
import com.intellij.ui.content.*;
import com.intellij.ui.content.tabs.PinToolwindowTabAction;
import com.intellij.ui.content.tabs.TabbedContentAction;
import com.intellij.ui.popup.list.ListPopupImpl;
import com.intellij.ui.switcher.SwitchProvider;
import com.intellij.ui.switcher.SwitchTarget;
import com.intellij.util.ui.UIUtil;
@@ -76,6 +77,7 @@ public class ToolWindowContentUi extends JPanel implements ContentUI, PropertyCh
ContentLayout myComboLayout = new ComboContentLayout(this);
private ToolWindowContentUiType myType = ToolWindowContentUiType.TABBED;
private boolean myShouldNotShowPopup;
public ToolWindowContentUi(ToolWindowImpl window) {
myWindow = window;
@@ -420,7 +422,11 @@ public class ToolWindowContentUi extends JPanel implements ContentUI, PropertyCh
return getCurrentLayout() == layout;
}
public void showContentPopup(InputEvent inputEvent) {
public void toggleContentPopup(InputEvent inputEvent) {
if (myShouldNotShowPopup) {
myShouldNotShowPopup = false;
return;
}
BaseListPopupStep step = new BaseListPopupStep<Content>(null, myManager.getContents()) {
@Override
public PopupStep onChosen(Content selectedValue, boolean finalChoice) {
@@ -453,8 +459,21 @@ public class ToolWindowContentUi extends JPanel implements ContentUI, PropertyCh
};
step.setDefaultOptionIndex(Arrays.asList(myManager.getContents()).indexOf(myManager.getSelectedContent()));
getCurrentLayout().showContentPopup(JBPopupFactory.getInstance().createListPopup(step));
final ListPopup popup = new ListPopupImpl(step) {
@Override
public void cancel(InputEvent e) {
super.cancel(e);
if (e instanceof MouseEvent) {
final MouseEvent me = (MouseEvent)e;
final Component component = SwingUtilities.getDeepestComponentAt(e.getComponent(), me.getX(), me.getY());
if (UIUtil.isActionClick(me) && component instanceof ContentComboLabel &&
SwingUtilities.isDescendingFrom(component, ToolWindowContentUi.this)) {
myShouldNotShowPopup = true;
}
}
}
};
getCurrentLayout().showContentPopup(popup);
}
public List<SwitchTarget> getTargets(boolean onlyVisible, boolean originalProvider) {
@@ -68,6 +68,7 @@ import com.intellij.openapi.editor.markup.GutterIconRenderer;
import com.intellij.openapi.editor.markup.RangeHighlighter;
import com.intellij.openapi.extensions.ExtensionPoint;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.extensions.ExtensionsArea;
import com.intellij.openapi.fileEditor.*;
import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider;
@@ -152,6 +153,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
@NonNls private static final String XXX = "XXX";
private final FileTreeAccessFilter myJavaFilesFilter = new FileTreeAccessFilter();
private boolean myAllowDirt;
private final Map<String, LocalInspectionEP> myExtensions = new HashMap<String, LocalInspectionEP>();
public CodeInsightTestFixtureImpl(IdeaProjectTestFixture projectFixture, TempDirTestFixture tempDirTestFixture) {
myProjectFixture = projectFixture;
@@ -1024,6 +1026,10 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
DaemonCodeAnalyzerSettings.getInstance().setImportHintEnabled(false);
ensureIndexesUpToDate(getProject());
((StartupManagerImpl)StartupManagerEx.getInstanceEx(getProject())).runPostStartupActivities();
LocalInspectionEP[] extensions = Extensions.getExtensions(LocalInspectionEP.LOCAL_INSPECTION);
for (LocalInspectionEP extension : extensions) {
myExtensions.put(extension.shortName, extension);
}
}
@Override
@@ -1057,9 +1063,15 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
HighlightDisplayKey.register(shortName, tool.getDisplayName(), id);
}
myAvailableTools.put(shortName, tool);
myAvailableLocalTools.put(shortName, tool instanceof LocalInspectionTool ?
new LocalInspectionToolWrapper((LocalInspectionTool)tool) :
(InspectionTool)tool);
InspectionTool inspectionTool;
if (tool instanceof LocalInspectionTool) {
LocalInspectionEP ep = myExtensions.get(tool.getShortName());
inspectionTool = new LocalInspectionToolWrapper((LocalInspectionTool)tool, ep);
}
else {
inspectionTool = (InspectionTool)tool;
}
myAvailableLocalTools.put(shortName, inspectionTool);
}
private void configureInspections(final InspectionProfileEntry[] tools) {
+1
View File
@@ -25,6 +25,7 @@
<orderEntry type="library" name="TestNG" level="project" />
<orderEntry type="module" module-name="compiler-impl" />
<orderEntry type="module" module-name="properties" />
<orderEntry type="module" module-name="idea-ui" scope="TEST" />
</component>
</module>
@@ -14,7 +14,6 @@ import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.JDOMUtil;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.vcs.VcsException;
@@ -37,7 +36,6 @@ import git4idea.i18n.GitBundle;
import git4idea.ui.GitUIUtil;
import org.jetbrains.plugins.github.ui.GithubShareDialog;
import javax.swing.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -98,17 +96,14 @@ public class GithubShareAction extends DumbAwareAction {
final GithubSettings settings = GithubSettings.getInstance();
final String password = settings.getPassword();
final boolean privateRepoAllowed;
try {
privateRepoAllowed = GithubUtil.accessToGithubWithModalProgress(project, new Computable<Boolean>() {
@Override
public Boolean compute() {
ProgressManager.getInstance().getProgressIndicator().setText("Trying to login to GitHub");
return GithubUtil.isPrivateRepoAllowed(settings.getHost(), settings.getLogin(), password);
}
});
}
catch (GithubUtil.CancelledException ex) {
final Boolean privateRepoAllowed = GithubUtil.accessToGithubWithModalProgress(project, new Computable<Boolean>() {
@Override
public Boolean compute() {
ProgressManager.getInstance().getProgressIndicator().setText("Trying to login to GitHub");
return GithubUtil.isPrivateRepoAllowed(settings.getHost(), settings.getLogin(), password);
}
});
if (privateRepoAllowed == null) {
return;
}
final GithubShareDialog shareDialog = new GithubShareDialog(project, names, privateRepoAllowed);
@@ -66,31 +66,21 @@ public class GithubUtil {
return url.startsWith("https://") ? url.substring(8) : url.startsWith("http://") ? url.substring(7) : url.startsWith("git@") ? url.substring(4) : url;
}
public static <T> T accessToGithubWithModalProgress(final Project project, final Computable<T> computable) throws CancelledException {
public static <T> T accessToGithubWithModalProgress(final Project project, final Computable<T> computable) {
final Ref<T> result = new Ref<T>();
ProgressManager.getInstance().run(new Task.Modal(project, "Access to GitHub", true) {
public void run(@NotNull ProgressIndicator indicator) {
result.set(computable.compute());
}
@Override
public void onCancel() {
throw new CancelledException();
}
});
return result.get();
}
public static void accessToGithubWithModalProgress(final Project project, final Runnable runnable) throws CancelledException {
public static void accessToGithubWithModalProgress(final Project project, final Runnable runnable) {
ProgressManager.getInstance().run(new Task.Modal(project, "Access to GitHub", true) {
public void run(@NotNull ProgressIndicator indicator) {
runnable.run();
}
@Override
public void onCancel() {
throw new CancelledException();
}
});
}
@@ -246,8 +236,6 @@ public class GithubUtil {
});
}
public static class CancelledException extends RuntimeException {}
/**
* Shows GitHub login settings if credentials are wrong or empty and return the list of all the watched repos by user
* @param project
@@ -263,20 +251,15 @@ public class GithubUtil {
}
}
// Otherwise our credentials are valid and they are successfully stored in settings
try {
final GithubSettings settings = GithubSettings.getInstance();
final String validPassword = settings.getPassword();
return accessToGithubWithModalProgress(project, new Computable<List<RepositoryInfo>>() {
@Override
public List<RepositoryInfo> compute() {
ProgressManager.getInstance().getProgressIndicator().setText("Extracting info about available repositories");
return getAvailableRepos(settings.getHost(), settings.getLogin(), validPassword, ownOnly);
}
});
}
catch (CancelledException e) {
return null;
}
final GithubSettings settings = GithubSettings.getInstance();
final String validPassword = settings.getPassword();
return accessToGithubWithModalProgress(project, new Computable<List<RepositoryInfo>>() {
@Override
public List<RepositoryInfo> compute() {
ProgressManager.getInstance().getProgressIndicator().setText("Extracting info about available repositories");
return getAvailableRepos(settings.getHost(), settings.getLogin(), validPassword, ownOnly);
}
});
}
/**
@@ -288,17 +271,14 @@ public class GithubUtil {
public static RepositoryInfo getDetailedRepositoryInfo(final Project project, final String owner, final String name) {
final GithubSettings settings = GithubSettings.getInstance();
final String password = settings.getPassword();
final boolean validCredentials;
try {
validCredentials = accessToGithubWithModalProgress(project, new Computable<Boolean>() {
@Override
public Boolean compute() {
ProgressManager.getInstance().getProgressIndicator().setText("Trying to login to GitHub");
return testConnection(settings.getHost(), settings.getLogin(), password);
}
});
}
catch (CancelledException e) {
final Boolean validCredentials = accessToGithubWithModalProgress(project, new Computable<Boolean>() {
@Override
public Boolean compute() {
ProgressManager.getInstance().getProgressIndicator().setText("Trying to login to GitHub");
return testConnection(settings.getHost(), settings.getLogin(), password);
}
});
if (validCredentials == null) {
return null;
}
if (!validCredentials){
@@ -309,19 +289,14 @@ public class GithubUtil {
}
}
// Otherwise our credentials are valid and they are successfully stored in settings
try {
final String validPassword = settings.getPassword();
return accessToGithubWithModalProgress(project, new Computable<RepositoryInfo>() {
@Override
public RepositoryInfo compute() {
ProgressManager.getInstance().getProgressIndicator().setText("Extracting detailed info about repository ''" + name + "''");
return getDetailedRepoInfo(settings.getHost(), settings.getLogin(), validPassword, owner, name);
}
});
}
catch (CancelledException e) {
return null;
}
final String validPassword = settings.getPassword();
return accessToGithubWithModalProgress(project, new Computable<RepositoryInfo>() {
@Override
public RepositoryInfo compute() {
ProgressManager.getInstance().getProgressIndicator().setText("Extracting detailed info about repository ''" + name + "''");
return getDetailedRepoInfo(settings.getHost(), settings.getLogin(), validPassword, owner, name);
}
});
}
@Nullable
@@ -5,8 +5,8 @@ intention.category.comments=Comments
intention.category.groovy.style=Groovy-style
intention.category.control.flow=Control Flow
demorgans.law.intention.family.name=DeMorgan's Law
demorgans.intention.name1=Replace \\&\\& with ||
demorgans.intention.name2=Replace || with \\&\\&
demorgans.intention.name1=Replace ''\\&\\&'' with ''||''
demorgans.intention.name2=Replace ''||'' with ''\\&\\&''
merge.if.and.intention.name=Merge if's
merge.if.and.intention.family.name=Merge Nested Ifs To ANDed Condition
make.closure.call.explicit.intention.name=Make closure call explicit
@@ -32,9 +32,9 @@ convert.integer.to.octal.intention.name=Convert to octal
convert.integer.to.octal.intention.family.name=Convert To Octal
convert.integer.to.binary.intention.name=Convert to binary
convert.integer.to.binary.intention.family.name=Convert To Binary
flip.comparison.intention.name=Flip {0} to {1}
negate.comparison.intention.name=Negate {0} to {1}
flip.smth.intention.name=Flip {0}
flip.comparison.intention.name=Flip ''{0}'' to ''{1}''
negate.comparison.intention.name=Negate ''{0}'' to ''{1}''
flip.smth.intention.name=Flip ''{0}''
merge.else.if.intention.name=Merge else-if
merge.else.if.intention.family.name=Merge Else If
split.else.if.intention.name=Split else-if
@@ -43,7 +43,7 @@ split.if.intention.name=Split into 2 if's
split.if.intention.family.name=Split into 2 if's
invert.if.intention.name=Invert If Condition
invert.if.intention.family.name=Invert If Condition
flip.conditional.intention.name=Flip ?:
flip.conditional.intention.name=Flip ''?:''
flip.conditional.intention.family.name=Flip Conditional
conditional.to.elvis.intention.name=Convert Conditional to Elvis
conditional.to.elvis.intention.family.name=Convert Conditional
@@ -37,6 +37,10 @@ public class FlipComparisonIntention extends MutablyNamedIntention {
final String comparison = ComparisonUtils.getStringForComparison(tokenType);
final String flippedComparison = ComparisonUtils.getFlippedComparison(tokenType);
if (comparison.equals(flippedComparison)) {
return GroovyIntentionsBundle.message("flip.smth.intention.name", comparison);
}
return GroovyIntentionsBundle.message("flip.comparison.intention.name", comparison, flippedComparison);
}
@@ -15,7 +15,6 @@
*/
package com.intellij.junit4;
import com.intellij.rt.execution.junit.JUnitForkedStarter;
import org.junit.Ignore;
import org.junit.internal.AssumptionViolatedException;
import org.junit.internal.requests.ClassRequest;
@@ -82,13 +81,10 @@ public class JUnit4TestRunnerUtil {
allClasses = JUnit46ClassesRequestBuilder.getClassesRequest(suiteName, classes);
}
catch (ClassNotFoundException e) {
try {
Class.forName("org.junit.internal.requests.ClassesRequest");
allClasses = JUnit4ClassesRequestBuilder.getClassesRequest(suiteName, classes);
}
catch (ClassNotFoundException e1) {
allClasses = JUnit45ClassesRequestBuilder.getClassesRequest(suiteName, classes);
}
allClasses = getClassRequestsUsing44API(suiteName, classes);
}
catch (NoSuchMethodError e) {
allClasses = getClassRequestsUsing44API(suiteName, classes);
}
return classMethods.isEmpty() ? allClasses : allClasses.filterWith(new Filter() {
@@ -160,6 +156,18 @@ public class JUnit4TestRunnerUtil {
return result.size() == 1 ? Request.aClass((Class)result.get(0)) : Request.classes(getArrayOfClasses(result));
}
private static Request getClassRequestsUsing44API(String suiteName, Class[] classes) {
Request allClasses;
try {
Class.forName("org.junit.internal.requests.ClassesRequest");
allClasses = JUnit4ClassesRequestBuilder.getClassesRequest(suiteName, classes);
}
catch (ClassNotFoundException e1) {
allClasses = JUnit45ClassesRequestBuilder.getClassesRequest(suiteName, classes);
}
return allClasses;
}
private static void appendTestClass(Vector result, String className) {
final Class aClass = loadTestClass(className);
if (!result.contains(aClass)) { //do not append classes twice: rerun failed tests from one test suite
+1 -1
View File
@@ -430,7 +430,7 @@
<localInspection language="JAVA" suppressId="deprecation" shortName="Deprecation" displayName="Deprecated API usage" groupName=""
enabledByDefault="true" level="WARNING"
implementationClass="com.intellij.codeInspection.deprecation.DeprecationInspection"/>
<localInspection language="JAVA" shortName="DeprecatedClassUsageInspection" displayName="Deprecated API usage in XML" groupName="XML"
<localInspection language="XML" shortName="DeprecatedClassUsageInspection" displayName="Deprecated API usage in XML" groupName="XML"
enabledByDefault="true" level="WARNING" implementationClass="com.intellij.util.xml.DeprecatedClassUsageInspection"/>
<localInspection language="JAVA" shortName="EqualsAndHashcode" bundle="messages.InspectionsBundle" key="inspection.equals.hashcode.display.name"
groupName="" enabledByDefault="false" level="WARNING"
@@ -76,24 +76,35 @@ public abstract class DomAnchorImpl<T extends DomElement> implements DomAnchor<T
final int index = values.indexOf(t);
if (index < 0) {
diagnoseNegativeIndex(t, parent, description, values);
diagnoseNegativeIndex2(t, parent, description, values);
}
return new IndexedAnchor<T>(parentAnchor, description, index);
}
private static <T extends DomElement> void diagnoseNegativeIndex(T t,
DomElement parent,
AbstractDomChildrenDescription description,
List<? extends DomElement> values) {
private static <T extends DomElement> void diagnoseNegativeIndex2(T t,
DomElement parent,
AbstractDomChildrenDescription description,
List<? extends DomElement> values) {
final XmlTag parentTag = parent.getXmlTag();
StringBuilder diag = new StringBuilder("Index<0: description=" + description + "\nparent=" + parent + "\nt=" + t + "\nvalues=" + values + "\n");
for (DomElement value : values) {
for (int i = 0, size = values.size(); i < size; i++) {
DomElement value = values.get(i);
if (value.toString().equals(t.toString())) {
diag.append(" hasSame, same=" + (value == t) +
final XmlElement tElement = t.getXmlElement();
final XmlElement valElement = value.getXmlElement();
diag.append(" hasSame, i=" + i +
"; same=" + (value == t) +
", equal=" + value.equals(t) +
", equal2=" + t.equals(value) +
", sameElements=" + (t.getXmlElement() == value.getXmlElement()) +
", t.physical=" + (tElement == null ? "null" : String.valueOf(tElement.isPhysical())) +
", value.physical=" + (valElement == null ? "null" : String.valueOf(valElement.isPhysical())) +
", sameElements=" + (tElement == value.getXmlElement()) +
"\n");
if (tElement != null && valElement != null) {
diag.append(" sameFile=" + (tElement.getContainingFile() == valElement.getContainingFile()) +
", sameParent=" + (tElement.getParent() == valElement.getParent()) +
"\n");
}
}
}
@@ -106,7 +117,7 @@ public abstract class DomAnchorImpl<T extends DomElement> implements DomAnchor<T
diag.append("\n");
} else {
for (XmlTag tag : parentTag.getSubTags()) {
diag.append(", subtag: ").append(tag.getName());
diag.append("\n subtag: ").append(tag.getName());
}
diag.append("\n");
}
@@ -588,7 +588,7 @@ public abstract class DomInvocationHandler<T extends AbstractDomChildDescription
return semElement;
}
}
return new IndexedElementInvocationHandler(evaluatedXmlName, description, index, new VirtualDomParentStrategy(this), myManager, "");
return new IndexedElementInvocationHandler(evaluatedXmlName, description, index, new VirtualDomParentStrategy(this), myManager);
}
@NotNull
@@ -105,7 +105,7 @@ public class DomSemContributor extends SemContributor {
}
if (current instanceof XmlTag) {
final XmlTag xmlTag = (XmlTag)current;
if (localName.equals(xmlTag.getName()) && namespace.equals(xmlTag.getNamespace())) {
if (localName.equals(xmlTag.getLocalName()) && namespace.equals(xmlTag.getNamespace())) {
index++;
if (index >= totalCount) {
return null;
@@ -117,7 +117,7 @@ public class DomSemContributor extends SemContributor {
final DomManagerImpl myDomManager = parent.getManager();
final IndexedElementInvocationHandler handler =
new IndexedElementInvocationHandler(parent.createEvaluatedXmlName(description.getXmlName()), (FixedChildDescriptionImpl)description, index,
new PhysicalDomParentStrategy(tag, myDomManager), myDomManager, namespace);
new PhysicalDomParentStrategy(tag, myDomManager), myDomManager);
tag.putUserData(DomManagerImpl.CACHED_DOM_HANDLER, handler);
return handler;
}
@@ -20,17 +20,14 @@ import java.util.List;
public class IndexedElementInvocationHandler extends DomInvocationHandler<FixedChildDescriptionImpl>{
private static final Logger LOG = Logger.getInstance("#com.intellij.util.xml.impl.IndexedElementInvocationHandler");
private final int myIndex;
private String myNamespace;
public IndexedElementInvocationHandler(final EvaluatedXmlName tagName,
final FixedChildDescriptionImpl description,
final int index,
final DomParentStrategy strategy,
final DomManagerImpl manager,
final String namespace) {
final DomManagerImpl manager) {
super(description.getType(), strategy, tagName, description, manager, strategy.getXmlElement() != null);
myIndex = index;
myNamespace = namespace;
}
@SuppressWarnings({"EqualsWhichDoesntCheckParameterClass"})
@@ -49,9 +46,7 @@ public class IndexedElementInvocationHandler extends DomInvocationHandler<FixedC
final List<XmlTag> tags = DomImplUtil.findSubTags(tag, getXmlName(), parentHandler.getFile());
if (tags.size() <= myIndex) return null;
final XmlTag childTag = tags.get(myIndex);
myNamespace = childTag.getNamespace();
return childTag;
return tags.get(myIndex);
}
protected XmlTag setEmptyXmlTag() {
@@ -62,9 +57,7 @@ public class IndexedElementInvocationHandler extends DomInvocationHandler<FixedC
parent.createFixedChildrenTags(getXmlName(), description, myIndex);
final List<XmlTag> tags = DomImplUtil.findSubTags(parent.getXmlTag(), getXmlName(), xmlFile);
if (tags.size() > myIndex) {
final XmlTag tag = tags.get(myIndex);
myNamespace = tag.getNamespace();
return tag;
return tags.get(myIndex);
}
final XmlTag[] newTag = new XmlTag[1];
@@ -79,7 +72,6 @@ public class IndexedElementInvocationHandler extends DomInvocationHandler<FixedC
}
}
});
myNamespace = newTag[0].getNamespace();
return newTag[0];
}