mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-23 23:44:44 +07:00
BiUtil.isSet() usages extracted
This commit is contained in:
1 parent
913bb1fa2f
commit
3c8e077114
56 files changed
+315
-285
No files matched your search
@@ -24,6 +24,7 @@ import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.psi.search.searches.ClassInheritorsSearch;
|
||||
import com.intellij.psi.search.searches.FunctionalExpressionSearch;
|
||||
import com.intellij.psi.util.*;
|
||||
import com.intellij.util.BitUtil;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.ThreeState;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -63,14 +64,14 @@ public class JavaTargetElementEvaluator extends TargetElementEvaluatorEx2 implem
|
||||
public PsiElement adjustTargetElement(Editor editor, int offset, int flags, @NotNull PsiElement targetElement) {
|
||||
if (targetElement instanceof PsiKeyword) {
|
||||
if (targetElement.getParent() instanceof PsiThisExpression) {
|
||||
if ((flags & THIS_ACCEPTED) == 0) return null;
|
||||
if (!BitUtil.isSet(flags, THIS_ACCEPTED)) return null;
|
||||
PsiType type = ((PsiThisExpression)targetElement.getParent()).getType();
|
||||
if (!(type instanceof PsiClassType)) return null;
|
||||
return ((PsiClassType)type).resolve();
|
||||
}
|
||||
|
||||
if (targetElement.getParent() instanceof PsiSuperExpression) {
|
||||
if ((flags & SUPER_ACCEPTED) == 0) return null;
|
||||
if (!BitUtil.isSet(flags, SUPER_ACCEPTED)) return null;
|
||||
PsiType type = ((PsiSuperExpression)targetElement.getParent()).getType();
|
||||
if (!(type instanceof PsiClassType)) return null;
|
||||
return ((PsiClassType)type).resolve();
|
||||
@@ -124,7 +125,7 @@ public class JavaTargetElementEvaluator extends TargetElementEvaluatorEx2 implem
|
||||
}
|
||||
|
||||
if (refElement != null) {
|
||||
if ((flags & NEW_AS_CONSTRUCTOR) != 0) {
|
||||
if (BitUtil.isSet(flags, NEW_AS_CONSTRUCTOR)) {
|
||||
if (ref == null) {
|
||||
ref = TargetElementUtil.findReference(editor, offset);
|
||||
}
|
||||
|
||||
+4
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -30,6 +30,7 @@ import com.intellij.psi.impl.source.jsp.jspJava.JspxImportStatement;
|
||||
import com.intellij.psi.statistics.JavaStatisticsManager;
|
||||
import com.intellij.psi.util.*;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.BitUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -72,8 +73,8 @@ public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager {
|
||||
CheckUtil.checkWritable(element);
|
||||
if (!SourceTreeToPsiMap.hasTreeElement(element)) return element;
|
||||
|
||||
final boolean addImports = (flags & DO_NOT_ADD_IMPORTS) == 0;
|
||||
final boolean incompleteCode = (flags & INCOMPLETE_CODE) != 0;
|
||||
final boolean addImports = !BitUtil.isSet(flags, DO_NOT_ADD_IMPORTS);
|
||||
final boolean incompleteCode = BitUtil.isSet(flags, INCOMPLETE_CODE);
|
||||
|
||||
final ReferenceAdjuster adjuster = ReferenceAdjuster.Extension.getReferenceAdjuster(element.getLanguage());
|
||||
if (adjuster != null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -18,6 +18,7 @@ package com.intellij.psi.stubsHierarchy.impl;
|
||||
import com.intellij.psi.impl.java.stubs.hierarchy.IndexTree;
|
||||
import com.intellij.psi.stubsHierarchy.stubs.Import;
|
||||
import com.intellij.psi.stubsHierarchy.stubs.UnitInfo;
|
||||
import com.intellij.util.BitUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -58,12 +59,12 @@ public class StubResolver {
|
||||
@NotNull
|
||||
private Set<Symbol> findIdent(Symbol startScope, UnitInfo info, int name, int kind) {
|
||||
Set<Symbol> result = new HashSet<Symbol>();
|
||||
if ((kind & IndexTree.CLASS) != 0) {
|
||||
if (BitUtil.isSet(kind, IndexTree.CLASS)) {
|
||||
findType(startScope, name, result);
|
||||
findGlobalType(info, name, result);
|
||||
}
|
||||
|
||||
if ((kind & IndexTree.PACKAGE) != 0) {
|
||||
if (BitUtil.isSet(kind, IndexTree.PACKAGE)) {
|
||||
Symbol.PackageSymbol pkg = mySymbols.getPackage(myNameEnvironment.qualifiedName(null, name, false));
|
||||
if (pkg != null)
|
||||
result.add(pkg);
|
||||
@@ -92,12 +93,12 @@ public class StubResolver {
|
||||
if (fullname == null) {
|
||||
return;
|
||||
}
|
||||
if ((kind & IndexTree.PACKAGE) != 0) {
|
||||
if (BitUtil.isSet(kind, IndexTree.PACKAGE)) {
|
||||
Symbol.PackageSymbol pkg = mySymbols.getPackage(fullname);
|
||||
if (pkg != null)
|
||||
symbols.add(pkg);
|
||||
}
|
||||
if ((kind & IndexTree.CLASS) != 0) {
|
||||
if (BitUtil.isSet(kind, IndexTree.CLASS)) {
|
||||
Collections.addAll(symbols, loadClass(fullname));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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,6 +17,7 @@ package com.intellij.psi.stubsHierarchy.impl;
|
||||
|
||||
import com.intellij.psi.impl.java.stubs.hierarchy.IndexTree;
|
||||
import com.intellij.psi.stubsHierarchy.stubs.UnitInfo;
|
||||
import com.intellij.util.BitUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Comparator;
|
||||
@@ -46,17 +47,20 @@ public abstract class Symbol {
|
||||
}
|
||||
|
||||
public boolean isStatic() {
|
||||
return (myFlags & IndexTree.STATIC) != 0;
|
||||
return BitUtil.isSet(myFlags, IndexTree.STATIC);
|
||||
}
|
||||
|
||||
public boolean isPackage() {
|
||||
return (myFlags & IndexTree.PACKAGE) != 0;}
|
||||
return BitUtil.isSet(myFlags, IndexTree.PACKAGE);
|
||||
}
|
||||
|
||||
public boolean isClass() {
|
||||
return (myFlags & IndexTree.CLASS) != 0;}
|
||||
return BitUtil.isSet(myFlags, IndexTree.CLASS);
|
||||
}
|
||||
|
||||
public boolean isMember() {
|
||||
return (myFlags & IndexTree.MEMBER) != 0;}
|
||||
return BitUtil.isSet(myFlags, IndexTree.MEMBER);
|
||||
}
|
||||
|
||||
public PackageSymbol pkg() {
|
||||
Symbol sym = this;
|
||||
@@ -117,7 +121,7 @@ public abstract class Symbol {
|
||||
}
|
||||
|
||||
public boolean isCompiled() {
|
||||
return (myFlags & IndexTree.COMPILED) != 0;
|
||||
return BitUtil.isSet(myFlags, IndexTree.COMPILED);
|
||||
}
|
||||
|
||||
public ClassSymbol[] members() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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,6 +20,7 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiNameHelper;
|
||||
import com.intellij.psi.impl.java.stubs.hierarchy.IndexTree;
|
||||
import com.intellij.psi.stubsHierarchy.stubs.*;
|
||||
import com.intellij.util.BitUtil;
|
||||
import gnu.trove.TLongArrayList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -101,7 +102,7 @@ public class Translator {
|
||||
for (String aSuper : def.mySupers) {
|
||||
superList.add(id(nameEnvironment, aSuper));
|
||||
}
|
||||
if ((def.myMods & IndexTree.ENUM) != 0) {
|
||||
if (BitUtil.isSet(def.myMods, IndexTree.ENUM)) {
|
||||
superList.add(nameEnvironment.java_lang_Enum);
|
||||
}
|
||||
ArrayList<Declaration> innerDefList = new ArrayList<Declaration>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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,15 +15,16 @@
|
||||
*/
|
||||
package com.intellij.psi.stubsHierarchy.stubs;
|
||||
|
||||
import com.intellij.psi.stubsHierarchy.impl.QualifiedName;
|
||||
import com.intellij.psi.stubsHierarchy.impl.NameEnvironment;
|
||||
import com.intellij.psi.stubsHierarchy.impl.QualifiedName;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.BitUtil;
|
||||
|
||||
public class Import {
|
||||
public final static long[] EMPTY_ARRAY = ArrayUtil.EMPTY_LONG_ARRAY;
|
||||
|
||||
public static int onDemandMask = 1 << 29;
|
||||
public static int staticMask = 1 << 30;
|
||||
public static final int onDemandMask = 1 << 29;
|
||||
public static final int staticMask = 1 << 30;
|
||||
|
||||
public static int mask = ~(onDemandMask | staticMask);
|
||||
|
||||
@@ -42,11 +43,11 @@ public class Import {
|
||||
}
|
||||
|
||||
public static boolean isOnDemand(long importMask) {
|
||||
return (importMask & onDemandMask) != 0;
|
||||
return BitUtil.isSet(importMask, onDemandMask);
|
||||
}
|
||||
|
||||
public static boolean isStatic(long importMask) {
|
||||
return (importMask & staticMask) != 0;
|
||||
return BitUtil.isSet(importMask, staticMask);
|
||||
}
|
||||
|
||||
public static long mkImport(QualifiedName fullname, boolean importStatic, boolean onDemand, int alias) {
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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,6 +24,7 @@ import com.intellij.refactoring.RefactoringBundle;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.components.panels.ValidatingComponent;
|
||||
import com.intellij.ui.table.JBTable;
|
||||
import com.intellij.util.BitUtil;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -250,7 +251,7 @@ public class AutomaticUsageRenamingDialog<T> extends DialogWrapper {
|
||||
textField.setFont(font.deriveFont(font.getStyle() | Font.ITALIC));
|
||||
} else {
|
||||
textField.setForeground(SimpleTextAttributes.REGULAR_ATTRIBUTES.getFgColor());
|
||||
textField.setFont(font.deriveFont(font.getStyle() & (~Font.ITALIC)));
|
||||
textField.setFont(font.deriveFont(BitUtil.clear(font.getStyle(), Font.ITALIC)));
|
||||
}
|
||||
repaintTable();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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,6 +24,7 @@ import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
import com.intellij.usages.TextChunk;
|
||||
import com.intellij.util.BitUtil;
|
||||
import com.intellij.util.FontUtil;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.SmartList;
|
||||
@@ -59,7 +60,7 @@ public class SliceUsageCellRenderer extends SliceUsageCellRendererBase {
|
||||
if (isForcedLeaf) {
|
||||
attributes = attributes.derive(attributes.getStyle(), JBColor.LIGHT_GRAY, attributes.getBgColor(), attributes.getWaveColor());
|
||||
}
|
||||
boolean inUsage = (attributes.getFontStyle() & Font.BOLD) != 0;
|
||||
boolean inUsage = BitUtil.isSet(attributes.getFontStyle(), Font.BOLD);
|
||||
if (isInsideContainer && inUsage) {
|
||||
//Color darker = Color.BLACK;//attributes.getBgColor() == null ? Color.BLACK : attributes.getBgColor().darker();
|
||||
//attributes = attributes.derive(SimpleTextAttributes.STYLE_OPAQUE, attributes.getFgColor(), UIUtil.getTreeBackground().brighter(), attributes.getWaveColor());
|
||||
|
||||
Reference in new issue
Block a user