Merge remote-tracking branch 'origin/master' into test2

This commit is contained in:
Ilya.Kazakevich
2014-11-28 18:00:37 +03:00
59 changed files with 411 additions and 120 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -20,7 +20,7 @@ import com.intellij.ide.FrameStateManager;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CustomShortcutSet;
import com.intellij.openapi.actionSystem.CommonShortcuts;
import com.intellij.openapi.keymap.KeymapUtil;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Weighted;
@@ -289,7 +289,7 @@ public class TipManager implements Disposable, PopupMenuListener {
});
final HideTooltipAction hide = new HideTooltipAction();
hide.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0)), myComponent);
hide.registerCustomShortcutSet(CommonShortcuts.ESCAPE, myComponent);
Disposer.register(this, new Disposable() {
@Override
public void dispose() {
@@ -102,7 +102,11 @@ public class CompileStepBeforeRun extends BeforeRunTaskProvider<CompileStepBefor
return doMake(myProject, configuration, env, false);
}
static boolean doMake(final Project myProject, final RunConfiguration configuration, final ExecutionEnvironment env, final boolean ignoreErrors) {
static boolean doMake(final Project myProject, final RunConfiguration configuration, final ExecutionEnvironment env, final boolean ignoreErrors) {
return doMake(myProject, configuration, env, ignoreErrors, Boolean.getBoolean(MAKE_PROJECT_ON_RUN_KEY));
}
static boolean doMake(final Project myProject, final RunConfiguration configuration, final ExecutionEnvironment env, final boolean ignoreErrors, final boolean forceMakeProject) {
if (!(configuration instanceof RunProfileWithCompileBeforeLaunchOption)) {
return true;
}
@@ -130,7 +134,7 @@ public class CompileStepBeforeRun extends BeforeRunTaskProvider<CompileStepBefor
public void run() {
CompileScope scope;
final CompilerManager compilerManager = CompilerManager.getInstance(myProject);
if (Boolean.valueOf(System.getProperty(MAKE_PROJECT_ON_RUN_KEY, Boolean.FALSE.toString())).booleanValue()) {
if (forceMakeProject) {
// user explicitly requested whole-project make
scope = compilerManager.createProjectCompileScope(myProject);
}
@@ -0,0 +1,108 @@
/*
* Copyright 2000-2014 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.execution.BeforeRunTask;
import com.intellij.execution.BeforeRunTaskProvider;
import com.intellij.execution.ExecutionBundle;
import com.intellij.execution.configurations.RunConfiguration;
import com.intellij.execution.configurations.RunProfileWithCompileBeforeLaunchOption;
import com.intellij.execution.remote.RemoteConfiguration;
import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.compiler.CompileContext;
import com.intellij.openapi.compiler.CompileScope;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
public class MakeProjectStepBeforeRun extends BeforeRunTaskProvider<MakeProjectStepBeforeRun.MakeProjectBeforeRunTask> {
public static final Key<MakeProjectBeforeRunTask> ID = Key.create("MakeProject");
private final Project myProject;
public MakeProjectStepBeforeRun(@NotNull Project project) {
myProject = project;
}
@Override
public Key<MakeProjectBeforeRunTask> getId() {
return ID;
}
@Override
public String getName() {
return ExecutionBundle.message("before.launch.make.project.step");
}
@Override
public String getDescription(MakeProjectBeforeRunTask task) {
return getName();
}
@Override
public Icon getIcon() {
return AllIcons.Actions.Compile;
}
@Override
public Icon getTaskIcon(MakeProjectBeforeRunTask task) {
return AllIcons.Actions.Compile;
}
public boolean configureTask(RunConfiguration runConfiguration, MakeProjectBeforeRunTask task) {
return false;
}
@Override
public boolean canExecuteTask(RunConfiguration configuration, MakeProjectBeforeRunTask task) {
return true;
}
public boolean executeTask(DataContext context, final RunConfiguration configuration, final ExecutionEnvironment env, MakeProjectBeforeRunTask task) {
return CompileStepBeforeRun.doMake(myProject, configuration, env, false, true);
}
public boolean isConfigurable() {
return false;
}
@Nullable
public static RunConfiguration getRunConfiguration(final CompileContext context) {
return getRunConfiguration(context.getCompileScope());
}
@Nullable
public static RunConfiguration getRunConfiguration(final CompileScope compileScope) {
return compileScope.getUserData(CompileStepBeforeRun.RUN_CONFIGURATION);
}
public MakeProjectBeforeRunTask createTask(RunConfiguration runConfiguration) {
return !(runConfiguration instanceof RemoteConfiguration) && runConfiguration instanceof RunProfileWithCompileBeforeLaunchOption
? new MakeProjectBeforeRunTask()
: null;
}
public static class MakeProjectBeforeRunTask extends BeforeRunTask<MakeProjectBeforeRunTask> {
public MakeProjectBeforeRunTask() {
super(ID);
}
}
}
@@ -134,21 +134,6 @@ public class DataFlowInspectionBase extends BaseJavaBatchLocalInspectionTool {
};
analyzeDfaWithNestedClosures(scope, holder, dfaRunner, Arrays.asList(dfaRunner.createMemoryState()), onTheFly);
}
@Nullable
public static Collection<PsiElement> getNullableReturn(PsiMethod method) {
final StandardDataFlowRunner dfaRunner = new StandardDataFlowRunner();
final DataFlowInstructionVisitor visitor = new DataFlowInstructionVisitor(dfaRunner);
final PsiCodeBlock body = method.getBody();
if (body == null) {
return null;
}
final RunnerResult rc = dfaRunner.analyzeMethod(body, visitor);
if (rc == RunnerResult.OK) {
return visitor.getProblems(NullabilityProblem.nullableReturn);
}
return null;
}
private void analyzeDfaWithNestedClosures(PsiElement scope,
ProblemsHolder holder,
@@ -422,6 +422,9 @@ public class NullityInferrer {
//so as not to drill into anonymous classes
}
@Override
public void visitLambdaExpression(PsiLambdaExpression expression) {}
@Override
public void visitReturnStatement(@NotNull PsiReturnStatement statement) {
super.visitReturnStatement(statement);
@@ -491,8 +494,10 @@ public class NullityInferrer {
final boolean[] sometimesReturnsNull = new boolean[1];
body.accept(new JavaRecursiveElementWalkingVisitor() {
@Override
public void visitClass(PsiClass aClass) {
}
public void visitClass(PsiClass aClass) {}
@Override
public void visitLambdaExpression(PsiLambdaExpression expression) {}
@Override
public void visitElement(PsiElement element) {
@@ -61,7 +61,8 @@ import java.awt.event.*;
*/
@SuppressWarnings("MethodMayBeStatic")
public class ExtractMethodDialog extends DialogWrapper implements AbstractExtractDialog {
public static final String EXTRACT_METHOD_DEFAULT_VISIBILITY = "extract.method.default.visibility";
private static final String EXTRACT_METHOD_DEFAULT_VISIBILITY = "extract.method.default.visibility";
public static final String EXTRACT_METHOD_GENERATE_ANNOTATIONS = "extractMethod.generateAnnotations";
private final Project myProject;
private final PsiType myReturnType;
private final PsiTypeParameterList myTypeParameterList;
@@ -75,6 +76,7 @@ public class ExtractMethodDialog extends DialogWrapper implements AbstractExtrac
private final MethodSignatureComponent mySignature;
private final JCheckBox myMakeStatic;
protected JCheckBox myMakeVarargs;
protected JCheckBox myGenerateAnnotations;
private JCheckBox myCbChainedConstructor;
private final InputVariables myVariableData;
@@ -196,6 +198,10 @@ public class ExtractMethodDialog extends DialogWrapper implements AbstractExtrac
if (containingMethod != null && containingMethod.hasModifierProperty(PsiModifier.PUBLIC)) {
PropertiesComponent.getInstance(myProject).setValue(EXTRACT_METHOD_DEFAULT_VISIBILITY, getVisibility());
}
if (myGenerateAnnotations != null) {
PropertiesComponent.getInstance(myProject).setValue(EXTRACT_METHOD_GENERATE_ANNOTATIONS, String.valueOf(myGenerateAnnotations.isSelected()));
}
super.doOKAction();
}
@@ -287,6 +293,13 @@ public class ExtractMethodDialog extends DialogWrapper implements AbstractExtrac
optionsPanel.add(myMakeVarargs);
}
if (!(myReturnType instanceof PsiPrimitiveType) && PsiUtil.isLanguageLevel5OrHigher(myTargetClass)) {
final boolean isSelected = PropertiesComponent.getInstance(myProject).getBoolean(EXTRACT_METHOD_GENERATE_ANNOTATIONS, true);
myGenerateAnnotations = new JCheckBox("Generate annotations", isSelected);
//todo update signature?!
optionsPanel.add(myGenerateAnnotations);
}
if (myCbChainedConstructor != null) {
optionsPanel.add(myCbChainedConstructor);
myCbChainedConstructor.setBorder(emptyBorder);
@@ -31,6 +31,7 @@ import com.intellij.codeInspection.dataFlow.*;
import com.intellij.codeInspection.dataFlow.instructions.BranchingInstruction;
import com.intellij.codeInspection.dataFlow.instructions.Instruction;
import com.intellij.ide.DataManager;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.ide.util.PsiClassListCellRenderer;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
@@ -867,15 +868,25 @@ public class ExtractMethodProcessor implements MatchProvider {
}
}
if (isNullabilityCheckApplicable() && !(newMethod.getReturnType() instanceof PsiPrimitiveType) &&
PsiUtil.isLanguageLevel5OrHigher(newMethod) && Registry.is("annotate.extracted.method.nullable.when.applicable", true)) {
if (isNullabilityCheckApplicable() && !(newMethod.getReturnType() instanceof PsiPrimitiveType) && PsiUtil.isLanguageLevel5OrHigher(newMethod) &&
PropertiesComponent.getInstance(myProject).getBoolean(ExtractMethodDialog.EXTRACT_METHOD_GENERATE_ANNOTATIONS, true)) {
final NullableNotNullManager manager = NullableNotNullManager.getInstance(myProject);
final PsiClass nullableAnnotationClass =
JavaPsiFacade.getInstance(myProject).findClass(manager.getDefaultNullable(), GlobalSearchScope.allScope(myProject));
if (nullableAnnotationClass != null) {
final Collection<PsiElement> nullableReturn = DataFlowInspectionBase.getNullableReturn(newMethod);
if (nullableReturn != null && !nullableReturn.isEmpty()) {
final AddNullableNotNullAnnotationFix annotationFix = new AddNullableAnnotationFix(newMethod);
final Nullness nullness = DfaUtil.inferMethodNullity(newMethod);
AddNullableNotNullAnnotationFix annotationFix;
switch (nullness) {
case NOT_NULL:
annotationFix = new AddNotNullAnnotationFix(newMethod);
break;
case NULLABLE:
annotationFix = new AddNullableAnnotationFix(newMethod);
break;
default:
annotationFix = null;
}
if (annotationFix != null) {
annotationFix.invoke(myProject, myTargetClass.getContainingFile(), newMethod, newMethod);
}
}
@@ -271,6 +271,12 @@ public class ExtractMethodObjectProcessor extends BaseRefactoringProcessor {
public void visitReturnStatement(PsiReturnStatement statement) {
returnStatements.add(statement);
}
@Override
public void visitClass(PsiClass aClass) {}
@Override
public void visitLambdaExpression(PsiLambdaExpression expression) {}
});
if (myExtractProcessor.generatesConditionalExit()) {
for (int i = 0; i < returnStatements.size() - 1; i++) {
@@ -307,8 +313,10 @@ public class ExtractMethodObjectProcessor extends BaseRefactoringProcessor {
}
@Override
public void visitClass(PsiClass aClass) {
}
public void visitClass(PsiClass aClass) {}
@Override
public void visitLambdaExpression(PsiLambdaExpression expression) {}
@Override
public void visitDeclarationStatement(final PsiDeclarationStatement statement) {
@@ -116,8 +116,10 @@ public class InvertBooleanProcessor extends BaseRefactoringProcessor {
}
@Override
public void visitClass(PsiClass aClass) {
}
public void visitClass(PsiClass aClass) {}
@Override
public void visitLambdaExpression(PsiLambdaExpression expression) {}
});
}
} else if (myElement instanceof PsiParameter && ((PsiParameter)myElement).getDeclarationScope() instanceof PsiMethod) {
@@ -41,6 +41,7 @@ import com.intellij.refactoring.JavaRefactoringSettings;
import com.intellij.refactoring.RefactoringBundle;
import com.intellij.refactoring.changeSignature.inCallers.JavaCallerChooser;
import com.intellij.refactoring.safeDelete.usageInfo.*;
import com.intellij.refactoring.util.RefactoringChangeUtil;
import com.intellij.refactoring.util.RefactoringMessageUtil;
import com.intellij.refactoring.util.RefactoringUIUtil;
import com.intellij.usageView.UsageInfo;
@@ -747,7 +748,7 @@ public class JavaSafeDeleteProcessor extends SafeDeleteProcessorDelegateBase {
PsiElement element = reference.getElement();
if (element != null) {
JavaSafeDeleteDelegate.EP.forLanguage(element.getLanguage()).createUsageInfoForParameter(reference, usages, parameter, method);
if (!parameter.isVarArgs()) {
if (!parameter.isVarArgs() && !RefactoringChangeUtil.isSuperMethodCall(element.getParent())) {
final PsiParameter paramInCaller = SafeDeleteJavaCallerChooser.isTheOnlyOneParameterUsage(element.getParent(), parameterIndex, method);
if (paramInCaller != null) {
final PsiMethod callerMethod = (PsiMethod)paramInCaller.getDeclarationScope();
@@ -1,3 +1,5 @@
import org.jetbrains.annotations.NotNull;
class Test {
void foo(Object x) {
@@ -5,6 +7,7 @@ class Test {
if (x instanceof String) x = newMethod((String) x);
}
@NotNull
private String newMethod(String x) {
return x.substring(1);
}
@@ -1,9 +1,12 @@
import org.jetbrains.annotations.NotNull;
class Test {
void foo() {
bar(newMethod());
baz(newMethod());
}
@NotNull
private String newMethod() {
return String.valueOf(1);
}
@@ -1,3 +1,5 @@
import org.jetbrains.annotations.NotNull;
import java.util.*;
class C {
@@ -11,6 +13,7 @@ class C {
System.out.println("l1 = " + l1 + ", l2 = " + l2);
}
@NotNull
private List newMethod(Object[] array) {
List l1 = null;
l1 = new ArrayList(Arrays.asList(array));
@@ -1,3 +1,5 @@
import org.jetbrains.annotations.NotNull;
import java.util.*;
class C {
@@ -11,6 +13,7 @@ class C {
System.out.println("l1 = " + l1 + ", l2 = " + l2);
}
@NotNull
private List newMethod(Object[] array) {
return new ArrayList(Arrays.asList(array));
}
@@ -1,9 +1,12 @@
import org.jetbrains.annotations.NotNull;
class C {
String method(Object o) {
System.out.println(o);
return newMethod(o);
}
@NotNull
private String newMethod(Object o) {
Integer i = new Integer(o.hashCode());
return i.toString();
@@ -1,9 +1,12 @@
import org.jetbrains.annotations.NotNull;
class C {
String method(Object o) {
System.out.println(o);
return newMethod(o);
}
@NotNull
private String newMethod(Object o) {
Integer i = new Integer(o.hashCode());
return i.toString();
@@ -1,3 +1,5 @@
import org.jetbrains.annotations.NotNull;
import java.util.*;
class C {
@@ -8,6 +10,7 @@ class C {
List l1 = newMethod(new Object[0]);
}
@NotNull
private ArrayList newMethod(Object[] o) {
return new ArrayList(Arrays.asList(o));
}
@@ -1,3 +1,5 @@
import org.jetbrains.annotations.NotNull;
public class S {
{
String s;
@@ -8,6 +10,7 @@ public class S {
System.out.print(s);
}
@NotNull
private String newMethod() {
String s;
s = "";
@@ -1,3 +1,5 @@
import org.jetbrains.annotations.NotNull;
class Test {
interface I {
String foo();
@@ -8,6 +10,7 @@ class Test {
};
}
@NotNull
private String newMethod() {
return "42";
}
@@ -1,3 +1,5 @@
import org.jetbrains.annotations.NotNull;
class Test {
void foo() {
final String str = newMethod();
@@ -9,6 +11,7 @@ class Test {
}
}
@NotNull
private String newMethod() {
final String str = "";
if (str == "") {
@@ -1,3 +1,5 @@
import org.jetbrains.annotations.NotNull;
class A {
public String method() {
try {
@@ -9,6 +11,7 @@ class A {
return "";
}
@NotNull
private String newMethod() {
try {
return "";
@@ -1,3 +1,5 @@
import org.jetbrains.annotations.NotNull;
public class Foo {
static Foo
f1 = new Foo(){
@@ -6,6 +8,7 @@ public class Foo {
}
};
@NotNull
private static String newMethod() {
return "a" + "b";
}
@@ -1,3 +1,5 @@
import org.jetbrains.annotations.NotNull;
public class A {
A(String s) {
}
@@ -6,6 +8,7 @@ public class A {
this(newMethod());
}
@NotNull
private static String newMethod() {
return "a";
}
@@ -1,3 +1,5 @@
import org.jetbrains.annotations.NotNull;
class BasicLazyResolveTest {
@@ -9,6 +11,7 @@ class BasicLazyResolveTest {
}
@NotNull
private Object newMethod() {
return new Object() {
@@ -0,0 +1,12 @@
class C {
interface I {
boolean b();
}
private boolean bo<caret>ol() {
I i = () -> {
return true;
};
return false;
}
}
@@ -0,0 +1,12 @@
class C {
interface I {
boolean b();
}
private boolean boolInverted() {
I i = () -> {
return true;
};
return true;
}
}
@@ -21,6 +21,7 @@ import com.intellij.openapi.options.Scheme;
import com.intellij.openapi.util.JDOMExternalizable;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.awt.*;
@@ -36,6 +37,7 @@ public interface EditorColorsScheme extends Cloneable, JDOMExternalizable, TextA
@NotNull
Color getDefaultForeground();
@Nullable
Color getColor(ColorKey key);
void setColor(ColorKey key, Color color);
@@ -53,6 +53,7 @@ public class DefaultColorsScheme extends AbstractColorsScheme implements ReadOnl
return attrs;
}
@Nullable
@Override
public Color getColor(ColorKey key) {
if (key == null) return null;
@@ -24,6 +24,7 @@ import com.intellij.openapi.options.ExternalInfo;
import com.intellij.openapi.options.ExternalizableScheme;
import com.intellij.openapi.util.Comparing;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.awt.*;
@@ -73,6 +74,7 @@ public class EditorColorsSchemeImpl extends AbstractColorsScheme implements Exte
return myAttributesMap.containsKey(key);
}
@Nullable
@Override
public Color getColor(ColorKey key) {
if (myColorsMap.containsKey(key)) {
@@ -333,7 +333,8 @@ public class TemplateState implements Disposable {
PsiFile file = getPsiFile();
preprocessTemplate(file, myEditor.getCaretModel().getOffset());
myPrevTemplate = myTemplate;
assert !myTemplate.isInline();
LOG.assertTrue(!myTemplate.isInline(),
"current template: " + presentTemplate(myTemplate) + ", previous template: " + presentTemplate(myPrevTemplate));
int caretOffset = myEditor.getCaretModel().getOffset();
myTemplateRange = myDocument.createRangeMarker(caretOffset, caretOffset);
@@ -359,7 +359,11 @@ public class Bookmark implements Navigatable {
}
private static boolean darkBackground() {
return ColorUtil.isDark(EditorColorsManager.getInstance().getGlobalScheme().getColor(EditorColors.GUTTER_BACKGROUND));
Color gutterBackground = EditorColorsManager.getInstance().getGlobalScheme().getColor(EditorColors.GUTTER_BACKGROUND);
if (gutterBackground == null) {
gutterBackground = EditorColors.GUTTER_BACKGROUND.getDefaultColor();
}
return ColorUtil.isDark(gutterBackground);
}
private static class MyGutterIconRenderer extends GutterIconRenderer {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -380,7 +380,7 @@ public class MasterDetailPopupBuilder implements MasterController {
public void actionPerformed(AnActionEvent e) {
chooseItemWithEnterOrDoubleClick();
}
}.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0)), list);
}.registerCustomShortcutSet(CommonShortcuts.ENTER, list);
new AnAction() {
@Override
public void actionPerformed(AnActionEvent e) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -17,7 +17,7 @@ package com.intellij.ui;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CustomShortcutSet;
import com.intellij.openapi.actionSystem.CommonShortcuts;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.FixedSizeButton;
@@ -30,7 +30,6 @@ import javax.swing.event.DocumentEvent;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
/**
@@ -204,7 +203,7 @@ public abstract class AbstractFieldPanel extends JPanel {
public void actionPerformed(AnActionEvent e) {
doOKAction();
}
}.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0)), myTextArea);
}.registerCustomShortcutSet(CommonShortcuts.ENTER, myTextArea);
return ScrollPaneFactory.createScrollPane(myTextArea);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -15,13 +15,10 @@
*/
package com.intellij.util;
import com.intellij.ui.content.ContentManager;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentManager;
public class ContentsUtil {
private ContentsUtil() {
}
public static void addOrReplaceContent(ContentManager manager, Content content, boolean select) {
final String contentName = content.getDisplayName();
@@ -72,6 +72,7 @@ public abstract class DelegateColorScheme implements EditorColorsScheme {
return myDelegate.getDefaultForeground();
}
@Nullable
@Override
public Color getColor(ColorKey key) {
return myDelegate.getColor(key);
@@ -116,17 +116,13 @@ public class ContextMenuImpl extends JPanel implements Disposable {
}
private void toggleContextToolbar(final boolean show) {
final Component toolbar = myComponent.getComponent(0);
final int count = ((Container)toolbar).getComponentCount();
if (count == 0) {
myActionToolbar.updateActionsImmediately();
if (((Container)myActionToolbar).getComponentCount() == 0) {
return;
}
if (myShow != show) {
myShow = show;
if (myShow && myActionToolbar != null) {
myActionToolbar.updateActionsImmediately();
}
restartTimer();
}
}
@@ -6068,6 +6068,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
myOwnAttributes.put(key, attributes);
}
@Nullable
@Override
public Color getColor(ColorKey key) {
if (myOwnColors.containsKey(key)) return myOwnColors.get(key);
@@ -592,8 +592,14 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
}
}
else {
int half = getThickness() / 2;
int shift = isMirrored() ? -half + 2 : half - 1;
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);
@@ -349,7 +349,7 @@ public class KeymapPanel extends JPanel implements SearchableConfigurable, Confi
group.add(new AnAction("Edit Shortcut", "Edit Shortcut", AllIcons.ToolbarDecorator.Edit) {
{
registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0)), myActionsTree.getTree());
registerCustomShortcutSet(CommonShortcuts.ENTER, myActionsTree.getTree());
}
@Override
@@ -29,6 +29,7 @@ import com.intellij.openapi.options.*;
import com.intellij.openapi.options.ex.ConfigurableCardPanel;
import com.intellij.openapi.options.ex.ConfigurableVisitor;
import com.intellij.openapi.options.ex.ConfigurableWrapper;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.ActionCallback;
import com.intellij.ui.JBColor;
import com.intellij.ui.RelativeFont;
@@ -87,6 +88,7 @@ class ConfigurableEditor extends AbstractEditor implements AnActionListener, AWT
myResetAction.putValue(Action.SHORT_DESCRIPTION, RESET_DESCRIPTION);
myResetAction.setEnabled(false);
myErrorLabel.setOpaque(true);
myErrorLabel.setEnabled(parent instanceof SettingsEditor);
myErrorLabel.setVisible(false);
myErrorLabel.setVerticalTextPosition(SwingConstants.TOP);
myErrorLabel.setBorder(BorderFactory.createEmptyBorder(10, 15, 15, 15));
@@ -228,8 +230,13 @@ class ConfigurableEditor extends AbstractEditor implements AnActionListener, AWT
myErrorLabel.setVisible(false);
return true;
}
myErrorLabel.setText("<html><body><strong>Changes were not applied because of the following error</strong>:<br>" + exception.getMessage());
myErrorLabel.setVisible(true);
if (myErrorLabel.isEnabled()) {
myErrorLabel.setText("<html><body><strong>" + exception.getTitle() + "</strong>:<br>" + exception.getMessage());
myErrorLabel.setVisible(true);
}
else {
Messages.showMessageDialog(this, exception.getMessage(), exception.getTitle(), Messages.getErrorIcon());
}
return false;
}
@@ -438,7 +438,7 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra
final AnCancelAction anCancelAction = new AnCancelAction();
final JRootPane rootPane = getRootPane();
anCancelAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0)), rootPane);
anCancelAction.registerCustomShortcutSet(CommonShortcuts.ESCAPE, rootPane);
myDisposeActions.add(new Runnable() {
@Override
public void run() {
@@ -493,6 +493,7 @@ public class EditorTextField extends NonOpaquePanel implements DocumentListener,
colorsScheme.setColor(EditorColors.CARET_ROW_COLOR, null);
if (!isEnabled()) {
editor.setColorsScheme(new DelegateColorScheme(colorsScheme) {
@Nullable
@Override
public Color getColor(ColorKey key) {
return super.getColor(key);
@@ -0,0 +1,60 @@
/*
* Copyright 2000-2014 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.util;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Pair;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentManager;
import com.intellij.ui.content.TabbedContent;
import com.intellij.ui.content.impl.TabbedContentImpl;
import javax.swing.*;
import java.util.ArrayList;
/**
* @author Konstantin Bulenkov
*/
public class ContentUtilEx extends ContentsUtil {
public static void addTabbedContent(ContentManager manager, JComponent contentComponent, String groupPrefix, String tabName, boolean select) {
TabbedContent tabbedContent = null;
for (Content content : manager.getContents()) {
if (content instanceof TabbedContent && content.getTabName().startsWith(groupPrefix + ": ")) {
tabbedContent = (TabbedContent)content;
break;
}
}
if (tabbedContent == null) {
final Disposable disposable = Disposer.newDisposable();
tabbedContent = new TabbedContentImpl(contentComponent, tabName, true, groupPrefix);
ContentsUtil.addOrReplaceContent(manager, tabbedContent, select);
Disposer.register(tabbedContent, disposable);
} else {
for (Pair<String, JComponent> tab : new ArrayList<Pair<String, JComponent>>(tabbedContent.getTabs())) {
if (Comparing.equal(tab.second, contentComponent)) {
tabbedContent.removeContent(tab.second);
}
}
if (select) {
manager.setSelectedContent(tabbedContent, true, true);
}
tabbedContent.addContent(contentComponent, tabName, true);
}
}
}
@@ -323,6 +323,7 @@ configuration.action.chooser.title=Choose configuration type to run
env.vars.checkbox.title=&Include parent environment variables
before.launch.compile.step=Make
before.launch.make.project.step=Make Project
before.launch.compile.step.no.error.check=Make, no error check
execute.before.run.debug.dialog.title=Execute {0} Before Run/Debug
@@ -490,6 +490,9 @@ editor.caret.width.restartRequired=true
editor.transparent.scrollbar=true
editor.transparent.scrollbar.description=Don't paint background for editor scroll bars
editor.full.width.scrollbar=false
editor.full.size.scrollbar.description=Increase width of the vertical scrollbar to fit marks width
editor.xcode.like.scrollbar=false
editor.xcode.like.scrollbar.description=Enables auto-hideable Xcode-like editor stripes
@@ -497,7 +500,4 @@ editor.config.stop.at.project.root=true
editor.config.stop.at.project.root.description=Stops searching for .editorconfig at project root (requires project reopening)
JDK8042508.bug.fixed=false
JDK8042508.bug.fixed.description=Disable check for type variable until javac bug is fixed
annotate.extracted.method.nullable.when.applicable=true
annotate.extracted.method.nullable.when.applicable.description=Enables @Nullable annotation on newly extracted method when applicable
JDK8042508.bug.fixed.description=Disable check for type variable until javac bug is fixed
@@ -1774,6 +1774,17 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton {
}
}
@Override
public boolean equals(Object obj) {
return obj instanceof FileHistoryPanelImpl && Comparing.equal(((FileHistoryPanelImpl)obj).getVirtualFile(), getVirtualFile());
}
@Override
public int hashCode() {
final VirtualFile file = getVirtualFile();
return file == null ? 0 : file.hashCode();
}
private class MyToggleAction extends ToggleAction implements DumbAware {
public MyToggleAction() {
@@ -15,12 +15,8 @@
*/
package com.intellij.openapi.vcs.history;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.ui.MessageType;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.vcs.AbstractVcs;
import com.intellij.openapi.vcs.FilePath;
@@ -35,15 +31,12 @@ import com.intellij.openapi.wm.ToolWindowManager;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentFactory;
import com.intellij.ui.content.ContentManager;
import com.intellij.ui.content.TabbedContent;
import com.intellij.ui.content.impl.TabbedContentImpl;
import com.intellij.util.BufferedListConsumer;
import com.intellij.util.Consumer;
import com.intellij.util.ContentUtilEx;
import com.intellij.util.ContentsUtil;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.ArrayList;
import java.util.List;
/**
@@ -141,30 +134,7 @@ public class FileHistorySessionPartner implements VcsAppendableHistorySessionPar
assert toolWindow != null : "Version Control ToolWindow should be available at this point.";
if (Registry.is("vcs.merge.toolwindows")) {
Content history = null;
for (Content content : toolWindow.getContentManager().getContents()) {
if (content.getTabName().startsWith("History: ")) {
history = content;
break;
}
}
if (history == null) {
final Disposable disposable = Disposer.newDisposable();
history = new TabbedContentImpl(myFileHistoryPanel, myFileHistoryPanel.getVirtualFile().getName(), true, "History");
ContentsUtil.addOrReplaceContent(contentManager, history, true);
Disposer.register(history, disposable);
} else {
TabbedContent tabbedContent = (TabbedContent)history;
String fileName = myFileHistoryPanel.getVirtualFile().getName();
for (Pair<String, JComponent> tab : new ArrayList<Pair<String, JComponent>>(tabbedContent.getTabs())) {
if (Comparing.equal(((FileHistoryPanelImpl)tab.second).getVirtualFile(), myFileHistoryPanel.getVirtualFile())) {
tabbedContent.removeContent(tab.second);
}
}
toolWindow.getContentManager().setSelectedContent(tabbedContent, true, true);
tabbedContent.addContent(myFileHistoryPanel, fileName, true);
}
ContentUtilEx.addTabbedContent(toolWindow.getContentManager(), myFileHistoryPanel, "History", myFileHistoryPanel.getVirtualFile().getName(), true);
} else {
Content content = ContentFactory.SERVICE.getInstance().createContent(myFileHistoryPanel, actionName, true);
ContentsUtil.addOrReplaceContent(contentManager, content, true);
@@ -52,7 +52,6 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.util.*;
import java.util.List;
@@ -272,7 +271,7 @@ public class BreakpointsDialog extends DialogWrapper {
navigate(true);
close(OK_EXIT_CODE);
}
}.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0)), tree);
}.registerCustomShortcutSet(CommonShortcuts.ENTER, tree);
new AnAction("BreakpointDialog.ShowSource") {
@Override
@@ -102,9 +102,9 @@ public class BreakpointEditor {
done();
}
};
doneAction.registerCustomShortcutSet(new CompositeShortcutSet(CustomShortcutSet.fromString("ESCAPE"),
CustomShortcutSet.fromString("ENTER"),
CustomShortcutSet.fromString("control ENTER")), myMainPanel);
doneAction.registerCustomShortcutSet(new CompositeShortcutSet(CommonShortcuts.ESCAPE,
CommonShortcuts.ENTER,
CommonShortcuts.CTRL_ENTER), myMainPanel);
}
private void done() {
@@ -24,7 +24,11 @@ public class Utils {
}
public static void invalidConfigMessage(Project project, String configValue, String configKey, String filePath) {
EditorConfigNotifier.getInstance().error(project, configValue, "\"" + configValue + "\" is not a valid value" + (!configKey.isEmpty() ? " for " + configKey : "") + " for file " + filePath);
final String message = configValue != null ?
"\"" + configValue + "\" is not a valid value" + (!configKey.isEmpty() ? " for " + configKey : "") + " for file " + filePath :
"Failed to read .editorconfig file";
configValue = configValue != null ? configValue : "ioError";
EditorConfigNotifier.getInstance().error(project, configValue, message);
}
public static String getFilePath(Project project, VirtualFile file) {
@@ -27,8 +27,4 @@ public class EditorConfigNotifier {
Notifications.Bus.notify(new Notification("editorconfig", "EditorConfig", message, type), project);
PropertiesComponent.getInstance(project).setValue(LAST_NOTIFICATION_STATUS, id);
}
public void info(Project project, String message) {
doNotify(project, message, message, NotificationType.INFORMATION);
}
}
@@ -308,6 +308,7 @@ public class JBTerminalSystemSettingsProvider extends DefaultTabbedSettingsProvi
return getGlobal().getDefaultForeground();
}
@Nullable
@Override
public Color getColor(ColorKey key) {
if (myOwnColors.containsKey(key)) return myOwnColors.get(key);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -24,7 +24,7 @@ import com.intellij.designer.propertyTable.PropertyEditor;
import com.intellij.designer.propertyTable.PropertyEditorListener;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CustomShortcutSet;
import com.intellij.openapi.actionSystem.CommonShortcuts;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.diagnostic.Logger;
@@ -40,7 +40,6 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.awt.event.FocusEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
@@ -125,7 +124,7 @@ public class InplaceEditingLayer extends JComponent {
public void actionPerformed(AnActionEvent e) {
finishEditing(false);
}
}.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0)), myInplaceComponent);
}.registerCustomShortcutSet(CommonShortcuts.ESCAPE, myInplaceComponent);
myEditors = new ArrayList<PropertyEditor>();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -34,7 +34,6 @@ import java.awt.dnd.DragSourceListener;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -89,7 +88,7 @@ public class PalettePanel extends JPanel implements DataProvider, PaletteToolWin
public void actionPerformed(AnActionEvent e) {
clearActiveItem();
}
}.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0)), scrollPane);
}.registerCustomShortcutSet(CommonShortcuts.ESCAPE, scrollPane);
if (!ApplicationManager.getApplication().isHeadlessEnvironment()) {
DragSource.getDefaultDragSource().addDragSourceListener(myDragSourceListener);
@@ -330,6 +330,7 @@
<stepsBeforeRunProvider implementation="com.intellij.compiler.options.CompileStepBeforeRun" id="compileBeforeRun"/>
<stepsBeforeRunProvider implementation="com.intellij.compiler.options.MakeProjectStepBeforeRun" id="makeProjectBeforeRun"/>
<stepsBeforeRunProvider implementation="com.intellij.compiler.options.CompileStepBeforeRunNoErrorCheck" id="compileBeforeRunNoErrorCheck" order="after compileBeforeRun"/>
<stepsBeforeRunProvider implementation="com.intellij.packaging.impl.run.BuildArtifactsBeforeRunTaskProvider" order="after compileBeforeRunNoErrorCheck"/>
<programRunner id="defaultRunRunner" implementation="com.intellij.execution.impl.DefaultJavaProgramRunner"/>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.ide.browsers.BrowserSettingsPanel">
<grid id="27dc6" binding="root" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="root" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="595" height="400"/>
@@ -11,7 +11,7 @@
<grid id="df7ca" binding="defaultBrowserPanel" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -40,7 +40,7 @@
</grid>
<component id="c38a1" class="javax.swing.JComponent" binding="browsersTable" custom-create="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
</component>
<component id="b18a3" class="javax.swing.JCheckBox" binding="confirmExtractFiles" default-binding="true">
@@ -53,12 +53,20 @@
</component>
<component id="d1faa" class="javax.swing.JButton" binding="clearExtractedFiles" default-binding="true">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Clear extracted files"/>
</properties>
</component>
<component id="beb5b" class="com.intellij.ui.components.JBCheckBox" binding="showBrowserHover">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Show browser popup in editor"/>
</properties>
</component>
</children>
</grid>
<buttonGroups>
@@ -25,6 +25,7 @@ import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.openapi.util.Comparing;
import com.intellij.ui.ListCellRendererWrapper;
import com.intellij.ui.TitledSeparator;
import com.intellij.ui.components.JBCheckBox;
import com.intellij.util.Function;
import com.intellij.util.PathUtil;
import com.intellij.util.ui.ColumnInfo;
@@ -144,6 +145,7 @@ final class BrowserSettingsPanel {
private JComponent browsersTable;
private ComboBox defaultBrowserPolicyComboBox;
private JBCheckBox showBrowserHover;
private TableModelEditor<ConfigurableWebBrowser> browsersEditor;
@@ -321,7 +323,9 @@ final class BrowserSettingsPanel {
GeneralSettings generalSettings = GeneralSettings.getInstance();
DefaultBrowserPolicy defaultBrowserPolicy = getDefaultBrowser();
if (browserManager.getDefaultBrowserPolicy() != defaultBrowserPolicy || generalSettings.isConfirmExtractFiles() != confirmExtractFiles.isSelected()) {
if (browserManager.getDefaultBrowserPolicy() != defaultBrowserPolicy ||
generalSettings.isConfirmExtractFiles() != confirmExtractFiles.isSelected() ||
browserManager.isShowBrowserHover() != showBrowserHover.isSelected()) {
return true;
}
@@ -345,6 +349,7 @@ final class BrowserSettingsPanel {
settings.setConfirmExtractFiles(confirmExtractFiles.isSelected());
WebBrowserManager browserManager = WebBrowserManager.getInstance();
browserManager.setShowBrowserHover(showBrowserHover.isSelected());
browserManager.defaultBrowserPolicy = getDefaultBrowser();
browserManager.setList(browsersEditor.apply());
}
@@ -354,14 +359,16 @@ final class BrowserSettingsPanel {
}
public void reset() {
DefaultBrowserPolicy defaultBrowserPolicy = WebBrowserManager.getInstance().getDefaultBrowserPolicy();
final WebBrowserManager browserManager = WebBrowserManager.getInstance();
DefaultBrowserPolicy defaultBrowserPolicy = browserManager.getDefaultBrowserPolicy();
DefaultBrowserPolicy effectiveDefaultBrowserPolicy = defaultBrowserPolicy == DefaultBrowserPolicy.SYSTEM && !BrowserLauncherAppless.canUseSystemDefaultBrowserPolicy()
? DefaultBrowserPolicy.ALTERNATIVE : defaultBrowserPolicy;
defaultBrowserPolicyComboBox.setSelectedItem(effectiveDefaultBrowserPolicy);
GeneralSettings settings = GeneralSettings.getInstance();
confirmExtractFiles.setSelected(settings.isConfirmExtractFiles());
browsersEditor.reset(WebBrowserManager.getInstance().getList());
showBrowserHover.setSelected(browserManager.isShowBrowserHover());
browsersEditor.reset(browserManager.getList());
customPathValue = settings.getBrowserPath();
alternativeBrowserPathField.setEnabled(effectiveDefaultBrowserPolicy == DefaultBrowserPolicy.ALTERNATIVE);
@@ -51,7 +51,7 @@ public class WebBrowserManager extends SimpleModificationTracker implements Pers
);
private List<ConfigurableWebBrowser> browsers;
private boolean myShowBrowserHover = true;
DefaultBrowserPolicy defaultBrowserPolicy = DefaultBrowserPolicy.SYSTEM;
public WebBrowserManager() {
@@ -103,6 +103,9 @@ public class WebBrowserManager extends SimpleModificationTracker implements Pers
if (defaultBrowserPolicy != DefaultBrowserPolicy.SYSTEM) {
state.setAttribute("default", defaultBrowserPolicy.name().toLowerCase(Locale.ENGLISH));
}
if (!myShowBrowserHover) {
state.setAttribute("showHover", "false");
}
for (ConfigurableWebBrowser browser : browsers) {
Element entry = new Element("browser");
@@ -206,6 +209,8 @@ public class WebBrowserManager extends SimpleModificationTracker implements Pers
}
}
myShowBrowserHover = !"false".equals(element.getAttributeValue("showHover"));
List<ConfigurableWebBrowser> list = new ArrayList<ConfigurableWebBrowser>();
for (Element child : element.getChildren("browser")) {
BrowserFamily family = readFamily(child.getAttributeValue("family"));
@@ -388,4 +393,12 @@ public class WebBrowserManager extends SimpleModificationTracker implements Pers
}
return null;
}
public void setShowBrowserHover(boolean showBrowserHover) {
myShowBrowserHover = showBrowserHover;
}
public boolean isShowBrowserHover() {
return myShowBrowserHover;
}
}
@@ -80,7 +80,8 @@ public abstract class OpenInBrowserBaseGroupAction extends ComputableActionGroup
@Override
public void update(@NotNull AnActionEvent e) {
e.getPresentation().setVisible(!WebBrowserManager.getInstance().getBrowsers().isEmpty());
final WebBrowserManager browserManager = WebBrowserManager.getInstance();
e.getPresentation().setVisible(browserManager.isShowBrowserHover() && !browserManager.getActiveBrowsers().isEmpty());
}
}
}