diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompilerConfigurable.form b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompilerConfigurable.form index 8f01321975db..e1aa6ed463f5 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompilerConfigurable.form +++ b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/eclipse/EclipseCompilerConfigurable.form @@ -1,9 +1,9 @@
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacOptionsPanel.form b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacOptionsPanel.form index 1adbb30fd6c0..d6963cf3ed6d 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacOptionsPanel.form +++ b/java/compiler/impl/src/com/intellij/compiler/impl/javaCompiler/javac/JavacOptionsPanel.form @@ -1,9 +1,9 @@ diff --git a/java/compiler/impl/src/com/intellij/compiler/options/AnnotationProcessorsConfigurable.java b/java/compiler/impl/src/com/intellij/compiler/options/AnnotationProcessorsConfigurable.java index b81be012044c..defcbf8f8401 100644 --- a/java/compiler/impl/src/com/intellij/compiler/options/AnnotationProcessorsConfigurable.java +++ b/java/compiler/impl/src/com/intellij/compiler/options/AnnotationProcessorsConfigurable.java @@ -1,3 +1,18 @@ +/* + * 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.compiler.options; import com.intellij.compiler.CompilerConfiguration; @@ -197,7 +212,7 @@ public class AnnotationProcessorsConfigurable implements SearchableConfigurable if (header != null) { header.repaint(); } - myModulesTable.setEnabled(enabled); + myModulesTable.getComponent().setEnabled(enabled); } public boolean isModified() { diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/SourcePathsStep.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/SourcePathsStep.java index 2bbfb08db1b0..bb1790313f2b 100644 --- a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/SourcePathsStep.java +++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/SourcePathsStep.java @@ -254,7 +254,7 @@ public class SourcePathsStep extends AbstractStepWithProgressSettingsEditor
createEditor(P configuration) {
return null;
}
diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/FieldInAnonymous.java b/java/java-tests/testData/inspection/dataFlow/fixture/FieldInAnonymous.java
new file mode 100644
index 000000000000..92d4a5deb496
--- /dev/null
+++ b/java/java-tests/testData/inspection/dataFlow/fixture/FieldInAnonymous.java
@@ -0,0 +1,36 @@
+class Zoo2 {
+ private boolean condition;
+ private final boolean condition2;
+
+ Zoo2(boolean condition2) {
+ this.condition2 = condition2;
+ }
+
+ Runnable foo() {
+ if (!condition) {
+ return new Runnable() {
+
+ public void run() {
+ if (condition) {
+ System.out.println("aaa");
+ }
+ }
+ };
+ }
+ if (!condition2) {
+ return new Runnable() {
+
+ public void run() {
+ if (> BRACE_HIGHLIGHTERS_IN_EDITOR_VIEW_KEY = Key.create("BraceHighlighter.BRACE_HIGHLIGHTERS_IN_EDITOR_VIEW_KEY");
@@ -356,25 +358,25 @@ public class BraceHighlightingHandler {
}
private void highlightRightBrace(HighlighterIterator iterator, FileType fileType) {
- int brace1End = iterator.getEnd();
+ TextRange brace1 = TextRange.create(iterator.getStart(), iterator.getEnd());
boolean matched = BraceMatchingUtil.matchBrace(myDocument.getCharsSequence(), fileType, iterator, false);
- int brace2Start = iterator.atEnd() ? -1 : iterator.getStart();
+ TextRange brace2 = iterator.atEnd() ? null : TextRange.create(iterator.getStart(), iterator.getEnd());
- highlightBraces(brace2Start, brace1End - 1, matched, false, fileType);
+ highlightBraces(brace2, brace1, matched, false, fileType);
}
private void highlightLeftBrace(HighlighterIterator iterator, boolean scopeHighlighting, FileType fileType) {
- int brace1Start = iterator.getStart();
+ TextRange brace1Start = TextRange.create(iterator.getStart(), iterator.getEnd());
boolean matched = BraceMatchingUtil.matchBrace(myDocument.getCharsSequence(), fileType, iterator, true);
- int brace2End = iterator.atEnd() ? -1 : iterator.getEnd() - 1;
+ TextRange brace2End = iterator.atEnd() ? null : TextRange.create(iterator.getStart(), iterator.getEnd());
highlightBraces(brace1Start, brace2End, matched, scopeHighlighting, fileType);
}
- private void highlightBraces(final int lBraceOffset, int rBraceOffset, boolean matched, boolean scopeHighlighting, FileType fileType) {
+ private void highlightBraces(final TextRange lBrace, TextRange rBrace, boolean matched, boolean scopeHighlighting, FileType fileType) {
if (!matched && fileType == FileTypes.PLAIN_TEXT) {
return;
}
@@ -384,21 +386,21 @@ public class BraceHighlightingHandler {
matched ? scheme.getAttributes(CodeInsightColors.MATCHED_BRACE_ATTRIBUTES)
: scheme.getAttributes(CodeInsightColors.UNMATCHED_BRACE_ATTRIBUTES);
- if (rBraceOffset >= 0 && !scopeHighlighting) {
- highlightBrace(rBraceOffset, matched);
+ if (rBrace != null && !scopeHighlighting) {
+ highlightBrace(rBrace, matched);
}
- if (lBraceOffset >= 0 && !scopeHighlighting) {
- highlightBrace(lBraceOffset, matched);
+ if (lBrace != null && !scopeHighlighting) {
+ highlightBrace(lBrace, matched);
}
if (!myEditor.equals(FileEditorManager.getInstance(myProject).getSelectedTextEditor())) {
return;
}
- if (lBraceOffset >= 0 && rBraceOffset >= 0) {
- final int startLine = myEditor.offsetToLogicalPosition(lBraceOffset).line;
- final int endLine = myEditor.offsetToLogicalPosition(rBraceOffset).line;
+ if (lBrace != null && rBrace !=null) {
+ final int startLine = myEditor.offsetToLogicalPosition(lBrace.getStartOffset()).line;
+ final int endLine = myEditor.offsetToLogicalPosition(rBrace.getEndOffset()).line;
if (endLine - startLine > 0) {
final Runnable runnable = new Runnable() {
public void run() {
@@ -424,7 +426,7 @@ public class BraceHighlightingHandler {
}
if (!scopeHighlighting) {
- showScopeHint(lBraceOffset, lBraceOffset + 1);
+ showScopeHint(lBrace.getStartOffset(), lBrace.getEndOffset());
}
}
else {
@@ -434,7 +436,7 @@ public class BraceHighlightingHandler {
}
}
- private void highlightBrace(int rBraceOffset, boolean matched) {
+ private void highlightBrace(TextRange braceRange, boolean matched) {
EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
final TextAttributes attributes =
matched ? scheme.getAttributes(CodeInsightColors.MATCHED_BRACE_ATTRIBUTES)
@@ -443,7 +445,7 @@ public class BraceHighlightingHandler {
RangeHighlighter rbraceHighlighter =
myEditor.getMarkupModel().addRangeHighlighter(
- rBraceOffset, rBraceOffset + 1, HighlighterLayer.LAST + 1, attributes, HighlighterTargetArea.EXACT_RANGE);
+ braceRange.getStartOffset(), braceRange.getEndOffset(), HighlighterLayer.LAST + 1, attributes, HighlighterTargetArea.EXACT_RANGE);
rbraceHighlighter.setGreedyToLeft(false);
rbraceHighlighter.setGreedyToRight(false);
registerHighlighter(rbraceHighlighter);
diff --git a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarItem.java b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarItem.java
index 76ac0b6d0cdd..4aee0656f421 100644
--- a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarItem.java
+++ b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarItem.java
@@ -25,6 +25,7 @@ import com.intellij.util.ui.UIUtil;
import javax.swing.*;
import java.awt.*;
+import java.awt.geom.Path2D;
/**
* @author Konstantin Bulenkov
@@ -65,8 +66,12 @@ class NavBarItem extends SimpleColoredComponent implements Disposable {
setOpaque(false);
setFont(UIUtil.isUnderAquaLookAndFeel() ? UIUtil.getLabelFont().deriveFont(11.0f) : getFont());
-
- setIpad(new Insets(1, 2, 1, 2));
+ if (isPopupElement || !NavBarPanel.isDecorated()) {
+ setIpad(new Insets(1, 2, 1, 2));
+ } else {
+ setMyBorder(null);
+ setBorder(null);
+ }
update();
}
@@ -100,7 +105,9 @@ class NavBarItem extends SimpleColoredComponent implements Disposable {
final NavBarModel model = myPanel.getModel();
final boolean selected = isSelected();
- setPaintFocusBorder(selected && !isPopupElement && myPanel.isNodePopupActive());
+ if (!NavBarPanel.isDecorated()) {
+ setPaintFocusBorder(selected && !isPopupElement && myPanel.isNodePopupActive());
+ }
setFocusBorderAroundIcon(false);
setBackground(selected && focused
@@ -119,6 +126,76 @@ class NavBarItem extends SimpleColoredComponent implements Disposable {
repaint();
}
+ @Override
+ protected void doPaint(Graphics2D g) {
+ if (isPopupElement || !NavBarPanel.isDecorated()) {
+ super.doPaint(g);
+ } else {
+ doPaintDecorated(g);
+ }
+ }
+
+ private void doPaintDecorated(Graphics2D g) {
+ setPaintFocusBorder(false);
+ setIpad(new Insets(0, 0, 0, 0));
+ Icon icon = myIcon;
+ final Color bg = getBackground();
+ g.setPaint(bg);
+ int w = getWidth();
+ int h = getHeight();
+ g.fillRect(0, 0, w, h);
+ icon.paintIcon(this, g, 3, (h - icon.getIconHeight()) / 2);
+ int x = doPaintText(g, icon.getIconWidth() + 6, false);
+ g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+
+ Path2D.Double p = new Path2D.Double();
+ g.translate(x, 0);
+ p.moveTo(0, 0); //
+ p.lineTo(10 , h / 2); // |\
+ p.lineTo(0, h); // |/
+ p.lineTo(0, 0);
+ g.setPaint(getBackground());
+ g.fill(p);
+
+ if (isLastElement()) {
+ Path2D.Double path = new Path2D.Double();
+ path.moveTo(0, 0);
+ path.lineTo(10, h / 2); // ___
+ path.lineTo(0, h); // \ |
+ path.lineTo(12, h); // /_|
+ path.lineTo(12, 0);
+ path.lineTo(0, 0);
+ g.setPaint(isNextSelected() ? UIUtil.getListSelectionBackground() : UIUtil.getListBackground());
+ g.fill(path);
+
+ path = new Path2D.Double();
+ path.moveTo(0, 0); //
+ path.lineTo(10, h / 2); // \
+ path.lineTo(0, h); // /
+ g.setPaint(Color.GRAY);
+ g.draw(path);
+ }
+ }
+
+ private boolean isLastElement() {
+ return myIndex != myPanel.getModel().size() - 1;
+ }
+
+ @Override
+ public Dimension getPreferredSize() {
+ final Dimension size = super.getPreferredSize();
+ if (! isPopupElement && NavBarPanel.isDecorated()) {
+ size.width += 10 + 2*3;
+ size.height += 6;
+ }
+ return size;
+ }
+
+ @Override
+ public Dimension getMinimumSize() {
+ return getPreferredSize();
+ }
+
private boolean isFocused() {
final Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
return isPopupElement || (focusOwner == myPanel && !myPanel.isNodePopupShowing());
@@ -168,4 +245,9 @@ class NavBarItem extends SimpleColoredComponent implements Disposable {
@Override
public void dispose() {
}
+
+
+ private boolean isNextSelected() {
+ return myIndex == myPanel.getModel().getSelectedIndex() - 1;
+ }
}
diff --git a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPanel.java b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPanel.java
index 6f3df03acc7c..324c53bfa8bb 100644
--- a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPanel.java
+++ b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPanel.java
@@ -42,6 +42,7 @@ import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.util.AsyncResult;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.SystemInfo;
+import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
@@ -99,7 +100,7 @@ public class NavBarPanel extends JPanel implements DataProvider, PopupOwner, Dis
private RelativePoint myLocationCache;
public NavBarPanel(final Project project) {
- super(new FlowLayout(FlowLayout.LEFT, 5, 0));
+ super(new FlowLayout(FlowLayout.LEFT, isDecorated() ? 0 : 5, 0));
myProject = project;
myModel = new NavBarModel(myProject);
myIdeView = new NavBarIdeView(this);
@@ -108,7 +109,9 @@ public class NavBarPanel extends JPanel implements DataProvider, PopupOwner, Dis
PopupHandler.installPopupHandler(this, IdeActions.GROUP_NAVBAR_POPUP, ActionPlaces.NAVIGATION_BAR);
- setBorder(new NavBarBorder(false, -1));
+ if (!isDecorated()) {
+ setBorder(new NavBarBorder(false, -1));
+ }
setOpaque(false);
myCopyPasteDelegator = new CopyPasteDelegator(myProject, NavBarPanel.this) {
@@ -124,7 +127,9 @@ public class NavBarPanel extends JPanel implements DataProvider, PopupOwner, Dis
Disposer.register(project, this);
}
-
+ public static boolean isDecorated() {
+ return Registry.is("navbar.is.decorated");
+ }
public boolean isNodePopupActive() {
return myNodePopup != null && myNodePopup.isVisible();
diff --git a/platform/platform-api/src/com/intellij/openapi/roots/ui/util/CompositeAppearance.java b/platform/platform-api/src/com/intellij/openapi/roots/ui/util/CompositeAppearance.java
index ec927b3894f6..197618b84a1b 100644
--- a/platform/platform-api/src/com/intellij/openapi/roots/ui/util/CompositeAppearance.java
+++ b/platform/platform-api/src/com/intellij/openapi/roots/ui/util/CompositeAppearance.java
@@ -55,7 +55,7 @@ public class CompositeAppearance implements ModifiableCellAppearanceEx, Modifiab
final TextAttributes attributes = section.getTextAttributes();
renderer.append(section.getText(), SimpleTextAttributes.fromTextAttributes(attributes));
}
- setIcon(myIcon);
+ renderer.setIcon(myIcon);
}
}
diff --git a/platform/platform-api/src/com/intellij/openapi/ui/ComboBoxTableRenderer.java b/platform/platform-api/src/com/intellij/openapi/ui/ComboBoxTableRenderer.java
index 33302fcd12b6..5b401dbbe92a 100644
--- a/platform/platform-api/src/com/intellij/openapi/ui/ComboBoxTableRenderer.java
+++ b/platform/platform-api/src/com/intellij/openapi/ui/ComboBoxTableRenderer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -19,6 +19,7 @@ package com.intellij.openapi.ui;
import com.intellij.openapi.ui.popup.*;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.IconLoader;
+import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
@@ -40,10 +41,10 @@ import java.util.List;
*/
public class ComboBoxTableRenderer
null.
*/
- private MyBorder myBorder;
+ private Border myBorder;
private int myMainTextLastIndex = -1;
@@ -107,6 +108,8 @@ public class SimpleColoredComponent extends JComponent implements Accessible {
/**
* Appends string fragments to existing ones. Appended string
* will have specified attributes.
+ * @param fragment text fragment
+ * @param attributes text attributes
*/
public final void append(@NotNull final String fragment, @NotNull final SimpleTextAttributes attributes) {
append(fragment, attributes, myMainTextLastIndex < 0);
@@ -115,17 +118,22 @@ public class SimpleColoredComponent extends JComponent implements Accessible {
/**
* Appends string fragments to existing ones. Appended string
* will have specified attributes.
+ * @param fragment text fragment
+ * @param attributes text attributes
+ * @param isMainText main text of not
*/
public void append(@NotNull final String fragment, @NotNull final SimpleTextAttributes attributes, boolean isMainText) {
- synchronized (this) {
- myFragments.add(fragment);
- myAttributes.add(attributes);
- if (isMainText) {
- myMainTextLastIndex = myFragments.size() - 1;
- }
- }
+ _append(fragment, attributes, isMainText);
revalidateAndRepaint();
}
+
+ private synchronized void _append(@NotNull final String fragment, @NotNull final SimpleTextAttributes attributes, boolean isMainText) {
+ myFragments.add(fragment);
+ myAttributes.add(attributes);
+ if (isMainText) {
+ myMainTextLastIndex = myFragments.size() - 1;
+ }
+ }
private void revalidateAndRepaint() {
if (myAutoInvalidate) {
@@ -136,19 +144,21 @@ public class SimpleColoredComponent extends JComponent implements Accessible {
}
public void append(@NotNull final String fragment, @NotNull final SimpleTextAttributes attributes, Object tag) {
- synchronized (this) {
- append(fragment, attributes);
- if (myFragmentTags == null) {
- myFragmentTags = new ArrayList