Merge remote-tracking branch 'origin/master'

This commit is contained in:
Konstantin Bulenkov
2016-09-15 21:14:56 +02:00
32 changed files with 204 additions and 367 deletions
@@ -349,7 +349,7 @@ public class JavaCompletionContributor extends CompletionContributor {
if (parameters.getInvocationCount() >= 2) {
JavaClassNameCompletionContributor.addAllClasses(parameters, parameters.getInvocationCount() <= 2, result.getPrefixMatcher(), element -> {
if (!session.alreadyProcessed(element)) {
result.addElement(JavaClassNameCompletionContributor.highlightIfNeeded((JavaPsiClassReferenceElement)element, parameters));
result.addElement(JavaCompletionUtil.highlightIfNeeded(null, element, element.getObject(), parameters.getPosition()));
}
});
} else {
@@ -15,11 +15,11 @@
*/
package com.intellij.codeInsight.completion;
import com.intellij.codeInsight.AutoPopupController;
import com.intellij.codeInsight.completion.util.MethodParenthesesHandler;
import com.intellij.codeInsight.lookup.*;
import com.intellij.codeInsight.lookup.impl.JavaElementLookupRenderer;
import com.intellij.codeInsight.template.Template;
import com.intellij.codeInsight.template.TemplateManager;
import com.intellij.codeInsight.template.*;
import com.intellij.codeInsight.template.impl.ConstantNode;
import com.intellij.codeInsight.template.impl.TemplateManagerImpl;
import com.intellij.codeInsight.template.impl.TemplateState;
@@ -206,7 +206,8 @@ public class JavaMethodCallElement extends LookupItem<PsiMethod> implements Type
template.addTextSegment(", ");
}
String name = StringUtil.notNullize(parameters[i].getName());
template.addVariable(name, new ConstantNode(name), new ConstantNode(name), true);
Expression expression = Registry.is("java.completion.argument.live.template.completion") ? new AutoPopupCompletion() : new ConstantNode(name);
template.addVariable(name, expression, new ConstantNode(name), true);
}
template.addTextSegment(argList.getText().substring(caretOffset - argRange.getStartOffset(), argList.getTextLength()));
template.addEndVariable();
@@ -353,4 +354,24 @@ public class JavaMethodCallElement extends LookupItem<PsiMethod> implements Type
}
}
private static class AutoPopupCompletion extends Expression {
@Nullable
@Override
public Result calculateResult(ExpressionContext context) {
return new InvokeActionResult(() -> AutoPopupController.getInstance(context.getProject()).scheduleAutoPopup(context.getEditor()));
}
@Nullable
@Override
public Result calculateQuickResult(ExpressionContext context) {
return null;
}
@Nullable
@Override
public LookupElement[] calculateLookupItems(ExpressionContext context) {
return null;
}
}
}
@@ -61,9 +61,6 @@ public class AnnotationTargetUtil {
}
if (owner instanceof PsiModifierList) {
if (((PsiModifierList)owner).getNextSibling() instanceof PsiErrorElement) {
return TargetType.EMPTY_ARRAY;
}
PsiElement element = ((PsiModifierList)owner).getParent();
if (element instanceof PsiPackageStatement) {
return PACKAGE_TARGETS;
@@ -467,8 +467,8 @@ public class PsiClassImplUtil {
@NotNull LanguageLevel languageLevel,
boolean isRaw,
@NotNull GlobalSearchScope resolveScope) {
if (last instanceof PsiTypeParameterList || last instanceof PsiModifierList && !(last.getNextSibling() instanceof PsiErrorElement)) {
return true;
if (last instanceof PsiTypeParameterList || last instanceof PsiModifierList) {
return true; //TypeParameterList and ModifierList do not see our declarations
}
if (visited != null && visited.contains(aClass)) return true;
@@ -1,12 +0,0 @@
class Dummy {
public @interface Debug {
String value() default "[no comment]";
}
private static final class Constants {
private static final String INPUT = "Input";
}
<error descr="Annotations are not allowed here">@Dummy.Debug(Constants.INPUT)</error><EOLError descr="Identifier or type expected"></EOLError>
}
@@ -49,7 +49,6 @@ public class AnnotationsHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testRepeatable() { doTest8(); }
public void testEnumValues() { doTest8(); }
public void testReceiverParameters() { doTest8(); }
public void testAnnotationOverIncompleteCode() { doTest(); }
private void doTest() {
setLanguageLevel(LanguageLevel.JDK_1_7);
@@ -125,8 +125,8 @@ public abstract class TransactionGuard {
public abstract void submitTransactionLater(@NotNull Disposable parentDisposable, @NotNull Runnable transaction);
/**
* Schedules a transaction and waits for it to be completed. Fails if invoked on UI thread inside an incompatible transaction,
* or inside a read action on non-UI thread.
* Schedules a transaction and waits for it to be completed. Logs an error if invoked on UI thread inside an incompatible transaction,
* throws {@link IllegalStateException} inside a read action on non-UI thread.
* @see #submitTransaction(Disposable, TransactionId, Runnable)
* @throws ProcessCanceledException if current thread is interrupted
*/
@@ -159,7 +159,9 @@ public class TransactionGuardImpl extends TransactionGuard {
return;
}
assert !app.isReadAccessAllowed() : "submitTransactionAndWait should not be invoked from a read action";
if (app.isReadAccessAllowed()) {
throw new IllegalStateException("submitTransactionAndWait should not be invoked from a read action");
}
final Semaphore semaphore = new Semaphore();
semaphore.down();
final Throwable[] exception = {null};
@@ -36,19 +36,8 @@ public interface Filter {
Filter[] EMPTY_ARRAY = new Filter[0];
class Result extends ResultItem {
private static final Map<TextAttributesKey, TextAttributes> GRAYED_BY_NORMAL_CACHE = ContainerUtil.newConcurrentMap(2);
static {
ApplicationManager.getApplication().getMessageBus().connect().subscribe(EditorColorsManager.TOPIC, new EditorColorsListener() {
@Override
public void globalSchemeChange(EditorColorsScheme scheme) {
// invalidate cache on Appearance Theme/Editor Scheme change
GRAYED_BY_NORMAL_CACHE.clear();
}
});
}
protected NextAction myNextAction = NextAction.EXIT;
protected final List<ResultItem> myResultItems;
private NextAction myNextAction = NextAction.EXIT;
private final List<ResultItem> myResultItems;
public Result(final int highlightStartOffset, final int highlightEndOffset, @Nullable final HyperlinkInfo hyperlinkInfo) {
this(highlightStartOffset, highlightEndOffset, hyperlinkInfo, null);
@@ -75,9 +64,7 @@ public interface Filter {
final int highlightEndOffset,
@Nullable final HyperlinkInfo hyperlinkInfo,
final boolean grayedHyperlink) {
super(highlightStartOffset, highlightEndOffset, hyperlinkInfo,
grayedHyperlink ? getGrayedHyperlinkAttributes(CodeInsightColors.HYPERLINK_ATTRIBUTES) : null,
grayedHyperlink ? getGrayedHyperlinkAttributes(CodeInsightColors.FOLLOWED_HYPERLINK_ATTRIBUTES) : null);
super(highlightStartOffset, highlightEndOffset, hyperlinkInfo, grayedHyperlink);
myResultItems = null;
}
@@ -154,22 +141,6 @@ public interface Filter {
public void setNextAction(NextAction nextAction) {
myNextAction = nextAction;
}
@Nullable
private static TextAttributes getGrayedHyperlinkAttributes(@NotNull TextAttributesKey normalHyperlinkAttrsKey) {
EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme();
TextAttributes grayedHyperlinkAttrs = GRAYED_BY_NORMAL_CACHE.get(normalHyperlinkAttrsKey);
if (grayedHyperlinkAttrs == null) {
TextAttributes normalHyperlinkAttrs = globalScheme.getAttributes(normalHyperlinkAttrsKey);
if (normalHyperlinkAttrs != null) {
grayedHyperlinkAttrs = normalHyperlinkAttrs.clone();
grayedHyperlinkAttrs.setForegroundColor(UIUtil.getInactiveTextColor());
grayedHyperlinkAttrs.setEffectColor(UIUtil.getInactiveTextColor());
GRAYED_BY_NORMAL_CACHE.put(normalHyperlinkAttrsKey, grayedHyperlinkAttrs);
}
}
return grayedHyperlinkAttrs;
}
}
enum NextAction {
@@ -177,6 +148,17 @@ public interface Filter {
}
class ResultItem {
private static final Map<TextAttributesKey, TextAttributes> GRAYED_BY_NORMAL_CACHE = ContainerUtil.newConcurrentMap(2);
static {
ApplicationManager.getApplication().getMessageBus().connect().subscribe(EditorColorsManager.TOPIC, new EditorColorsListener() {
@Override
public void globalSchemeChange(EditorColorsScheme scheme) {
// invalidate cache on Appearance Theme/Editor Scheme change
GRAYED_BY_NORMAL_CACHE.clear();
}
});
}
/**
* @deprecated use getter, the visibility of this field will be decreased.
*/
@@ -213,6 +195,15 @@ public interface Filter {
this(highlightStartOffset, highlightEndOffset, hyperlinkInfo, highlightAttributes, null);
}
public ResultItem(int highlightStartOffset,
int highlightEndOffset,
@Nullable HyperlinkInfo hyperlinkInfo,
boolean grayedHyperlink) {
this(highlightStartOffset, highlightEndOffset, hyperlinkInfo,
grayedHyperlink ? getGrayedHyperlinkAttributes(CodeInsightColors.HYPERLINK_ATTRIBUTES) : null,
grayedHyperlink ? getGrayedHyperlinkAttributes(CodeInsightColors.FOLLOWED_HYPERLINK_ATTRIBUTES) : null);
}
@SuppressWarnings("deprecation")
public ResultItem(final int highlightStartOffset,
final int highlightEndOffset,
@@ -252,6 +243,22 @@ public interface Filter {
//noinspection deprecation
return hyperlinkInfo;
}
@Nullable
private static TextAttributes getGrayedHyperlinkAttributes(@NotNull TextAttributesKey normalHyperlinkAttrsKey) {
EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme();
TextAttributes grayedHyperlinkAttrs = GRAYED_BY_NORMAL_CACHE.get(normalHyperlinkAttrsKey);
if (grayedHyperlinkAttrs == null) {
TextAttributes normalHyperlinkAttrs = globalScheme.getAttributes(normalHyperlinkAttrsKey);
if (normalHyperlinkAttrs != null) {
grayedHyperlinkAttrs = normalHyperlinkAttrs.clone();
grayedHyperlinkAttrs.setForegroundColor(UIUtil.getInactiveTextColor());
grayedHyperlinkAttrs.setEffectColor(UIUtil.getInactiveTextColor());
GRAYED_BY_NORMAL_CACHE.put(normalHyperlinkAttrsKey, grayedHyperlinkAttrs);
}
}
return grayedHyperlinkAttrs;
}
}
/**
@@ -49,7 +49,6 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
@@ -197,18 +196,7 @@ public class LanguageConsoleImpl extends ConsoleViewImpl implements LanguageCons
private void setHistoryScrollBarVisible(boolean visible) {
JScrollBar prev = myHistoryViewer.getScrollPane().getHorizontalScrollBar();
if (Registry.is("ide.scroll.new.layout")) {
prev.setEnabled(visible);
return;
}
JScrollBar next;
if (visible) {
next = ((EmptyScrollBar)prev).original;
}
else {
next = new EmptyScrollBar(prev);
}
myHistoryViewer.getScrollPane().setHorizontalScrollBar(next);
prev.setEnabled(visible);
}
private void setupComponents() {
@@ -93,7 +93,7 @@ class DefaultScrollBarUI extends ScrollBarUI {
}
boolean isBorderNeeded(JComponent c) {
return c.isOpaque() && Registry.is("ide.scroll.track.border.paint");
return false;
}
boolean isTrackClickable() {
@@ -101,7 +101,7 @@ class DefaultScrollBarUI extends ScrollBarUI {
}
boolean isTrackExpandable() {
return Registry.is("ide.scroll.bar.expand.animation");
return false;
}
boolean isTrackContains(int x, int y) {
@@ -122,10 +122,6 @@ class DefaultScrollBarUI extends ScrollBarUI {
void paintTrack(Graphics2D g, int x, int y, int width, int height, JComponent c) {
RegionPainter<Float> p = ScrollColorProducer.isDark(c) ? ScrollPainter.Track.DARCULA : ScrollPainter.Track.DEFAULT;
if (!isTrackExpandable() && Registry.is("ide.scroll.background.wide")) {
p.paint(g, x, y, width, height, myTrackAnimator.myValue);
return; // temporary registry key for designer
}
paint(p, g, x, y, width, height, c, myTrackAnimator.myValue, false);
}
@@ -17,8 +17,6 @@ package com.intellij.ui.components;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.util.ui.ButtonlessScrollBarUI;
import com.intellij.util.ui.RegionPainter;
import com.intellij.util.ui.UIUtil;
import org.intellij.lang.annotations.JdkConstants;
@@ -72,9 +70,6 @@ public class JBScrollBar extends JScrollBar {
*/
@SuppressWarnings("UnusedParameters")
public static ScrollBarUI createUI(JComponent c) {
if (Registry.is("ide.scroll.new.layout")) {
return SystemInfo.isMac ? new MacScrollBarUI() : new DefaultScrollBarUI();
}
return ButtonlessScrollBarUI.createNormal();
return SystemInfo.isMac ? new MacScrollBarUI() : new DefaultScrollBarUI();
}
}
@@ -149,7 +149,7 @@ public class JBScrollPane extends JScrollPane {
}
private void init(boolean setupCorners) {
setLayout(Registry.is("ide.scroll.new.layout") ? new Layout() : new ScrollPaneLayout());
setLayout(new Layout());
if (setupCorners) {
setupCorners();
@@ -433,27 +433,6 @@ public class JBScrollPane extends JScrollPane {
protected void paintComponent(Graphics g) {
g.setColor(getBackground());
g.fillRect(0, 0, getWidth(), getHeight());
if (SystemInfo.isMac || !Registry.is("ide.scroll.track.border.paint")) return;
g.setColor(getForeground());
int x2 = getWidth() - 1;
int y2 = getHeight() - 1;
if (myPos == UPPER_LEFT_CORNER || myPos == UPPER_RIGHT_CORNER) {
g.drawLine(0, y2, x2, y2);
}
if (myPos == LOWER_LEFT_CORNER || myPos == LOWER_RIGHT_CORNER) {
g.drawLine(0, 0, x2, 0);
}
if (myPos == UPPER_LEFT_CORNER || myPos == LOWER_LEFT_CORNER) {
g.drawLine(x2, 0, x2, y2);
}
if (myPos == UPPER_RIGHT_CORNER || myPos == LOWER_RIGHT_CORNER) {
g.drawLine(0, 0, 0, y2);
}
}
}
@@ -44,7 +44,7 @@ public class JBViewport extends JViewport implements ZoomableViewport {
@Override
public void layoutContainer(Container parent) {
if (parent instanceof JViewport && Registry.is("ide.scroll.new.layout")) {
if (parent instanceof JViewport) {
JViewport viewport = (JViewport)parent;
Component view = viewport.getView();
if (view != null) {
@@ -56,38 +56,7 @@ public class JBViewport extends JViewport implements ZoomableViewport {
super.layoutContainer(parent);
}
}
return;
}
JBViewport viewport = (JBViewport)parent;
Component view = viewport.getView();
JBScrollPane scrollPane = UIUtil.getParentOfType(JBScrollPane.class, parent);
// do not force viewport size on editor component, e.g. EditorTextField and LanguageConsole
if (view == null || scrollPane == null || view instanceof TypingTarget) {
super.layoutContainer(parent);
return;
}
Dimension size = doSuperLayoutContainer(viewport);
Dimension visible = viewport.getExtentSize();
if (scrollPane.getHorizontalScrollBarPolicy() == ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER) {
size.width = visible.width;
}
if (scrollPane.getVerticalScrollBarPolicy() == ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER) {
size.height = visible.height;
}
viewport.setViewSize(size);
}
private Dimension doSuperLayoutContainer(JBViewport viewport) {
try {
viewport.mySaveTempViewSize = true;
super.layoutContainer(viewport);
}
finally {
viewport.mySaveTempViewSize = false;
}
return viewport.myTempViewSize;
}
};
@@ -96,8 +65,6 @@ public class JBViewport extends JViewport implements ZoomableViewport {
private ZoomingDelegate myZoomer;
private Dimension myTempViewSize;
private boolean mySaveTempViewSize;
private volatile boolean myBackgroundRequested; // avoid cyclic references
public JBViewport() {
@@ -147,18 +114,6 @@ public class JBViewport extends JViewport implements ZoomableViewport {
return ourLayoutManager;
}
@Override
public void setViewSize(Dimension newSize) {
// only store newSize from ViewportLayout.layoutContainer
// if we're going to fix it the next moment in our layoutContainer code
if (mySaveTempViewSize) {
myTempViewSize = newSize;
}
else {
super.setViewSize(newSize);
}
}
@Override
protected Graphics getComponentGraphics(Graphics graphics) {
return JBSwingUtilities.runGlobalCGTransform(this, super.getComponentGraphics(graphics));
@@ -115,15 +115,7 @@ class ScrollPainter extends RegionPainter.Alpha {
}
protected void draw(Graphics2D g, int x, int y, int width, int height) {
if (Registry.is("ide.scroll.thumb.border.rounded")) {
g.drawLine(x + 1, y, x + width - 2, y);
g.drawLine(x + 1, y + height - 1, x + width - 2, y + height - 1);
g.drawLine(x, y + 1, x, y + height - 2);
g.drawLine(x + width - 1, y + 1, x + width - 1, y + height - 2);
}
else {
g.drawRect(x, y, width - 1, height - 1);
}
g.drawRect(x, y, width - 1, height - 1);
}
private static class Round extends ScrollPainter {
@@ -52,6 +52,7 @@ public class ButtonlessScrollBarUI extends BasicScrollBarUI {
* @see RegionPainter
* @see UIUtil#putClientProperty
*/
@Deprecated
public static final Key<RegionPainter<Integer>> MAXI_THUMB = Key.create("BUTTONLESS_SCROLL_BAR_UI_MAXI_THUMB");
private static final Logger LOG = Logger.getInstance("#" + ButtonlessScrollBarUI.class.getName());
@@ -692,7 +693,7 @@ public class ButtonlessScrollBarUI extends BasicScrollBarUI {
if (isMacOverlayScrollbar()) {
paintMacThumb(g, thumbBounds);
}
else if (Registry.is("ide.scroll.new.layout")) {
else {
Rectangle bounds = new Rectangle(thumbBounds);
if (isThumbTranslucent()) {
Alignment alignment = Alignment.get(scrollbar);
@@ -744,17 +745,6 @@ public class ButtonlessScrollBarUI extends BasicScrollBarUI {
painter.paint((Graphics2D)g, bounds.x, bounds.y, bounds.width, bounds.height, value);
}
}
else {
RegionPainter<Integer> painter = UIUtil.getClientProperty(scrollbar, MAXI_THUMB);
if (painter != null) {
painter.paint((Graphics2D)g, thumbBounds.x, thumbBounds.y, thumbBounds.width, thumbBounds.height, myThumbFadeColorShift);
}
else {
g.translate(thumbBounds.x, thumbBounds.y);
paintMaxiThumb((Graphics2D)g, thumbBounds);
g.translate(-thumbBounds.x, -thumbBounds.y);
}
}
}
@Deprecated
@@ -1071,21 +1061,6 @@ public class ButtonlessScrollBarUI extends BasicScrollBarUI {
return false;
}
@Override
protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) {
if (!Registry.is("ide.scroll.new.layout") && !isMacOverlayScrollbar()) {
int half = getThickness() / 2;
int shiftX = isVertical() ? half - 1 : 0;
int shiftY = isVertical() ? 0 : half - 1;
g.translate(shiftX, shiftY);
super.paintThumb(g, c, thumbBounds);
g.translate(-shiftX, -shiftY);
}
else {
super.paintThumb(g, c, thumbBounds);
}
}
protected void paintMaxiThumb(Graphics2D g, Rectangle thumbBounds) {
int arc = JBUI.scale(3);
g.setColor(adjustColor(getGradientDarkColor()));
@@ -16,7 +16,6 @@
package com.intellij.ide.ui.laf.darcula.ui;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.util.ui.ButtonlessScrollBarUI;
import javax.swing.*;
@@ -32,14 +31,12 @@ public class DarculaScrollBarUI extends ButtonlessScrollBarUI {
@SuppressWarnings({"MethodOverridesStaticMethodOfSuperclass", "UnusedDeclaration"})
public static ComponentUI createUI(JComponent c) {
if (Registry.is("ide.scroll.new.layout")) {
try {
return (ComponentUI)newInstance(Class.forName(SystemInfo.isMac
? "com.intellij.ui.components.MacScrollBarUI"
: "com.intellij.ui.components.DefaultScrollBarUI"));
}
catch (Exception ignore) {
}
try {
return (ComponentUI)newInstance(Class.forName(SystemInfo.isMac
? "com.intellij.ui.components.MacScrollBarUI"
: "com.intellij.ui.components.DefaultScrollBarUI"));
}
catch (Exception ignore) {
}
return new DarculaScrollBarUI();
}
@@ -873,9 +873,6 @@ public class NotificationsManagerImpl extends NotificationsManager {
public static void configureBalloonScrollPane(@NotNull JScrollPane pane, @NotNull Color fillColor) {
pane.setOpaque(false);
pane.getViewport().setOpaque(false);
if (!Registry.is("ide.scroll.new.layout")) {
pane.getVerticalScrollBar().setUI(ButtonlessScrollBarUI.createTransparent());
}
pane.setBackground(fillColor);
pane.getViewport().setBackground(fillColor);
pane.getVerticalScrollBar().setBackground(fillColor);
@@ -5365,20 +5365,12 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
assertIsDispatchThread();
int currentHorOffset = myScrollingModel.getHorizontalScrollOffset();
myScrollBarOrientation = type;
if (Registry.is("ide.scroll.new.layout")) {
myScrollPane.putClientProperty(JBScrollPane.Flip.class,
type == VERTICAL_SCROLLBAR_LEFT
? JBScrollPane.Flip.HORIZONTAL
: null);
JScrollBar vsb = myScrollPane.getVerticalScrollBar();
if (vsb != null) vsb.setOpaque(true);
}
else if (type == VERTICAL_SCROLLBAR_LEFT) {
myScrollPane.setLayout(new LeftHandScrollbarLayout());
}
else {
myScrollPane.setLayout(new ScrollPaneLayout());
}
myScrollPane.putClientProperty(JBScrollPane.Flip.class,
type == VERTICAL_SCROLLBAR_LEFT
? JBScrollPane.Flip.HORIZONTAL
: null);
JScrollBar vsb = myScrollPane.getVerticalScrollBar();
if (vsb != null) vsb.setOpaque(true);
myScrollingModel.scrollHorizontally(currentHorOffset);
}
@@ -7118,15 +7110,6 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
return new MyScrollBar(Adjustable.VERTICAL);
}
@NotNull
@Override
public JScrollBar createHorizontalScrollBar() {
if (Registry.is("ide.scroll.new.layout")) {
return super.createHorizontalScrollBar();
}
return new MyScrollBar(Adjustable.HORIZONTAL);
}
@Override
protected void setupCorners() {
super.setupCorners();
@@ -563,21 +563,8 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
g2d.setTransform(old);
}
}
else if (Registry.is("ide.scroll.new.layout")) {
super.paintThumb(g, c, thumbBounds);
}
else {
int shift;
if (Registry.is("editor.full.width.scrollbar")) {
shift = isMirrored() ? -myMinMarkHeight + 1 : myMinMarkHeight;
}
else {
int half = getThickness() / 2;
shift = isMirrored() ? -half + 2 : half - 1;
}
g.translate(shift, 0);
super.paintThumb(g, c, thumbBounds);
g.translate(-shift, 0);
}
}
@@ -24,14 +24,12 @@ import com.intellij.openapi.keymap.KeyMapBundle;
import com.intellij.openapi.keymap.Keymap;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.ui.ScrollPaneFactory;
import com.intellij.ui.SimpleColoredComponent;
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.ui.components.GradientViewport;
import com.intellij.ui.components.JBPanel;
import com.intellij.ui.components.panels.VerticalLayout;
import com.intellij.util.ui.ButtonlessScrollBarUI;
import com.intellij.util.ui.JBUI;
import org.jetbrains.annotations.Nullable;
@@ -160,9 +158,6 @@ abstract class ShortcutDialog<T extends Shortcut> extends DialogWrapper {
JScrollPane scroll = ScrollPaneFactory.createScrollPane(null, true);
scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scroll.setViewport(new GradientViewport(myConflictsContainer, JBUI.insets(5), false));
if (!Registry.is("ide.scroll.new.layout")) {
scroll.getVerticalScrollBar().setUI(ButtonlessScrollBarUI.createTransparent());
}
scroll.getVerticalScrollBar().setOpaque(false);
scroll.getViewport().setOpaque(false);
scroll.setOpaque(false);
@@ -26,10 +26,8 @@ import com.intellij.openapi.options.ex.ConfigurableWrapper;
import com.intellij.openapi.options.ex.Settings;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.LoadingDecorator;
import com.intellij.openapi.ui.OnePixelDivider;
import com.intellij.openapi.util.ActionCallback;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.ui.OnePixelSplitter;
@@ -191,50 +189,26 @@ final class SettingsEditor extends AbstractEditor implements DataProvider {
myLoadingDecorator = new LoadingDecorator(myEditor, this, 10, true);
myBanner = new Banner(myEditor.getResetAction());
mySearchPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
JComponent left = myTreeView;
JComponent right = myLoadingDecorator.getComponent();
if (Registry.is("ide.settings.old.style")) {
myBanner.setBorder(BorderFactory.createEmptyBorder(5, 10, 0, 10));
mySearch.setBackground(UIUtil.SIDE_PANEL_BACKGROUND);
mySearchPanel.setBackground(UIUtil.SIDE_PANEL_BACKGROUND);
mySearchPanel.addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent event) {
Dimension size = myBanner.getPreferredSize();
size.height = mySearchPanel.getHeight() - 5;
myBanner.setPreferredSize(size);
myBanner.setSize(size);
myBanner.revalidate();
myBanner.repaint();
}
});
left = new JPanel(new BorderLayout());
left.add(BorderLayout.NORTH, mySearchPanel);
left.add(BorderLayout.CENTER, myTreeView);
right = new JPanel(new BorderLayout());
right.add(BorderLayout.NORTH, myBanner);
right.add(BorderLayout.CENTER, myLoadingDecorator.getComponent());
}
else {
myBanner.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
myTreeView.addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent event) {
Dimension size = mySearchPanel.getPreferredSize();
size.width = myTreeView.getWidth();
mySearchPanel.setPreferredSize(size);
mySearchPanel.setSize(size);
mySearchPanel.revalidate();
mySearchPanel.repaint();
}
});
JPanel panel = new JPanel(new BorderLayout());
panel.add(BorderLayout.WEST, mySearchPanel);
panel.add(BorderLayout.CENTER, myBanner);
panel.setBorder(JBUI.Borders.customLine(OnePixelDivider.BACKGROUND, 0, 0, 1, 0));
add(BorderLayout.NORTH, panel);
}
myBanner.setBorder(BorderFactory.createEmptyBorder(5, 10, 0, 10));
mySearch.setBackground(UIUtil.SIDE_PANEL_BACKGROUND);
mySearchPanel.setBackground(UIUtil.SIDE_PANEL_BACKGROUND);
mySearchPanel.addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent event) {
Dimension size = myBanner.getPreferredSize();
size.height = mySearchPanel.getHeight() - 5;
myBanner.setPreferredSize(size);
myBanner.setSize(size);
myBanner.revalidate();
myBanner.repaint();
}
});
JComponent left = new JPanel(new BorderLayout());
left.add(BorderLayout.NORTH, mySearchPanel);
left.add(BorderLayout.CENTER, myTreeView);
JComponent right = new JPanel(new BorderLayout());
right.add(BorderLayout.NORTH, myBanner);
right.add(BorderLayout.CENTER, myLoadingDecorator.getComponent());
mySplitter = new OnePixelSplitter(false, myProperties.getFloat(SPLITTER_PROPORTION, .2f));
mySplitter.setHonorComponentsMinimumSize(true);
mySplitter.setFirstComponent(left);
@@ -159,9 +159,6 @@ final class SettingsTreeView extends JComponent implements Accessible, Disposabl
return myHeader;
}
});
if (!Registry.is("ide.scroll.new.layout")) {
myScroller.getVerticalScrollBar().setUI(ButtonlessScrollBarUI.createTransparent());
}
if (!Registry.is("ide.scroll.background.auto")) {
myScroller.setBackground(UIUtil.SIDE_PANEL_BACKGROUND);
myScroller.getViewport().setBackground(UIUtil.SIDE_PANEL_BACKGROUND);
@@ -27,6 +27,8 @@ import com.intellij.util.Alarm;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.lang.management.ThreadInfo;
public class FreezeLoggerImpl extends FreezeLogger {
private static final Logger LOG = Logger.getInstance(FreezeLoggerImpl.class);
@@ -57,7 +59,8 @@ public class FreezeLoggerImpl extends FreezeLogger {
return;
}
final String edtTrace = ThreadDumper.dumpEdtStackTrace();
final ThreadInfo[] infos = ThreadDumper.getThreadInfos();
final String edtTrace = ThreadDumper.dumpEdtStackTrace(infos);
if (edtTrace.contains("java.lang.ClassLoader.loadClass")) {
return;
}
@@ -69,7 +72,7 @@ public class FreezeLoggerImpl extends FreezeLogger {
+ "\n\n\n";
if (Registry.is("typing.freeze.report.dumps")) {
ThreadDumpInfo info = new ThreadDumpInfo(dumps, isInDumbMode);
ThreadDumpInfo info = new ThreadDumpInfo(infos, isInDumbMode);
String report = ReporterKt.createReportLine("typing-freeze-dumps", info);
if (!StatsSender.INSTANCE.send(report, true)) {
LOG.debug("Error while reporting thread dump");
@@ -83,15 +86,15 @@ public class FreezeLoggerImpl extends FreezeLogger {
}
class ThreadDumpInfo {
public final String dump;
public final ThreadInfo[] threadInfos;
public final String version;
public final String product;
public final String buildNumber;
public final boolean isEAP;
public final boolean isInDumbMode;
public ThreadDumpInfo(String dump, boolean isInDumbMode) {
this.dump = dump;
public ThreadDumpInfo(ThreadInfo[] threadInfos, boolean isInDumbMode) {
this.threadInfos = threadInfos;
this.product = ApplicationInfo.getInstance().getVersionName();
this.version = ApplicationInfo.getInstance().getFullVersion();
this.buildNumber = ApplicationInfo.getInstance().getBuild().toString();
@@ -958,7 +958,7 @@ update.downloading.patch.progress=Downloading Patch File
update.preparing.patch.progress=Preparing Patch Files
update.cleaning.patch.progress=Cleaning Patch Files
update.downloading.plugins.progress=Downloading Plugin Updates
update.downloading.patch.error=Failed to download patch file:<br>{0}<br><a href="#">Download page</a>.
update.downloading.patch.error=Failed to prepare an update:<br>{0}<br><a href="#">Open download page</a>.
update.plugins.update.action=&Update
update.restart.plugins.update.action=&Update and Restart
update.shutdown.plugins.update.action=&Update and Shutdown
@@ -88,7 +88,7 @@ public final class TestProxyPrinterProvider {
}
private void printLine(@NotNull String line, @NotNull ConsoleViewContentType contentType) {
Filter.Result result = null;
Filter.Result result;
try {
result = myFilter.applyFilter(line, line.length());
}
@@ -96,10 +96,12 @@ public final class TestProxyPrinterProvider {
throw new RuntimeException("Error while applying " + myFilter + " to '"+line+"'", t);
}
if (result != null) {
defaultPrint(line.substring(0, result.getHighlightStartOffset()), contentType);
String linkText = line.substring(result.getHighlightStartOffset(), result.getHighlightEndOffset());
printHyperlink(linkText, result.getHyperlinkInfo());
defaultPrint(line.substring(result.getHighlightEndOffset()), contentType);
for (Filter.ResultItem item : result.getResultItems()) {
defaultPrint(line.substring(0, item.getHighlightStartOffset()), contentType);
String linkText = line.substring(item.getHighlightStartOffset(), item.getHighlightEndOffset());
printHyperlink(linkText, item.getHyperlinkInfo());
defaultPrint(line.substring(item.getHighlightEndOffset()), contentType);
}
}
else {
defaultPrint(line, contentType);
@@ -29,6 +29,10 @@ import java.util.LinkedHashSet;
* @author max
*/
public class ExternalClasspathClassLoader extends URLClassLoader {
static {
registerAsParallelCapable();
}
private ExternalClasspathClassLoader(URL[] urls) {
super(urls, Thread.currentThread().getContextClassLoader());
}
@@ -36,11 +36,16 @@ actionSystem.quickAccessEnabled=false
actionSystem.quickAccessModifiers=
actionSystem.quickAccessShowSpotsTime=1500
actionSystem.win.suppressAlt=true
actionSystem.win.suppressAlt.new=true
actionSystem.win.suppressAlt.new.description=Enables another approach to consume Alt which may move focus to main menu (Windows L&F only).
actionSystem.mouseGesturesEnabled=true
actionSystem.assertFocusAccessFromEdt=true
actionSystem.enableAbbreviations=true
actionSystem.extendedKeyCode.disabled=false
actionSystem.extendedKeyCode.disabled.description=Disables our key processing that uses extended code to determine a shortcut.
color.blindness.icon.filter=false
color.blindness.daltonization=false
@@ -51,7 +56,10 @@ ide.debugMode.description=Record additional information to make bug reports more
ide.forcedShowTooltip=alt
ide.forcedShowTooltip.description=Shortcut for forced show tooltip.
ide.popup.dropShadow=false
ide.popup.resizable.border.sensitivity=4
ide.popup.resizable.border.sensitivity.description=Amount of pixels from the edge of undecorated popup to listen resize events.
ide.consumeKnownToolkitBugs=true
ide.highlight.match.in.selected.only=true
ide.lazyIconLoading=true
@@ -112,13 +120,11 @@ ide.splitter.mouseZone=6
ide.scroll.default.unit.increment=false
ide.scroll.default.unit.increment.description=Use default unit increment from Java (may decrease scrolling performance). // Malenkov
ide.scroll.new.layout=true
ide.scroll.align.component=true
ide.scroll.background.auto=true
ide.scroll.background.wide=false
ide.scroll.bar.expand.animation=false
ide.scroll.track.border.paint=false
ide.scroll.thumb.border.rounded=false
ide.scroll.background.auto.description=Use background color of a view to paint viewport, scroll pane, and scroll bars.
ide.scroll.thumb.small.if.opaque=true
mac.scroll.horizontal.gap=false
@@ -177,7 +183,10 @@ skip.untitled.windows.for.mac.messages=false
skip.untitled.windows.for.mac.messages.description=Temporary key to test a fix for MacMessages
ide.mac.mountain.lion.notifications.enabled=true
ide.mac.inplaceDialogMnemonicsFix=false
ide.mac.alt.mnemonic.without.ctrl=true
ide.mac.alt.mnemonic.without.ctrl.description=Processes Alt-based shortcuts for mnemonics in addition to Ctrl+Alt-based shortcuts. Affect MacOS only.
ide.mac.fix.dialog.showing=false
ide.mac.hide.cursor.when.typing=true
ide.mac.show.native.help=true
@@ -295,7 +304,9 @@ vcs.unversioned.files.in.commit=true
psi.incremental.reparse.depth.limit=1000
psi.deferIconLoading=true
psi.track.invalidation=true
psi.element.list.cell.renderer.focus.border.enabled=false
psi.element.list.cell.renderer.focus.border.enabled.description=Enables default focus border in a list of PSI elements. // Malenkov
ide.suggest.file.when.creating.filename.like.directory=true
ide.suggest.file.when.creating.filename.like.directory.description=When creating a directory named foo.txt, suggest to create a file with such a name instead
@@ -329,6 +340,9 @@ java.completion.make.outer.variables.final.description=Make variables accessed f
java.completion.argument.live.template=false
java.completion.argument.live.template.description=When completing a method call, start a live template with all arguments
java.completion.argument.live.template.completion=false
java.completion.argument.live.template.completion.description=If java.completion.argument.live.template is enabled, show completion for method arguments immediately
java.completion.show.constructors=false
java.completion.show.constructors.description=Show separate constructors when completing constructor call, instead of a single class name
@@ -578,9 +592,12 @@ console.too.much.text.buffer.ratio.description=Used for disabling of console pro
The ratio is used against the console cycle buffer size (idea.cycle.buffer.size/theRatio=maxTextLength).
ide.settings.keymap.input.method.enabled=false
ide.settings.keymap.input.method.enabled.description=Use input method instead of simple key event to enter shortcuts.
ide.settings.configurable.loading.threshold=0
ide.settings.configurable.loading.threshold.description=A positive number of milliseconds starts debugging of Settings loading.
ide.settings.replace.group.with.single.configurable=true
ide.settings.old.style=true
commonjs.complete.required.filename.with.extension=false
commonjs.complete.required.filename.with.extension.description=If checked, required filenames are completed with extension
@@ -653,6 +670,8 @@ editor.bold.underline.height=2
editor.bold.underline.height.description=Underline height for EffectType.BOLD_LINE_UNDERSCORE
error.stripe.enabled=true
error.stripe.enabled.description=Shows error stripes in the project view.
error.stripe.gap=1
error.stripe.gap.description=Minimal space between error stripe.
@@ -43,17 +43,21 @@ public class ThreadDumper {
}
@NotNull
public static String dumpEdtStackTrace() {
ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
ThreadInfo[] threads = sort(threadMXBean.dumpAllThreads(false, false));
public static String dumpEdtStackTrace(ThreadInfo[] threadInfos) {
StringWriter writer = new StringWriter();
if (threads.length > 0) {
StackTraceElement[] trace = threads[0].getStackTrace();
if (threadInfos.length > 0) {
StackTraceElement[] trace = threadInfos[0].getStackTrace();
printStackTrace(writer, trace);
}
return writer.toString();
}
@NotNull
public static ThreadInfo[] getThreadInfos() {
ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
return sort(threadMXBean.dumpAllThreads(false, false));
}
@NotNull
public static ThreadDump getThreadDumpInfo(@NotNull final ThreadMXBean threadMXBean) {
StringWriter writer = new StringWriter();
@@ -55,7 +55,6 @@ import com.intellij.util.Alarm;
import com.intellij.util.ObjectUtils;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.AbstractLayoutManager;
import com.intellij.util.ui.ButtonlessScrollBarUI;
import com.intellij.util.ui.GridBag;
import com.intellij.util.ui.JBUI;
import org.jetbrains.annotations.NonNls;
@@ -1009,10 +1008,6 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
JPanel mainPanel;
if (myAdditionalOptionsPanel != null) {
JScrollPane optionsPane = ScrollPaneFactory.createScrollPane(myAdditionalOptionsPanel, true);
if (!Registry.is("ide.scroll.new.layout")) {
optionsPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
optionsPane.getVerticalScrollBar().setUI(ButtonlessScrollBarUI.createTransparent());
}
JPanel infoPanel = JBUI.Panels.simplePanel(optionsPane).withBorder(JBUI.Borders.emptyLeft(10));
mainPanel = new JPanel(new MyOptionsLayout(mySplitter, infoPanel, JBUI.scale(250)));
@@ -171,9 +171,7 @@ public class UpdateZipAction extends BaseUpdateAction {
@Override
protected void doApply(final ZipFile patchFile, File backupDir, File toFile) throws IOException {
File temp = Utils.createTempFile();
try (ZipOutputWrapper out = new ZipOutputWrapper(new FileOutputStream(temp))) {
out.setCompressionLevel(0);
try (ZipOutputWrapper out = new ZipOutputWrapper(new FileOutputStream(temp), 0)) {
processZipFile(getSource(backupDir), new Processor() {
@Override
public void process(ZipEntry entry, InputStream in) throws IOException {
@@ -16,75 +16,70 @@
package com.intellij.updater;
import java.io.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.*;
import java.util.zip.CRC32;
import java.util.zip.Checksum;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
public class ZipOutputWrapper implements AutoCloseable {
private final ZipOutputStream myOut;
private final Set<String> myDirs = new HashSet<>();
private boolean isCompressed = true;
private final boolean myCompressed;
private final Set<String> myDirs = new TreeSet<>();
public ZipOutputWrapper(OutputStream stream) {
myOut = new ZipOutputStream(new BufferedOutputStream(stream));
myCompressed = true;
}
public void setCompressionLevel(int level) {
myOut.setLevel(level);
if (level == 0) {
myOut.setMethod(ZipEntry.STORED);
isCompressed = false;
}
public ZipOutputWrapper(OutputStream stream, int compressionLevel) {
myOut = new ZipOutputStream(new BufferedOutputStream(stream));
myOut.setLevel(compressionLevel);
myCompressed = compressionLevel > 0;
}
public OutputStream zipStream(final String entryPath) throws IOException {
final ByteArrayOutputStream tempOut = new ByteArrayOutputStream();
return new BufferedOutputStream(new OutputStream() {
@Override
public void write(int b) throws IOException {
tempOut.write(b);
}
public OutputStream zipStream(String entryPath) throws IOException {
return new OptByteArrayOutputStream() {
@Override
public void close() throws IOException {
super.close();
tempOut.close();
zipBytes(entryPath, tempOut);
zipBytes(entryPath, this);
}
});
};
}
public void zipEntry(ZipEntry entry, InputStream from) throws IOException {
if (entry.isDirectory()) {
addDirs(entry.getName(), true);
return;
}
zipEntry(entry.getName(), from);
else {
zipEntry(entry.getName(), from);
}
}
public void zipEntry(String entryPath, InputStream from) throws IOException {
ByteArrayOutputStream tempOut = new ByteArrayOutputStream();
try {
Utils.copyStream(from, tempOut);
}
finally {
tempOut.close();
}
OptByteArrayOutputStream tempOut = new OptByteArrayOutputStream();
Utils.copyStream(from, tempOut);
zipBytes(entryPath, tempOut);
}
public void zipBytes(String entryPath, ByteArrayOutputStream byteOut) throws IOException {
public void zipFile(String entryPath, File file) throws IOException {
if (file.isDirectory()) {
throw new IllegalArgumentException("Doesn't make sense");
}
try (InputStream from = new BufferedInputStream(new FileInputStream(file))) {
zipEntry(new ZipEntry(entryPath), from);
}
}
private void zipBytes(String entryPath, OptByteArrayOutputStream byteOut) throws IOException {
addDirs(entryPath, false);
ZipEntry entry = new ZipEntry(entryPath);
if (!isCompressed) {
if (!myCompressed) {
entry.setSize(byteOut.size());
CRC32 crc = new CRC32();
crc.update(byteOut.toByteArray());
byteOut.updateChecksum(crc);
entry.setCrc(crc.getValue());
}
@@ -93,25 +88,12 @@ public class ZipOutputWrapper implements AutoCloseable {
myOut.closeEntry();
}
public void zipFile(String entryPath, File file) throws IOException {
if (file.isDirectory()) {
addDirs(entryPath, true);
return;
}
try (InputStream from = new BufferedInputStream(new FileInputStream(file))) {
zipEntry(new ZipEntry(entryPath), from);
}
}
private void addDirs(String relPath, boolean isDir) {
List<String> temp = new ArrayList<>();
if (isDir && !relPath.endsWith("/")) relPath += "/";
int index = 0;
while ((index = relPath.indexOf('/', index + 1)) != -1) {
temp.add(relPath.substring(0, index));
myDirs.add(relPath.substring(0, index));
}
myDirs.addAll(temp);
}
public void finish() throws IOException {
@@ -130,4 +112,10 @@ public class ZipOutputWrapper implements AutoCloseable {
public void close() throws IOException {
myOut.close();
}
private static class OptByteArrayOutputStream extends ByteArrayOutputStream {
public void updateChecksum(Checksum cs) {
cs.update(buf, 0, count);
}
}
}