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:
-43
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.codeInsight.completion;
|
||||
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.patterns.PsiJavaPatterns;
|
||||
import com.intellij.psi.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public class DispreferImplementationsWeigher extends CompletionWeigher {
|
||||
|
||||
public Comparable weigh(@NotNull final LookupElement item, @NotNull final CompletionLocation location) {
|
||||
final Object object = item.getObject();
|
||||
if (object instanceof PsiClass) {
|
||||
if (PsiJavaPatterns.psiElement().afterLeaf(PsiKeyword.NEW).accepts(location.getCompletionParameters().getPosition())) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
final String qname = ((PsiClass)object).getQualifiedName();
|
||||
if (qname != null && qname.endsWith("Impl")) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -7,5 +7,6 @@ public class Aaaaaaa {
|
||||
|
||||
}
|
||||
|
||||
class XxxEx {}
|
||||
class XxxImpl {}
|
||||
class Xxy {}
|
||||
+2
-3
@@ -2,10 +2,9 @@ public class Aaaaaaa {
|
||||
private final String aaa;
|
||||
|
||||
Aaaaaaa(Object aabbb) {
|
||||
new Xx<caret>
|
||||
Xxx x = new Xx<caret>
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class XxxImpl {}
|
||||
class Xxy {}
|
||||
class XxxImpl implements Xxx {}
|
||||
@@ -0,0 +1,12 @@
|
||||
public class Aaaaaaa {
|
||||
private final String aaa;
|
||||
|
||||
Aaaaaaa(Object aabbb) {
|
||||
if (aabbb instanceof XY<caret>)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class XaYaEx {}
|
||||
class XaYaImpl {}
|
||||
class XyYaXa {}
|
||||
@@ -2,7 +2,7 @@ class A{
|
||||
{
|
||||
String str;
|
||||
|
||||
str.subSequence(<caret>);
|
||||
str.substring(<caret>);
|
||||
jhasgfjhsdgf();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -223,7 +223,7 @@ public class KeywordCompletionTest extends LightCompletionTestCase {
|
||||
|
||||
public void testTryInExpression() throws Throwable {
|
||||
configureByFile(BASE_PATH + "/" + getTestName(true) + ".java");
|
||||
assertStringItems("toString", "this");
|
||||
assertStringItems("this", "toString");
|
||||
}
|
||||
|
||||
public void testNull() throws Exception{
|
||||
|
||||
+11
-3
@@ -7,6 +7,7 @@ package com.intellij.codeInsight.completion;
|
||||
import com.intellij.codeInsight.CodeInsightSettings;
|
||||
import com.intellij.codeInsight.lookup.impl.LookupImpl;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
|
||||
@SuppressWarnings({"ALL"})
|
||||
@@ -108,12 +109,19 @@ public class NormalCompletionOrderingTest extends CompletionSortingTestCase {
|
||||
|
||||
public void testDispreferImpls() throws Throwable {
|
||||
VfsUtil.saveText(getSourceRoot().createChildDirectory(this, "foo").createChildData(this, "Xxx.java"), "package foo; public class Xxx {}");
|
||||
checkPreferredItems(0, "Xxy", "Xxx", "XxxImpl");
|
||||
checkPreferredItems(0, "Xxy", "Xxx", "XxxEx", "XxxImpl");
|
||||
}
|
||||
|
||||
public void testDontDispreferImplsAfterNew() throws Throwable {
|
||||
VfsUtil.saveText(getSourceRoot().createChildDirectory(this, "foo").createChildData(this, "Xxx.java"), "package foo; public class Xxx {}");
|
||||
checkPreferredItems(0, "XxxImpl", "Xxy", "Xxx");
|
||||
VfsUtil.saveText(getSourceRoot().createChildDirectory(this, "foo").createChildData(this, "Xxx.java"), "package foo; public interface Xxx {}");
|
||||
checkPreferredItems(0, "Xxx", "XxxImpl");
|
||||
}
|
||||
|
||||
public void testPreferLessHumps() throws Throwable {
|
||||
final VirtualFile foo = getSourceRoot().createChildDirectory(this, "foo");
|
||||
VfsUtil.saveText(foo.createChildData(this, "XaYa.java"), "package foo; public interface XaYa {}");
|
||||
VfsUtil.saveText(foo.createChildData(this, "XyYa.java"), "package foo; public interface XyYa {}");
|
||||
checkPreferredItems(0, "XaYa", "XyYa", "XaYaEx", "XaYaImpl", "XyYaXa");
|
||||
}
|
||||
|
||||
public void testPreferLessParameters() throws Throwable {
|
||||
|
||||
+2
-2
@@ -90,8 +90,8 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase {
|
||||
configureByFile("QualifiedNew1.java");
|
||||
|
||||
assertEquals(2, myItems.length);
|
||||
assertEquals("IInner", myItems[0].getLookupString());
|
||||
assertEquals("Inner", myItems[1].getLookupString());
|
||||
assertEquals("Inner", myItems[0].getLookupString());
|
||||
assertEquals("IInner", myItems[1].getLookupString());
|
||||
}
|
||||
|
||||
public void testQualifiedNew2() throws Exception {
|
||||
|
||||
+13
-7
@@ -18,7 +18,6 @@ package com.intellij.codeInsight.completion;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
@@ -26,14 +25,21 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class PrefixMatchingWeigher extends CompletionWeigher {
|
||||
|
||||
public Comparable weigh(@NotNull final LookupElement item, @NotNull final CompletionLocation location) {
|
||||
if (location == null) {
|
||||
return null;
|
||||
final String prefix = item.getPrefixMatcher().getPrefix();
|
||||
|
||||
if (prefix.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
if (location.getCompletionType() == CompletionType.CLASS_NAME) return 0;
|
||||
|
||||
final String lookupString = item.getLookupString();
|
||||
return (StringUtil.capitalsOnly(lookupString).startsWith(StringUtil.capitalsOnly(item.getPrefixMatcher().getPrefix())) ? 4 : 0) +
|
||||
(lookupString.startsWith(item.getPrefixMatcher().getPrefix()) ? 2 : 0) +
|
||||
(StringUtil.startsWithIgnoreCase(lookupString, item.getPrefixMatcher().getPrefix()) ? 1 : 0);
|
||||
final String prefixHumps = StringUtil.capitalsOnly(prefix);
|
||||
final String itemHumps = StringUtil.capitalsOnly(lookupString);
|
||||
|
||||
if (itemHumps.equals(prefixHumps)) return 20;
|
||||
if (itemHumps.startsWith(prefixHumps)) return 10;
|
||||
|
||||
if (lookupString.startsWith(prefix)) return 5;
|
||||
if (StringUtil.startsWithIgnoreCase(lookupString, prefix)) return 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
public final class InplaceButton extends JComponent implements ActiveComponent {
|
||||
public class InplaceButton extends JComponent implements ActiveComponent {
|
||||
|
||||
private boolean myPainting = true;
|
||||
private boolean myActive = true;
|
||||
@@ -43,6 +43,8 @@ public final class InplaceButton extends JComponent implements ActiveComponent {
|
||||
private int myYTransform = 0;
|
||||
private boolean myFill;
|
||||
|
||||
private boolean myHoveringEnabled;
|
||||
|
||||
public InplaceButton(String tooltip, final Icon icon, final ActionListener listener) {
|
||||
this(new IconButton(tooltip, icon, icon), listener, null);
|
||||
}
|
||||
@@ -142,7 +144,7 @@ public final class InplaceButton extends JComponent implements ActiveComponent {
|
||||
g.translate(myXTransform, myYTransform);
|
||||
|
||||
|
||||
if (myBehavior.isHovered()) {
|
||||
if (myBehavior.isHovered() && myHoveringEnabled) {
|
||||
if (myBehavior.isPressedByMouse()) {
|
||||
myHovered.paintIcon(this, g, 1, 1);
|
||||
}
|
||||
@@ -151,7 +153,7 @@ public final class InplaceButton extends JComponent implements ActiveComponent {
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (myActive) {
|
||||
if (isActive()) {
|
||||
myRegular.paintIcon(this, g, 0, 0);
|
||||
}
|
||||
else {
|
||||
@@ -167,4 +169,13 @@ public final class InplaceButton extends JComponent implements ActiveComponent {
|
||||
myYTransform = y;
|
||||
}
|
||||
|
||||
public void setHoveringEnabled(boolean enabled) {
|
||||
myHoveringEnabled = enabled;
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
|
||||
|
||||
return myActive;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,11 +101,8 @@ public final class InternalDecorator extends JPanel implements Queryable, TypeSa
|
||||
private final MyDivider myDivider;
|
||||
private final TitlePanel myTitlePanel;
|
||||
private final MyTitleButton myToggleFloatingModeButton;
|
||||
private final Separator myFloatingDockSeparator;
|
||||
private final MyTitleButton myToggleDockModeButton;
|
||||
private final Separator myDockAutoHideSeparator;
|
||||
private final MyTitleButton myToggleAutoHideModeButton;
|
||||
private final Separator myAutoHideHideSeparator;
|
||||
private final MyTitleButton myHideButton;
|
||||
private final EventListenerList myListenerList;
|
||||
/*
|
||||
@@ -139,17 +136,18 @@ public final class InternalDecorator extends JPanel implements Queryable, TypeSa
|
||||
myToolWindow = toolWindow;
|
||||
myToolWindow.setDecorator(this);
|
||||
myDivider = new MyDivider();
|
||||
myTitlePanel = new TitlePanel();
|
||||
myTitlePanel = new TitlePanel() {
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return computeActive();
|
||||
}
|
||||
};
|
||||
myTitleTabs = toolWindow.getContentUI().getTabComponent();
|
||||
|
||||
myToggleFloatingModeAction = new ToggleFloatingModeAction();
|
||||
myToggleSideModeAction = new ToggleSideModeAction();
|
||||
myFloatingDockSeparator = new Separator();
|
||||
myFloatingDockSeparator.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
|
||||
myToggleDockModeAction = new ToggleDockModeAction();
|
||||
myDockAutoHideSeparator = new Separator();
|
||||
myToggleAutoHideModeAction = new TogglePinnedModeAction();
|
||||
myAutoHideHideSeparator = new Separator();
|
||||
myHideAction = new HideAction();
|
||||
HideSideAction hideSideAction = new HideSideAction();
|
||||
myToggleContentUiTypeAction = new ToggleContentUiTypeAction();
|
||||
@@ -177,6 +175,14 @@ public final class InternalDecorator extends JPanel implements Queryable, TypeSa
|
||||
apply(info);
|
||||
}
|
||||
|
||||
private boolean computeActive() {
|
||||
Component component = IdeFocusManager.getInstance(myProject).getFocusedDescendantFor(myToolWindow.getComponent());
|
||||
if (component != null) return true;
|
||||
|
||||
Component owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
|
||||
return owner != null && SwingUtilities.isDescendingFrom(owner, myToolWindow.getComponent());
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies specified decoration.
|
||||
*/
|
||||
@@ -185,14 +191,6 @@ public final class InternalDecorator extends JPanel implements Queryable, TypeSa
|
||||
return;
|
||||
}
|
||||
myInfo = info;
|
||||
// Active
|
||||
final boolean active = info.isActive();
|
||||
myTitlePanel.setActive(active);
|
||||
|
||||
//todo myToolWindowBorder.setActive(active);
|
||||
myFloatingDockSeparator.setActive(active);
|
||||
myDockAutoHideSeparator.setActive(active);
|
||||
myAutoHideHideSeparator.setActive(active);
|
||||
|
||||
// Anchor
|
||||
final ToolWindowAnchor anchor = myInfo.getAnchor();
|
||||
@@ -220,16 +218,16 @@ public final class InternalDecorator extends JPanel implements Queryable, TypeSa
|
||||
if (!info.isFloating()) {
|
||||
myHideSideButton.setVisible(true);
|
||||
if (ToolWindowAnchor.TOP == anchor) {
|
||||
myHideSideButton.setIcon(active ? ourHideSideUp : ourHideSideUpInactive);
|
||||
myHideSideButton.setIcon(ourHideSideUp, ourHideSideUpInactive);
|
||||
}
|
||||
else if (ToolWindowAnchor.LEFT == anchor) {
|
||||
myHideSideButton.setIcon(active ? ourHideSideLeft : ourHideSideLeftInactive);
|
||||
myHideSideButton.setIcon(ourHideSideLeft, ourHideSideLeftInactive);
|
||||
}
|
||||
else if (ToolWindowAnchor.BOTTOM == anchor) {
|
||||
myHideSideButton.setIcon(active ? ourHideSideDown : ourHideSideDownInactive);
|
||||
myHideSideButton.setIcon(ourHideSideDown, ourHideSideDownInactive);
|
||||
}
|
||||
else if (ToolWindowAnchor.RIGHT == anchor) {
|
||||
myHideSideButton.setIcon(active ? ourHideSideRight : ourHideSideRightInactive);
|
||||
myHideSideButton.setIcon(ourHideSideRight, ourHideSideRightInactive);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -240,38 +238,30 @@ public final class InternalDecorator extends JPanel implements Queryable, TypeSa
|
||||
repaint();
|
||||
// Type
|
||||
if (myInfo.isDocked()) {
|
||||
myToggleFloatingModeButton.setIcon(active ? ourFloatingIcon : ourFloatingInactiveIcon);
|
||||
myToggleFloatingModeButton.setIcon(ourFloatingIcon, ourFloatingInactiveIcon);
|
||||
myToggleDockModeButton.setVisible(true);
|
||||
myDockAutoHideSeparator.setVisible(true);
|
||||
myToggleDockModeButton.setIcon(active ? ourSlidingIcon : ourSlidingInactiveIcon);
|
||||
myToggleDockModeButton.setIcon(ourSlidingIcon, ourSlidingInactiveIcon);
|
||||
myToggleAutoHideModeButton.setVisible(true);
|
||||
myAutoHideHideSeparator.setVisible(true);
|
||||
myToggleAutoHideModeButton.setIcon(active
|
||||
? (myInfo.isAutoHide() ? ourAuthoHideOnIcon : ourAuthoHideOffIcon)
|
||||
: (myInfo.isAutoHide() ? ourAuthoHideOnInactiveIcon : ourAuthoHideOffInactiveIcon));
|
||||
myToggleAutoHideModeButton.setIcon((myInfo.isAutoHide() ? ourAuthoHideOnIcon : ourAuthoHideOffIcon),
|
||||
(myInfo.isAutoHide() ? ourAuthoHideOnInactiveIcon : ourAuthoHideOffInactiveIcon));
|
||||
myHideButton.setVisible(true);
|
||||
}
|
||||
else if (myInfo.isFloating()) {
|
||||
myToggleFloatingModeButton.setIcon(active ? ourFixIcon : ourFixInactiveIcon);
|
||||
myToggleFloatingModeButton.setIcon(ourFixIcon, ourFixInactiveIcon);
|
||||
myToggleDockModeButton.setVisible(false);
|
||||
myDockAutoHideSeparator.setVisible(false);
|
||||
myToggleAutoHideModeButton.setVisible(true);
|
||||
myAutoHideHideSeparator.setVisible(true);
|
||||
myToggleAutoHideModeButton.setIcon(active
|
||||
? myInfo.isAutoHide() ? ourAuthoHideOnIcon : ourAuthoHideOffIcon
|
||||
: myInfo.isAutoHide() ? ourAuthoHideOnInactiveIcon : ourAuthoHideOffInactiveIcon);
|
||||
myToggleAutoHideModeButton.setIcon(myInfo.isAutoHide() ? ourAuthoHideOnIcon : ourAuthoHideOffIcon,
|
||||
myInfo.isAutoHide() ? ourAuthoHideOnInactiveIcon : ourAuthoHideOffInactiveIcon);
|
||||
myHideButton.setVisible(true);
|
||||
}
|
||||
else if (myInfo.isSliding()) {
|
||||
myToggleFloatingModeButton.setIcon(active ? ourFloatingIcon : ourFloatingInactiveIcon);
|
||||
myToggleFloatingModeButton.setIcon(ourFloatingIcon, ourFloatingInactiveIcon);
|
||||
myToggleDockModeButton.setVisible(true);
|
||||
myDockAutoHideSeparator.setVisible(true);
|
||||
myToggleDockModeButton.setIcon(active ? ourDockedIcon : ourDockedInactiveIcon);
|
||||
myToggleDockModeButton.setIcon(ourDockedIcon, ourDockedInactiveIcon);
|
||||
myToggleAutoHideModeButton.setVisible(false);
|
||||
myAutoHideHideSeparator.setVisible(false);
|
||||
myHideButton.setVisible(true);
|
||||
}
|
||||
myHideButton.setIcon(active ? ourHideIcon : ourHideInactiveIcon);
|
||||
myHideButton.setIcon(ourHideIcon, ourHideInactiveIcon);
|
||||
|
||||
//
|
||||
updateTitle();
|
||||
@@ -396,23 +386,13 @@ public final class InternalDecorator extends JPanel implements Queryable, TypeSa
|
||||
// Compose title bar
|
||||
myTitlePanel.addTitle(myTitleTabs);
|
||||
|
||||
final JPanel buttonPanel = new JPanel(new GridBagLayout());
|
||||
final JPanel buttonPanel = new JPanel(new GridLayout(1, 4, 2, 0));
|
||||
buttonPanel.setOpaque(false);
|
||||
buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 2));
|
||||
buttonPanel.add(myToggleFloatingModeButton, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
|
||||
new Insets(0, 0, 0, 0), 0, 0));
|
||||
buttonPanel.add(myFloatingDockSeparator, new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE,
|
||||
new Insets(0, 0, 0, 0), 0, 0));
|
||||
buttonPanel.add(myToggleDockModeButton, new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE,
|
||||
new Insets(0, 0, 0, 0), 0, 0));
|
||||
buttonPanel.add(myDockAutoHideSeparator, new GridBagConstraints(3, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE,
|
||||
new Insets(0, 0, 0, 0), 0, 0));
|
||||
buttonPanel.add(myToggleAutoHideModeButton, new GridBagConstraints(4, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE,
|
||||
new Insets(0, 0, 0, 0), 0, 0));
|
||||
buttonPanel.add(myAutoHideHideSeparator, new GridBagConstraints(5, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE,
|
||||
new Insets(0, 0, 0, 0), 0, 0));
|
||||
buttonPanel.add(myHideButton, new GridBagConstraints(6, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE,
|
||||
new Insets(0, 0, 0, 0), 0, 0));
|
||||
buttonPanel.add(myToggleFloatingModeButton);
|
||||
buttonPanel.add(myToggleDockModeButton);
|
||||
buttonPanel.add(myToggleAutoHideModeButton);
|
||||
buttonPanel.add(myHideButton);
|
||||
|
||||
myTitlePanel.addButtons(buttonPanel, myHideSideButton);
|
||||
|
||||
@@ -926,15 +906,20 @@ public final class InternalDecorator extends JPanel implements Queryable, TypeSa
|
||||
}
|
||||
|
||||
|
||||
private static final class MyTitleButton extends Wrapper implements ActionListener {
|
||||
private class MyTitleButton extends Wrapper implements ActionListener {
|
||||
|
||||
private final InplaceButton myButton;
|
||||
private final AnAction myAction;
|
||||
|
||||
public MyTitleButton(AnAction action) {
|
||||
myAction = action;
|
||||
myButton = new InplaceButton(null, new EmptyIcon(16), this);
|
||||
//myButton.setTransform(0, -1);
|
||||
myButton = new InplaceButton(null, new EmptyIcon(16), this) {
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return MyTitleButton.this.isActive();
|
||||
}
|
||||
};
|
||||
myButton.setHoveringEnabled(false);
|
||||
setContent(myButton);
|
||||
setOpaque(false);
|
||||
}
|
||||
@@ -952,8 +937,12 @@ public final class InternalDecorator extends JPanel implements Queryable, TypeSa
|
||||
myAction.actionPerformed(event);
|
||||
}
|
||||
|
||||
public void setIcon(final Icon icon) {
|
||||
myButton.setIcon(icon);
|
||||
public boolean isActive() {
|
||||
return InternalDecorator.this.computeActive();
|
||||
}
|
||||
|
||||
public void setIcon(final Icon active, Icon inactive) {
|
||||
myButton.setIcons(active, inactive, active);
|
||||
}
|
||||
|
||||
|
||||
@@ -1010,20 +999,6 @@ public final class InternalDecorator extends JPanel implements Queryable, TypeSa
|
||||
// }
|
||||
//}
|
||||
|
||||
private static final class Separator extends JLabel {
|
||||
private static final Icon ourActiveSeparator = IconLoader.getIcon("/general/separator.png");
|
||||
private static final Icon ourInactiveSeparator = IconLoader.getIcon("/general/inactiveSeparator.png");
|
||||
|
||||
public final void setActive(final boolean active) {
|
||||
setIcon(active ? ourActiveSeparator : ourInactiveSeparator);
|
||||
}
|
||||
|
||||
public final void updateUI() {
|
||||
super.updateUI();
|
||||
setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 3));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Synchronizes decorator with IdeToolWindow changes.
|
||||
*/
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.awt.*;
|
||||
* @author Anton Katilin
|
||||
* @author Vladimir Kondratyev
|
||||
*/
|
||||
public final class TitlePanel extends JPanel {
|
||||
public class TitlePanel extends JPanel {
|
||||
private static final Color CNT_COLOR = new SameColor(184);
|
||||
private static final Color BND_COLOR = CNT_COLOR;
|
||||
|
||||
@@ -80,8 +80,10 @@ public final class TitlePanel extends JPanel {
|
||||
final Graphics2D g2d = (Graphics2D) g;
|
||||
|
||||
|
||||
Color bndColor = myActive ? BND_ACTIVE_COLOR : BND_COLOR;
|
||||
Color cntColor = myActive ? CNT_ACTIVE_COLOR : CNT_COLOR;
|
||||
boolean active = isActive();
|
||||
|
||||
Color bndColor = active ? BND_ACTIVE_COLOR : BND_COLOR;
|
||||
Color cntColor = active ? CNT_ACTIVE_COLOR : CNT_COLOR;
|
||||
|
||||
g2d.setPaint(new GradientPaint(0, STRUT, bndColor, 0, getHeight(), cntColor));
|
||||
if (mySideButtons.isVisible()) {
|
||||
@@ -89,12 +91,12 @@ public final class TitlePanel extends JPanel {
|
||||
g2d.fillRect(0, STRUT, getWidth() - sideRec.width, getHeight());
|
||||
|
||||
g2d.setColor(UIUtil.getHeaderInactiveColor());
|
||||
final Color buttonInnerColor = myActive ? ACTIVE_SIDE_BUTTON_BG : INACTIVE_SIDE_BUTTON_BG;
|
||||
final Color buttonInnerColor = active ? ACTIVE_SIDE_BUTTON_BG : INACTIVE_SIDE_BUTTON_BG;
|
||||
g2d.setPaint(new GradientPaint(sideRec.x, sideRec.y, Color.white, sideRec.x, (int)sideRec.getMaxY() - 1, buttonInnerColor));
|
||||
g2d.fillRect(sideRec.x + 2, sideRec.y, sideRec.width - 2, sideRec.height);
|
||||
|
||||
|
||||
Icon separator = myActive ? mySeparatorActive : mySeparatorInactive;
|
||||
Icon separator = active ? mySeparatorActive : mySeparatorInactive;
|
||||
separator.paintIcon(this, g, sideRec.x, sideRec.y);
|
||||
|
||||
} else {
|
||||
@@ -121,4 +123,8 @@ public final class TitlePanel extends JPanel {
|
||||
|
||||
add(wrapper, BorderLayout.EAST);
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
return myActive;
|
||||
}
|
||||
}
|
||||
|
||||
+60
-11
@@ -96,7 +96,9 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
private final MyToolWindowPropertyChangeListener myToolWindowPropertyChangeListener;
|
||||
private final InternalDecoratorListener myInternalDecoratorListener;
|
||||
|
||||
private boolean myEditorComponentActive;
|
||||
private boolean myEditorWasActive;
|
||||
private Boolean myEditorActive;
|
||||
|
||||
private final ActiveStack myActiveStack;
|
||||
private final SideStack mySideStack;
|
||||
|
||||
@@ -127,11 +129,20 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
}
|
||||
}
|
||||
};
|
||||
private PropertyChangeListener myFocusListener;
|
||||
|
||||
private enum KeyState {
|
||||
waiting, pressed, released, hold
|
||||
}
|
||||
|
||||
private Alarm myUpdateHeadersAlarm = new Alarm();
|
||||
private Runnable myUpdateHeadersRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateToolWindowHeaders();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* invoked by reflection
|
||||
*/
|
||||
@@ -175,7 +186,6 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
myToolWindowPropertyChangeListener = new MyToolWindowPropertyChangeListener();
|
||||
myInternalDecoratorListener = new MyInternalDecoratorListener();
|
||||
|
||||
myEditorComponentActive = false;
|
||||
myActiveStack = new ActiveStack();
|
||||
mySideStack = new SideStack();
|
||||
|
||||
@@ -196,6 +206,39 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
public void selectionChanged(FileEditorManagerEvent event) {
|
||||
}
|
||||
});
|
||||
|
||||
myFocusListener = new PropertyChangeListener() {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
myEditorActive = null;
|
||||
if ("focusOwner".equals(evt.getPropertyName())) {
|
||||
myUpdateHeadersAlarm.cancelAllRequests();
|
||||
myUpdateHeadersAlarm.addRequest(myUpdateHeadersRunnable, 50);
|
||||
}
|
||||
}
|
||||
};
|
||||
KeyboardFocusManager.getCurrentKeyboardFocusManager().addPropertyChangeListener(myFocusListener);
|
||||
}
|
||||
|
||||
|
||||
private void updateToolWindowHeaders() {
|
||||
getFocusManager().doWhenFocusSettlesDown(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
WindowInfoImpl[] infos = myLayout.getInfos();
|
||||
for (WindowInfoImpl each : infos) {
|
||||
if (each.isVisible()) {
|
||||
ToolWindow tw = getToolWindow(each.getId());
|
||||
if (tw instanceof ToolWindowImpl) {
|
||||
InternalDecorator decorator = ((ToolWindowImpl)tw).getDecorator();
|
||||
if (decorator != null) {
|
||||
decorator.repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public boolean dispatchKeyEvent(KeyEvent e) {
|
||||
@@ -314,6 +357,7 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
}
|
||||
|
||||
public void disposeComponent() {
|
||||
KeyboardFocusManager.getCurrentKeyboardFocusManager().removePropertyChangeListener(myFocusListener);
|
||||
}
|
||||
|
||||
public void projectOpened() {
|
||||
@@ -346,7 +390,7 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
myEditorComponentFocusWatcher.install(editorComponent);
|
||||
|
||||
appendSetEditorComponentCmd(editorComponent, commandsList);
|
||||
if (myEditorComponentActive) {
|
||||
if (myEditorWasActive) {
|
||||
activateEditorComponentImpl(editorManager.getSplitters(), commandsList, true);
|
||||
}
|
||||
execute(commandsList);
|
||||
@@ -537,7 +581,6 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
}
|
||||
deactivateWindows(postExecute, null);
|
||||
myActiveStack.clear();
|
||||
myEditorComponentActive = true;
|
||||
|
||||
execute(postExecute);
|
||||
}
|
||||
@@ -617,7 +660,6 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
if (toApplyInfo) {
|
||||
appendApplyWindowInfoCmd(info, commandsList);
|
||||
myActiveStack.push(id);
|
||||
myEditorComponentActive = false;
|
||||
}
|
||||
|
||||
if (autoFocusContents) {
|
||||
@@ -1172,7 +1214,7 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
}
|
||||
// if there is no any active tool window and editor is also inactive
|
||||
// then activate editor
|
||||
if (!myEditorComponentActive && getActiveToolWindowId() == null) {
|
||||
if (!myEditorWasActive && getActiveToolWindowId() == null) {
|
||||
activateEditorComponentImpl(getSplittersFromFocus(), commandList, true);
|
||||
}
|
||||
execute(commandList);
|
||||
@@ -1308,7 +1350,14 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
|
||||
public boolean isEditorComponentActive() {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
return myEditorComponentActive;
|
||||
|
||||
if (myEditorActive == null) {
|
||||
Component owner = getFocusManager().getFocusOwner();
|
||||
EditorsSplitters splitters = UIUtil.getParentOfType(EditorsSplitters.class, owner);
|
||||
myEditorActive = splitters != null;
|
||||
}
|
||||
|
||||
return myEditorActive;
|
||||
}
|
||||
|
||||
ToolWindowAnchor getToolWindowAnchor(final String id) {
|
||||
@@ -1669,7 +1718,7 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
for (final Object o : element.getChildren()) {
|
||||
final Element e = (Element)o;
|
||||
if (EDITOR_ELEMENT.equals(e.getName())) {
|
||||
myEditorComponentActive = Boolean.valueOf(e.getAttributeValue(ACTIVE_ATTR_VALUE)).booleanValue();
|
||||
myEditorWasActive = Boolean.valueOf(e.getAttributeValue(ACTIVE_ATTR_VALUE)).booleanValue();
|
||||
}
|
||||
else if (DesktopLayout.TAG.equals(e.getName())) { // read layout of tool windows
|
||||
myLayout.readExternal(e);
|
||||
@@ -1709,7 +1758,7 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
frameElement.setAttribute(EXTENDED_STATE_ATTR, Integer.toString(myFrame.getExtendedState()));
|
||||
// Save whether editor is active or not
|
||||
final Element editorElement = new Element(EDITOR_ELEMENT);
|
||||
editorElement.setAttribute(ACTIVE_ATTR_VALUE, myEditorComponentActive ? Boolean.TRUE.toString() : Boolean.FALSE.toString());
|
||||
editorElement.setAttribute(ACTIVE_ATTR_VALUE, isEditorComponentActive() ? Boolean.TRUE.toString() : Boolean.FALSE.toString());
|
||||
element.addContent(editorElement);
|
||||
// Save layout of tool windows
|
||||
final Element layoutElement = new Element(DesktopLayout.TAG);
|
||||
@@ -1836,7 +1885,7 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
// Sometimes focus gained comes when editor is active. For example it can happen when
|
||||
// user switches between menus or closes some dialog. In that case we just ignore this event,
|
||||
// i.e. don't initiate deactivation of tool windows and requesting focus in editor.
|
||||
if (myEditorComponentActive) {
|
||||
if (isEditorComponentActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2044,7 +2093,7 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
private ActionCallback processDefaultFocusRequest(boolean forced) {
|
||||
if (ModalityState.NON_MODAL.equals(ModalityState.current())) {
|
||||
final String activeId = getActiveToolWindowId();
|
||||
if (myEditorComponentActive || activeId == null || getToolWindow(activeId) == null) {
|
||||
if (isEditorComponentActive() || activeId == null || getToolWindow(activeId) == null) {
|
||||
activateEditorComponent(forced, true);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -234,7 +234,7 @@ button.text.settings=Settings...
|
||||
display.name.firefox.settings=Firefox Settings
|
||||
zen.coding.title=XML Zen Coding
|
||||
zen.coding.enable.label=Enable Zen Coding
|
||||
zen.coding.enter.abbreviation.dialog.label=Please entrer an abbreviation
|
||||
zen.coding.enter.abbreviation.dialog.label=Please enter an abbreviation
|
||||
zen.coding.incorrect.abbreviation.error=Incorrect abbreviation
|
||||
title.cannot.create.html.file=Cannot create HTML/XHTML file
|
||||
new.html.file.action=HTML/XHTML file
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ public class ExportTestResultsDialog extends DialogWrapper {
|
||||
super(project);
|
||||
myProject = project;
|
||||
String defaultFolder = StringUtil.isNotEmpty(config.getOutputFolder()) ?
|
||||
FileUtil.toSystemDependentName(config.getOutputFolder()) : FileUtil.toSystemDependentName(project.getLocation());
|
||||
FileUtil.toSystemDependentName(config.getOutputFolder()) : FileUtil.toSystemDependentName(project.getBaseDir().getPresentableUrl());
|
||||
myForm = new ExportTestResultsForm(config, defaultFileName, defaultFolder);
|
||||
myForm.addChangeListener(new ChangeListener() {
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
||||
<xsl:output method="html" indent="yes" encoding="US-ASCII"
|
||||
<xsl:output method="html" indent="yes" encoding="UTF-8"
|
||||
doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
|
||||
<xsl:decimal-format decimal-separator="." grouping-separator=","/>
|
||||
<xsl:template match="testrun">
|
||||
|
||||
@@ -801,16 +801,14 @@
|
||||
<weigher key="completion" implementationClass="com.intellij.codeInsight.completion.NameEndMatchingDegreeWeigher" id="nameEnd"
|
||||
order="after expectedType, before stats"/>
|
||||
|
||||
<weigher key="completion" implementationClass="com.intellij.codeInsight.completion.DispreferImplementationsWeigher" id="implementations"
|
||||
order="after prefix"/>
|
||||
<weigher key="completion" implementationClass="com.intellij.codeInsight.completion.PreferNonGenericWeigher" id="nonGeneric"
|
||||
order="after implementations"/>
|
||||
order="after stats"/>
|
||||
<weigher key="completion" implementationClass="com.intellij.codeInsight.completion.PreferAccessibleWeigher" id="accessible"
|
||||
order="after nonGeneric"/>
|
||||
<weigher key="completion" implementationClass="com.intellij.codeInsight.completion.PreferSimpleWeigher" id="simple"
|
||||
order="after accessible"/>
|
||||
<weigher key="completion" implementationClass="com.intellij.codeInsight.completion.PreferEnumConstantsWeigher" id="constants"
|
||||
order="after simple, before proximity"/>
|
||||
order="after simple, before prefix"/>
|
||||
<weigher key="completion" implementationClass="com.intellij.codeInsight.completion.SameWordsWeigher" id="sameWords"
|
||||
order="after proximity"/>
|
||||
<weigher key="completion" implementationClass="com.intellij.codeInsight.completion.PreferFieldsAndGettersWeigher" id="fieldsAndGetters"
|
||||
|
||||
Reference in New Issue
Block a user