mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
@@ -101,7 +101,7 @@ public class PsiDocMethodOrFieldRef extends CompositePsiElement implements PsiDo
|
||||
final PsiElementFactory elementFactory = JavaPsiFacade.getInstance(element.getProject()).getElementFactory();
|
||||
for (String s : signature) {
|
||||
try {
|
||||
types.add(elementFactory.createTypeFromText(s, scope));
|
||||
types.add(elementFactory.createTypeFromText(s, element));
|
||||
}
|
||||
catch (IncorrectOperationException e) {
|
||||
types.add(PsiType.NULL);
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package pkg;
|
||||
|
||||
/**
|
||||
* @see #equals(Object)
|
||||
|
||||
* @see A3#equals(Object)
|
||||
* @see pkg.A3#equals(Object)
|
||||
|
||||
* @see Object#equals(Object)
|
||||
* @see java.lang.Object#equals(Object)
|
||||
*/
|
||||
class A3 {
|
||||
public boolean equals(Object obj) {
|
||||
return super.equals(obj);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #equals(Object)
|
||||
|
||||
* @see B3#equals(Object)
|
||||
* @see pkg.B3#equals(Object)
|
||||
|
||||
* @see Object#equals(Object)
|
||||
* @see java.lang.Object#equals(Object)
|
||||
*/
|
||||
class B3 {
|
||||
}
|
||||
@@ -30,6 +30,7 @@ public class JavadocResolveTest extends DaemonAnalyzerTestCase {
|
||||
public void testSee0() throws Exception { doTest(); }
|
||||
public void testSee1() throws Exception { doTest(); }
|
||||
public void testSee2() throws Exception { doTest(); }
|
||||
public void testSee3() throws Exception { doTest(); }
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(BASE_PATH + "/pkg/" + getTestName(false) + ".java", BASE_PATH, false, false);
|
||||
|
||||
@@ -49,6 +49,7 @@ public class ProblemDescriptorImpl extends CommonProblemDescriptorImpl implement
|
||||
private final boolean myShowTooltip;
|
||||
private final HintAction myHintAction;
|
||||
private TextAttributesKey myEnforcedTextAttributes;
|
||||
private int myLineNumber = -1;
|
||||
|
||||
public ProblemDescriptorImpl(@NotNull PsiElement startElement, @NotNull PsiElement endElement, String descriptionTemplate, LocalQuickFix[] fixes,
|
||||
ProblemHighlightType highlightType,
|
||||
@@ -132,17 +133,20 @@ public class ProblemDescriptorImpl extends CommonProblemDescriptorImpl implement
|
||||
}
|
||||
|
||||
public int getLineNumber() {
|
||||
PsiElement psiElement = getPsiElement();
|
||||
if (psiElement == null) return -1;
|
||||
if (!psiElement.isValid()) return -1;
|
||||
LOG.assertTrue(psiElement.isPhysical());
|
||||
PsiFile containingFile = InjectedLanguageUtil.getTopLevelFile(psiElement);
|
||||
Document document = PsiDocumentManager.getInstance(psiElement.getProject()).getDocument(containingFile);
|
||||
if (document == null) return -1;
|
||||
TextRange textRange = getTextRange();
|
||||
if (textRange == null) return -1;
|
||||
textRange = InjectedLanguageManager.getInstance(containingFile.getProject()).injectedToHost(psiElement, textRange);
|
||||
return document.getLineNumber(textRange.getStartOffset()) + 1;
|
||||
if (myLineNumber == -1) {
|
||||
PsiElement psiElement = getPsiElement();
|
||||
if (psiElement == null) return -1;
|
||||
if (!psiElement.isValid()) return -1;
|
||||
LOG.assertTrue(psiElement.isPhysical());
|
||||
PsiFile containingFile = InjectedLanguageUtil.getTopLevelFile(psiElement);
|
||||
Document document = PsiDocumentManager.getInstance(psiElement.getProject()).getDocument(containingFile);
|
||||
if (document == null) return -1;
|
||||
TextRange textRange = getTextRange();
|
||||
if (textRange == null) return -1;
|
||||
textRange = InjectedLanguageManager.getInstance(containingFile.getProject()).injectedToHost(psiElement, textRange);
|
||||
myLineNumber = document.getLineNumber(textRange.getStartOffset()) + 1;
|
||||
}
|
||||
return myLineNumber;
|
||||
}
|
||||
|
||||
public ProblemHighlightType getHighlightType() {
|
||||
|
||||
@@ -428,10 +428,10 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren
|
||||
private void addTool(InspectionTool tool, HighlightDisplayLevel errorLevel, boolean groupedBySeverity) {
|
||||
final InspectionTreeNode parentNode = getToolParentNode(tool.getGroupDisplayName().length() > 0 ? tool.getGroupDisplayName() : InspectionProfileEntry.GENERAL_GROUP_NAME, errorLevel, groupedBySeverity);
|
||||
tool.createToolNode(myProvider, parentNode, myGlobalInspectionContext.getUIOptions().SHOW_STRUCTURE);
|
||||
regsisterActionShortcuts(tool);
|
||||
registerActionShortcuts(tool);
|
||||
}
|
||||
|
||||
private void regsisterActionShortcuts(InspectionTool tool) {
|
||||
private void registerActionShortcuts(InspectionTool tool) {
|
||||
final QuickFixAction[] fixes = tool.getQuickFixes(null);
|
||||
if (fixes != null) {
|
||||
for (QuickFixAction fix : fixes) {
|
||||
@@ -465,8 +465,7 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren
|
||||
}
|
||||
clearTree();
|
||||
boolean resultsFound = buildTree();
|
||||
myTree.sort();
|
||||
myTree.restoreExpantionAndSelection();
|
||||
myTree.restoreExpansionAndSelection();
|
||||
return resultsFound;
|
||||
}
|
||||
|
||||
|
||||
+6
-2
@@ -127,10 +127,14 @@ public class InspectionResultsViewComparator implements Comparator {
|
||||
}
|
||||
|
||||
private static int compareEntities(final RefEntity entity1, final RefEntity entity2) {
|
||||
if (entity1 != null && entity2 != null) {
|
||||
final int nameComparison = entity1.getName().compareToIgnoreCase(entity2.getName());
|
||||
if (nameComparison != 0) {
|
||||
return nameComparison;
|
||||
}
|
||||
}
|
||||
if (entity1 instanceof RefElement && entity2 instanceof RefElement) {
|
||||
return PsiUtilBase.compareElementsByPosition(((RefElement)entity1).getElement(), ((RefElement)entity2).getElement());
|
||||
} else if (entity1 != null && entity2 != null) {
|
||||
return entity1.getName().compareToIgnoreCase(entity2.getName());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -212,26 +212,22 @@ public class InspectionTree extends Tree {
|
||||
}
|
||||
}
|
||||
|
||||
public void restoreExpantionAndSelection() {
|
||||
restoreExpantion();
|
||||
public void restoreExpansionAndSelection() {
|
||||
restoreExpansionStatus((InspectionTreeNode)getModel().getRoot());
|
||||
if (mySelectionPath != null) {
|
||||
mySelectionPath.restore();
|
||||
}
|
||||
}
|
||||
|
||||
private void restoreExpantion() {
|
||||
restoreExpantionStatus((InspectionTreeNode)getModel().getRoot());
|
||||
}
|
||||
|
||||
|
||||
private void restoreExpantionStatus(InspectionTreeNode node) {
|
||||
private void restoreExpansionStatus(InspectionTreeNode node) {
|
||||
if (myExpandedUserObjects.contains(node.getUserObject())) {
|
||||
sortChildren(node);
|
||||
TreeNode[] pathToNode = node.getPath();
|
||||
expandPath(new TreePath(pathToNode));
|
||||
Enumeration children = node.children();
|
||||
while (children.hasMoreElements()) {
|
||||
InspectionTreeNode childNode = (InspectionTreeNode)children.nextElement();
|
||||
restoreExpantionStatus(childNode);
|
||||
restoreExpansionStatus(childNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -300,10 +296,6 @@ public class InspectionTree extends Tree {
|
||||
}
|
||||
}
|
||||
|
||||
public void sort() {
|
||||
sortChildren(getRoot());
|
||||
}
|
||||
|
||||
private static void sortChildren(InspectionTreeNode node) {
|
||||
final List<TreeNode> children = TreeUtil.childrenToArray(node);
|
||||
Collections.sort(children, InspectionResultsViewComparator.getInstance());
|
||||
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.actionSystem.impl;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.wm.IdeFrame;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: kirillk
|
||||
* Date: 3/9/11
|
||||
* Time: 2:50 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class MouseGestureManager implements ApplicationComponent {
|
||||
|
||||
private static final Logger LOG = Logger.getInstance("MouseGestureManager");
|
||||
private ActionManagerImpl myActionManager;
|
||||
|
||||
private Map<IdeFrame, Object> myListeners = new HashMap<IdeFrame, Object>();
|
||||
|
||||
public MouseGestureManager(ActionManagerImpl actionManager) {
|
||||
myActionManager = actionManager;
|
||||
}
|
||||
|
||||
public void add(final IdeFrame frame) {
|
||||
if (!Registry.is("actionSystem.mouseGesturesEnabled")) return;
|
||||
|
||||
if (SystemInfo.isMacOSSnowLeopard) {
|
||||
try {
|
||||
assert !myListeners.containsKey(frame) : "Frame already registered";
|
||||
|
||||
Class<?> gestureListenerClass = Class.forName("com.apple.eawt.event.GestureListener");
|
||||
Class<?> swipeListenerClass = Class.forName("com.apple.eawt.event.SwipeListener");
|
||||
Object listener = Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{swipeListenerClass}, new InvocationHandler() {
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
if ("swipedRight".equals(method.getName())) {
|
||||
processRightSwipe(frame);
|
||||
} else if ("swipedLeft".equals(method.getName())) {
|
||||
processLeftSwipe(frame);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
Class<?> utilsClass = Class.forName("com.apple.eawt.event.GestureUtilities");
|
||||
Method addMethod = utilsClass.getDeclaredMethod("addGestureListenerTo", JComponent.class, gestureListenerClass);
|
||||
addMethod.invoke(null, frame.getComponent(), listener);
|
||||
|
||||
myListeners.put(frame, listener);
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void processLeftSwipe(IdeFrame frame) {
|
||||
AnAction forward = myActionManager.getAction("Forward");
|
||||
if (forward == null) return;
|
||||
|
||||
myActionManager.tryToExecute(forward, createMouseEventWrapper(frame), null, null, false);
|
||||
}
|
||||
|
||||
private void processRightSwipe(IdeFrame frame) {
|
||||
AnAction back = myActionManager.getAction("Back");
|
||||
if (back == null) return;
|
||||
|
||||
myActionManager.tryToExecute(back, createMouseEventWrapper(frame), null, null, false);
|
||||
}
|
||||
|
||||
private MouseEvent createMouseEventWrapper(IdeFrame frame) {
|
||||
return new MouseEvent(frame.getComponent(), ActionEvent.ACTION_PERFORMED, System.currentTimeMillis(), 0, 0, 0, 0, false, 0);
|
||||
}
|
||||
|
||||
public void remove(IdeFrame frame) {
|
||||
if (!Registry.is("actionSystem.mouseGesturesEnabled")) return;
|
||||
|
||||
if (SystemInfo.isMacOSSnowLeopard) {
|
||||
try {
|
||||
Object listener = myListeners.get(frame);
|
||||
if (listener != null) {
|
||||
Class<?> gestureListenerClass = Class.forName("com.apple.eawt.event.GestureListener");
|
||||
Class<?> utilsClass = Class.forName("com.apple.eawt.event.GestureUtilities");
|
||||
Method addMethod = utilsClass.getDeclaredMethod("removeGestureListenerFrom", JComponent.class, gestureListenerClass);
|
||||
addMethod.invoke(null, frame.getComponent(), listener);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initComponent() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeComponent() {
|
||||
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return "MouseGestureListener";
|
||||
}
|
||||
|
||||
public static MouseGestureManager getInstance() {
|
||||
return ApplicationManager.getApplication().getComponent(MouseGestureManager.class);
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@ import com.intellij.openapi.MnemonicHelper;
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.actionSystem.ex.ActionManagerEx;
|
||||
import com.intellij.openapi.actionSystem.impl.MouseGestureManager;
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationInfo;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -57,6 +58,9 @@ import java.awt.*;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
|
||||
/**
|
||||
* @author Anton Katilin
|
||||
@@ -99,6 +103,7 @@ public class IdeFrameImpl extends JFrame implements IdeFrame, DataProvider {
|
||||
setFocusableWindowState(false);
|
||||
}
|
||||
|
||||
MouseGestureManager.getInstance().add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -326,6 +331,8 @@ public class IdeFrameImpl extends JFrame implements IdeFrame, DataProvider {
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
MouseGestureManager.getInstance().remove(this);
|
||||
|
||||
if (myRootPane != null) {
|
||||
myRootPane = null;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ actionSystem.quickAccessEnabled=false
|
||||
actionSystem.quickAccessModifiers=
|
||||
actionSystem.quickAccessShowSpotsTime=1500
|
||||
actionSystem.win.supressAlt=true
|
||||
actionSystem.mouseGesturesEnabled=true
|
||||
|
||||
ide.firstStartup=true
|
||||
ide.debugMode=false
|
||||
@@ -116,4 +117,4 @@ vcs.show.history.numbers=true
|
||||
navbar.updateMergeTime=250
|
||||
navbar.userActivityMergeTime=500
|
||||
|
||||
inspectionGadgets.telemetry.enabled=false
|
||||
inspectionGadgets.telemetry.enabled=false
|
||||
|
||||
@@ -35,6 +35,10 @@
|
||||
<implementation-class>com.intellij.ide.IdeTooltipManager</implementation-class>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<implementation-class>com.intellij.openapi.actionSystem.impl.MouseGestureManager</implementation-class>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<interface-class>com.intellij.ide.SaveAndSyncHandler</interface-class>
|
||||
<implementation-class>com.intellij.ide.SaveAndSyncHandler</implementation-class>
|
||||
|
||||
Reference in New Issue
Block a user