Merge remote-tracking branch 'origin/master'
@@ -57,7 +57,11 @@ public class DfaVariableValue extends DfaValue {
|
||||
}
|
||||
|
||||
public DfaVariableValue createVariableValue(PsiVariable myVariable, boolean isNegated) {
|
||||
return createVariableValue(myVariable, myVariable.getType(), isNegated, null);
|
||||
PsiType varType = myVariable.getType();
|
||||
if (varType instanceof PsiEllipsisType) {
|
||||
varType = new PsiArrayType(((PsiEllipsisType)varType).getComponentType());
|
||||
}
|
||||
return createVariableValue(myVariable, varType, isNegated, null);
|
||||
}
|
||||
@NotNull
|
||||
public DfaVariableValue createVariableValue(@NotNull PsiModifierListOwner myVariable,
|
||||
|
||||
@@ -53,6 +53,7 @@ public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionToo
|
||||
@Deprecated @SuppressWarnings({"WeakerAccess"}) public boolean REPORT_NOT_ANNOTATED_PARAMETER_OVERRIDES_NOTNULL = true;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean REPORT_NOT_ANNOTATED_GETTER = true;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean IGNORE_EXTERNAL_SUPER_NOTNULL = false;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean REQUIRE_NOTNULL_FIELDS_INITIALIZED = true;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean REPORT_NOTNULL_PARAMETERS_OVERRIDES_NOT_ANNOTATED = false;
|
||||
@Deprecated @SuppressWarnings({"WeakerAccess"}) public boolean REPORT_NOT_ANNOTATED_SETTER_PARAMETER = true;
|
||||
@Deprecated @SuppressWarnings({"WeakerAccess"}) public boolean REPORT_ANNOTATION_NOT_PROPAGATED_TO_OVERRIDERS = true; // remains for test
|
||||
@@ -67,7 +68,8 @@ public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionToo
|
||||
String name = child.getAttributeValue("name");
|
||||
String value = child.getAttributeValue("value");
|
||||
if ("IGNORE_EXTERNAL_SUPER_NOTNULL".equals(name) && "false".equals(value) ||
|
||||
"REPORT_NOTNULL_PARAMETERS_OVERRIDES_NOT_ANNOTATED".equals(name) && "false".equals(value)) {
|
||||
"REPORT_NOTNULL_PARAMETERS_OVERRIDES_NOT_ANNOTATED".equals(name) && "false".equals(value) ||
|
||||
"REQUIRE_NOTNULL_FIELDS_INITIALIZED".equals(name) && "true".equals(value)) {
|
||||
node.removeContent(child);
|
||||
}
|
||||
}
|
||||
@@ -178,12 +180,14 @@ public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionToo
|
||||
}
|
||||
|
||||
List<PsiExpression> initializers = DfaPsiUtil.findAllConstructorInitializers(field);
|
||||
if (annotated.isDeclaredNotNull && initializers.isEmpty()) {
|
||||
final PsiAnnotation annotation = AnnotationUtil.findAnnotation(field, manager.getNotNulls());
|
||||
if (annotation != null) {
|
||||
holder.registerProblem(annotation.isPhysical() ? annotation : field.getNameIdentifier(),
|
||||
"Not-null fields must be initialized",
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
|
||||
if (REQUIRE_NOTNULL_FIELDS_INITIALIZED) {
|
||||
if (annotated.isDeclaredNotNull && initializers.isEmpty()) {
|
||||
final PsiAnnotation annotation = AnnotationUtil.findAnnotation(field, manager.getNotNulls());
|
||||
if (annotation != null) {
|
||||
holder.registerProblem(annotation.isPhysical() ? annotation : field.getNameIdentifier(),
|
||||
"Not-null fields must be initialized",
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ public class NullableStuffInspection extends NullableStuffInspectionBase {
|
||||
private JButton myConfigureAnnotationsButton;
|
||||
private JCheckBox myIgnoreExternalSuperNotNull;
|
||||
private JCheckBox myNNParameterOverridesNA;
|
||||
private JCheckBox myRequireNNFieldsInitialized;
|
||||
|
||||
private OptionsPanel() {
|
||||
super(new BorderLayout());
|
||||
@@ -56,6 +57,7 @@ public class NullableStuffInspection extends NullableStuffInspectionBase {
|
||||
myNNParameterOverridesNA.addActionListener(actionListener);
|
||||
myReportNotAnnotatedGetter.addActionListener(actionListener);
|
||||
myIgnoreExternalSuperNotNull.addActionListener(actionListener);
|
||||
myRequireNNFieldsInitialized.addActionListener(actionListener);
|
||||
myConfigureAnnotationsButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -74,6 +76,7 @@ public class NullableStuffInspection extends NullableStuffInspectionBase {
|
||||
myReportNotAnnotatedGetter.setSelected(REPORT_NOT_ANNOTATED_GETTER);
|
||||
myIgnoreExternalSuperNotNull.setSelected(IGNORE_EXTERNAL_SUPER_NOTNULL);
|
||||
myNNParameterOverridesNA.setSelected(REPORT_NOTNULL_PARAMETERS_OVERRIDES_NOT_ANNOTATED);
|
||||
myRequireNNFieldsInitialized.setSelected(REQUIRE_NOTNULL_FIELDS_INITIALIZED);
|
||||
|
||||
myIgnoreExternalSuperNotNull.setEnabled(myNAMethodOverridesNN.isSelected());
|
||||
}
|
||||
@@ -84,6 +87,7 @@ public class NullableStuffInspection extends NullableStuffInspectionBase {
|
||||
REPORT_NOT_ANNOTATED_GETTER = myReportNotAnnotatedGetter.isSelected();
|
||||
IGNORE_EXTERNAL_SUPER_NOTNULL = myIgnoreExternalSuperNotNull.isSelected();
|
||||
REPORT_NOTNULL_PARAMETERS_OVERRIDES_NOT_ANNOTATED = myNNParameterOverridesNA.isSelected();
|
||||
REQUIRE_NOTNULL_FIELDS_INITIALIZED = myRequireNNFieldsInitialized.isSelected();
|
||||
REPORT_ANNOTATION_NOT_PROPAGATED_TO_OVERRIDERS = REPORT_NOT_ANNOTATED_METHOD_OVERRIDES_NOTNULL;
|
||||
|
||||
myIgnoreExternalSuperNotNull.setEnabled(myNAMethodOverridesNN.isSelected());
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.codeInspection.nullable.NullableStuffInspection.OptionsPanel">
|
||||
<grid id="cc1c9" binding="myPanel" layout-manager="GridLayoutManager" row-count="7" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="cc1c9" binding="myPanel" layout-manager="GridLayoutManager" row-count="8" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="69" y="57" width="634" height="235"/>
|
||||
<xy x="69" y="57" width="634" height="239"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<vspacer id="c3eef">
|
||||
<constraints>
|
||||
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="2f304" class="javax.swing.JCheckBox" binding="myReportNotAnnotatedGetter">
|
||||
@@ -39,7 +39,7 @@
|
||||
</component>
|
||||
<component id="ef852" class="javax.swing.JButton" binding="myConfigureAnnotationsButton" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="5" 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="6" column="0" 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 resource-bundle="messages/InspectionsBundle" key="configure.annotations.option"/>
|
||||
@@ -61,6 +61,14 @@
|
||||
<text value="Report @NotNull &parameters overriding non-annotated"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="f6e46" class="javax.swing.JCheckBox" binding="myRequireNNFieldsInitialized">
|
||||
<constraints>
|
||||
<grid row="5" column="0" 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="Require @NotNull fields to be initialized explicitly"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
|
||||
@@ -203,7 +203,7 @@ public class MoveJavaMemberHandler implements MoveMemberHandler {
|
||||
}
|
||||
|
||||
protected static void changeQualifier(PsiReferenceExpression refExpr, PsiClass aClass, PsiMember member) throws IncorrectOperationException {
|
||||
if (RefactoringUtil.hasOnDemandStaticImport(refExpr, aClass)) {
|
||||
if (RefactoringUtil.hasOnDemandStaticImport(refExpr, aClass) && !(refExpr instanceof PsiMethodReferenceExpression)) {
|
||||
refExpr.setQualifierExpression(null);
|
||||
}
|
||||
else if (!ImportsUtil.hasStaticImportOn(refExpr, member, false)){
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -767,7 +767,10 @@ public class DeclarationParser {
|
||||
final PsiBuilder.Marker anno = builder.mark();
|
||||
builder.advanceLexer();
|
||||
|
||||
final PsiBuilder.Marker classRef = myParser.getReferenceParser().parseJavaCodeReference(builder, true, false, false, false);
|
||||
PsiBuilder.Marker classRef = null;
|
||||
if (builder.getTokenType() == JavaTokenType.IDENTIFIER) {
|
||||
classRef = myParser.getReferenceParser().parseJavaCodeReference(builder, true, false, false, false);
|
||||
}
|
||||
if (classRef == null) {
|
||||
error(builder, JavaErrorMessages.message("expected.class.reference"));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
class X {
|
||||
public static String compute(String... s) {
|
||||
if (s == null) return null;
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
class Test {
|
||||
@NotNull Object member;
|
||||
|
||||
private void accessMember() {
|
||||
member = new Object();
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@ PsiJavaFile:AnnoDefault.java
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:foo('foo')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiParameterList:()
|
||||
PsiJavaToken:LPARENTH('(')
|
||||
PsiJavaToken:RPARENTH(')')
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
PsiJavaFile:AnnoLoop.java
|
||||
PsiJavaToken:LBRACE('{')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Unexpected token
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaToken:AT('@')
|
||||
PsiJavaToken:AT('@')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiField:i
|
||||
PsiModifierList:
|
||||
<empty list>
|
||||
PsiTypeElement:int
|
||||
PsiKeyword:int('int')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiIdentifier:i('i')
|
||||
PsiJavaToken:SEMICOLON(';')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiJavaToken:RBRACE('}')
|
||||
@@ -40,4 +40,5 @@ public class ContractCheckTest extends LightCodeInsightFixtureTestCase {
|
||||
public void testNestedCallsMayThrow() { doTest(); }
|
||||
|
||||
public void testSignatureIssues() { doTest(); }
|
||||
public void testVarargInferred() { doTest(); }
|
||||
}
|
||||
|
||||
@@ -48,7 +48,13 @@ public class NullableStuffInspectionTest extends LightCodeInsightFixtureTestCase
|
||||
public void testNullableFieldNotnullParam() throws Exception{ doTest(); }
|
||||
public void testNotNullFieldNullableParam() throws Exception{ doTest(); }
|
||||
public void testNotNullCustomException() throws Exception{ doTest(); }
|
||||
|
||||
public void testNotNullFieldNotInitialized() throws Exception{ doTest(); }
|
||||
public void testNotNullFieldNotInitializedSetting() {
|
||||
myInspection.REQUIRE_NOTNULL_FIELDS_INITIALIZED = false;
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNotNullAnnotationChecksInChildClassMethods() { doTest(); }
|
||||
|
||||
public void testGetterSetterProblems() throws Exception{ doTest(); }
|
||||
|
||||
@@ -60,10 +60,11 @@ public class DeclarationParserTest extends JavaParsingTestCase {
|
||||
public void testEnumWithoutConstants() { doParserTest("{ private A }", false, true); }
|
||||
|
||||
public void testAnnoSimple() { doParserTest("{ int foo (); }", true, false); }
|
||||
public void testAnnoDefault() { doParserTest("{ Class foo () default String.class; }", true, false); }
|
||||
public void testAnnoDefault() { doParserTest("{ Class foo() default String.class; }", true, false); }
|
||||
public void testAnnoNested() { doParserTest("{ @interface Inner { String bar () default \"<unspecified>\"; } }", true, false); }
|
||||
public void testAnnoInner() { doParserTest("{ @interface Inner { double bar () default 0.0; } }"); }
|
||||
public void testAnnoOtherMembers() { doParserTest("{ int field;\n void m() {}\n class C {}\n interface I {} }", true, false); }
|
||||
public void testAnnoLoop() { doParserTest("{ @@@ int i; }"); }
|
||||
|
||||
public void testFieldSimple() { doParserTest("{ int field = 0; }"); }
|
||||
public void testFieldMulti() { doParserTest("{ int field1 = 0, field2; }"); }
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.intellij.lang.impl;
|
||||
|
||||
import com.intellij.lang.*;
|
||||
@@ -66,6 +65,8 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder {
|
||||
public static final Key<TripleFunction<ASTNode, LighterASTNode, FlyweightCapableTreeStructure<LighterASTNode>, ThreeState>>
|
||||
CUSTOM_COMPARATOR = Key.create("CUSTOM_COMPARATOR");
|
||||
|
||||
private static TokenSet ourAnyLanguageWhitespaceTokens = TokenSet.EMPTY;
|
||||
|
||||
private final Project myProject;
|
||||
private PsiFile myFile;
|
||||
|
||||
@@ -75,7 +76,7 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder {
|
||||
|
||||
private final MyList myProduction = new MyList();
|
||||
|
||||
@NotNull private final Lexer myLexer;
|
||||
private final Lexer myLexer;
|
||||
private final TokenSet myWhitespaces;
|
||||
private TokenSet myComments;
|
||||
|
||||
@@ -92,8 +93,6 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder {
|
||||
private final MyTreeStructure myParentLightTree;
|
||||
private final int myOffset;
|
||||
|
||||
private static TokenSet ourAnyLanguageWhitespaceTokens = TokenSet.EMPTY;
|
||||
|
||||
private Map<Key, Object> myUserData = null;
|
||||
private IElementType myCachedTokenType;
|
||||
|
||||
@@ -764,14 +763,16 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder {
|
||||
|
||||
@Override
|
||||
public void advanceLexer() {
|
||||
ProgressIndicatorProvider.checkCanceled();
|
||||
|
||||
if (eof()) return;
|
||||
|
||||
if (!myTokenTypeChecked) {
|
||||
LOG.assertTrue(eof(), "Probably a bug: eating token without its type checking");
|
||||
LOG.error("Probably a bug: eating token without its type checking");
|
||||
}
|
||||
|
||||
myTokenTypeChecked = false;
|
||||
myCurrentLexeme++;
|
||||
ProgressIndicatorProvider.checkCanceled();
|
||||
clearCachedTokenType();
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ public class ApplicationUtil {
|
||||
* Note that the process may continue to run in background indefinitely - so <b>avoid using this method unless absolutely needed</b>.
|
||||
*/
|
||||
public static <T> T runWithCheckCanceled(@NotNull final Callable<T> callable,
|
||||
@NotNull final ProgressIndicator indicator, ExecutorService executorService) throws Exception {
|
||||
@NotNull final ProgressIndicator indicator, @NotNull ExecutorService executorService) throws Exception {
|
||||
final Ref<T> result = Ref.create();
|
||||
final Ref<Throwable> error = Ref.create();
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ public class DiffUtil {
|
||||
|
||||
if (enableFolding) {
|
||||
editor.getSettings().setFoldingOutlineShown(true);
|
||||
editor.getSettings().setCodeFoldingEnabled(false);
|
||||
editor.getSettings().setAutoCodeFoldingEnabled(false);
|
||||
}
|
||||
else {
|
||||
editor.getSettings().setFoldingOutlineShown(false);
|
||||
|
||||
@@ -54,8 +54,8 @@ public interface EditorSettings {
|
||||
boolean isFoldingOutlineShown();
|
||||
void setFoldingOutlineShown(boolean val);
|
||||
|
||||
boolean isCodeFoldingEnabled();
|
||||
void setCodeFoldingEnabled(boolean val);
|
||||
boolean isAutoCodeFoldingEnabled();
|
||||
void setAutoCodeFoldingEnabled(boolean val);
|
||||
|
||||
boolean isUseTabCharacter(Project project);
|
||||
void setUseTabCharacter(boolean useTabCharacter);
|
||||
|
||||
|
Before Width: | Height: | Size: 163 B After Width: | Height: | Size: 165 B |
|
After Width: | Height: | Size: 319 B |
|
After Width: | Height: | Size: 319 B |
|
Before Width: | Height: | Size: 502 B After Width: | Height: | Size: 165 B |
|
After Width: | Height: | Size: 316 B |
|
After Width: | Height: | Size: 318 B |
|
After Width: | Height: | Size: 165 B |
|
After Width: | Height: | Size: 165 B |
@@ -26,8 +26,8 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
public class ArrangementRemoveConditionAction extends AnAction {
|
||||
|
||||
public ArrangementRemoveConditionAction() {
|
||||
getTemplatePresentation().setIcon(AllIcons.Actions.CloseNew);
|
||||
getTemplatePresentation().setHoveredIcon(AllIcons.Actions.CloseNewHovered);
|
||||
getTemplatePresentation().setIcon(AllIcons.Actions.Close);
|
||||
getTemplatePresentation().setHoveredIcon(AllIcons.Actions.CloseHovered);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -248,7 +248,6 @@ public class CodeFoldingManagerImpl extends CodeFoldingManager implements Projec
|
||||
}
|
||||
|
||||
private void initFolding(@NotNull final Editor editor) {
|
||||
if (!editor.getSettings().isCodeFoldingEnabled()) return;
|
||||
final Document document = editor.getDocument();
|
||||
editor.getFoldingModel().runBatchFoldingOperation(new Runnable() {
|
||||
@Override
|
||||
@@ -289,6 +288,7 @@ public class CodeFoldingManagerImpl extends CodeFoldingManager implements Projec
|
||||
}
|
||||
|
||||
public void updateFoldRegions(Editor editor, boolean quick) {
|
||||
if (!editor.getSettings().isAutoCodeFoldingEnabled()) return;
|
||||
PsiDocumentManager.getInstance(myProject).commitDocument(editor.getDocument());
|
||||
Runnable runnable = updateFoldRegions(editor, false, quick);
|
||||
if (runnable != null) {
|
||||
@@ -322,6 +322,7 @@ public class CodeFoldingManagerImpl extends CodeFoldingManager implements Projec
|
||||
@Override
|
||||
@Nullable
|
||||
public Runnable updateFoldRegionsAsync(@NotNull final Editor editor, final boolean firstTime) {
|
||||
if (!editor.getSettings().isAutoCodeFoldingEnabled()) return null;
|
||||
final Runnable runnable = updateFoldRegions(editor, firstTime, false);
|
||||
return new Runnable() {
|
||||
@Override
|
||||
@@ -338,7 +339,6 @@ public class CodeFoldingManagerImpl extends CodeFoldingManager implements Projec
|
||||
|
||||
@Nullable
|
||||
private Runnable updateFoldRegions(@NotNull Editor editor, boolean applyDefaultState, boolean quick) {
|
||||
if (!editor.getSettings().isCodeFoldingEnabled()) return null;
|
||||
PsiFile file = PsiDocumentManager.getInstance(myProject).getPsiFile(editor.getDocument());
|
||||
if (file != null) {
|
||||
return FoldingUpdate.updateFoldRegions(editor, file, applyDefaultState, quick);
|
||||
|
||||
@@ -207,6 +207,7 @@ public class LookupTypedHandler extends TypedActionHandlerBase {
|
||||
|
||||
@Nullable
|
||||
private static CharFilter.Result getFiltersDecision(char charTyped, LookupImpl lookup) {
|
||||
lookup.checkValid();
|
||||
LookupElement item = lookup.getCurrentItem();
|
||||
int prefixLength = item == null ? lookup.getAdditionalPrefix().length(): lookup.itemPattern(item).length();
|
||||
|
||||
@@ -215,6 +216,9 @@ public class LookupTypedHandler extends TypedActionHandlerBase {
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
if (lookup.isLookupDisposed()) {
|
||||
throw new AssertionError("Lookup disposed after " + extension);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ public class CloseViewAction extends BaseViewAction {
|
||||
@Override
|
||||
protected void update(final AnActionEvent e, final ViewContext context, final Content[] content) {
|
||||
setEnabled(e, isEnabled(content));
|
||||
e.getPresentation().setIcon(AllIcons.Actions.CloseNew);
|
||||
e.getPresentation().setHoveredIcon(AllIcons.Actions.CloseNewHovered);
|
||||
e.getPresentation().setIcon(AllIcons.Actions.Close);
|
||||
e.getPresentation().setHoveredIcon(AllIcons.Actions.CloseHovered);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -186,7 +186,7 @@ public class MasterDetailPopupBuilder implements MasterController {
|
||||
});
|
||||
}
|
||||
else {
|
||||
builder.setCommandButton(new InplaceButton(new IconButton("Close", AllIcons.Actions.CloseNew, AllIcons.Actions.CloseNewHovered), actionListener));
|
||||
builder.setCommandButton(new InplaceButton(new IconButton("Close", AllIcons.Actions.Close, AllIcons.Actions.CloseHovered), actionListener));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public class SettingsImpl implements EditorSettings {
|
||||
private int myLineCursorWidth = Registry.intValue("editor.caret.width", 2);
|
||||
private boolean myLineMarkerAreaShown = true;
|
||||
private boolean myAllowSingleLogicalLineFolding = false;
|
||||
private boolean myCodeFoldingEnabled = true;
|
||||
private boolean myAutoCodeFoldingEnabled = true;
|
||||
|
||||
// These comes from CodeStyleSettings
|
||||
private Integer myTabSize = null;
|
||||
@@ -281,14 +281,13 @@ public class SettingsImpl implements EditorSettings {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCodeFoldingEnabled() {
|
||||
return myCodeFoldingEnabled;
|
||||
public boolean isAutoCodeFoldingEnabled() {
|
||||
return myAutoCodeFoldingEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCodeFoldingEnabled(boolean val) {
|
||||
myCodeFoldingEnabled = val;
|
||||
fireEditorRefresh();
|
||||
public void setAutoCodeFoldingEnabled(boolean val) {
|
||||
myAutoCodeFoldingEnabled = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -420,8 +420,8 @@ public final class EditorTabbedContainer implements Disposable, CloseAction.Clos
|
||||
|
||||
@Override
|
||||
public void update(final AnActionEvent e) {
|
||||
e.getPresentation().setIcon(myTabs.isEditorTabs() ? AllIcons.Actions.CloseNew : AllIcons.Actions.Close);
|
||||
e.getPresentation().setHoveredIcon(myTabs.isEditorTabs()? AllIcons.Actions.CloseNewHovered : AllIcons.Actions.CloseHovered);
|
||||
e.getPresentation().setIcon(AllIcons.Actions.Close);
|
||||
e.getPresentation().setHoveredIcon(AllIcons.Actions.CloseHovered);
|
||||
e.getPresentation().setVisible(UISettings.getInstance().SHOW_CLOSE_BUTTON);
|
||||
e.getPresentation().setText("Close. Alt-click to close others.");
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.intellij.openapi.fileEditor.FileEditorProvider;
|
||||
import com.intellij.openapi.fileEditor.WeighedFileEditorProvider;
|
||||
import com.intellij.openapi.fileEditor.ex.FileEditorProviderManager;
|
||||
import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
@@ -86,6 +87,9 @@ public final class FileEditorProviderManagerImpl extends FileEditorProviderManag
|
||||
if (ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
|
||||
@Override
|
||||
public Boolean compute() {
|
||||
if (DumbService.isDumb(project) && !DumbService.isDumbAware(provider)) {
|
||||
return false;
|
||||
}
|
||||
return provider.accept(project, file);
|
||||
}
|
||||
})) {
|
||||
|
||||
@@ -52,6 +52,7 @@ public class GCUtil {
|
||||
if (q.poll() != null) {
|
||||
break;
|
||||
}
|
||||
TimeoutUtil.sleep(10);
|
||||
long bytes = Math.min(Runtime.getRuntime().freeMemory() / 2, Integer.MAX_VALUE);
|
||||
list.add(new SoftReference<byte[]>(new byte[(int)bytes]));
|
||||
}
|
||||
|
||||
@@ -155,8 +155,8 @@ public class Restarter {
|
||||
|
||||
public static File createTempExecutable(File executable) throws IOException {
|
||||
File executableDir = new File(System.getProperty("user.home") + "/." + System.getProperty("idea.paths.selector") + "/restart");
|
||||
File copy = new File(executableDir.getPath() + "/" + executable.getName());
|
||||
if (!FileUtilRt.createDirectory(executableDir)) throw new IOException("Cannot create dir: " + executableDir);
|
||||
File copy = new File(executableDir.getPath() + "/" + executable.getName());
|
||||
if (!FileUtilRt.ensureCanCreateFile(copy) || (copy.exists() && !copy.delete())) {
|
||||
String ext = FileUtilRt.getExtension(executable.getName());
|
||||
copy = FileUtilRt.createTempFile(executableDir, FileUtilRt.getNameWithoutExtension(copy.getName()),
|
||||
|
||||
@@ -189,8 +189,8 @@ public class StudyEditInputAction extends DumbAwareAction {
|
||||
|
||||
@Override
|
||||
public void update(final AnActionEvent e) {
|
||||
e.getPresentation().setIcon(tabbedPane.isEditorTabs() ? AllIcons.Actions.CloseNew : AllIcons.Actions.Close);
|
||||
e.getPresentation().setHoveredIcon(tabbedPane.isEditorTabs() ? AllIcons.Actions.CloseNewHovered : AllIcons.Actions.CloseHovered);
|
||||
e.getPresentation().setIcon(AllIcons.Actions.Close);
|
||||
e.getPresentation().setHoveredIcon(AllIcons.Actions.CloseHovered);
|
||||
e.getPresentation().setVisible(UISettings.getInstance().SHOW_CLOSE_BUTTON);
|
||||
e.getPresentation().setText("Delete test");
|
||||
}
|
||||
|
||||