Merge remote-tracking branch 'origin/master'

This commit is contained in:
Dmitry Trofimov
2013-08-22 16:43:34 +02:00
10 changed files with 229 additions and 33 deletions
@@ -271,21 +271,23 @@ class Impl extends Bar implements Foo {}
CodeStyleSettingsManager.getSettings(getProject()).USE_FQ_CLASS_NAMES_IN_JAVADOC = false
try {
myFixture.addClass("package foo; public class Foo {}")
myFixture.addClass("package bar; public class Bar {}")
myFixture.configureByText "a.java", '''
import foo.*;
import bar.*;
/**
* {@link #go<caret>
*/
class Goo { void goo(Foo foo {} }
* {@link #go<caret>
*/
class Goo { void goo(Foo foo, Bar bar) {} }
'''
myFixture.completeBasic()
assert myFixture.editor.document.text.contains('@link #goo(Foo)')
assert myFixture.editor.document.text.contains('@link #goo(Foo, Bar)')
}
finally {
CodeStyleSettingsManager.getSettings(getProject()).USE_FQ_CLASS_NAMES_IN_JAVADOC = true
}
}
public void testCustomReferenceProvider() throws Exception {
@@ -18,6 +18,7 @@ package com.intellij.ide.util.gotoByName;
import com.intellij.navigation.EfficientChooseByNameContributor;
import com.intellij.navigation.NavigationItem;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ContentIterator;
@@ -76,6 +77,7 @@ public class DefaultFileNavigationContributor implements EfficientChooseByNameCo
idSet.set(
((VirtualFileWithId)fileOrDir).getId()
);
ProgressManager.checkCanceled();
return true;
}
};
@@ -17,6 +17,7 @@
package com.intellij.util.indexing;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.util.LowMemoryWatcher;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.util.CommonProcessors;
@@ -252,6 +253,7 @@ public final class MapIndexStorage<Key, Value> implements IndexStorage<Key, Valu
public boolean process(int[] key) {
if (!idFilter.contains(key[1])) return true;
hashMaskSet.add(key[0]);
ProgressManager.checkCanceled();
return true;
}
});
@@ -0,0 +1,166 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.ide;
import java.awt.event.KeyEvent;
import java.util.HashMap;
/**
* @author Denis Fokin
*/
class CharToVKeyMap {
private CharToVKeyMap() {}
private static HashMap<Character, Integer> charToVKeyMap =
new HashMap<Character, Integer>();
public static Integer get (Character ch) {
return charToVKeyMap.get(ch);
}
static {
charToVKeyMap.put(',', KeyEvent.VK_COMMA);
charToVKeyMap.put('-',KeyEvent.VK_MINUS);
charToVKeyMap.put('.',KeyEvent.VK_PERIOD);
charToVKeyMap.put('/',KeyEvent.VK_SLASH);
charToVKeyMap.put(';',KeyEvent.VK_SEMICOLON);
charToVKeyMap.put('=',KeyEvent.VK_EQUALS);
charToVKeyMap.put('[',KeyEvent.VK_OPEN_BRACKET);
charToVKeyMap.put('\\',KeyEvent.VK_BACK_SLASH);
charToVKeyMap.put(']',KeyEvent.VK_CLOSE_BRACKET);
charToVKeyMap.put('`',KeyEvent.VK_BACK_QUOTE);
charToVKeyMap.put('\'',KeyEvent.VK_QUOTE);
charToVKeyMap.put('&',KeyEvent.VK_AMPERSAND);
charToVKeyMap.put('*',KeyEvent.VK_ASTERISK);
charToVKeyMap.put('"',KeyEvent.VK_QUOTEDBL);
charToVKeyMap.put('<',KeyEvent.VK_LESS);
charToVKeyMap.put('>',KeyEvent.VK_GREATER);
charToVKeyMap.put('{',KeyEvent.VK_BRACELEFT);
charToVKeyMap.put('}',KeyEvent.VK_BRACERIGHT);
charToVKeyMap.put('@',KeyEvent.VK_AT);
charToVKeyMap.put(';',KeyEvent.VK_COLON);
charToVKeyMap.put('$',KeyEvent.VK_DOLLAR);
charToVKeyMap.put('€',KeyEvent.VK_EURO_SIGN);
charToVKeyMap.put('!',KeyEvent.VK_EXCLAMATION_MARK);
charToVKeyMap.put('¡',KeyEvent.VK_INVERTED_EXCLAMATION_MARK);
charToVKeyMap.put('(',KeyEvent.VK_LEFT_PARENTHESIS);
charToVKeyMap.put('#',KeyEvent.VK_NUMBER_SIGN);
charToVKeyMap.put('+',KeyEvent.VK_PLUS);
charToVKeyMap.put(')',KeyEvent.VK_RIGHT_PARENTHESIS);
charToVKeyMap.put('_',KeyEvent.VK_UNDERSCORE);
// All these keys should be similar
//charToVKeyMap.put('',KeyEvent.VK_ENTER);
//charToVKeyMap.put('',KeyEvent.VK_BACK_SPACE);
//charToVKeyMap.put('',KeyEvent.VK_TAB);
//charToVKeyMap.put('',KeyEvent.VK_CANCEL);
//charToVKeyMap.put('',KeyEvent.VK_CLEAR);
//charToVKeyMap.put('',KeyEvent.VK_SHIFT);
//charToVKeyMap.put('',KeyEvent.VK_CONTROL);
//charToVKeyMap.put('',KeyEvent.VK_ALT);
//charToVKeyMap.put('',KeyEvent.VK_PAUSE);
//charToVKeyMap.put('',KeyEvent.VK_CAPS_LOCK);
//charToVKeyMap.put('',KeyEvent.VK_ESCAPE);
//charToVKeyMap.put('',KeyEvent.VK_SPACE);
//charToVKeyMap.put('',KeyEvent.VK_PAGE_UP);
//charToVKeyMap.put('',KeyEvent.VK_PAGE_DOWN);
//charToVKeyMap.put('',KeyEvent.VK_END);
//charToVKeyMap.put('',KeyEvent.VK_HOME);
//charToVKeyMap.put('',KeyEvent.VK_LEFT);
//charToVKeyMap.put('',KeyEvent.VK_UP);
//charToVKeyMap.put('',KeyEvent.VK_RIGHT);
//charToVKeyMap.put('',KeyEvent.VK_DOWN);
//charToVKeyMap.put('0',KeyEvent.VK_0);
//charToVKeyMap.put('1',KeyEvent.VK_1);
//charToVKeyMap.put('2',KeyEvent.VK_2);
//charToVKeyMap.put('3',KeyEvent.VK_3);
//charToVKeyMap.put('4',KeyEvent.VK_4);
//charToVKeyMap.put('5',KeyEvent.VK_5);
//charToVKeyMap.put('6',KeyEvent.VK_6);
//charToVKeyMap.put('7',KeyEvent.VK_7);
//charToVKeyMap.put('8',KeyEvent.VK_8);
//charToVKeyMap.put('9',KeyEvent.VK_9);
//charToVKeyMap.put('a',KeyEvent.VK_A);
//charToVKeyMap.put('b',KeyEvent.VK_B);
//charToVKeyMap.put('c',KeyEvent.VK_C);
//charToVKeyMap.put('d',KeyEvent.VK_D);
//charToVKeyMap.put('e',KeyEvent.VK_E);
//charToVKeyMap.put('f',KeyEvent.VK_F);
//charToVKeyMap.put('g',KeyEvent.VK_G);
//charToVKeyMap.put('h',KeyEvent.VK_H);
//charToVKeyMap.put('i',KeyEvent.VK_I);
//charToVKeyMap.put('j',KeyEvent.VK_J);
//charToVKeyMap.put('k',KeyEvent.VK_K);
//charToVKeyMap.put('l',KeyEvent.VK_L);
//charToVKeyMap.put('m',KeyEvent.VK_M);
//charToVKeyMap.put('n',KeyEvent.VK_N);
//charToVKeyMap.put('o',KeyEvent.VK_O);
//charToVKeyMap.put('p',KeyEvent.VK_P);
//charToVKeyMap.put('q',KeyEvent.VK_Q);
//charToVKeyMap.put('r',KeyEvent.VK_R);
//charToVKeyMap.put('s',KeyEvent.VK_S);
//charToVKeyMap.put('t',KeyEvent.VK_T);
//charToVKeyMap.put('u',KeyEvent.VK_U);
//charToVKeyMap.put('v',KeyEvent.VK_V);
//charToVKeyMap.put('w',KeyEvent.VK_W);
//charToVKeyMap.put('x',KeyEvent.VK_X);
//charToVKeyMap.put('y',KeyEvent.VK_Y);
//charToVKeyMap.put('z',KeyEvent.VK_Z);
//charToVKeyMap.put('A',KeyEvent.VK_A);
//charToVKeyMap.put('B',KeyEvent.VK_B);
//charToVKeyMap.put('C',KeyEvent.VK_C);
//charToVKeyMap.put('D',KeyEvent.VK_D);
//charToVKeyMap.put('E',KeyEvent.VK_E);
//charToVKeyMap.put('F',KeyEvent.VK_F);
//charToVKeyMap.put('G',KeyEvent.VK_G);
//charToVKeyMap.put('H',KeyEvent.VK_H);
//charToVKeyMap.put('I',KeyEvent.VK_I);
//charToVKeyMap.put('J',KeyEvent.VK_J);
//charToVKeyMap.put('K',KeyEvent.VK_K);
//charToVKeyMap.put('L',KeyEvent.VK_L);
//charToVKeyMap.put('M',KeyEvent.VK_M);
//charToVKeyMap.put('N',KeyEvent.VK_N);
//charToVKeyMap.put('O',KeyEvent.VK_O);
//charToVKeyMap.put('P',KeyEvent.VK_P);
//charToVKeyMap.put('Q',KeyEvent.VK_Q);
//charToVKeyMap.put('R',KeyEvent.VK_R);
//charToVKeyMap.put('S',KeyEvent.VK_S);
//charToVKeyMap.put('T',KeyEvent.VK_T);
//charToVKeyMap.put('U',KeyEvent.VK_U);
//charToVKeyMap.put('V',KeyEvent.VK_V);
//charToVKeyMap.put('W',KeyEvent.VK_W);
//charToVKeyMap.put('X',KeyEvent.VK_X);
//charToVKeyMap.put('Y',KeyEvent.VK_Y);
//charToVKeyMap.put('Z',KeyEvent.VK_Z);
//charToVKeyMap.put('',KeyEvent.VK_NUMPAD0);
//charToVKeyMap.put('',KeyEvent.VK_NUMPAD1);
//charToVKeyMap.put('',KeyEvent.VK_NUMPAD2);
//charToVKeyMap.put('',KeyEvent.VK_NUMPAD3);
//charToVKeyMap.put('',KeyEvent.VK_NUMPAD4);
//charToVKeyMap.put('',KeyEvent.VK_NUMPAD5);
//charToVKeyMap.put('',KeyEvent.VK_NUMPAD6);
//charToVKeyMap.put('',KeyEvent.VK_NUMPAD7);
//charToVKeyMap.put('',KeyEvent.VK_NUMPAD8);
//charToVKeyMap.put('',KeyEvent.VK_NUMPAD9);
//charToVKeyMap.put('',KeyEvent.VK_WINDOWS);
//charToVKeyMap.put('',KeyEvent.VK_CONTEXT_MENU);
//charToVKeyMap.put('',KeyEvent.VK_CIRCUMFLEX);
}
}
@@ -321,6 +321,9 @@ public class IdeEventQueue extends EventQueue {
@Override
public void dispatchEvent(AWTEvent e) {
fixNonEnglishKeyboardLayouts(e);
e = mapEvent(e);
boolean wasInputEvent = myIsInInputEvent;
@@ -350,6 +353,20 @@ public class IdeEventQueue extends EventQueue {
}
}
private static void fixNonEnglishKeyboardLayouts(AWTEvent e) {
if (!Registry.is("ide.non.english.keyboard.layout.fix")) return;
if (e instanceof KeyEvent) {
KeyEvent ke = (KeyEvent)e;
Integer keyCodeFromChar = CharToVKeyMap.get(ke.getKeyChar());
if (keyCodeFromChar != null) {
if (keyCodeFromChar != ke.getKeyCode()) {
// non-english layout
ke.setKeyCode(keyCodeFromChar);
}
}
}
}
private static AWTEvent mapEvent(AWTEvent e) {
if (SystemInfo.isXWindow && e instanceof MouseEvent && ((MouseEvent)e).getButton() > 3) {
MouseEvent src = (MouseEvent)e;
@@ -631,9 +648,9 @@ public class IdeEventQueue extends EventQueue {
public static boolean isMouseEventAhead(@Nullable AWTEvent e) {
IdeEventQueue queue = getInstance();
return e instanceof MouseEvent ||
queue.peekEvent(MouseEvent.MOUSE_PRESSED) != null ||
queue.peekEvent(MouseEvent.MOUSE_RELEASED) != null ||
queue.peekEvent(MouseEvent.MOUSE_CLICKED) != null;
queue.peekEvent(MouseEvent.MOUSE_PRESSED) != null ||
queue.peekEvent(MouseEvent.MOUSE_RELEASED) != null ||
queue.peekEvent(MouseEvent.MOUSE_CLICKED) != null;
}
private void enterSuspendModeIfNeeded(AWTEvent e) {
@@ -7,7 +7,7 @@ undo.documentUndoLimit=100
actionSystem.fixLostTyping=true
# suppress inspection "UnusedProperty"
actionSystem.fixLostTyping.description=Redispatch events, lost between actions and dialog show/close.
actionSystem.fixLostTyping.descrinonRegistry.isption=Redispatch events, lost between actions and dialog show/close.
actionSystem.fixStickyFocusedWindows=true
actionSystem.fixNullFocusedComponent=true
actionSystem.noDefaultComponent=true
@@ -232,6 +232,9 @@ ide.goto.middle.matching=true
ide.goto.middle.matching.description=Suggest items in goto actions that contain the entered string somewhere in the middle.
ide.goto.rebuild.delay=0
ide.non.english.keyboard.layout.fix=false
ide.non.english.keyboard.layout.fix.description=Enables a fix for key codes with non-English keyboard layouts
ide.enable.toolwindow.stack=false
change.signature.awesome.mode=true
@@ -18,8 +18,10 @@ package com.intellij.xml.util;
import com.intellij.codeInsight.daemon.impl.analysis.XmlHighlightVisitor;
import com.intellij.openapi.util.Key;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiLanguageInjectionHost;
import com.intellij.psi.PsiReference;
import com.intellij.psi.PsiReferenceProvider;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.intellij.psi.xml.XmlAttribute;
import com.intellij.psi.xml.XmlAttributeValue;
import com.intellij.util.ProcessingContext;
@@ -44,6 +46,9 @@ public class XmlEnumeratedValueReferenceProvider extends PsiReferenceProvider {
return PsiReference.EMPTY_ARRAY;
}
XmlAttributeValue value = (XmlAttributeValue)element;
if (value instanceof PsiLanguageInjectionHost && InjectedLanguageUtil.hasInjections((PsiLanguageInjectionHost)value)) {
return PsiReference.EMPTY_ARRAY;
}
String unquotedValue = value.getValue();
if (unquotedValue == null || XmlHighlightVisitor.skipValidation(value) || !XmlUtil.isSimpleXmlAttributeValue(unquotedValue, value)) {
return PsiReference.EMPTY_ARRAY;
@@ -17,9 +17,6 @@
package org.intellij.plugins.relaxNG.model.descriptors;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.DelimitedListProcessor;
import com.intellij.psi.ElementManipulators;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiReference;
@@ -30,8 +27,8 @@ import com.intellij.psi.xml.XmlTag;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.xml.util.XmlEnumeratedValueReference;
import com.intellij.xml.impl.BasicXmlAttributeDescriptor;
import com.intellij.xml.util.XmlEnumeratedValueReference;
import gnu.trove.THashSet;
import gnu.trove.TObjectHashingStrategy;
import org.jetbrains.annotations.NonNls;
@@ -212,19 +209,15 @@ public class RngXmlAttributeDescriptor extends BasicXmlAttributeDescriptor {
public PsiReference[] getValueReferences(final XmlAttributeValue value) {
String text = value.getValue();
if (text == null) return PsiReference.EMPTY_ARRAY;
final int offset = ElementManipulators.getValueTextRange(value).getStartOffset();
final List<PsiReference> list = new ArrayList<PsiReference>();
new DelimitedListProcessor("") {
return new PsiReference[] { new XmlEnumeratedValueReference(value, this) {
@Nullable
@Override
protected boolean isDelimiter(char ch) {
return Character.isWhitespace(ch);
public PsiElement resolve() {
if (isTokenDatatype(getValue())) {
return getElement();
}
return super.resolve();
}
@Override
protected void processToken(int start, int end, boolean delimitersOnly) {
list.add(new XmlEnumeratedValueReference(value, TextRange.create(offset + start, offset + end), RngXmlAttributeDescriptor.this));
}
}.processText(text);
return list.toArray(new PsiReference[list.size()]);
}};
}
}
@@ -17,7 +17,7 @@
package org.intellij.plugins.relaxNG;
import com.intellij.javaee.ExternalResourceManagerEx;
import com.intellij.javaee.ExternalResourceManagerImpl;
import com.intellij.javaee.ExternalResourceManagerExImpl;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.fileTypes.FileTypeManager;
import com.intellij.openapi.fileTypes.StdFileTypes;
@@ -41,13 +41,19 @@ public class RngXmlHighlightingTest extends HighlightingTestBase {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
final ExternalResourceManagerEx m = ExternalResourceManagerEx.getInstanceEx();
ExternalResourceManagerImpl.addTestResource("urn:test:simple.rng", toAbsolutePath("highlighting/simple.rng"), myTestRootDisposable);
ExternalResourceManagerImpl.addTestResource("urn:test:addressBook", toAbsolutePath("highlighting/rnc/addressbook.rnc"), myTestRootDisposable);
ExternalResourceManagerExImpl
.addTestResource("urn:test:simple.rng", toAbsolutePath("highlighting/simple.rng"), myTestRootDisposable);
ExternalResourceManagerExImpl.addTestResource("urn:test:addressBook", toAbsolutePath("highlighting/rnc/addressbook.rnc"),
myTestRootDisposable);
//m.addResource("http://www.w3.org/1999/XSL/Transform", toAbsolutePath("highlighting/relaxng.rng"));
ExternalResourceManagerImpl.addTestResource("http://www.w3.org/1999/XSL/Format", toAbsolutePath("highlighting/rnc/fo/main.rnc"), myTestRootDisposable);
ExternalResourceManagerImpl.addTestResource("http://docbook.org/ns/docbook", toAbsolutePath("highlighting/docbook.rng"), myTestRootDisposable);
ExternalResourceManagerImpl.addTestResource("urn:intelliForm:AttachmentFilter", toAbsolutePath("highlighting/attachment-filter.rng"), myTestRootDisposable);
ExternalResourceManagerImpl.addTestResource("http://www.w3.org/1999/xhtml", toAbsolutePath("highlighting/html5/xhtml5.rnc"), myTestRootDisposable);
ExternalResourceManagerExImpl.addTestResource("http://www.w3.org/1999/XSL/Format", toAbsolutePath("highlighting/rnc/fo/main.rnc"),
myTestRootDisposable);
ExternalResourceManagerExImpl.addTestResource("http://docbook.org/ns/docbook", toAbsolutePath("highlighting/docbook.rng"),
myTestRootDisposable);
ExternalResourceManagerExImpl.addTestResource("urn:intelliForm:AttachmentFilter",
toAbsolutePath("highlighting/attachment-filter.rng"), myTestRootDisposable);
ExternalResourceManagerExImpl
.addTestResource("http://www.w3.org/1999/xhtml", toAbsolutePath("highlighting/html5/xhtml5.rnc"), myTestRootDisposable);
m.addIgnoredResource("urn:intelliForm:Spaces");
m.addIgnoredResource("http://www.w3.org/1999/xlink");
@@ -1,4 +1,4 @@
<token-datatype xmlns="urn:test:simple.rng"
a=" v " b="v" c=" x y "
s1="v" s2=" v "
s3=<error>" v "</error> />
s3="<error descr="Attribute should have fixed value v"> v </error>" />