Merge remote-tracking branch 'origin/master'

Conflicts:
	python/helpers/pycharm/utrunner.py
This commit is contained in:
Ilya.Kazakevich
2015-05-18 19:18:48 +03:00
67 changed files with 1058 additions and 724 deletions
+23
View File
@@ -0,0 +1,23 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Dart tests" type="JUnit" factoryName="JUnit" singleton="true">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="Dart-community" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" value="" />
<option name="PACKAGE_NAME" value="" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<option name="VM_PARAMETERS" value="-ea -Didea.home.path=../ -Didea.system.path=../test-system -Didea.config.path=../test-config -Xbootclasspath/p:../out/classes/production/boot -XX:+HeapDumpOnOutOfMemoryError -Xmx350m -XX:MaxPermSize=200m -Djava.system.class.loader=com.intellij.util.lang.UrlClassLoader" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/bin" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<envs />
<patterns />
<method />
</configuration>
</component>
+1 -1
View File
@@ -49,7 +49,7 @@ def unpackJdks() {
private void unpackJdk(File osDir, File jdkDir, String majorVersion) {
def jdkFiles = osDir.listFiles().findAll { it.name.startsWith("jdk$majorVersion") }
if (SystemInfo.isWindows) {
def arch = SystemInfo.is64Bit ? "x64" : "x32"
def arch = "x64"
jdkFiles = jdkFiles.findAll { it.name.endsWith("_${arch}.zip") }
}
if (jdkFiles.empty) {
@@ -321,8 +321,9 @@ public class JavaDebugProcess extends XDebugProcess {
leftToolbar.add(ActionManager.getInstance().getAction(DebuggerActions.DUMP_THREADS), beforeRunner);
leftToolbar.add(Separator.getInstance(), beforeRunner);
settings.addAction(new AutoVarsSwitchAction(), Constraints.FIRST);
settings.addAction(new WatchLastMethodReturnValueAction(), Constraints.FIRST);
Constraints beforeSort = new Constraints(Anchor.BEFORE, "XDebugger.ToggleSortValues");
settings.addAction(new WatchLastMethodReturnValueAction(), beforeSort);
settings.addAction(new AutoVarsSwitchAction(), beforeSort);
}
private static class AutoVarsSwitchAction extends ToggleAction {
@@ -69,18 +69,20 @@ public class ModulesConfigurator implements ModulesProvider, ModuleEditor.Change
private static final Logger LOG = Logger.getInstance("#" + ModulesConfigurator.class.getName());
private final Project myProject;
private final List<ModuleEditor> myModuleEditors = new ArrayList<ModuleEditor>();
private final Comparator<ModuleEditor> myModuleEditorComparator = new Comparator<ModuleEditor>() {
@Override
public int compare(ModuleEditor editor1, ModuleEditor editor2) {
return ModulesAlphaComparator.INSTANCE.compare(editor1.getModule(), editor2.getModule());
}
@SuppressWarnings({"EqualsWhichDoesntCheckParameterClass"})
public boolean equals(Object o) {
return false;
private final Map<Module, ModuleEditor> myModuleEditors = new TreeMap<Module, ModuleEditor>(new Comparator<Module>() {
@Override
public int compare(Module o1, Module o2) {
String n1 = o1.getName();
String n2 = o2.getName();
int result = n1.compareToIgnoreCase(n2);
if (result != 0) {
return result;
}
return n1.compareTo(n2);
}
};
});
private boolean myModified = false;
private ModifiableModuleModel myModuleModel;
private boolean myModuleModelCommitted = false;
@@ -107,7 +109,7 @@ public class ModulesConfigurator implements ModulesProvider, ModuleEditor.Change
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
for (final ModuleEditor moduleEditor : myModuleEditors) {
for (final ModuleEditor moduleEditor : myModuleEditors.values()) {
Disposer.dispose(moduleEditor);
}
myModuleEditors.clear();
@@ -119,7 +121,6 @@ public class ModulesConfigurator implements ModulesProvider, ModuleEditor.Change
}
}
});
}
@Override
@@ -140,12 +141,7 @@ public class ModulesConfigurator implements ModulesProvider, ModuleEditor.Change
@Nullable
public ModuleEditor getModuleEditor(Module module) {
for (final ModuleEditor moduleEditor : myModuleEditors) {
if (module.equals(moduleEditor.getModule())) {
return moduleEditor;
}
}
return null;
return myModuleEditors.get(module);
}
@Override
@@ -170,7 +166,7 @@ public class ModulesConfigurator implements ModulesProvider, ModuleEditor.Change
}
};
myModuleEditors.add(moduleEditor);
myModuleEditors.put(moduleEditor.getModule(), moduleEditor);
moduleEditor.addChangeListener(this);
Disposer.register(moduleEditor, new Disposable() {
@@ -202,7 +198,6 @@ public class ModulesConfigurator implements ModulesProvider, ModuleEditor.Change
for (Module module : modules) {
getOrCreateModuleEditor(module);
}
Collections.sort(myModuleEditors, myModuleEditorComparator);
}
}
});
@@ -226,7 +221,7 @@ public class ModulesConfigurator implements ModulesProvider, ModuleEditor.Change
// validate content and source roots
final Map<VirtualFile, String> contentRootToModuleNameMap = new HashMap<VirtualFile, String>();
final Map<VirtualFile, VirtualFile> srcRootsToContentRootMap = new HashMap<VirtualFile, VirtualFile>();
for (final ModuleEditor moduleEditor : myModuleEditors) {
for (final ModuleEditor moduleEditor : myModuleEditors.values()) {
final ModifiableRootModel rootModel = moduleEditor.getModifiableRootModel();
final ContentEntry[] contents = rootModel.getContentEntries();
for (ContentEntry contentEntry : contents) {
@@ -278,7 +273,7 @@ public class ModulesConfigurator implements ModulesProvider, ModuleEditor.Change
}
final List<ModifiableRootModel> models = new ArrayList<ModifiableRootModel>(myModuleEditors.size());
for (ModuleEditor moduleEditor : myModuleEditors) {
for (ModuleEditor moduleEditor : myModuleEditors.values()) {
moduleEditor.canApply();
}
@@ -287,8 +282,8 @@ public class ModulesConfigurator implements ModulesProvider, ModuleEditor.Change
for (Map.Entry<Sdk, Sdk> entry : projectJdksModel.getProjectSdks().entrySet()) {
modifiedToOriginalMap.put(entry.getValue(), entry.getKey());
}
for (final ModuleEditor moduleEditor : myModuleEditors) {
for (final ModuleEditor moduleEditor : myModuleEditors.values()) {
final ModifiableRootModel model = moduleEditor.apply();
if (model != null) {
if (!model.isSdkInherited()) {
@@ -407,7 +402,6 @@ public class ModulesConfigurator implements ModulesProvider, ModuleEditor.Change
@Override
public void run() {
getOrCreateModuleEditor(module);
Collections.sort(myModuleEditors, myModuleEditorComparator);
}
});
processModuleCountChanged();
@@ -466,13 +460,13 @@ public class ModulesConfigurator implements ModulesProvider, ModuleEditor.Change
return false;
}
// do remove
myModuleEditors.remove(selectedEditor);
myModuleEditors.remove(selectedEditor.getModule());
// destroyProcess removed module
final Module moduleToRemove = selectedEditor.getModule();
// remove all dependencies on the module that is about to be removed
List<ModifiableRootModel> modifiableRootModels = new ArrayList<ModifiableRootModel>();
for (final ModuleEditor moduleEditor : myModuleEditors) {
for (final ModuleEditor moduleEditor : myModuleEditors.values()) {
final ModifiableRootModel modifiableRootModel = moduleEditor.getModifiableRootModelProxy();
modifiableRootModels.add(modifiableRootModel);
}
@@ -487,13 +481,13 @@ public class ModulesConfigurator implements ModulesProvider, ModuleEditor.Change
private void processModuleCountChanged() {
for (ModuleEditor moduleEditor : myModuleEditors) {
for (ModuleEditor moduleEditor : myModuleEditors.values()) {
moduleEditor.moduleCountChanged();
}
}
public void processModuleCompilerOutputChanged(String baseUrl) {
for (ModuleEditor moduleEditor : myModuleEditors) {
for (ModuleEditor moduleEditor : myModuleEditors.values()) {
moduleEditor.updateCompilerOutputPathChanged(baseUrl, moduleEditor.getName());
}
}
@@ -502,7 +496,7 @@ public class ModulesConfigurator implements ModulesProvider, ModuleEditor.Change
if (myModuleModel.isChanged()) {
return true;
}
for (ModuleEditor moduleEditor : myModuleEditors) {
for (ModuleEditor moduleEditor : myModuleEditors.values()) {
if (moduleEditor.isModified()) {
return true;
}
@@ -552,13 +546,12 @@ public class ModulesConfigurator implements ModulesProvider, ModuleEditor.Change
}
public void moduleRenamed(Module module, final String oldName, final String name) {
for (ModuleEditor moduleEditor : myModuleEditors) {
if (module == moduleEditor.getModule() && Comparing.strEqual(moduleEditor.getName(), oldName)) {
moduleEditor.setModuleName(name);
moduleEditor.updateCompilerOutputPathChanged(ProjectStructureConfigurable.getInstance(myProject).getProjectConfig().getCompilerOutputUrl(), name);
myContext.getDaemonAnalyzer().queueUpdate(new ModuleProjectStructureElement(myContext, module));
return;
}
ModuleEditor moduleEditor = myModuleEditors.get(module);
if (moduleEditor != null && Comparing.strEqual(moduleEditor.getName(), oldName)) {
moduleEditor.setModuleName(name);
moduleEditor.updateCompilerOutputPathChanged(
ProjectStructureConfigurable.getInstance(myProject).getProjectConfig().getCompilerOutputUrl(), name);
myContext.getDaemonAnalyzer().queueUpdate(new ModuleProjectStructureElement(myContext, module));
}
}
@@ -276,13 +276,15 @@ public class GenerateMembersUtil {
substituteReturnType(PsiManager.getInstance(project), resultMethod, sourceMethod.getReturnType(), collisionResolvedSubstitutor);
substituteParameters(factory, codeStyleManager, sourceMethod.getParameterList(), resultMethod.getParameterList(), collisionResolvedSubstitutor, target);
copyDocComment(sourceMethod, resultMethod, factory);
final List<PsiClassType> thrownTypes = ExceptionUtil.collectSubstituted(collisionResolvedSubstitutor, sourceMethod.getThrowsList().getReferencedTypes());
GlobalSearchScope scope = sourceMethod.getResolveScope();
final List<PsiClassType> thrownTypes = ExceptionUtil.collectSubstituted(collisionResolvedSubstitutor, sourceMethod.getThrowsList().getReferencedTypes(),
scope);
if (target instanceof PsiClass) {
final PsiClass[] supers = ((PsiClass)target).getSupers();
for (PsiClass aSuper : supers) {
final PsiMethod psiMethod = aSuper.findMethodBySignature(sourceMethod, true);
if (psiMethod != null && psiMethod != sourceMethod) {
ExceptionUtil.retainExceptions(thrownTypes, ExceptionUtil.collectSubstituted(TypeConversionUtil.getSuperClassSubstitutor(aSuper, (PsiClass)target, PsiSubstitutor.EMPTY), psiMethod.getThrowsList().getReferencedTypes()));
ExceptionUtil.retainExceptions(thrownTypes, ExceptionUtil.collectSubstituted(TypeConversionUtil.getSuperClassSubstitutor(aSuper, (PsiClass)target, PsiSubstitutor.EMPTY), psiMethod.getThrowsList().getReferencedTypes(), scope));
}
}
}
@@ -1,20 +1,4 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* 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.
*/
/* The following code was generated by JFlex 1.4.3 on 1/21/15 7:24 PM */
/* The following code was generated by JFlex 1.4.3 on 5/15/15 11:22 AM */
/* It's an automatically generated code. Do not modify it. */
package com.intellij.lang.java.lexer;
@@ -28,8 +12,8 @@ import com.intellij.psi.tree.IElementType;
/**
* This class is a scanner generated by
* <a href="http://www.jflex.de/">JFlex</a> 1.4.3
* on 1/21/15 7:24 PM from the specification file
* <tt>/Users/yole/jetbrains/IDEA/tools/lexer/../../community/java/java-psi-impl/src/com/intellij/lang/java/lexer/_JavaDocLexer.flex</tt>
* on 5/15/15 11:22 AM from the specification file
* <tt>C:/ws/IDEA/tools/lexer/../../community/java/java-psi-impl/src/com/intellij/lang/java/lexer/_JavaDocLexer.flex</tt>
*/
class _JavaDocLexer implements FlexLexer {
/** initial size of the lookahead buffer */
@@ -63,70 +47,90 @@ class _JavaDocLexer implements FlexLexer {
* Translates characters to character classes
*/
private static final String ZZ_CMAP_PACKED =
"\11\0\1\2\1\35\1\0\1\2\1\1\22\0\1\2\2\0\1\13"+
"\1\4\3\0\1\11\1\12\1\7\1\0\1\14\1\5\1\3\1\6"+
"\12\3\1\5\1\0\1\22\1\0\1\23\1\0\1\15\32\4\1\10"+
"\1\0\1\10\1\0\1\4\1\0\1\17\1\4\1\25\1\27\1\30"+
"\3\4\1\32\2\4\1\31\1\21\1\4\1\26\1\16\1\4\1\20"+
"\1\4\1\33\6\4\1\24\1\0\1\34\44\0\4\4\4\0\1\4"+
"\12\0\1\4\4\0\1\4\5\0\27\4\1\0\37\4\1\0\u013f\4"+
"\31\0\162\4\4\0\14\4\16\0\5\4\11\0\1\4\213\0\1\4"+
"\13\0\1\4\1\0\3\4\1\0\1\4\1\0\24\4\1\0\54\4"+
"\1\0\46\4\1\0\5\4\4\0\202\4\10\0\105\4\1\0\46\4"+
"\2\0\2\4\6\0\20\4\41\0\46\4\2\0\1\4\7\0\47\4"+
"\110\0\33\4\5\0\3\4\56\0\32\4\5\0\13\4\43\0\2\4"+
"\1\0\143\4\1\0\1\4\17\0\2\4\7\0\2\4\12\0\3\4"+
"\2\0\1\4\20\0\1\4\1\0\36\4\35\0\3\4\60\0\46\4"+
"\13\0\1\4\u0152\0\66\4\3\0\1\4\22\0\1\4\7\0\12\4"+
"\43\0\10\4\2\0\2\4\2\0\26\4\1\0\7\4\1\0\1\4"+
"\3\0\4\4\3\0\1\4\36\0\2\4\1\0\3\4\16\0\4\4"+
"\21\0\6\4\4\0\2\4\2\0\26\4\1\0\7\4\1\0\2\4"+
"\1\0\2\4\1\0\2\4\37\0\4\4\1\0\1\4\23\0\3\4"+
"\20\0\11\4\1\0\3\4\1\0\26\4\1\0\7\4\1\0\2\4"+
"\1\0\5\4\3\0\1\4\22\0\1\4\17\0\2\4\17\0\1\4"+
"\23\0\10\4\2\0\2\4\2\0\26\4\1\0\7\4\1\0\2\4"+
"\1\0\5\4\3\0\1\4\36\0\2\4\1\0\3\4\17\0\1\4"+
"\21\0\1\4\1\0\6\4\3\0\3\4\1\0\4\4\3\0\2\4"+
"\1\0\1\4\1\0\2\4\3\0\2\4\3\0\3\4\3\0\10\4"+
"\1\0\3\4\77\0\1\4\13\0\10\4\1\0\3\4\1\0\27\4"+
"\1\0\12\4\1\0\5\4\46\0\2\4\43\0\10\4\1\0\3\4"+
"\1\0\27\4\1\0\12\4\1\0\5\4\3\0\1\4\40\0\1\4"+
"\1\0\2\4\43\0\10\4\1\0\3\4\1\0\27\4\1\0\20\4"+
"\46\0\2\4\43\0\22\4\3\0\30\4\1\0\11\4\1\0\1\4"+
"\2\0\7\4\72\0\60\4\1\0\2\4\13\0\10\4\72\0\2\4"+
"\1\0\1\4\2\0\2\4\1\0\1\4\2\0\1\4\6\0\4\4"+
"\1\0\7\4\1\0\3\4\1\0\1\4\1\0\1\4\2\0\2\4"+
"\1\0\4\4\1\0\2\4\11\0\1\4\2\0\5\4\1\0\1\4"+
"\25\0\2\4\42\0\1\4\77\0\10\4\1\0\42\4\35\0\4\4"+
"\164\0\42\4\1\0\5\4\1\0\2\4\45\0\6\4\112\0\46\4"+
"\12\0\51\4\7\0\132\4\5\0\104\4\5\0\122\4\6\0\7\4"+
"\1\0\77\4\1\0\1\4\1\0\4\4\2\0\7\4\1\0\1\4"+
"\1\0\4\4\2\0\47\4\1\0\1\4\1\0\4\4\2\0\37\4"+
"\1\0\1\4\1\0\4\4\2\0\7\4\1\0\1\4\1\0\4\4"+
"\2\0\7\4\1\0\7\4\1\0\27\4\1\0\37\4\1\0\1\4"+
"\1\0\4\4\2\0\7\4\1\0\47\4\1\0\23\4\105\0\125\4"+
"\14\0\u026c\4\2\0\10\4\12\0\32\4\5\0\113\4\3\0\3\4"+
"\17\0\15\4\1\0\4\4\16\0\22\4\16\0\22\4\16\0\15\4"+
"\1\0\3\4\17\0\64\4\43\0\1\4\3\0\2\4\103\0\130\4"+
"\10\0\51\4\127\0\35\4\63\0\36\4\2\0\5\4\u038b\0\154\4"+
"\224\0\234\4\4\0\132\4\6\0\26\4\2\0\6\4\2\0\46\4"+
"\2\0\6\4\2\0\10\4\1\0\1\4\1\0\1\4\1\0\1\4"+
"\1\0\37\4\2\0\65\4\1\0\7\4\1\0\1\4\3\0\3\4"+
"\1\0\7\4\3\0\4\4\2\0\6\4\4\0\15\4\5\0\3\4"+
"\1\0\7\4\102\0\2\4\23\0\1\4\34\0\1\4\15\0\1\4"+
"\40\0\22\4\120\0\1\4\4\0\1\4\2\0\12\4\1\0\1\4"+
"\3\0\5\4\6\0\1\4\1\0\1\4\1\0\1\4\1\0\4\4"+
"\1\0\3\4\1\0\7\4\3\0\3\4\5\0\5\4\26\0\44\4"+
"\u0e81\0\3\4\31\0\11\4\7\0\5\4\2\0\5\4\4\0\126\4"+
"\6\0\3\4\1\0\137\4\5\0\50\4\4\0\136\4\21\0\30\4"+
"\70\0\20\4\u0200\0\u19b6\4\112\0\u51a6\4\132\0\u048d\4\u0773\0\u2ba4\4"+
"\u215c\0\u012e\4\2\0\73\4\225\0\7\4\14\0\5\4\5\0\1\4"+
"\1\0\12\4\1\0\15\4\1\0\5\4\1\0\1\4\1\0\2\4"+
"\1\0\2\4\1\0\154\4\41\0\u016b\4\22\0\100\4\2\0\66\4"+
"\50\0\15\4\66\0\2\4\30\0\3\4\31\0\1\4\6\0\5\4"+
"\1\0\207\4\7\0\1\4\34\0\32\4\4\0\1\4\1\0\32\4"+
"\12\0\132\4\3\0\6\4\2\0\6\4\2\0\6\4\2\0\3\4"+
"\3\0\2\4\3\0\2\4\31\0";
"\11\0\1\2\1\35\1\0\1\2\1\1\22\0\1\2\2\0\1\14"+
"\1\4\3\0\1\12\1\13\1\10\1\0\1\15\1\5\1\3\1\7"+
"\12\3\1\5\1\0\1\23\1\0\1\24\1\0\1\16\32\4\1\11"+
"\1\0\1\11\1\0\1\4\1\0\1\20\1\4\1\26\1\30\1\31"+
"\3\4\1\33\2\4\1\32\1\22\1\4\1\27\1\17\1\4\1\21"+
"\1\4\1\34\6\4\1\25\1\0\1\6\44\0\4\4\4\0\1\4"+
"\12\0\1\4\4\0\1\4\5\0\27\4\1\0\37\4\1\0\u01ca\4"+
"\4\0\14\4\16\0\5\4\7\0\1\4\1\0\1\4\201\0\5\4"+
"\1\0\2\4\2\0\4\4\10\0\1\4\1\0\3\4\1\0\1\4"+
"\1\0\24\4\1\0\123\4\1\0\213\4\10\0\236\4\11\0\46\4"+
"\2\0\1\4\7\0\47\4\7\0\1\4\100\0\33\4\5\0\3\4"+
"\30\0\1\4\24\0\53\4\43\0\2\4\1\0\143\4\1\0\1\4"+
"\17\0\2\4\7\0\2\4\12\0\3\4\2\0\1\4\20\0\1\4"+
"\1\0\36\4\35\0\131\4\13\0\1\4\30\0\41\4\11\0\2\4"+
"\4\0\1\4\5\0\26\4\4\0\1\4\11\0\1\4\3\0\1\4"+
"\27\0\31\4\107\0\1\4\1\0\13\4\127\0\66\4\3\0\1\4"+
"\22\0\1\4\7\0\12\4\17\0\7\4\1\0\7\4\5\0\10\4"+
"\2\0\2\4\2\0\26\4\1\0\7\4\1\0\1\4\3\0\4\4"+
"\3\0\1\4\20\0\1\4\15\0\2\4\1\0\3\4\16\0\4\4"+
"\7\0\1\4\11\0\6\4\4\0\2\4\2\0\26\4\1\0\7\4"+
"\1\0\2\4\1\0\2\4\1\0\2\4\37\0\4\4\1\0\1\4"+
"\23\0\3\4\20\0\11\4\1\0\3\4\1\0\26\4\1\0\7\4"+
"\1\0\2\4\1\0\5\4\3\0\1\4\22\0\1\4\17\0\2\4"+
"\17\0\1\4\23\0\10\4\2\0\2\4\2\0\26\4\1\0\7\4"+
"\1\0\2\4\1\0\5\4\3\0\1\4\36\0\2\4\1\0\3\4"+
"\17\0\1\4\21\0\1\4\1\0\6\4\3\0\3\4\1\0\4\4"+
"\3\0\2\4\1\0\1\4\1\0\2\4\3\0\2\4\3\0\3\4"+
"\3\0\14\4\26\0\1\4\50\0\1\4\13\0\10\4\1\0\3\4"+
"\1\0\27\4\1\0\12\4\1\0\5\4\3\0\1\4\32\0\2\4"+
"\6\0\2\4\43\0\10\4\1\0\3\4\1\0\27\4\1\0\12\4"+
"\1\0\5\4\3\0\1\4\40\0\1\4\1\0\2\4\17\0\2\4"+
"\22\0\10\4\1\0\3\4\1\0\51\4\2\0\1\4\20\0\1\4"+
"\21\0\2\4\30\0\6\4\5\0\22\4\3\0\30\4\1\0\11\4"+
"\1\0\1\4\2\0\7\4\72\0\60\4\1\0\2\4\13\0\10\4"+
"\72\0\2\4\1\0\1\4\2\0\2\4\1\0\1\4\2\0\1\4"+
"\6\0\4\4\1\0\7\4\1\0\3\4\1\0\1\4\1\0\1\4"+
"\2\0\2\4\1\0\4\4\1\0\2\4\11\0\1\4\2\0\5\4"+
"\1\0\1\4\25\0\4\4\40\0\1\4\77\0\10\4\1\0\44\4"+
"\33\0\5\4\163\0\53\4\24\0\1\4\20\0\6\4\4\0\4\4"+
"\3\0\1\4\3\0\2\4\7\0\3\4\4\0\15\4\14\0\1\4"+
"\21\0\46\4\1\0\1\4\5\0\1\4\2\0\53\4\1\0\u014d\4"+
"\1\0\4\4\2\0\7\4\1\0\1\4\1\0\4\4\2\0\51\4"+
"\1\0\4\4\2\0\41\4\1\0\4\4\2\0\7\4\1\0\1\4"+
"\1\0\4\4\2\0\17\4\1\0\71\4\1\0\4\4\2\0\103\4"+
"\45\0\20\4\20\0\125\4\14\0\u026c\4\2\0\21\4\1\0\32\4"+
"\5\0\113\4\3\0\3\4\17\0\15\4\1\0\4\4\16\0\22\4"+
"\16\0\22\4\16\0\15\4\1\0\3\4\17\0\64\4\43\0\1\4"+
"\3\0\2\4\103\0\130\4\10\0\51\4\1\0\1\4\5\0\106\4"+
"\12\0\35\4\63\0\36\4\2\0\5\4\13\0\54\4\25\0\7\4"+
"\70\0\27\4\11\0\65\4\122\0\1\4\135\0\57\4\21\0\7\4"+
"\67\0\36\4\15\0\2\4\12\0\54\4\32\0\44\4\51\0\3\4"+
"\12\0\44\4\153\0\4\4\1\0\4\4\3\0\2\4\11\0\300\4"+
"\100\0\u0116\4\2\0\6\4\2\0\46\4\2\0\6\4\2\0\10\4"+
"\1\0\1\4\1\0\1\4\1\0\1\4\1\0\37\4\2\0\65\4"+
"\1\0\7\4\1\0\1\4\3\0\3\4\1\0\7\4\3\0\4\4"+
"\2\0\6\4\4\0\15\4\5\0\3\4\1\0\7\4\102\0\2\4"+
"\23\0\1\4\34\0\1\4\15\0\1\4\20\0\15\4\3\0\33\4"+
"\107\0\1\4\4\0\1\4\2\0\12\4\1\0\1\4\3\0\5\4"+
"\6\0\1\4\1\0\1\4\1\0\1\4\1\0\4\4\1\0\13\4"+
"\2\0\4\4\5\0\5\4\4\0\1\4\21\0\51\4\u0a77\0\57\4"+
"\1\0\57\4\1\0\205\4\6\0\4\4\3\0\2\4\14\0\46\4"+
"\1\0\1\4\5\0\1\4\2\0\70\4\7\0\1\4\20\0\27\4"+
"\11\0\7\4\1\0\7\4\1\0\7\4\1\0\7\4\1\0\7\4"+
"\1\0\7\4\1\0\7\4\1\0\7\4\120\0\1\4\u01d5\0\3\4"+
"\31\0\11\4\7\0\5\4\2\0\5\4\4\0\126\4\6\0\3\4"+
"\1\0\132\4\1\0\4\4\5\0\51\4\3\0\136\4\21\0\33\4"+
"\65\0\20\4\u0200\0\u19b6\4\112\0\u51cd\4\63\0\u048d\4\103\0\56\4"+
"\2\0\u010d\4\3\0\20\4\12\0\2\4\24\0\57\4\20\0\31\4"+
"\10\0\120\4\47\0\11\4\2\0\147\4\2\0\4\4\1\0\4\4"+
"\14\0\13\4\115\0\12\4\1\0\3\4\1\0\4\4\1\0\27\4"+
"\25\0\1\4\7\0\64\4\16\0\62\4\76\0\6\4\3\0\1\4"+
"\16\0\34\4\12\0\27\4\31\0\35\4\7\0\57\4\34\0\1\4"+
"\60\0\51\4\27\0\3\4\1\0\10\4\24\0\27\4\3\0\1\4"+
"\5\0\60\4\1\0\1\4\3\0\2\4\2\0\5\4\2\0\1\4"+
"\1\0\1\4\30\0\3\4\2\0\13\4\7\0\3\4\14\0\6\4"+
"\2\0\6\4\2\0\6\4\11\0\7\4\1\0\7\4\221\0\43\4"+
"\35\0\u2ba4\4\14\0\27\4\4\0\61\4\u2104\0\u016e\4\2\0\152\4"+
"\46\0\7\4\14\0\5\4\5\0\1\4\1\0\12\4\1\0\15\4"+
"\1\0\5\4\1\0\1\4\1\0\2\4\1\0\2\4\1\0\154\4"+
"\41\0\u016b\4\22\0\100\4\2\0\66\4\50\0\15\4\66\0\2\4"+
"\30\0\3\4\31\0\1\4\6\0\5\4\1\0\207\4\7\0\1\4"+
"\34\0\32\4\4\0\1\4\1\0\32\4\13\0\131\4\3\0\6\4"+
"\2\0\6\4\2\0\6\4\2\0\3\4\3\0\2\4\3\0\2\4"+
"\31\0";
/**
* Translates characters to character classes
@@ -139,13 +143,13 @@ class _JavaDocLexer implements FlexLexer {
private static final int [] ZZ_ACTION = zzUnpackAction();
private static final String ZZ_ACTION_PACKED_0 =
"\13\0\3\1\1\2\1\3\2\2\1\4\1\5\1\6"+
"\13\0\3\1\1\2\1\3\1\4\2\2\1\5\1\6"+
"\1\7\1\10\1\11\1\12\1\13\1\14\1\15\1\16"+
"\1\17\1\12\1\20\1\1\3\21\1\22\1\0\1\23"+
"\1\0\4\24\1\25\7\24\1\26\1\24\1\27\2\24";
"\1\0\6\24\1\25\12\24\1\26\1\24\2\27\2\24";
private static int [] zzUnpackAction() {
int [] result = new int[57];
int [] result = new int[63];
int offset = 0;
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
return result;
@@ -172,15 +176,15 @@ class _JavaDocLexer implements FlexLexer {
private static final String ZZ_ROWMAP_PACKED_0 =
"\0\0\0\36\0\74\0\132\0\170\0\226\0\264\0\322"+
"\0\360\0\u010e\0\u012c\0\u014a\0\u0168\0\u0186\0\u014a\0\u01a4"+
"\0\u0186\0\u01c2\0\u014a\0\u014a\0\u01e0\0\u01fe\0\u021c\0\u023a"+
"\0\u014a\0\u0186\0\u01c2\0\u014a\0\u01e0\0\u01fe\0\u021c\0\u023a"+
"\0\u0258\0\u014a\0\u014a\0\u014a\0\u014a\0\u014a\0\u0276\0\u014a"+
"\0\u0294\0\u014a\0\u02b2\0\u0186\0\u02b2\0\u02d0\0\u014a\0\u0186"+
"\0\u02ee\0\u030c\0\u032a\0\u0348\0\u014a\0\u0366\0\u0384\0\u03a2"+
"\0\u03c0\0\u03de\0\u03fc\0\u041a\0\u02ee\0\u0438\0\u02ee\0\u0456"+
"\0\u0474";
"\0\u02ee\0\u030c\0\u032a\0\u0348\0\u0366\0\u0384\0\u014a\0\u03a2"+
"\0\u03c0\0\u03de\0\u03fc\0\u041a\0\u0438\0\u0456\0\u0474\0\u0492"+
"\0\u04b0\0\u032a\0\u04ce\0\u02ee\0\u032a\0\u04ec\0\u050a";
private static int [] zzUnpackRowMap() {
int [] result = new int[57];
int [] result = new int[63];
int offset = 0;
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
return result;
@@ -203,43 +207,48 @@ class _JavaDocLexer implements FlexLexer {
private static final int [] ZZ_TRANS = zzUnpackTrans();
private static final String ZZ_TRANS_PACKED_0 =
"\6\14\1\15\1\16\26\14\1\17\2\20\4\17\1\21"+
"\5\17\1\22\6\17\1\23\7\17\1\24\1\20\1\17"+
"\1\20\1\25\4\17\1\21\14\17\1\23\7\17\1\24"+
"\1\20\1\14\2\26\4\14\1\16\24\14\1\24\1\26"+
"\1\14\2\27\4\14\1\16\25\14\1\27\1\17\2\30"+
"\2\31\2\17\1\21\1\31\1\32\1\17\1\33\1\34"+
"\1\17\4\31\1\35\2\17\7\31\1\24\1\30\1\14"+
"\2\20\2\31\2\14\1\16\1\31\1\14\1\36\1\14"+
"\1\34\1\14\4\31\3\14\7\31\1\14\1\20\4\14"+
"\1\37\2\14\1\16\6\14\4\37\1\14\1\40\1\14"+
"\7\37\11\14\1\16\5\14\1\41\20\14\1\42\2\43"+
"\4\42\1\44\14\42\1\23\7\42\1\24\1\45\1\42"+
"\2\43\4\42\1\44\24\42\1\24\1\45\45\0\1\46"+
"\34\0\1\47\1\50\27\0\2\20\32\0\1\20\4\0"+
"\1\51\11\0\1\52\3\51\3\0\7\51\4\0\1\25"+
"\34\0\2\26\32\0\1\26\1\0\2\27\32\0\1\27"+
"\1\0\2\30\32\0\1\30\3\0\2\31\3\0\1\31"+
"\5\0\4\31\3\0\7\31\5\0\3\37\10\0\4\37"+
"\3\0\7\37\6\0\1\51\11\0\1\52\3\51\3\0"+
"\1\53\3\51\1\54\2\51\3\0\2\45\32\0\1\45"+
"\7\0\1\55\31\0\3\51\10\0\4\51\3\0\7\51"+
"\5\0\3\51\10\0\1\51\1\56\2\51\3\0\7\51"+
"\5\0\3\51\10\0\4\51\3\0\1\51\1\57\5\51"+
"\5\0\3\51\10\0\4\51\3\0\5\51\1\60\1\51"+
"\5\0\3\51\10\0\2\51\1\61\1\51\3\0\7\51"+
"\5\0\3\51\10\0\4\51\3\0\2\51\1\62\4\51"+
"\5\0\3\51\10\0\4\51\3\0\6\51\1\63\5\0"+
"\3\51\10\0\1\51\1\64\2\51\3\0\7\51\5\0"+
"\3\51\10\0\4\51\3\0\3\51\1\65\3\51\5\0"+
"\3\51\10\0\4\51\3\0\3\51\1\66\3\51\5\0"+
"\3\51\10\0\3\51\1\67\3\0\7\51\5\0\3\51"+
"\10\0\2\51\1\70\1\51\3\0\7\51\5\0\3\51"+
"\10\0\1\51\1\71\2\51\3\0\7\51\5\0\3\51"+
"\10\0\4\51\3\0\4\51\1\65\2\51\2\0";
"\7\14\1\15\1\16\25\14\1\17\2\20\3\17\1\21"+
"\1\17\1\22\5\17\1\23\6\17\1\24\7\17\1\20"+
"\1\17\1\20\1\25\3\17\1\21\1\17\1\22\14\17"+
"\1\24\7\17\1\20\1\14\2\26\3\14\1\21\1\14"+
"\1\16\24\14\1\26\1\14\2\27\5\14\1\16\24\14"+
"\1\27\1\17\2\30\2\31\1\17\1\21\1\17\1\22"+
"\1\31\1\32\1\17\1\33\1\34\1\17\4\31\1\35"+
"\2\17\7\31\1\30\1\14\2\20\2\31\3\14\1\16"+
"\1\31\1\14\1\36\1\14\1\34\1\14\4\31\3\14"+
"\7\31\1\20\4\14\1\37\3\14\1\16\6\14\4\37"+
"\1\14\1\40\1\14\7\37\11\14\1\16\5\14\1\41"+
"\17\14\1\42\2\43\3\42\1\21\1\42\1\44\14\42"+
"\1\24\7\42\1\45\1\42\2\43\3\42\1\21\1\42"+
"\1\44\24\42\1\45\46\0\1\46\34\0\1\47\1\50"+
"\26\0\2\20\32\0\1\20\1\51\2\0\14\51\1\52"+
"\15\51\3\0\1\25\34\0\2\26\32\0\1\26\1\0"+
"\2\27\32\0\1\27\1\0\2\30\32\0\1\30\3\0"+
"\2\31\4\0\1\31\5\0\4\31\3\0\7\31\4\0"+
"\3\37\11\0\4\37\3\0\7\37\1\0\1\53\2\0"+
"\3\53\1\0\10\53\1\54\6\53\1\55\3\53\1\56"+
"\2\53\2\0\2\45\32\0\1\45\10\0\1\57\25\0"+
"\1\51\2\0\32\51\1\0\1\51\2\0\15\51\1\60"+
"\14\51\1\0\1\53\2\0\3\53\1\0\26\53\1\0"+
"\1\53\2\0\3\53\1\0\11\53\1\61\14\53\1\0"+
"\1\53\2\0\3\53\1\0\20\53\1\62\5\53\1\0"+
"\1\53\2\0\3\53\1\0\24\53\1\63\1\53\1\0"+
"\1\51\2\0\16\51\1\64\13\51\1\0\1\53\2\0"+
"\3\53\1\0\12\53\1\65\13\53\1\0\1\53\2\0"+
"\3\53\1\0\21\53\1\66\4\53\1\0\1\53\2\0"+
"\3\53\1\0\25\53\1\67\1\0\1\51\2\0\15\51"+
"\1\70\14\51\1\0\1\53\2\0\3\53\1\0\11\53"+
"\1\71\14\53\1\0\1\53\2\0\3\53\1\0\22\53"+
"\1\72\3\53\1\0\1\53\2\0\3\53\1\0\22\53"+
"\1\73\3\53\1\0\1\51\2\0\17\51\1\74\12\51"+
"\1\0\1\53\2\0\3\53\1\0\13\53\1\75\12\53"+
"\1\0\1\53\2\0\3\53\1\0\12\53\1\76\13\53"+
"\1\0\1\53\2\0\3\53\1\0\11\53\1\77\14\53"+
"\1\0\1\53\2\0\3\53\1\0\23\53\1\72\2\53"+
"\1\0";
private static int [] zzUnpackTrans() {
int [] result = new int[1170];
int [] result = new int[1320];
int offset = 0;
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
return result;
@@ -280,12 +289,12 @@ class _JavaDocLexer implements FlexLexer {
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
private static final String ZZ_ATTRIBUTE_PACKED_0 =
"\13\0\1\11\2\1\1\11\3\1\2\11\5\1\5\11"+
"\1\1\1\11\1\1\1\11\3\1\1\0\1\11\1\0"+
"\4\1\1\11\14\1";
"\13\0\1\11\2\1\1\11\1\1\1\11\2\1\1\11"+
"\5\1\5\11\1\1\1\11\1\1\1\11\3\1\1\0"+
"\1\11\1\0\6\1\1\11\20\1";
private static int [] zzUnpackAttribute() {
int [] result = new int[57];
int [] result = new int[63];
int offset = 0;
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
return result;
@@ -365,19 +374,15 @@ class _JavaDocLexer implements FlexLexer {
}
/**
* Creates a new scanner
*
* @param in the java.io.Reader to read input from.
*/
_JavaDocLexer(java.io.Reader in) {
this.zzReader = in;
}
/**
* Creates a new scanner.
* There is also java.io.Reader version of this constructor.
*
* @param in the java.io.Inputstream to read input from.
*/
_JavaDocLexer(java.io.InputStream in) {
this(new java.io.InputStreamReader(in));
}
/**
* Unpacks the compressed character translation table.
@@ -389,7 +394,7 @@ class _JavaDocLexer implements FlexLexer {
char [] map = new char[0x10000];
int i = 0; /* index in packed string */
int j = 0; /* index in unpacked array */
while (i < 1270) {
while (i < 1662) {
int count = packed.charAt(i++);
char value = packed.charAt(i++);
do map[j++] = value; while (--count > 0);
@@ -631,25 +636,66 @@ class _JavaDocLexer implements FlexLexer {
{ return myTokenTypes.commentData();
}
case 28: break;
case 5:
case 4:
{ yybegin(COMMENT_DATA); return myTokenTypes.inlineTagEnd();
}
case 29: break;
case 4:
{ if (checkAhead('@')) {
yybegin(INLINE_TAG_NAME);
return myTokenTypes.inlineTagStart();
}
else{
yybegin(COMMENT_DATA);
return myTokenTypes.inlineTagStart();
}
}
case 30: break;
case 21:
{ yybegin(COMMENT_DATA_START); return myTokenTypes.commentStart();
}
case 30: break;
case 7:
{ if (checkAhead('<') || checkAhead('\"')) yybegin(COMMENT_DATA);
else if (checkAhead('\u007b') ) yybegin(COMMENT_DATA); // lbrace - there's a error in JLex when typing lbrace directly
else yybegin(DOC_TAG_VALUE);
return myTokenTypes.space();
}
case 31: break;
case 8:
{ yybegin(DOC_TAG_VALUE); return myTokenTypes.space();
}
case 32: break;
case 10:
{ return myTokenTypes.tagValueToken();
}
case 33: break;
case 20:
{ yybegin(TAG_DOC_SPACE); return myTokenTypes.tagName();
}
case 34: break;
case 18:
{ yybegin(CODE_TAG);
return myTokenTypes.space();
}
case 35: break;
case 9:
{ yybegin(COMMENT_DATA); return myTokenTypes.space();
}
case 36: break;
case 23:
{ yybegin(PARAM_TAG_SPACE); return myTokenTypes.tagName();
}
case 37: break;
case 22:
{ yybegin(CODE_TAG_SPACE); return myTokenTypes.tagName();
}
case 38: break;
case 1:
{ return myTokenTypes.badCharacter();
}
case 39: break;
case 15:
{ yybegin(DOC_TAG_VALUE); return myTokenTypes.tagValueRParen();
}
case 40: break;
case 11:
{ yybegin(DOC_TAG_VALUE_IN_PAREN); return myTokenTypes.tagValueLParen();
}
case 41: break;
case 13:
{ return myTokenTypes.tagValueComma();
}
case 42: break;
case 14:
{ if (myJdk15Enabled) {
yybegin(DOC_TAG_VALUE_IN_LTGT);
@@ -660,57 +706,16 @@ class _JavaDocLexer implements FlexLexer {
return myTokenTypes.commentData();
}
}
case 32: break;
case 18:
{ yybegin(CODE_TAG);
return myTokenTypes.space();
}
case 33: break;
case 8:
{ yybegin(DOC_TAG_VALUE); return myTokenTypes.space();
}
case 34: break;
case 10:
{ return myTokenTypes.tagValueToken();
}
case 35: break;
case 20:
{ yybegin(TAG_DOC_SPACE); return myTokenTypes.tagName();
}
case 36: break;
case 9:
{ yybegin(COMMENT_DATA); return myTokenTypes.space();
}
case 37: break;
case 23:
{ yybegin(PARAM_TAG_SPACE); return myTokenTypes.tagName();
}
case 38: break;
case 22:
{ yybegin(CODE_TAG_SPACE); return myTokenTypes.tagName();
}
case 39: break;
case 7:
{ if (checkAhead('<') || checkAhead('\"')) yybegin(COMMENT_DATA);
else if (checkAhead('\u007b') ) yybegin(COMMENT_DATA); // lbrace - there's a error in JLex when typing lbrace directly
else yybegin(DOC_TAG_VALUE);
return myTokenTypes.space();
}
case 40: break;
case 1:
{ return myTokenTypes.badCharacter();
}
case 41: break;
case 15:
{ yybegin(DOC_TAG_VALUE); return myTokenTypes.tagValueRParen();
}
case 42: break;
case 11:
{ yybegin(DOC_TAG_VALUE_IN_PAREN); return myTokenTypes.tagValueLParen();
}
case 43: break;
case 13:
{ return myTokenTypes.tagValueComma();
case 5:
{ if (checkAhead('@')) {
yybegin(INLINE_TAG_NAME);
return myTokenTypes.inlineTagStart();
}
else{
yybegin(COMMENT_DATA);
return myTokenTypes.inlineTagStart();
}
}
case 44: break;
case 2:
@@ -22,12 +22,14 @@ import com.intellij.openapi.util.RecursionGuard;
import com.intellij.openapi.util.RecursionManager;
import com.intellij.psi.*;
import com.intellij.psi.controlFlow.*;
import com.intellij.psi.impl.PsiClassImplUtil;
import com.intellij.psi.impl.PsiImplUtil;
import com.intellij.psi.infos.CandidateInfo;
import com.intellij.psi.infos.MethodCandidateInfo;
import com.intellij.psi.scope.MethodProcessorSetupFailedException;
import com.intellij.psi.scope.processor.MethodResolverProcessor;
import com.intellij.psi.scope.util.PsiScopesUtil;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.util.*;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Function;
@@ -187,7 +189,7 @@ public class ExceptionUtil {
PsiMethod method = (PsiMethod)resolveResult.getElement();
if (method != null) {
addExceptions(result, getExceptionsByMethod(method, resolveResult.getSubstitutor()));
addExceptions(result, getExceptionsByMethod(method, resolveResult.getSubstitutor(), element));
}
addExceptions(result, getThrownExceptions(element.getChildren()));
@@ -196,12 +198,16 @@ public class ExceptionUtil {
}
@NotNull
private static List<PsiClassType> getExceptionsByMethod(@NotNull PsiMethod method, @NotNull PsiSubstitutor substitutor) {
List<PsiClassType> result = ContainerUtil.newArrayList();
private static List<PsiClassType> getExceptionsByMethod(@NotNull PsiMethod method, @NotNull PsiSubstitutor substitutor,
@NotNull PsiElement place) {
PsiClassType[] referenceTypes = method.getThrowsList().getReferencedTypes();
if (referenceTypes.length == 0) return Collections.emptyList();
GlobalSearchScope scope = place.getResolveScope();
List<PsiClassType> result = ContainerUtil.newArrayList();
for (PsiType type : referenceTypes) {
type = substitutor.substitute(type);
type = PsiClassImplUtil.correctType(substitutor.substitute(type), scope);
if (type instanceof PsiClassType) {
result.add((PsiClassType)type);
}
@@ -449,13 +455,14 @@ public class ExceptionUtil {
}
});
if (candidates.size() > 1) {
final List<PsiClassType> ex = collectSubstituted(substitutor, thrownExceptions);
GlobalSearchScope scope = methodCall.getResolveScope();
final List<PsiClassType> ex = collectSubstituted(substitutor, thrownExceptions, scope);
for (Pair<PsiMethod, PsiSubstitutor> pair : candidates) {
final PsiClassType[] exceptions = pair.first.getThrowsList().getReferencedTypes();
if (exceptions.length == 0) {
return getUnhandledExceptions(methodCall, topElement, PsiSubstitutor.EMPTY, PsiClassType.EMPTY_ARRAY);
}
retainExceptions(ex, collectSubstituted(pair.second, exceptions));
retainExceptions(ex, collectSubstituted(pair.second, exceptions, scope));
}
return getUnhandledExceptions(methodCall, topElement, PsiSubstitutor.EMPTY, ex.toArray(new PsiClassType[ex.size()]));
}
@@ -512,10 +519,10 @@ public class ExceptionUtil {
ex.addAll(replacement);
}
public static List<PsiClassType> collectSubstituted(PsiSubstitutor substitutor, PsiClassType[] thrownExceptions) {
public static List<PsiClassType> collectSubstituted(PsiSubstitutor substitutor, PsiClassType[] thrownExceptions, GlobalSearchScope scope) {
final List<PsiClassType> ex = new ArrayList<PsiClassType>();
for (PsiClassType thrownException : thrownExceptions) {
final PsiType psiType = substitutor.substitute(thrownException);
final PsiType psiType = PsiClassImplUtil.correctType(substitutor.substitute(thrownException), scope);
if (psiType instanceof PsiClassType) {
ex.add((PsiClassType)psiType);
}
@@ -527,7 +534,7 @@ public class ExceptionUtil {
public static List<PsiClassType> getCloserExceptions(@NotNull PsiResourceVariable resource) {
PsiMethod method = PsiUtil.getResourceCloserMethod(resource);
PsiSubstitutor substitutor = PsiUtil.resolveGenericsClassInType(resource.getType()).getSubstitutor();
return method != null ? getExceptionsByMethod(method, substitutor) : Collections.<PsiClassType>emptyList();
return method != null ? getExceptionsByMethod(method, substitutor, resource) : Collections.<PsiClassType>emptyList();
}
@NotNull
@@ -593,7 +600,7 @@ public class ExceptionUtil {
List<PsiClassType> result = ContainerUtil.newArrayList();
for (PsiClassType referencedType : referencedTypes) {
final PsiType type = GenericsUtil.eliminateWildcards(substitutor.substitute(referencedType), false);
final PsiType type = PsiClassImplUtil.correctType(GenericsUtil.eliminateWildcards(substitutor.substitute(referencedType), false), element.getResolveScope());
if (!(type instanceof PsiClassType)) continue;
PsiClassType classType = (PsiClassType)type;
PsiClass exceptionClass = ((PsiClassType)type).resolve();
@@ -1264,9 +1264,6 @@ public class JavaDocInfoGenerator {
else if (tagName.equals(VALUE_TAG)) {
generateValueValue(tag, buffer, element);
}
else {
buffer.append(element.getText());
}
}
else {
buffer.append(StringUtil.replaceUnicodeEscapeSequences(element.getText()));
@@ -54,6 +54,8 @@ WHITE_DOC_SPACE_NO_LR=[\ \t\f]
DIGIT=[0-9]
ALPHA=[:jletter:]
IDENTIFIER={ALPHA}({ALPHA}|{DIGIT}|[":.-"])*
TAG_IDENTIFIER=[^\ \t\f\n\r]+
INLINE_TAG_IDENTIFIER=[^\ \t\f\n\r\}]+
%%
@@ -98,12 +100,12 @@ IDENTIFIER={ALPHA}({ALPHA}|{DIGIT}|[":.-"])*
}
<INLINE_TAG_NAME> "@code" { yybegin(CODE_TAG_SPACE); return myTokenTypes.tagName(); }
<INLINE_TAG_NAME> "@literal" { yybegin(CODE_TAG_SPACE); return myTokenTypes.tagName(); }
<INLINE_TAG_NAME> "@"{IDENTIFIER} { yybegin(TAG_DOC_SPACE); return myTokenTypes.tagName(); }
<INLINE_TAG_NAME> "@"{INLINE_TAG_IDENTIFIER} { yybegin(TAG_DOC_SPACE); return myTokenTypes.tagName(); }
<COMMENT_DATA_START, COMMENT_DATA, TAG_DOC_SPACE, DOC_TAG_VALUE, CODE_TAG, CODE_TAG_SPACE> "}" { yybegin(COMMENT_DATA); return myTokenTypes.inlineTagEnd(); }
<COMMENT_DATA_START, COMMENT_DATA, DOC_TAG_VALUE> . { yybegin(COMMENT_DATA); return myTokenTypes.commentData(); }
<CODE_TAG, CODE_TAG_SPACE> . { yybegin(CODE_TAG); return myTokenTypes.commentData(); }
<COMMENT_DATA_START> "@"{IDENTIFIER} { yybegin(TAG_DOC_SPACE); return myTokenTypes.tagName(); }
<COMMENT_DATA_START> "@"{TAG_IDENTIFIER} { yybegin(TAG_DOC_SPACE); return myTokenTypes.tagName(); }
<TAG_DOC_SPACE> {WHITE_DOC_SPACE_CHAR}+ {
if (checkAhead('<') || checkAhead('\"')) yybegin(COMMENT_DATA);
@@ -52,7 +52,7 @@ public class JavaClassSupersImpl extends JavaClassSupers {
if (substitutor == null) return null;
if (PsiUtil.isRawSubstitutor(derivedClass, derivedSubstitutor)) return createRawSubstitutor(superClass);
return composeSubstitutors(derivedSubstitutor, substitutor);
return composeSubstitutors(derivedSubstitutor, substitutor, superClass);
}
@NotNull
@@ -61,10 +61,14 @@ public class JavaClassSupersImpl extends JavaClassSupers {
}
@NotNull
private static PsiSubstitutor composeSubstitutors(PsiSubstitutor outer, PsiSubstitutor inner) {
private static PsiSubstitutor composeSubstitutors(PsiSubstitutor outer, PsiSubstitutor inner, PsiClass onClass) {
PsiSubstitutor answer = PsiSubstitutor.EMPTY;
for (Map.Entry<PsiTypeParameter, PsiType> entry : inner.getSubstitutionMap().entrySet()) {
answer = answer.put(entry.getKey(), outer.substitute(entry.getValue()));
Map<PsiTypeParameter, PsiType> outerMap = outer.getSubstitutionMap();
Map<PsiTypeParameter, PsiType> innerMap = inner.getSubstitutionMap();
for (PsiTypeParameter parameter : PsiUtil.typeParametersIterable(onClass)) {
if (outerMap.containsKey(parameter) || innerMap.containsKey(parameter)) {
answer = answer.put(parameter, outer.substitute(inner.substitute(parameter)));
}
}
return answer;
}
@@ -97,7 +101,7 @@ public class JavaClassSupersImpl extends JavaClassSupers {
else {
answer = getSuperSubstitutorWithCaching(superClass, psiClass, scope, result.getSubstitutor());
if (answer != null) {
return composeSubstitutors(derivedSubstitutor, answer);
return composeSubstitutors(derivedSubstitutor, answer, superClass);
}
}
}
@@ -308,7 +308,7 @@ public class PsiSuperMethodImplUtil {
if (superClass.isInterface() ||
CommonClassNames.JAVA_LANG_OBJECT.equals(superClass.getQualifiedName())) {
if (superMethod.hasModifierProperty(PsiModifier.STATIC) ||
superMethod.hasModifierProperty(PsiModifier.DEFAULT) && hierarchicalMethodSignature.getMethod().hasModifierProperty(PsiModifier.STATIC)) {
superMethod.hasModifierProperty(PsiModifier.DEFAULT) && hierarchicalMethodSignature.getMethod().hasModifierProperty(PsiModifier.STATIC) && !InheritanceUtil.isInheritorOrSelf(containingClass, superClass, true)) {
return false;
}
@@ -18,14 +18,19 @@ package com.intellij.psi.impl;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.util.*;
import com.intellij.psi.util.CachedValueProvider;
import com.intellij.psi.util.CachedValuesManager;
import com.intellij.psi.util.PsiModificationTracker;
import com.intellij.psi.util.PsiUtil;
import com.intellij.util.containers.ConcurrentFactoryMap;
import com.intellij.util.containers.ContainerUtil;
import gnu.trove.TObjectHashingStrategy;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import static com.intellij.util.ObjectUtils.assertNotNull;
@@ -48,27 +53,36 @@ class ScopedClassHierarchy {
private final Map<PsiClass, PsiClassType.ClassResolveResult> mySupersWithSubstitutors = ContainerUtil.newTroveMap(CLASS_HASHING_STRATEGY);
private ScopedClassHierarchy(PsiClass psiClass, GlobalSearchScope resolveScope) {
PsiClassType type = JavaPsiFacade.getElementFactory(psiClass.getProject()).createType(psiClass, PsiSubstitutor.EMPTY);
visitTypes(resolveScope, PsiSubstitutor.EMPTY, type);
visitType(resolveScope, JavaPsiFacade.getElementFactory(psiClass.getProject()).createType(psiClass, PsiSubstitutor.EMPTY));
}
private void visitTypes(GlobalSearchScope resolveScope, PsiSubstitutor substitutor, PsiType... types) {
for (PsiType type : types) {
type = PsiClassImplUtil.correctType(substitutor.substitute(type), resolveScope);
if (!(type instanceof PsiClassType)) continue;
PsiClassType.ClassResolveResult resolveResult = ((PsiClassType)type).resolveGenerics();
PsiClass psiClass = resolveResult.getElement();
if (psiClass == null || InheritanceImplUtil.hasObjectQualifiedName(psiClass) || mySupersWithSubstitutors.containsKey(psiClass)) continue;
mySupersWithSubstitutors.put(psiClass, resolveResult);
if (psiClass instanceof PsiAnonymousClass) {
visitTypes(resolveScope, resolveResult.getSubstitutor(), ((PsiAnonymousClass)psiClass).getBaseClassType());
}
visitTypes(resolveScope, resolveResult.getSubstitutor(), psiClass.getExtendsListTypes());
visitTypes(resolveScope, resolveResult.getSubstitutor(), psiClass.getImplementsListTypes());
private void visitType(GlobalSearchScope resolveScope, @NotNull PsiClassType type) {
PsiClassType.ClassResolveResult resolveResult = type.resolveGenerics();
PsiClass psiClass = resolveResult.getElement();
if (psiClass == null || InheritanceImplUtil.hasObjectQualifiedName(psiClass) || mySupersWithSubstitutors.containsKey(psiClass)) {
return;
}
mySupersWithSubstitutors.put(psiClass, resolveResult);
for (PsiType superType : getSuperTypes(psiClass)) {
superType = type.isRaw() && superType instanceof PsiClassType ? ((PsiClassType)superType).rawType() : resolveResult.getSubstitutor().substitute(superType);
superType = PsiClassImplUtil.correctType(superType, resolveScope);
if (superType instanceof PsiClassType) {
visitType(resolveScope, (PsiClassType)superType);
}
}
}
@NotNull
private static List<PsiType> getSuperTypes(PsiClass psiClass) {
List<PsiType> superTypes = ContainerUtil.newArrayList();
if (psiClass instanceof PsiAnonymousClass) {
ContainerUtil.addIfNotNull(superTypes, ((PsiAnonymousClass)psiClass).getBaseClassType());
}
Collections.addAll(superTypes, psiClass.getExtendsListTypes());
Collections.addAll(superTypes, psiClass.getImplementsListTypes());
return superTypes;
}
@NotNull
@@ -108,8 +108,12 @@ class TypeCorrector extends PsiTypeMapper {
PsiTypeParameter[] originalTypeParameters = originalClass.getTypeParameters();
if (typeParameters.length != originalTypeParameters.length) return substitutor;
Map<PsiTypeParameter, PsiType> substitutionMap = substitutor.getSubstitutionMap();
PsiSubstitutor mappedSubstitutor = PsiSubstitutor.EMPTY;
for (int i = 0; i < originalTypeParameters.length; i++) {
if (!substitutionMap.containsKey(originalTypeParameters[i])) continue;
PsiType originalSubstitute = substitutor.substitute(originalTypeParameters[i]);
if (originalSubstitute != null) {
PsiType substitute = mapType(originalSubstitute);
@@ -256,7 +256,7 @@ public class StubBuildingVisitor<T> extends ClassVisitor {
if ((access & Opcodes.ACC_ABSTRACT) != 0) {
flags |= ModifierFlags.ABSTRACT_MASK;
}
else if (isInterface) {
else if (isInterface && (access & Opcodes.ACC_STATIC) == 0) {
flags |= ModifierFlags.DEFENDER_MASK;
}
if ((access & Opcodes.ACC_STRICT) != 0) {
@@ -25,7 +25,6 @@ import com.intellij.psi.scope.processor.MethodCandidatesProcessor;
import com.intellij.psi.scope.processor.MethodResolverProcessor;
import com.intellij.psi.scope.util.PsiScopesUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.psi.util.TypeConversionUtil;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -60,7 +59,6 @@ public class PsiResolveHelperImpl implements PsiResolveHelper {
processor = new MethodResolverProcessor(anonymous, argumentList, place, place.getContainingFile());
aClass = anonymous.getBaseClassType().resolve();
if (aClass == null) return JavaResolveResult.EMPTY_ARRAY;
substitutor = substitutor.putAll(TypeConversionUtil.getSuperClassSubstitutor(aClass, anonymous, substitutor));
}
else {
processor = new MethodResolverProcessor(aClass, argumentList, place, place.getContainingFile());
@@ -0,0 +1,7 @@
interface A {
default void foo(){}
}
interface B extends A {
<error descr="Static method 'foo()' in 'B' cannot override instance method 'foo()' in 'A'">static void foo()</error>{}
}
@@ -0,0 +1,2 @@
<html><head><base href="placeholder"> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><PRE>class <b>Foo</b>
extends <a href="psi_element://java.lang.Object"><code>Object</code></a></PRE> foobar</body></html>
@@ -0,0 +1,2 @@
/** foo{@literal@tag}bar */
class Foo {}
@@ -0,0 +1,16 @@
// IntelliJ API Decompiler stub source generated from a class file
// Implementation of methods is not available
package java.util.function;
@java.lang.FunctionalInterface
public interface Function <T, R> {
R apply(T t);
default <V> java.util.function.Function<V,R> compose(java.util.function.Function<? super V,? extends T> function) { /* compiled code */ }
default <V> java.util.function.Function<T,V> andThen(java.util.function.Function<? super R,? extends V> function) { /* compiled code */ }
static <T> java.util.function.Function<T,T> identity() { /* compiled code */ }
}
@@ -14,11 +14,16 @@
* limitations under the License.
*/
package com.intellij.codeInsight
import com.intellij.openapi.module.JavaModuleType
import com.intellij.openapi.roots.ModuleRootManager
import com.intellij.openapi.roots.ModuleRootModificationUtil
import com.intellij.openapi.roots.ModuleSourceOrderEntry
import com.intellij.openapi.roots.OrderEntry
import com.intellij.testFramework.PsiTestUtil
import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase
import com.intellij.util.Consumer
import com.intellij.util.containers.ContainerUtil
/**
* @author peter
*/
@@ -95,4 +100,51 @@ class Class3 {
ModuleRootModificationUtil.addDependency(myModule, mod1)
ModuleRootModificationUtil.addDependency(myModule, mod2)
}
public void testOverridingJdkExceptions() {
def dep = PsiTestUtil.addModule(project, JavaModuleType.moduleType, "dep", myFixture.tempDirFixture.findOrCreateDir("dep"))
ModuleRootModificationUtil.setModuleSdk(dep, ModuleRootManager.getInstance(myModule).sdk)
ModuleRootModificationUtil.updateModel(myModule, { model ->
model.addModuleOrderEntry(dep)
List<OrderEntry> entries = model.orderEntries as List
def srcEntry = ContainerUtil.findInstance(entries, ModuleSourceOrderEntry)
assert srcEntry
model.rearrangeOrderEntries(([srcEntry] + (entries - srcEntry)) as OrderEntry[])
} as Consumer)
myFixture.addFileToProject "java/lang/IllegalArgumentException.java", '''
package java.lang;
public class IllegalArgumentException extends Exception { }
'''
myFixture.addFileToProject 'dep/foo/Foo.java', '''
package foo;
public class Foo {
public static void libraryMethod() throws IllegalArgumentException {}
}
'''
myFixture.configureFromExistingVirtualFile(myFixture.addFileToProject('Bar.java', '''
class Bar {
void caught() {
try {
foo.Foo.libraryMethod();
} catch (IllegalArgumentException e) {}
}
void uncaught() {
<error descr="Unhandled exception: java.lang.IllegalArgumentException">foo.Foo.libraryMethod();</error>
}
}
''').virtualFile)
myFixture.checkHighlighting()
}
}
@@ -52,6 +52,10 @@ public class Interface8MethodsHighlightingTest extends LightCodeInsightFixtureTe
doTest(true, false);
}
public void testInheritanceOfStaticMethodFromDefault() throws Exception {
doTest();
}
public void testStaticMethodAccessibleBothThroughStaticImportAndInheritance() throws Exception {
myFixture.addClass("package p; public interface Foo {" +
" static void foo() {}" +
@@ -159,6 +159,10 @@ public class JavaDocInfoGeneratorTest extends CodeInsightTestCase {
assertNotNull(docInfo);
assertEquals(exampleHtmlFileText(getTestName(true)), replaceEnvironmentDependentContent(docInfo));
}
public void testNoSpaceAfterTagName() throws Exception {
verifyJavaDoc(getTestClass());
}
private static String exampleHtmlFileText(String name) throws IOException {
final File htmlPath = new File(JavaTestUtil.getJavaTestDataPath() + "/codeInsight/javadocIG/" + name + ".html");
@@ -82,6 +82,13 @@ public class ClsMirrorBuildingTest extends LightIdeaTestCase {
doTest(clsPath, txtPath);
}
public void testStaticMethodInInterface() {
String testDir = JavaTestUtil.getJavaTestDataPath();
String clsPath = testDir + "/../../mockJDK-1.8/jre/lib/rt.jar!/java/util/function/Function.class";
String txtPath = testDir + "/psi/cls/mirror/Function.txt";
doTest(clsPath, txtPath);
}
public void testStrayInnersFiltering() throws IOException {
String path = JavaTestUtil.getJavaTestDataPath() + "/../../mockJDK-1.8/jre/lib/rt.jar!/java/lang/Class.class";
VirtualFile file = StandardFileSystems.jar().findFileByPath(path);
@@ -89,8 +89,9 @@ public abstract class VirtualFileSystem {
* This method is useful when the file was created externally and you need to find <code>{@link VirtualFile}</code>
* corresponding to it.<p>
* <p/>
* This method should be only called within write-action.
* See {@link Application#runWriteAction}.
* If this method is invoked not from Swing event dispatch thread, then it must not happen inside a read action. The reason is that
* then the method call won't return until proper VFS events are fired, which happens on Swing thread and in write action. So invoking
* this method in a read action would result in a deadlock.
*
* @param path the path
* @return <code>{@link VirtualFile}</code> if the file was found, <code>null</code> otherwise
@@ -40,6 +40,10 @@ public interface FrameDiffTool extends DiffTool {
@NotNull
@CalledInAwt
ToolbarComponents init();
@Override
@CalledInAwt
void dispose();
}
class ToolbarComponents {
@@ -49,4 +49,8 @@ public abstract class MessageDiffRequest extends DiffRequest {
public void setMessage(@NotNull String message) {
myMessage = message;
}
@Override
public final void onAssigned(boolean isAssigned) {
}
}
@@ -138,7 +138,7 @@ public abstract class CacheDiffRequestChainProcessor extends DiffRequestProcesso
@CalledInAwt
protected void onDispose() {
super.onDispose();
Disposer.dispose(myQueue);
myQueue.abort();
myRequestCache.clear();
}
@@ -35,7 +35,6 @@ public class DiffRequestPanelImpl implements DiffRequestPanel {
public DiffRequestPanelImpl(@Nullable Project project, @Nullable Window window) {
myProcessor = new MyCacheDiffRequestChainProcessor(project, window);
myProcessor.init();
myPanel = new JPanel(new BorderLayout()) {
@Override
@@ -93,7 +93,7 @@ public abstract class DiffRequestProcessor implements Disposable {
@NotNull private DiffRequest myActiveRequest;
@NotNull private ViewerState myState;
@Nullable private ViewerState myState;
public DiffRequestProcessor(@Nullable Project project) {
this(project, new UserDataHolderBase());
@@ -106,14 +106,14 @@ public abstract class DiffRequestProcessor implements Disposable {
public DiffRequestProcessor(@Nullable Project project, @NotNull UserDataHolder context) {
myProject = project;
myAvailableTools = DiffManagerEx.getInstance().getDiffTools();
myToolOrder = new LinkedList<DiffTool>();
myContext = new MyDiffContext(context);
myActiveRequest = NoDiffRequest.INSTANCE;
mySettings = DiffSettingsHolder.getInstance().getSettings(myContext.getUserData(DiffUserDataKeysEx.PLACE));
myAvailableTools = DiffManagerEx.getInstance().getDiffTools();
myToolOrder = new LinkedList<DiffTool>(getToolOrderFromSettings(myAvailableTools));
// UI
myPanel = new JPanel(new BorderLayout());
@@ -139,6 +139,8 @@ public abstract class DiffRequestProcessor implements Disposable {
if (bottomPanel != null) myMainPanel.add(bottomPanel, BorderLayout.SOUTH);
if (bottomPanel instanceof Disposable) Disposer.register(this, (Disposable)bottomPanel);
myState = new EmptyState();
myContentPanel.setContent(DiffUtil.createMessagePanel(NoDiffRequest.INSTANCE.getMessage()));
myOpenInEditorAction = new OpenInEditorAction(new Runnable() {
@Override
@@ -148,14 +150,6 @@ public abstract class DiffRequestProcessor implements Disposable {
});
}
public void init() {
myToolOrder.addAll(getToolOrderFromSettings(myAvailableTools));
myActiveRequest.onAssigned(true);
myState = new ErrorState((MessageDiffRequest)myActiveRequest);
myState.init();
}
//
// Update
//
@@ -966,8 +960,10 @@ public abstract class DiffRequestProcessor implements Disposable {
//
private interface ViewerState {
@CalledInAwt
void init();
@CalledInAwt
void destroy();
@Nullable
@@ -980,6 +976,34 @@ public abstract class DiffRequestProcessor implements Disposable {
DiffTool getActiveTool();
}
private static class EmptyState implements ViewerState {
@Override
public void init() {
}
@Override
public void destroy() {
}
@Nullable
@Override
public JComponent getPreferredFocusedComponent() {
return null;
}
@Nullable
@Override
public Object getData(@NonNls String dataId) {
return null;
}
@NotNull
@Override
public DiffTool getActiveTool() {
return ErrorDiffTool.INSTANCE;
}
}
private class ErrorState implements ViewerState {
@Nullable private final DiffTool myDiffTool;
@NotNull private final MessageDiffRequest myRequest;
@@ -998,6 +1022,7 @@ public abstract class DiffRequestProcessor implements Disposable {
}
@Override
@CalledInAwt
public void init() {
myContentPanel.setContent(myViewer.getComponent());
@@ -1008,6 +1033,7 @@ public abstract class DiffRequestProcessor implements Disposable {
}
@Override
@CalledInAwt
public void destroy() {
Disposer.dispose(myViewer);
}
@@ -1041,6 +1067,7 @@ public abstract class DiffRequestProcessor implements Disposable {
}
@Override
@CalledInAwt
public void init() {
myContentPanel.setContent(myViewer.getComponent());
setTitle(myActiveRequest.getTitle());
@@ -1058,6 +1085,7 @@ public abstract class DiffRequestProcessor implements Disposable {
}
@Override
@CalledInAwt
public void destroy() {
Disposer.dispose(myViewer);
}
@@ -1097,6 +1125,7 @@ public abstract class DiffRequestProcessor implements Disposable {
}
@Override
@CalledInAwt
public void init() {
myContentPanel.setContent(myWrapperViewer.getComponent());
setTitle(myActiveRequest.getTitle());
@@ -1130,6 +1159,7 @@ public abstract class DiffRequestProcessor implements Disposable {
}
@Override
@CalledInAwt
public void destroy() {
Disposer.dispose(myViewer);
Disposer.dispose(myWrapperViewer);
@@ -64,7 +64,6 @@ public abstract class DiffWindowBase {
}
})
.build();
myProcessor.init();
myWrapper.setImage(ImageLoader.loadFromResource("/diff/Diff.png"));
Disposer.register(myWrapper, myProcessor);
@@ -55,6 +55,7 @@ import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.CalledInAwt;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -118,20 +119,17 @@ public class BinaryDiffViewer extends ListenerDiffViewerBase {
}
@Override
protected void onInit() {
super.onInit();
processContextHints();
}
@Override
@CalledInAwt
public void onDispose() {
updateContextHints();
destroyEditorListeners();
destroyEditors();
super.onDispose();
}
private void processContextHints() {
@Override
@CalledInAwt
protected void processContextHints() {
super.processContextHints();
if (myEditor1 == null) {
myCurrentSide = Side.RIGHT;
}
@@ -144,7 +142,10 @@ public class BinaryDiffViewer extends ListenerDiffViewerBase {
}
}
private void updateContextHints() {
@Override
@CalledInAwt
protected void updateContextHints() {
super.updateContextHints();
if (myEditor1 != null && myEditor2 != null) {
myContext.putUserData(DiffUserDataKeys.PREFERRED_FOCUS_SIDE, myCurrentSide);
}
@@ -146,30 +146,34 @@ public class OnesideDiffViewer extends TextDiffViewerBase {
}
@Override
@CalledInAwt
protected void onInit() {
super.onInit();
processContextHints();
installTypingSupport();
myPanel.setLoadingContent(); // We need loading panel only for initial rediff()
}
@Override
@CalledInAwt
protected void onDispose() {
updateContextHints();
EditorFactory.getInstance().releaseEditor(myEditor);
super.onDispose();
EditorFactory.getInstance().releaseEditor(myEditor);
}
@Override
@CalledInAwt
protected void processContextHints() {
super.processContextHints();
Side side = DiffUtil.getUserData(myRequest, myContext, DiffUserDataKeys.MASTER_SIDE);
if (side != null && side.select(myActualContent1, myActualContent2) != null) myMasterSide = side;
myInitialScrollHelper.processContext(myRequest);
}
@Override
@CalledInAwt
protected void updateContextHints() {
super.updateContextHints();
myInitialScrollHelper.updateContext(myRequest);
myFoldingModel.updateContext(myRequest, getFoldingModelSettings());
}
@@ -92,6 +92,7 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer {
}
@Override
@CalledInAwt
protected void onInit() {
super.onInit();
myContentPanel.setPainter(new MyDividerPainter());
@@ -99,10 +100,11 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer {
}
@Override
protected void onDisposeAwt() {
@CalledInAwt
protected void onDispose() {
myModifierProvider.destroy();
destroyChangedBlocks();
super.onDisposeAwt();
super.onDispose();
}
@NotNull
@@ -159,16 +161,18 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer {
}
@Override
@CalledInAwt
protected void processContextHints() {
super.processContextHints();
myInitialScrollHelper.processContext(myRequest);
}
@Override
@CalledInAwt
protected void updateContextHints() {
super.updateContextHints();
if (myFoldingModel != null) myFoldingModel.updateContext(myRequest, getFoldingModelSettings());
myInitialScrollHelper.updateContext(myRequest);
super.updateContextHints();
}
//
@@ -86,6 +86,7 @@ public class SimpleThreesideDiffViewer extends ThreesideTextDiffViewer {
}
@Override
@CalledInAwt
protected void onInit() {
super.onInit();
myContentPanel.setPainter(new MyDividerPainter(Side.LEFT), Side.LEFT);
@@ -94,9 +95,10 @@ public class SimpleThreesideDiffViewer extends ThreesideTextDiffViewer {
}
@Override
protected void onDisposeAwt() {
@CalledInAwt
protected void onDispose() {
destroyChangedBlocks();
super.onDisposeAwt();
super.onDispose();
}
@NotNull
@@ -136,12 +138,14 @@ public class SimpleThreesideDiffViewer extends ThreesideTextDiffViewer {
}
@Override
@CalledInAwt
protected void processContextHints() {
super.processContextHints();
myInitialScrollHelper.processContext(myRequest);
}
@Override
@CalledInAwt
protected void updateContextHints() {
super.updateContextHints();
myFoldingModel.updateContext(myRequest, getFoldingModelSettings());
@@ -259,6 +263,8 @@ public class SimpleThreesideDiffViewer extends ThreesideTextDiffViewer {
}
myInvalidDiffChanges.clear();
myFoldingModel.destroy();
myContentPanel.repaintDividers();
myStatusPanel.update();
}
@@ -31,13 +31,13 @@ import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.util.ProgressWindow;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
import com.intellij.util.Alarm;
import com.intellij.util.Function;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.*;
import javax.swing.*;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
public abstract class DiffViewerBase implements DiffViewer, DataProvider {
protected static final Logger LOG = Logger.getInstance(DiffViewerBase.class);
@@ -47,7 +47,8 @@ public abstract class DiffViewerBase implements DiffViewer, DataProvider {
@NotNull protected final ContentDiffRequest myRequest;
@NotNull private final DiffTaskQueue myTaskExecutor = new DiffTaskQueue();
@NotNull private final AtomicBoolean myDisposed = new AtomicBoolean(false);
@NotNull private final Alarm myTaskAlarm = new Alarm();
private volatile boolean myDisposed;
public DiffViewerBase(@NotNull DiffContext context, @NotNull ContentDiffRequest request) {
myProject = context.getProject();
@@ -57,6 +58,7 @@ public abstract class DiffViewerBase implements DiffViewer, DataProvider {
@NotNull
public final FrameDiffTool.ToolbarComponents init() {
processContextHints();
onInit();
FrameDiffTool.ToolbarComponents components = new FrameDiffTool.ToolbarComponents();
@@ -69,24 +71,41 @@ public abstract class DiffViewerBase implements DiffViewer, DataProvider {
}
@Override
@CalledInAwt
public final void dispose() {
if (!myDisposed.compareAndSet(false, true)) return;
if (myDisposed) return;
onDispose();
UIUtil.invokeLaterIfNeeded(new Runnable() {
Runnable doDispose = new Runnable() {
@Override
public void run() {
onDisposeAwt();
if (myDisposed) return;
myDisposed = true;
abortRediff();
updateContextHints();
onDispose();
}
});
};
if (!ApplicationManager.getApplication().isDispatchThread()) LOG.warn(new Throwable("dispose() not from EDT"));
UIUtil.invokeLaterIfNeeded(doDispose);
}
@CalledInAwt
protected void processContextHints() {
}
@CalledInAwt
protected void updateContextHints() {
}
@CalledInAwt
public final void scheduleRediff() {
if (myDisposed.get()) return;
if (isDisposed()) return;
myTaskExecutor.abortAndSchedule(new Runnable() {
abortRediff();
myTaskAlarm.addRequest(new Runnable() {
@Override
public void run() {
rediff();
@@ -97,6 +116,7 @@ public abstract class DiffViewerBase implements DiffViewer, DataProvider {
@CalledInAwt
public final void abortRediff() {
myTaskExecutor.abort();
myTaskAlarm.cancelAllRequests();
}
@CalledInAwt
@@ -106,7 +126,7 @@ public abstract class DiffViewerBase implements DiffViewer, DataProvider {
@CalledInAwt
public final void rediff(boolean trySync) {
if (myDisposed.get()) return;
if (isDisposed()) return;
onBeforeRediff();
@@ -148,7 +168,7 @@ public abstract class DiffViewerBase implements DiffViewer, DataProvider {
}
public boolean isDisposed() {
return myDisposed.get();
return myDisposed;
}
//
@@ -191,12 +211,9 @@ public abstract class DiffViewerBase implements DiffViewer, DataProvider {
@NotNull
protected abstract Runnable performRediff(@NotNull ProgressIndicator indicator);
protected void onDispose() {
Disposer.dispose(myTaskExecutor);
}
@CalledInAwt
protected void onDisposeAwt() {
protected void onDispose() {
Disposer.dispose(myTaskAlarm);
}
@Nullable
@@ -111,29 +111,24 @@ public abstract class ThreesideTextDiffViewer extends TextDiffViewerBase {
}
@Override
protected void onInit() {
super.onInit();
processContextHints();
}
@Override
@CalledInAwt
protected void onDispose() {
updateContextHints();
super.onDispose();
destroyEditors();
}
@Override
protected void onDisposeAwt() {
destroyEditors();
super.onDisposeAwt();
}
@CalledInAwt
protected void processContextHints() {
super.processContextHints();
ThreeSide side = myContext.getUserData(DiffUserDataKeys.PREFERRED_FOCUS_THREESIDE);
if (side != null) myCurrentSide = side;
}
@Override
@CalledInAwt
protected void updateContextHints() {
super.updateContextHints();
myContext.putUserData(DiffUserDataKeys.PREFERRED_FOCUS_THREESIDE, myCurrentSide);
}
@@ -114,24 +114,16 @@ public abstract class TwosideTextDiffViewer extends TextDiffViewerBase {
}
@Override
protected void onInit() {
super.onInit();
processContextHints();
}
@Override
@CalledInAwt
protected void onDispose() {
updateContextHints();
super.onDispose();
destroyEditors();
}
@Override
protected void onDisposeAwt() {
destroyEditors();
super.onDisposeAwt();
}
@CalledInAwt
protected void processContextHints() {
super.processContextHints();
if (myEditor1 == null) {
myCurrentSide = Side.RIGHT;
}
@@ -144,7 +136,10 @@ public abstract class TwosideTextDiffViewer extends TextDiffViewerBase {
}
}
@Override
@CalledInAwt
protected void updateContextHints() {
super.updateContextHints();
if (myEditor1 != null && myEditor2 != null) {
myContext.putUserData(DiffUserDataKeys.PREFERRED_FOCUS_SIDE, myCurrentSide);
}
@@ -15,64 +15,19 @@
*/
package com.intellij.diff.util;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.util.Disposer;
import com.intellij.util.Alarm;
import com.intellij.util.Function;
import org.jetbrains.annotations.*;
import org.jetbrains.annotations.CalledInAwt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.concurrent.atomic.AtomicReference;
public class DiffTaskQueue implements Disposable {
@NotNull private final Object LOCK = new Object();
@NotNull private final Alarm myAlarm = new Alarm();
private boolean myDisposed;
@NotNull private final AtomicReference<ProgressIndicator> myProgressIndicator = new AtomicReference<ProgressIndicator>();
@CalledInAny
public void dispose() {
// if EDT is awaiting for background progress in executeAndTryWait - it holds LOCK.
// so we want to try cancel indicator before getting the lock.
cancelProgress();
synchronized (LOCK) {
if (myDisposed) return;
myDisposed = true;
cancelProgress();
Disposer.dispose(myAlarm);
}
}
public class DiffTaskQueue {
@Nullable private ProgressIndicator myProgressIndicator;
@CalledInAwt
public void abort() {
synchronized (LOCK) {
cancelProgress();
myAlarm.cancelAllRequests();
}
}
private void cancelProgress() {
ProgressIndicator indicator = myProgressIndicator.getAndSet(null);
if (indicator != null) indicator.cancel();
}
@CalledInAwt
public void abortAndSchedule(@NotNull final Runnable task, int millis) {
synchronized (LOCK) {
if (myDisposed) return;
abort();
myAlarm.addRequest(new Runnable() {
@Override
public void run() {
synchronized (LOCK) {
if (myDisposed) return;
}
task.run();
}
}, millis);
}
if (myProgressIndicator != null) myProgressIndicator.cancel();
myProgressIndicator = null;
}
@CalledInAwt
@@ -87,11 +42,7 @@ public class DiffTaskQueue implements Disposable {
@Nullable final Runnable onSlowAction,
final int waitMillis,
final boolean forceEDT) {
synchronized (LOCK) {
if (myDisposed) return;
abort();
myProgressIndicator.set(BackgroundTaskUtil.executeAndTryWait(backgroundTask, onSlowAction, waitMillis, forceEDT));
}
abort();
myProgressIndicator = BackgroundTaskUtil.executeAndTryWait(backgroundTask, onSlowAction, waitMillis, forceEDT);
}
}
@@ -16,6 +16,7 @@
package com.intellij.ide.util;
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
import com.intellij.icons.AllIcons;
import com.intellij.ide.DataManager;
import com.intellij.ide.DefaultTreeExpander;
import com.intellij.ide.IdeBundle;
@@ -27,6 +28,8 @@ import com.intellij.ide.structureView.StructureViewTreeElement;
import com.intellij.ide.structureView.impl.StructureViewComposite;
import com.intellij.ide.structureView.impl.common.PsiTreeElementBase;
import com.intellij.ide.structureView.newStructureView.StructureViewComponent;
import com.intellij.ide.structureView.newStructureView.TreeActionWrapper;
import com.intellij.ide.structureView.newStructureView.TreeActionsOwner;
import com.intellij.ide.structureView.newStructureView.TreeModelWrapper;
import com.intellij.ide.util.treeView.AbstractTreeNode;
import com.intellij.ide.util.treeView.NodeRenderer;
@@ -46,8 +49,7 @@ import com.intellij.openapi.fileEditor.ex.IdeDocumentHistory;
import com.intellij.openapi.keymap.KeymapManager;
import com.intellij.openapi.keymap.KeymapUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.JBPopup;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.ui.popup.*;
import com.intellij.openapi.util.*;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
@@ -77,8 +79,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
@@ -91,7 +91,7 @@ import java.util.List;
/**
* @author Konstantin Bulenkov
*/
public class FileStructurePopup implements Disposable {
public class FileStructurePopup implements Disposable, TreeActionsOwner {
private static final Logger LOG = Logger.getInstance("#com.intellij.ide.util.FileStructurePopup");
private final Project myProject;
private final StructureViewModel myTreeModel;
@@ -101,7 +101,6 @@ public class FileStructurePopup implements Disposable {
private JBPopup myPopup;
@NonNls private static final String narrowDownPropertyKey = "FileStructurePopup.narrowDown";
private boolean myShouldNarrowDown = true;
private final FileStructureTree myTree;
private final FilteringTreeBuilder myAbstractTreeBuilder;
private String myTitle;
@@ -119,6 +118,7 @@ public class FileStructurePopup implements Disposable {
private final TreeExpander myTreeExpander;
@NotNull private final FileEditor myFileEditor;
private final StructureView myStructureViewDelegate;
private boolean myCanClose = true;
public FileStructurePopup(@NotNull Project project,
@@ -259,7 +259,7 @@ public class FileStructurePopup implements Disposable {
@Override
public Boolean compute() {
DimensionService.getInstance().setLocation(getDimensionServiceKey(), myPopup.getLocationOnScreen(), myProject);
return true;
return myCanClose;
}
})
.createPopup();
@@ -498,6 +498,10 @@ public class FileStructurePopup implements Disposable {
}
private static boolean isShouldNarrowDown() {
return PropertiesComponent.getInstance().getBoolean(narrowDownPropertyKey, true);
}
@NonNls
protected static String getDimensionServiceKey() {
return "StructurePopup";
@@ -584,12 +588,17 @@ public class FileStructurePopup implements Disposable {
for (FileStructureNodeProvider provider : fileStructureNodeProviders) {
addCheckbox(comboPanel, provider);
}
final JPanel topPanel = new JPanel(new BorderLayout());
topPanel.add(comboPanel);
topPanel.add(createSettingsButton(), BorderLayout.EAST);
myPreferredWidth = Math.max(comboPanel.getPreferredSize().width, JBUI.scale(350));
panel.add(comboPanel, BorderLayout.NORTH);
panel.add(topPanel, BorderLayout.NORTH);
JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myAbstractTreeBuilder.getTree());
scrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.TOP | SideBorder.BOTTOM));
panel.add(scrollPane, BorderLayout.CENTER);
panel.add(createSouthPanel(), BorderLayout.SOUTH);
//panel.add(createSouthPanel(), BorderLayout.SOUTH);
DataManager.registerDataProvider(panel, new DataProvider() {
@Override
public Object getData(@NonNls String dataId) {
@@ -634,6 +643,84 @@ public class FileStructurePopup implements Disposable {
return panel;
}
@NotNull
protected JComponent createSettingsButton() {
final JLabel label = new JLabel(AllIcons.General.SecondaryGroup);
new ClickListener() {
@Override
public boolean onClick(@NotNull MouseEvent event, int clickCount) {
DefaultActionGroup group = new DefaultActionGroup();
//addSorters(group);
//addGroupers(group);
//addFilters(group);
group.add(new ToggleAction(IdeBundle.message("checkbox.narrow.down.on.typing")) {
@Override
public boolean isSelected(AnActionEvent e) {
return isShouldNarrowDown();
}
@Override
public void setSelected(AnActionEvent e, boolean state) {
PropertiesComponent.getInstance().setValue(narrowDownPropertyKey, Boolean.toString(state));
if (mySpeedSearch.isPopupActive() && !StringUtil.isEmpty(mySpeedSearch.getEnteredPrefix())) {
myAbstractTreeBuilder.queueUpdate();
}
}
});
final DataManager dataManager = DataManager.getInstance();
assert dataManager != null;
final ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(null, group,
dataManager.getDataContext(label),
JBPopupFactory.ActionSelectionAid.SPEEDSEARCH,
false);
popup.addListener(
new JBPopupListener() {
@Override
public void beforeShown(LightweightWindowEvent event) {
}
@Override
public void onClosed(LightweightWindowEvent event) {
myCanClose = true;
}
});
myCanClose = false;
popup.showUnderneathOf(label);
return true;
}
}.installOn(label);
return label;
}
protected void addFilters(DefaultActionGroup group) {
Filter[] filters = myTreeModel.getFilters();
for (Filter filter : filters) {
group.add(new TreeActionWrapper(filter, this));
}
}
protected void addGroupers(DefaultActionGroup group) {
Grouper[] groupers = myTreeModel.getGroupers();
for (Grouper grouper : groupers) {
group.add(new TreeActionWrapper(grouper, this));
}
}
protected void addSorters(DefaultActionGroup group) {
Sorter[] sorters = myTreeModel.getSorters();
for (final Sorter sorter : sorters) {
if (sorter.isVisible()) {
group.add(new TreeActionWrapper(sorter, this));
}
}
if (sorters.length > 0) {
group.addSeparator();
}
}
@Nullable
private AbstractTreeNode getSelectedNode() {
final TreePath path = myTree.getSelectionPath();
@@ -687,28 +774,6 @@ public class FileStructurePopup implements Disposable {
return succeeded.get();
}
private JComponent createSouthPanel() {
final JCheckBox checkBox = new JCheckBox(IdeBundle.message("checkbox.narrow.down.on.typing"));
checkBox.setSelected(PropertiesComponent.getInstance().getBoolean(narrowDownPropertyKey, true));
checkBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
myShouldNarrowDown = checkBox.isSelected();
PropertiesComponent.getInstance().setValue(narrowDownPropertyKey, Boolean.toString(myShouldNarrowDown));
if (mySpeedSearch.isPopupActive() && !StringUtil.isEmpty(mySpeedSearch.getEnteredPrefix())) {
myAbstractTreeBuilder.queueUpdate();
}
}
});
checkBox.setFocusable(false);
UIUtil.applyStyle(UIUtil.ComponentStyle.MINI, checkBox);
final JPanel panel = new JPanel(new BorderLayout());
panel.add(checkBox, BorderLayout.WEST);
return panel;
}
private void addCheckbox(final JPanel panel, final TreeAction action) {
String text = action instanceof FileStructureFilter ? ((FileStructureFilter)action).getCheckBoxText() :
action instanceof FileStructureNodeProvider ? ((FileStructureNodeProvider)action).getCheckBoxText() : null;
@@ -881,6 +946,16 @@ public class FileStructurePopup implements Disposable {
return null;
}
@Override
public void setActionActive(String name, boolean state) {
}
@Override
public boolean isActionActive(String name) {
return false;
}
private class FileStructurePopupFilter implements ElementFilter {
private String myLastFilter = null;
private final Set<Object> myVisibleParents = new HashSet<Object>();
@@ -888,7 +963,7 @@ public class FileStructurePopup implements Disposable {
@Override
public boolean shouldBeShowing(Object value) {
if (!myShouldNarrowDown) return true;
if (!isShouldNarrowDown()) return true;
String filter = getSearchPrefix();
if (!StringUtil.equals(myLastFilter, filter)) {
@@ -136,7 +136,11 @@ public class FileBasedIndexProjectHandler extends AbstractProjectComponent imple
@Nullable
public static DumbModeTask createChangedFilesIndexingTask(final Project project) {
final FileBasedIndexImpl index = (FileBasedIndexImpl)FileBasedIndex.getInstance();
final FileBasedIndex i = FileBasedIndex.getInstance();
if (!(i instanceof FileBasedIndexImpl)) {
return null;
}
final FileBasedIndexImpl index = (FileBasedIndexImpl)i;
if (index.getChangedFileCount() + index.getNumberOfPendingInvalidations() < 20) {
return null;
@@ -22,6 +22,8 @@ import com.sun.istack.internal.NotNull;
import org.jetbrains.annotations.Nullable;
import java.awt.*;
import java.awt.im.InputContext;
import java.util.Locale;
/**
* @author Denis Fokin
@@ -33,7 +35,7 @@ import java.awt.*;
)
public class KeyboardSettingsExternalizable implements PersistentStateComponent<KeyboardSettingsExternalizable.OptionSet> {
private static final String [] supportedNonEnglishLanguages = {"de", "fr", "it"};
private static final String [] supportedNonEnglishLanguages = {"de", "fr", "it", "uk"};
public static boolean isSupportedKeyboardLayout(@NotNull Component component) {
if (SystemInfo.isMac) return false;
@@ -46,12 +48,22 @@ public class KeyboardSettingsExternalizable implements PersistentStateComponent<
return false;
}
@Nullable
public static String getLanguageForComponent(@NotNull Component component) {
return component.getInputContext().getLocale().getLanguage();
final Locale locale = getLocaleForComponent(component);
return locale == null ? null : locale.getLanguage();
}
@Nullable
protected static Locale getLocaleForComponent(@NotNull Component component) {
final InputContext context = component.getInputContext();
return context == null ? null : context.getLocale();
}
@Nullable
public static String getDisplayLanguageNameForComponent(@NotNull Component component) {
return component.getInputContext().getLocale().getDisplayLanguage();
final Locale locale = getLocaleForComponent(component);
return locale == null ? null : locale.getDisplayLanguage();
}
public static final class OptionSet {
@@ -80,6 +92,10 @@ public class KeyboardSettingsExternalizable implements PersistentStateComponent<
myOptions = state;
}
public boolean isUkrainianKeyboard (Component c) {
return c!=null && "uk".equals(c.getInputContext().getLocale().getLanguage());
}
public boolean isNonEnglishKeyboardSupportEnabled () {
return myOptions.USE_NON_ENGLISH_KEYBOARD;
}
@@ -416,20 +416,8 @@ public class IdeEventQueue extends EventQueue {
if (e instanceof KeyEvent) {
KeyEvent ke = (KeyEvent)e;
// Alt,keyChar=Undefined keyChar,modifiers=Ctrl+Alt,extModifiers=Ctrl+Alt+Button5,keyLocation=KEY_LOCATION_RIGHT
//if (ke.getKeyCode() == KeyEvent.VK_ALT && ke.getID() == KeyEvent.KEY_PRESSED) {
//
// if (ke.getKeyLocation() == KeyEvent.KEY_LOCATION_RIGHT) {
// if ((ke.getModifiersEx() & (InputEvent.ALT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK)) != (InputEvent.ALT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK))
// {
// altGrIsPressed = true;
// }
// }
//
//} else {
// altGrIsPressed = false;
//}
// Try to get it from editor
Component sourceComponent = WindowManagerEx.getInstanceEx().getMostRecentFocusedWindow();
if (ke.getID() == KeyEvent.KEY_PRESSED) {
switch (ke.getKeyCode()) {
@@ -459,8 +447,15 @@ public class IdeEventQueue extends EventQueue {
}
}
if (!leftAltIsPressed && KeyboardSettingsExternalizable.getInstance().isUkrainianKeyboard(sourceComponent) ) {
if ('ґ' == ke.getKeyChar() || ke.getKeyCode() == KeyEvent.VK_U) {
ke = new KeyEvent(ke.getComponent(), ke.getID(), ke.getWhen(), 0,
KeyEvent.VK_UNDEFINED, 'ґ', ke.getKeyLocation());
ke.setKeyCode(KeyEvent.VK_U);
ke.setKeyChar('ґ');
return ke;
}
}
Integer keyCodeFromChar = CharToVKeyMap.get(ke.getKeyChar());
if (keyCodeFromChar != null) {
@@ -469,15 +464,12 @@ public class IdeEventQueue extends EventQueue {
ke.setKeyCode(keyCodeFromChar);
}
// Try to get it from editor
Component sourceComponent = WindowManagerEx.getInstanceEx().getMostRecentFocusedWindow();
//for (int i = 0; sourceComponent == null && i < WindowManagerEx.getInstanceEx().getAllProjectFrames().length; i++) {
// sourceComponent = WindowManagerEx.getInstanceEx().getAllProjectFrames()[i].getComponent();
//}
if (sourceComponent != null) {
if (sourceComponent.getInputContext().getLocale().getLanguage().equals("de")) {
if (KeyboardSettingsExternalizable.isSupportedKeyboardLayout(sourceComponent)) {
if ((ke.getModifiersEx() & (InputEvent.ALT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK)) != 0 /*&& ke.getKeyLocation() == KeyEvent.KEY_LOCATION_RIGHT*/) {
// On German keyboard layout on Windows we are getting on key press
// ctrl + alt instead of AltGr
@@ -110,9 +110,16 @@ public class RefreshSessionImpl extends RefreshSession {
boolean haveEventsToFire = myFinishRunnable != null || !myEvents.isEmpty();
if (!workQueue.isEmpty()) {
LocalFileSystemImpl fs = (LocalFileSystemImpl)LocalFileSystem.getInstance();
fs.markSuspiciousFilesDirty(workQueue);
FileWatcher watcher = fs.getFileWatcher();
final LocalFileSystem fileSystem = LocalFileSystem.getInstance();
final FileWatcher watcher;
if (fileSystem instanceof LocalFileSystemImpl) {
LocalFileSystemImpl fs = (LocalFileSystemImpl)fileSystem;
fs.markSuspiciousFilesDirty(workQueue);
watcher = fs.getFileWatcher();
}
else {
watcher = null;
}
long t = 0;
if (LOG.isDebugEnabled()) {
@@ -124,7 +131,7 @@ public class RefreshSessionImpl extends RefreshSession {
if (myCancelled) break;
NewVirtualFile nvf = (NewVirtualFile)file;
if (!myIsRecursive && (!myIsAsync || !watcher.isWatched(nvf))) {
if (!myIsRecursive && (!myIsAsync || (watcher != null && !watcher.isWatched(nvf)))) {
// we're unable to definitely refresh synchronously by means of file watcher.
nvf.markDirty();
}
@@ -18,6 +18,7 @@ package com.intellij.openapi.wm.impl.welcomeScreen;
import com.intellij.ide.ProjectGroup;
import com.intellij.ide.ProjectGroupActionGroup;
import com.intellij.ide.RecentProjectsManager;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.ui.InputValidatorEx;
import com.intellij.openapi.ui.Messages;
@@ -25,6 +26,7 @@ import com.intellij.ui.ListScrollingUtil;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.List;
/**
* @author Konstantin Bulenkov
@@ -82,4 +84,11 @@ public class EditProjectGroupAction extends RecentProjectsWelcomeScreenActionBas
}
}
}
@Override
public void update(AnActionEvent e) {
final List<AnAction> selected = getSelectedElements(e);
boolean enabled = !selected.isEmpty() && selected.get(0) instanceof ProjectGroupActionGroup;
e.getPresentation().setEnabledAndVisible(enabled);
}
}
@@ -982,11 +982,11 @@ action.XDebugger.NewWatch.text=New Watch...
action.XDebugger.EditWatch.text=Edit...
action.XDebugger.AutoTooltip.text=Value auto tooltip
action.XDebugger.AutoTooltip.description=Toggles if value tooltip is shown automatically on mouse over
action.XDebugger.Inline.text=Show values in editor
action.XDebugger.Inline.text=Show Values Inline
action.XDebugger.Inline.description=Show available debugger session values inside editor
action.XDebugger.AutoTooltipOnSelection.text=Show value on selection change
action.XDebugger.AutoTooltipOnSelection.description=Toggles if value tooltip is shown automatically on selection change in editor
action.XDebugger.ToggleSortValues.text=Sort values alphabetically
action.XDebugger.ToggleSortValues.text=Sort Values Alphabetically
action.XDebugger.ToggleSortValues.description=Sort values alphabetically in debugger views
group.XDebugger.settings.text=Settings
@@ -1020,7 +1020,7 @@ action.Debugger.MarkObject.unmark.text=Unmark Object
action.Debugger.MarkObject.description=Mark/unmark the object so that it can be visually distinguished in in debugger views
action.Debugger.AddToWatch.text=Add to Watches
action.Debugger.EvaluateInConsole.text=Evaluate in Console
action.Debugger.UnmuteOnStop.text=Unmute breakpoints on session finish
action.XDebugger.UnmuteOnStop.text=Unmute Breakpoints on Session Finish
action.Debugger.AutoRenderer.text=Auto
group.EditorPopupMenu.text=Editor Popup Menu
group.EditorPopupMenu.description=Editor Popup Menu
@@ -128,3 +128,6 @@ setting.focus.app.on.breakpoint.label=Focus application on breakpoint
settings.show.window.label=Show &debug window on breakpoint
showReferring.dialog.title=Referring Objects For {0}
settings.show.values.inline=Show values inline
settings.show.value.tooltip=Show value tooltip.
settings.show.tooltip.on.selection=Show value tooltip on code selection
@@ -23,4 +23,5 @@ com.jetbrains.chronon 134.1221 134.1414 134.1618 135.1291 135.476 135.666
ArgoUML.Integration 0.1.1 0.1.2
IdeaServerPlugin 1.0 1.0.2 1.0.3 1.0.4 1.0.7 1.0.8
copy.on.steroids 3.1
"AWS Elastic Beanstalk" 0.7.7 0.7.6 0.7.5 0.7.4 0.7.3 0.7.2 0.7.1 0.7.0 0.6.1 0.6.0 0.5.5 0.5.4 0.5.3 0.5.2 0.5.1 0.5.0
"AWS Elastic Beanstalk" 0.7.7 0.7.6 0.7.5 0.7.4 0.7.3 0.7.2 0.7.1 0.7.0 0.6.1 0.6.0 0.5.5 0.5.4 0.5.3 0.5.2 0.5.1 0.5.0
com.jetbrains.typoscript 0.1.1 0.1.0
@@ -794,10 +794,13 @@
</group>
<group id="XDebugger.Settings" icon="AllIcons.General.SecondaryGroup" popup="true">
<action id="Debugger.UnmuteOnStop" class="com.intellij.xdebugger.impl.actions.UnmuteOnStopAction"/>
<action id="XDebugger.Inline" class="com.intellij.xdebugger.impl.actions.UseInlineDebuggerAction"/>
<action id="XDebugger.AutoTooltip" class="com.intellij.xdebugger.impl.actions.ValueTooltipAutoShowAction"/>
<action id="XDebugger.AutoTooltipOnSelection" class="com.intellij.xdebugger.impl.actions.ValueTooltipAutoShowOnSelectionAction"/>
<separator/>
<reference ref="XDebugger.ToggleSortValues"/>
<!--<action id="XDebugger.AutoTooltip" class="com.intellij.xdebugger.impl.actions.ValueTooltipAutoShowAction"/>-->
<!--<action id="XDebugger.AutoTooltipOnSelection" class="com.intellij.xdebugger.impl.actions.ValueTooltipAutoShowOnSelectionAction"/>-->
<separator/>
<action id="XDebugger.UnmuteOnStop" class="com.intellij.xdebugger.impl.actions.UnmuteOnStopAction" />
</group>
<group id="RunnerLayoutActions">
@@ -1040,9 +1040,9 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
public LookupElement[] complete(@NotNull final CompletionType type, final int invocationCount) {
assertInitialized();
myEmptyLookup = false;
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
return UIUtil.invokeAndWaitIfNeeded(new Computable<LookupElement[]>() {
@Override
public void run() {
public LookupElement[] compute() {
CommandProcessor.getInstance().executeCommand(getProject(), new Runnable() {
@Override
public void run() {
@@ -1059,10 +1059,9 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); // to compare with file text
}
}, null, null);
return getLookupElements();
}
});
return getLookupElements();
}
@Nullable
@@ -31,7 +31,6 @@ import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.util.ProgressWindow;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.vcs.changes.actions.diff.ChangeDiffRequestProducer;
import com.intellij.util.Function;
@@ -161,7 +160,7 @@ public abstract class CacheChangeProcessor extends DiffRequestProcessor {
@CalledInAwt
protected void onDispose() {
super.onDispose();
Disposer.dispose(myQueue);
myQueue.abort();
myRequestCache.clear();
}
@@ -121,7 +121,6 @@ public class ChangesViewManager implements ChangesViewI, JDOMExternalizable, Pro
Disposer.register(project, myView);
myRepaintAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD, project);
myDiffDetails = new MyChangeProcessor(myProject);
myDiffDetails.init();
myTsl = new TreeSelectionListener() {
@Override
public void valueChanged(TreeSelectionEvent e) {
@@ -321,7 +321,6 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
});
}
});
myDiffDetails.init();
myBrowserExtender.addToolbarActions(this);
@@ -13,25 +13,9 @@
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="9a000" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/XDebuggerBundle" key="setting.value.tooltip.delay.label"/>
</properties>
</component>
<component id="fdcd5" class="javax.swing.JFormattedTextField" binding="valueTooltipDelayTextField">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<columns value="4"/>
</properties>
</component>
<component id="98130" class="javax.swing.JCheckBox" binding="enableAutoExpressionsCheckBox">
<constraints>
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/XDebuggerBundle" key="setting.enable.auto.expressions.label"/>
@@ -39,12 +23,62 @@
</component>
<component id="a57b4" class="javax.swing.JCheckBox" binding="sortAlphabeticallyCheckBox" default-binding="true">
<constraints>
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/XDebuggerBundle" key="setting.sort.alphabetically.label"/>
</properties>
</component>
<grid id="a4cab" binding="myEditorSettingsPanel" custom-create="true" layout-manager="GridLayoutManager" row-count="3" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="4aad4" class="javax.swing.JCheckBox" binding="myShowValuesInlineCheckBox" default-binding="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/XDebuggerBundle" key="settings.show.values.inline"/>
</properties>
</component>
<component id="83498" class="javax.swing.JCheckBox" binding="myShowValueTooltipCheckBox" default-binding="true">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/XDebuggerBundle" key="settings.show.value.tooltip"/>
</properties>
</component>
<component id="be332" class="javax.swing.JCheckBox" binding="myShowValueTooltipOnCheckBox" default-binding="true">
<constraints>
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/XDebuggerBundle" key="settings.show.tooltip.on.selection"/>
</properties>
</component>
<component id="e6be7" class="javax.swing.JFormattedTextField" binding="valueTooltipDelayTextField">
<constraints>
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<columns value="4"/>
</properties>
</component>
<component id="b0718" class="javax.swing.JLabel">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/XDebuggerBundle" key="setting.value.tooltip.delay.label"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
</form>
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,17 +15,28 @@
*/
package com.intellij.xdebugger.impl.settings;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.ui.IdeBorderFactory;
import com.intellij.ui.border.IdeaTitledBorder;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
public class DataViewsConfigurableUi {
public static final String IDE_DEBUGGER_INLINE_KEY = "ide.debugger.inline";
public static final String DEBUGGER_VALUE_TOOLTIP_AUTO_SHOW_KEY = "debugger.valueTooltipAutoShow";
public static final String DEBUGGER_VALUE_TOOLTIP_AUTO_SHOW_ON_SELECTION_KEY = "debugger.valueTooltipAutoShowOnSelection";
private JCheckBox enableAutoExpressionsCheckBox;
private JFormattedTextField valueTooltipDelayTextField;
private JPanel panel;
private JCheckBox sortAlphabeticallyCheckBox;
private JPanel myEditorSettingsPanel;
private JCheckBox myShowValuesInlineCheckBox;
private JCheckBox myShowValueTooltipCheckBox;
private JCheckBox myShowValueTooltipOnCheckBox;
public DataViewsConfigurableUi() {
UIUtil.configureNumericFormattedTextField(valueTooltipDelayTextField);
@@ -33,7 +44,8 @@ public class DataViewsConfigurableUi {
private int getValueTooltipDelay() {
Object value = valueTooltipDelayTextField.getValue();
return value instanceof Number ? ((Number)value).intValue() : StringUtilRt.parseInt((String)value, XDebuggerDataViewSettings.DEFAULT_VALUE_TOOLTIP_DELAY);
return value instanceof Number ? ((Number)value).intValue() :
StringUtilRt.parseInt((String)value, XDebuggerDataViewSettings.DEFAULT_VALUE_TOOLTIP_DELAY);
}
@NotNull
@@ -44,18 +56,34 @@ public class DataViewsConfigurableUi {
public boolean isModified(@NotNull XDebuggerDataViewSettings settings) {
return getValueTooltipDelay() != settings.getValueLookupDelay() ||
sortAlphabeticallyCheckBox.isSelected() != settings.isSortValues() ||
enableAutoExpressionsCheckBox.isSelected() != settings.isAutoExpressions();
enableAutoExpressionsCheckBox.isSelected() != settings.isAutoExpressions() ||
myShowValuesInlineCheckBox.isSelected() != Registry.is(IDE_DEBUGGER_INLINE_KEY) ||
myShowValuesInlineCheckBox.isSelected() != Registry.is(DEBUGGER_VALUE_TOOLTIP_AUTO_SHOW_KEY) ||
myShowValueTooltipOnCheckBox.isSelected() != Registry.is(DEBUGGER_VALUE_TOOLTIP_AUTO_SHOW_ON_SELECTION_KEY);
}
public void reset(@NotNull XDebuggerDataViewSettings settings) {
valueTooltipDelayTextField.setValue(settings.getValueLookupDelay());
sortAlphabeticallyCheckBox.setSelected(settings.isSortValues());
enableAutoExpressionsCheckBox.setSelected(settings.isAutoExpressions());
myShowValuesInlineCheckBox.setSelected(Registry.is(IDE_DEBUGGER_INLINE_KEY));
myShowValueTooltipCheckBox.setSelected(Registry.is(DEBUGGER_VALUE_TOOLTIP_AUTO_SHOW_KEY));
myShowValueTooltipOnCheckBox.setSelected(Registry.is(DEBUGGER_VALUE_TOOLTIP_AUTO_SHOW_ON_SELECTION_KEY));
}
public void apply(@NotNull XDebuggerDataViewSettings settings) {
settings.setValueLookupDelay(getValueTooltipDelay());
settings.setSortValues(sortAlphabeticallyCheckBox.isSelected());
settings.setAutoExpressions(enableAutoExpressionsCheckBox.isSelected());
Registry.get(IDE_DEBUGGER_INLINE_KEY).setValue(myShowValuesInlineCheckBox.isSelected());
Registry.get(DEBUGGER_VALUE_TOOLTIP_AUTO_SHOW_KEY).setValue(myShowValueTooltipCheckBox.isSelected());
Registry.get(DEBUGGER_VALUE_TOOLTIP_AUTO_SHOW_ON_SELECTION_KEY).setValue(myShowValueTooltipOnCheckBox.isSelected());
}
private void createUIComponents() {
myEditorSettingsPanel = new JPanel();
IdeaTitledBorder titledBorder = IdeBorderFactory.createTitledBorder("Editor", false);
myEditorSettingsPanel.setBorder(titledBorder);
titledBorder.acceptMinimumSize(myEditorSettingsPanel);
}
}
@@ -267,16 +267,7 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
final AnAction[] commonSettings = myUi.getOptions().getSettingsActionsList();
DefaultActionGroup settings = new DefaultActionGroup(ActionsBundle.message("group.XDebugger.settings.text"), true);
settings.getTemplatePresentation().setIcon(myUi.getOptions().getSettingsActions().getTemplatePresentation().getIcon());
if (commonSettings.length > 0) {
for (AnAction each : commonSettings) {
settings.add(each);
}
settings.addSeparator();
}
if (!session.getDebugProcess().isValuesCustomSorted()) {
settings.add(new ToggleSortValuesAction(commonSettings.length == 0));
}
settings.addAll(commonSettings);
leftToolbar.add(settings);
leftToolbar.addSeparator();
@@ -316,7 +307,7 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
}
@Override
public void update(AnActionEvent e) {
public void update(@NotNull AnActionEvent e) {
super.update(e);
if (!myShowIcon) {
e.getPresentation().setIcon(null);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,13 +18,23 @@ package com.intellij.xdebugger.impl.ui.tree.actions;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.ToggleAction;
import com.intellij.openapi.project.DumbAware;
import com.intellij.xdebugger.XDebugSession;
import com.intellij.xdebugger.impl.XDebuggerUtilImpl;
import com.intellij.xdebugger.impl.settings.XDebuggerSettingsManager;
import org.jetbrains.annotations.NotNull;
/**
* @author nik
*/
public class SortValuesToggleAction extends ToggleAction implements DumbAware {
@Override
public void update(@NotNull AnActionEvent e) {
super.update(e);
XDebugSession session = XDebugSession.DATA_KEY.getData(e.getDataContext());
e.getPresentation().setEnabledAndVisible(session != null && !session.getDebugProcess().isValuesCustomSorted());
}
@Override
public boolean isSelected(AnActionEvent e) {
return XDebuggerSettingsManager.getInstanceImpl().getDataViewSettings().isSortValues();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,14 +15,13 @@
*/
package com.intellij.byteCodeViewer;
import com.intellij.codeInsight.hint.EditorFragmentComponent;
import com.intellij.execution.filters.LineNumbersMapping;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.ActionPlaces;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.editor.*;
import com.intellij.openapi.editor.colors.EditorColors;
import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory;
@@ -30,10 +29,10 @@ import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.fileTypes.SyntaxHighlighter;
import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.ui.Gray;
import com.intellij.ui.JBColor;
import com.intellij.psi.PsiFile;
import com.intellij.util.DocumentUtil;
import javax.swing.*;
@@ -82,9 +81,23 @@ public class ByteCodeViewerComponent extends JPanel implements Disposable {
public void setText(final String bytecode, PsiElement element) {
int offset = 0;
final Document document = PsiDocumentManager.getInstance(element.getProject()).getDocument(element.getContainingFile());
PsiFile psiFile = element.getContainingFile();
final Document document = PsiDocumentManager.getInstance(element.getProject()).getDocument(psiFile);
if (document != null) {
int lineNumber = document.getLineNumber(element.getTextOffset());
VirtualFile file = psiFile.getVirtualFile();
if (file != null) {
LineNumbersMapping mapping = file.getUserData(LineNumbersMapping.LINE_NUMBERS_MAPPING_KEY);
if (mapping != null) {
int mappedLine = mapping.sourceToBytecode(lineNumber);
while (mappedLine == -1 && lineNumber < document.getLineCount()) {
mappedLine = mapping.sourceToBytecode(++lineNumber);
}
if (mappedLine > 0) {
lineNumber = mappedLine;
}
}
}
offset = bytecode.indexOf("LINENUMBER " + lineNumber);
while (offset == -1 && lineNumber < document.getLineCount()) {
offset = bytecode.indexOf("LINENUMBER " + (lineNumber++));
@@ -84,8 +84,7 @@ public class ThrowableInstanceNeverThrownInspection extends BaseInspection {
return;
}
final PsiElement parent = getParent(expression.getParent());
if (parent instanceof PsiThrowStatement ||
parent instanceof PsiReturnStatement) {
if (canBeThrown(parent)) {
return;
}
if (PsiTreeUtil.getParentOfType(parent, PsiCallExpression.class) != null) {
@@ -93,7 +92,7 @@ public class ThrowableInstanceNeverThrownInspection extends BaseInspection {
}
final PsiElement typedParent = PsiTreeUtil.getParentOfType(expression, PsiAssignmentExpression.class, PsiVariable.class);
final PsiElement variable = ThrowableResultOfMethodCallIgnoredInspection.getVariable(typedParent, expression);
if (variable == null) {
if (typedParent != null && variable == null) {
return;
}
if (variable instanceof PsiLocalVariable) {
@@ -104,8 +103,7 @@ public class ThrowableInstanceNeverThrownInspection extends BaseInspection {
while (usageParent instanceof PsiParenthesizedExpression) {
usageParent = usageParent.getParent();
}
if (usageParent instanceof PsiThrowStatement ||
usageParent instanceof PsiReturnStatement) {
if (canBeThrown(usageParent)) {
return;
}
if (PsiTreeUtil.getParentOfType(usageParent, PsiCallExpression.class) != null) {
@@ -116,6 +114,12 @@ public class ThrowableInstanceNeverThrownInspection extends BaseInspection {
registerError(expression, expression);
}
private static boolean canBeThrown(PsiElement parent) {
return parent instanceof PsiThrowStatement ||
parent instanceof PsiReturnStatement ||
parent instanceof PsiLambdaExpression;
}
public static PsiElement getParent(PsiElement element) {
PsiElement parent = element;
while (parent instanceof PsiParenthesizedExpression ||
@@ -63,10 +63,7 @@ public class ThrowableResultOfMethodCallIgnoredInspection extends BaseInspection
while (parent instanceof PsiParenthesizedExpression || parent instanceof PsiTypeCastExpression) {
parent = parent.getParent();
}
if (parent instanceof PsiReturnStatement ||
parent instanceof PsiThrowStatement ||
parent instanceof PsiExpressionList ||
parent instanceof PsiLambdaExpression) {
if (canBeThrown(parent)) {
return;
}
if (!TypeUtils.expressionHasTypeOrSubtype(expression, CommonClassNames.JAVA_LANG_THROWABLE)) {
@@ -102,15 +99,20 @@ public class ThrowableResultOfMethodCallIgnoredInspection extends BaseInspection
while (usageParent instanceof PsiParenthesizedExpression) {
usageParent = usageParent.getParent();
}
if (usageParent instanceof PsiThrowStatement ||
usageParent instanceof PsiReturnStatement ||
usageParent instanceof PsiExpressionList) {
if (canBeThrown(usageParent)) {
return;
}
}
}
registerMethodCallError(expression);
}
private static boolean canBeThrown(PsiElement parent) {
return parent instanceof PsiReturnStatement ||
parent instanceof PsiThrowStatement ||
parent instanceof PsiExpressionList ||
parent instanceof PsiLambdaExpression;
}
}
protected static PsiElement getVariable(PsiElement parent, PsiElement expression) {
@@ -16,8 +16,10 @@
package com.siyeh.ig.performance;
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.util.WriteExternalException;
import com.intellij.psi.*;
import com.intellij.psi.impl.AllowedApiFilterExtension;
import com.siyeh.InspectionGadgetsBundle;
import com.siyeh.ig.BaseInspection;
import com.siyeh.ig.BaseInspectionVisitor;
@@ -124,7 +126,14 @@ public class DynamicRegexReplaceableByCompiledPatternInspectionBase extends Base
return false;
}
final String className = containingClass.getQualifiedName();
return CommonClassNames.JAVA_LANG_STRING.equals(className);
if (!CommonClassNames.JAVA_LANG_STRING.equals(className)) {
return false;
}
if (Extensions.getRootArea().hasExtensionPoint(AllowedApiFilterExtension.EP_NAME.getName())) {
//todo[nik] remove this condition when the extension point will be registered in java-analysis-impl module
return AllowedApiFilterExtension.isClassAllowed("java.util.regex.Pattern", expression);
}
return true;
}
private boolean isOptimizedPattern(String regex) {
@@ -44,3 +44,16 @@ public class ThrowableInstanceNeverThrown {
void methodCall(IOException e){}
}
interface I {
Exception get();
}
class L {
{
I i = () -> new RuntimeException();
final RuntimeException exception = new RuntimeException();
I i2 = () -> exception;
}
}
@@ -73,7 +73,7 @@ public class GradleProjectImportBuilder extends AbstractExternalProjectImportBui
final ImportFromGradleControl importFromGradleControl = getControl(context.getProject());
importFromGradleControl.setLinkedProjectPath(pathToUse);
final Pair<String, Sdk> sdkPair = ExternalSystemJdkUtil.getAvailableJdk(context.getProject());
if (sdkPair != null) {
if (sdkPair != null && !ExternalSystemJdkUtil.USE_INTERNAL_JAVA.equals(sdkPair.first)) {
importFromGradleControl.getProjectSettings().setGradleJvm(sdkPair.first);
}
}
+3 -2
View File
@@ -52,8 +52,9 @@ def walkModules(modulesAndPattern, dirname, names):
if name.endswith(".py") and prog.match(name):
modules.append(loadSource(os.path.join(dirname, name)))
# For default pattern see https://docs.python.org/2/library/unittest.html#test-discovery
def loadModulesFromFolderRec(folder, pattern = "test*.py"):
def loadModulesFromFolderRec(folder, pattern="test*.py"):
modules = []
if PYTHON_VERSION_MAJOR == 3:
# fnmatch converts glob to regexp
@@ -105,7 +106,7 @@ if __name__ == "__main__":
a = arg.split("::")
if len(a) == 1:
# From module or folder
a_splitted = a[0].split("_args_separator_") # ";" can't be used with bash, so we use "_args_separator_"
a_splitted = a[0].split("_args_separator_") # ";" can't be used with bash, so we use "_args_separator_"
if len(a_splitted) != 1:
# means we have pattern to match against
if a_splitted[0].endswith(os.path.sep):
@@ -441,7 +441,7 @@ action.show.watches.description=Shows or hides 'watches' pane
action.show.watches.text.hide=Hide Watches
action.show.watches.text.show=Show Watches
action.watch.method.return.value.description=Enables watching last executed method return value
action.watches.method.return.value.enable=Watch method return values
action.watches.method.return.value.enable=Show Method Return Values
action.watches.method.return.value.disable=Stop watching method return values
action.watches.method.return.value.unavailable.reason=Feature is not supported by the target VM
action.auto.variables.mode=Auto-Variables Mode
@@ -37,12 +37,12 @@ import org.jetbrains.annotations.Nullable;
public class HtmlParsing {
@NonNls private static final String TR_TAG = "tr";
@NonNls private static final String TD_TAG = "td";
@NonNls private static final String DD_TAG = "dd";
@NonNls private static final String DT_TAG = "dt";
@NonNls private static final String TH_TAG = "th";
@NonNls private static final String TABLE_TAG = "table";
private final PsiBuilder myBuilder;
private final Stack<String> myTagNamesStack = new Stack<String>();
private final Stack<String> myOriginalTagNamesStack = new Stack<String>();
private final Stack<PsiBuilder.Marker> myTagMarkersStack = new Stack<PsiBuilder.Marker>();
@NonNls private static final String COMPLETION_NAME = CompletionUtilCore.DUMMY_IDENTIFIER_TRIMMED.toLowerCase();
@@ -64,7 +64,7 @@ public class HtmlParsing {
final IElementType tt = token();
if (tt == XmlTokenType.XML_START_TAG_START) {
error = flushError(error);
parseTag("");
parseTag();
myTagMarkersStack.clear();
myTagNamesStack.clear();
}
@@ -133,146 +133,72 @@ public class HtmlParsing {
doctype.done(XmlElementType.XML_DOCTYPE);
}
private static boolean ddordt(String name) {
return DT_TAG.equals(name) || DD_TAG.equals(name);
}
private boolean parseTag(String parentName) {
private void parseTag() {
assert token() == XmlTokenType.XML_START_TAG_START : "Tag start expected";
final PsiBuilder.Marker tag = mark();
myTagMarkersStack.push(tag);
// Start tag header
advance();
final String originalTagName;
if (token() != XmlTokenType.XML_NAME) {
error(XmlErrorMessages.message("xml.parsing.tag.name.expected"));
originalTagName = "";
}
else {
originalTagName = myBuilder.getTokenText();
advance();
}
String tagName = StringUtil.toLowerCase(originalTagName);
if (ddordt(tagName) && ddordt(parentName) ||
tagName.equals(parentName) && HtmlUtil.isOptionalEndForHtmlTagL(tagName) ||
myTagMarkersStack.size() > MAGIC_FRAME_COUNT // no chance for evil guys wanting us to have stack overflow
) {
tag.rollbackTo();
myTagMarkersStack.pop();
return false;
}
myTagNamesStack.push(tagName);
boolean freeMakerTag = !tagName.isEmpty() && '#' == tagName.charAt(0);
do {
final IElementType tt = token();
if (freeMakerTag) {
if (tt == XmlTokenType.XML_EMPTY_ELEMENT_END ||
tt == XmlTokenType.XML_TAG_END ||
tt == XmlTokenType.XML_END_TAG_START ||
tt == XmlTokenType.XML_START_TAG_START) break;
advance();
}
else {
if (tt == XmlTokenType.XML_NAME) {
parseAttribute();
}
else if (tt == XmlTokenType.XML_CHAR_ENTITY_REF || tt == XmlTokenType.XML_ENTITY_REF_TOKEN) {
parseReference();
}
else {
break;
}
}
}
while (!eof());
if (token() == XmlTokenType.XML_EMPTY_ELEMENT_END) {
advance();
tag.done(XmlElementType.HTML_TAG);
return true;
}
if (token() == XmlTokenType.XML_TAG_END) {
advance();
}
else {
error(XmlErrorMessages.message("tag.start.is.not.closed"));
tag.done(XmlElementType.HTML_TAG);
return true;
}
if (HtmlUtil.isSingleHtmlTagL(tagName)) {
final PsiBuilder.Marker footer = mark();
if (token() == XmlTokenType.XML_END_TAG_START) {
advance();
if (token() == XmlTokenType.XML_NAME) {
if (tagName.equalsIgnoreCase(myBuilder.getTokenText())) {
advance();
footer.drop();
if (token() == XmlTokenType.XML_TAG_END) {
advance();
}
tag.done(XmlElementType.HTML_TAG);
return true;
}
}
}
footer.rollbackTo();
tag.done(XmlElementType.HTML_TAG);
return true;
}
// Done header, start content
boolean isInlineTagContainer = HtmlUtil.isInlineTagContainerL(tagName);
boolean isOptionalTagEnd = HtmlUtil.isOptionalEndForHtmlTagL(tagName);
PsiBuilder.Marker firstBlockChild = null;
String originalTagName;
PsiBuilder.Marker xmlText = null;
while (!eof()) {
final IElementType tt = token();
if (tt == XmlTokenType.XML_START_TAG_START) {
xmlText = terminateText(xmlText);
if (!parseTag(tagName)) {
tag.done(XmlElementType.HTML_TAG);
return true;
final PsiBuilder.Marker tag = mark();
// Start tag header
advance();
if (token() != XmlTokenType.XML_NAME) {
error(XmlErrorMessages.message("xml.parsing.tag.name.expected"));
originalTagName = "";
}
else {
originalTagName = myBuilder.getTokenText();
advance();
}
PsiBuilder.Marker childMarker = myTagMarkersStack.pop();
String childName = myTagNamesStack.pop();
String tagName = StringUtil.toLowerCase(originalTagName);
while (childTerminatesParentInStack(tagName)) {
PsiBuilder.Marker top = closeTag();
top.doneBefore(XmlElementType.HTML_TAG, tag);
}
if (isOptionalTagEnd) {
boolean foundMatch = childTerminatesParentInStack(childName, true);
if (foundMatch) {
// allow only one promotion per tag, otherwise last row in table
// will make it up to the first one moving all tags in between under first node
if (!canTerminate(childName, tagName)) {
myTagMarkersStack.pop();
myTagNamesStack.pop();
myTagMarkersStack.push(tag);
myTagNamesStack.push(tagName);
myOriginalTagNamesStack.push(originalTagName);
myTagMarkersStack.push(childMarker);
myTagNamesStack.push(childName);
parseHeader(tagName);
if (token() == XmlTokenType.XML_EMPTY_ELEMENT_END) {
advance();
doneTag(tag);
continue;
}
if (token() == XmlTokenType.XML_TAG_END) {
advance();
}
else {
error(XmlErrorMessages.message("tag.start.is.not.closed"));
doneTag(tag);
continue;
}
if (HtmlUtil.isSingleHtmlTagL(tagName)) {
final PsiBuilder.Marker footer = mark();
if (token() == XmlTokenType.XML_END_TAG_START) {
advance();
if (token() == XmlTokenType.XML_NAME) {
if (tagName.equalsIgnoreCase(myBuilder.getTokenText())) {
advance();
footer.drop();
if (token() == XmlTokenType.XML_TAG_END) {
advance();
}
doneTag(tag);
continue;
}
}
tag.doneBefore(XmlElementType.HTML_TAG, childMarker);
return true;
}
}
if (isInlineTagContainer && HtmlUtil.isHtmlBlockTagL(childName) && isOptionalTagEnd && !HtmlUtil.isPossiblyInlineTag(childName)) {
tag.doneBefore(XmlElementType.HTML_TAG, childMarker);
return true;
}
else if (isOptionalTagEnd && firstBlockChild == null && HtmlUtil.isHtmlBlockTagL(childName) && !HtmlUtil.isHtmlBlockTagL(tagName) && canTerminate(childName, tagName)) {
firstBlockChild = childMarker;
footer.rollbackTo();
doneTag(tag);
}
}
else if (tt == XmlTokenType.XML_PI_START) {
@@ -312,23 +238,20 @@ public class HtmlParsing {
if (token() == XmlTokenType.XML_NAME) {
String endName = StringUtil.toLowerCase(myBuilder.getTokenText());
if (!tagName.equals(endName) && !endName.endsWith(COMPLETION_NAME)) {
final boolean hasChancesToMatch = HtmlUtil.isOptionalEndForHtmlTagL(endName) ? childTerminatesParentInStack(endName, false) : myTagNamesStack.contains(endName);
final String parentTagName = !myTagNamesStack.isEmpty() ? myTagNamesStack.peek() : "";
if (!parentTagName.equals(endName) && !endName.endsWith(COMPLETION_NAME)) {
final boolean isOptionalTagEnd = HtmlUtil.isOptionalEndForHtmlTagL(parentTagName);
final boolean hasChancesToMatch = HtmlUtil.isOptionalEndForHtmlTagL(endName) ? childTerminatesParentInStack(endName) : myTagNamesStack.contains(endName);
if (hasChancesToMatch) {
footer.rollbackTo();
if (isOptionalTagEnd) {
if (firstBlockChild != null) {
tag.doneBefore(XmlElementType.HTML_TAG, firstBlockChild);
}
else {
tag.done(XmlElementType.HTML_TAG);
}
doneTag(myTagMarkersStack.peek());
}
else {
error(XmlErrorMessages.message("named.element.is.not.closed", originalTagName));
tag.done(XmlElementType.HTML_TAG);
error(XmlErrorMessages.message("named.element.is.not.closed", myOriginalTagNamesStack.peek()));
doneTag(myTagMarkersStack.peek());
}
return true;
continue;
}
else {
advance();
@@ -356,57 +279,105 @@ public class HtmlParsing {
else {
error(XmlErrorMessages.message("xml.parsing.closing.tag.is.not.done"));
}
tag.done(XmlElementType.HTML_TAG);
return true;
}
else {
if (hasTags()) doneTag(myTagMarkersStack.peek());
} else if ((token() == XmlTokenType.XML_REAL_WHITE_SPACE || token() == XmlTokenType.XML_DATA_CHARACTERS) && !hasTags()) {
xmlText = terminateText(xmlText);
advance();
} else {
xmlText = startText(xmlText);
advance();
}
}
terminateText(xmlText);
while (hasTags()) {
final String tagName = myTagNamesStack.peek();
if (!HtmlUtil.isOptionalEndForHtmlTagL(tagName) && !"html".equals(tagName) && !"body".equals(tagName)) {
error(XmlErrorMessages.message("named.element.is.not.closed", myOriginalTagNamesStack.peek()));
}
doneTag(myTagMarkersStack.peek());
}
}
if (isOptionalTagEnd || "body".equalsIgnoreCase(tagName) || "html".equalsIgnoreCase(tagName)) {
if (firstBlockChild != null) {
tag.doneBefore(XmlElementType.HTML_TAG, firstBlockChild);
private boolean hasTags() {
return !myTagNamesStack.isEmpty();
}
private PsiBuilder.Marker closeTag() {
myTagNamesStack.pop();
myOriginalTagNamesStack.pop();
return myTagMarkersStack.pop();
}
private void doneTag(PsiBuilder.Marker tag) {
tag.done(XmlElementType.HTML_TAG);
final String tagName = myTagNamesStack.peek();
closeTag();
final String parentTagName = hasTags() ? myTagNamesStack.peek() : "";
boolean isInlineTagContainer = HtmlUtil.isInlineTagContainerL(parentTagName);
boolean isOptionalTagEnd = HtmlUtil.isOptionalEndForHtmlTagL(parentTagName);
if (isInlineTagContainer && HtmlUtil.isHtmlBlockTagL(tagName) && isOptionalTagEnd && !HtmlUtil.isPossiblyInlineTag(tagName)) {
PsiBuilder.Marker top = closeTag();
top.doneBefore(XmlElementType.HTML_TAG, tag);
}
}
private void parseHeader(String tagName) {
boolean freeMakerTag = !tagName.isEmpty() && '#' == tagName.charAt(0);
do {
final IElementType tt = token();
if (freeMakerTag) {
if (tt == XmlTokenType.XML_EMPTY_ELEMENT_END ||
tt == XmlTokenType.XML_TAG_END ||
tt == XmlTokenType.XML_END_TAG_START ||
tt == XmlTokenType.XML_START_TAG_START) break;
advance();
}
else {
tag.done(XmlElementType.HTML_TAG);
if (tt == XmlTokenType.XML_NAME) {
parseAttribute();
}
else if (tt == XmlTokenType.XML_CHAR_ENTITY_REF || tt == XmlTokenType.XML_ENTITY_REF_TOKEN) {
parseReference();
}
else {
break;
}
}
}
else {
error(XmlErrorMessages.message("named.element.is.not.closed", originalTagName));
tag.done(XmlElementType.HTML_TAG);
}
return true;
while (!eof());
}
private static boolean canTerminate(final String childTagName,final String tagName) {
return childTagName.equals(tagName) || HtmlUtil.canTerminate(childTagName, tagName);
}
private boolean childTerminatesParentInStack(final String childName, final boolean terminateOnNonOptionalTag) {
boolean isCell = TD_TAG.equals(childName) || "th".equals(childName);
private boolean childTerminatesParentInStack(final String childName) {
boolean isCell = TD_TAG.equals(childName) || TH_TAG.equals(childName);
boolean isRow = TR_TAG.equals(childName);
boolean isStructure = isStructure(childName);
for (int i = myTagNamesStack.size() - 1; i >= 0; i--) {
String parentName = myTagNamesStack.get(i);
if (terminateOnNonOptionalTag && !HtmlUtil.isOptionalEndForHtmlTagL(parentName)) return false;
if (isCell && (TR_TAG.equals(parentName) || TABLE_TAG.equals(parentName)) ||
isRow && TABLE_TAG.equals(parentName)) {
final boolean isParentTable = TABLE_TAG.equals(parentName);
final boolean isParentStructure = isStructure(parentName);
if (isCell && (TR_TAG.equals(parentName) || isParentStructure || isParentTable) ||
isRow && (isParentStructure || isParentTable) ||
isStructure && isParentTable) {
return false;
}
if (canTerminate(childName, parentName)) {
if ("li".equals(childName) && ("ul".equals(parentName) || "ol".equals(parentName))) {
return false;
}
if (HtmlUtil.canTerminate(childName, parentName)) {
return true;
}
}
return false;
}
private static boolean isStructure(String childName) {
return "thead".equals(childName) || "tbody".equals(childName) || "tfoot".equals(childName);
}
@NotNull
private PsiBuilder.Marker startText(@Nullable PsiBuilder.Marker xmlText) {
@@ -621,6 +592,4 @@ public class HtmlParsing {
private void error(final String message) {
myBuilder.error(message);
}
private static final int MAGIC_FRAME_COUNT = 450;
}
@@ -31,7 +31,7 @@
<control name="cite" type="HtmlGenericControl" startTag="required" endTag="required" emptyAllowed="false"/>
<control name="code" type="HtmlGenericControl" startTag="required" endTag="required" emptyAllowed="false"/>
<control name="col" type="HtmlGenericControl" startTag="required" endTag="forbidden" emptyAllowed="true"/>
<control name="colGroup" type="HtmlGenericControl" startTag="required" endTag="optional" emptyAllowed="false" autoClosedBy="colGroup"/>
<control name="colGroup" type="HtmlGenericControl" startTag="required" endTag="optional" emptyAllowed="false" autoClosedBy="colGroup,thead,tbody,tfoot"/>
<control name="DD" type="HtmlGenericControl" startTag="required" endTag="optional" emptyAllowed="false" autoClosedBy="dt, dd"/>
<control name="del" type="HtmlGenericControl" startTag="required" endTag="required" emptyAllowed="false">