Java 类com.intellij.util.BitUtil 实例源码

项目:MultiHighlight    文件:ColorChooserPanel.java   
@Override
public void reset(@NotNull TextAttributes ta) {
    myCbBold.setEnabled(true);
    myCbItalic.setEnabled(true);

    int fontType = ta.getFontType();
    myCbBold.setSelected(BitUtil.isSet(fontType, Font.BOLD));
    myCbItalic.setSelected(BitUtil.isSet(fontType, Font.ITALIC));

    resetColorChooser(myCbForeground, myForegroundChooser, ta.getForegroundColor());
    resetColorChooser(myCbBackground, myBackgroundChooser, ta.getBackgroundColor());
    resetColorChooser(myCbErrorStripe, myErrorStripeColorChooser, ta.getErrorStripeColor());

    Color effectColor = ta.getEffectColor();
    resetColorChooser(myCbEffects, myEffectsColorChooser, effectColor);

    if (effectColor == null) {
        myEffectsCombo.setEnabled(false);
    } else {
        myEffectsCombo.setEnabled(true);
        myEffectsModel.setSelectedItem(
                ContainerUtil.reverseMap(myEffectsMap).get(ta.getEffectType()));
    }
}
项目:intellij-ce-playground    文件:ToolkitBugsProcessor.java   
public ToolkitBugsProcessor() {
  Class<?>[] classes = getClass().getDeclaredClasses();
  for (Class<?> each : classes) {
    if (!BitUtil.isSet(each.getModifiers(), Modifier.ABSTRACT) && Handler.class.isAssignableFrom(each)) {
      try {
        Handler eachHandler = (Handler)each.newInstance();
        if (eachHandler.isActual()) {
          myHandlers.add(eachHandler);
        }
      }
      catch (Throwable e) {
        LOG.error(e);
      }
    }
  }
}
项目:tools-idea    文件:ToolkitBugsProcessor.java   
public ToolkitBugsProcessor() {
  Class<?>[] classes = getClass().getDeclaredClasses();
  for (Class<?> each : classes) {
    if (!BitUtil.isSet(each.getModifiers(), Modifier.ABSTRACT) && Handler.class.isAssignableFrom(each)) {
      try {
        Handler eachHandler = (Handler)each.newInstance();
        if (eachHandler.isActual()) {
          myHandlers.add(eachHandler);
        }
      }
      catch (Throwable e) {
        LOG.error(e);
      }
    }
  }
}
项目:consulo-ikvm    文件:JavaMethodStubBuilder.java   
@Override
public void buildToBytecode(ClassWriter parent)
{
    int access = 0;
    access = BitUtil.set(access, Opcodes.ACC_STATIC, myModifiers.contains(PsiModifier.STATIC));
    access = BitUtil.set(access, Opcodes.ACC_PUBLIC, myModifiers.contains(PsiModifier.PUBLIC));

    StringBuilder descBuilder = new StringBuilder();
    descBuilder.append("(");
    for(JavaParameterStubBuilder parameter : myParameters)
    {
        appendType(parameter.getType(), descBuilder);
    }
    descBuilder.append(")");
    appendType(myReturnType, descBuilder);

    try
    {
        parent.visitMethod(access, myName, descBuilder.toString(), null, null).visitEnd();
    }
    catch(Exception e)
    {
        e.printStackTrace();
    }
}
项目:consulo-csharp    文件:SharedParsingHelpers.java   
protected static Pair<PsiBuilder.Marker, ModifierSet> parseModifierList(CSharpBuilderWrapper builder, int flags)
{
    PsiBuilder.Marker marker = builder.mark();

    Set<IElementType> set = new THashSet<>();
    while(!builder.eof())
    {
        if(MODIFIERS.contains(builder.getTokenType()))
        {
            set.add(builder.getTokenType());

            builder.advanceLexer();
        }
        else
        {
            break;
        }
    }
    marker.done(BitUtil.isSet(flags, STUB_SUPPORT) ? CSharpStubElements.MODIFIER_LIST : CSharpElements.MODIFIER_LIST);
    return Pair.create(marker, ModifierSet.create(set));
}
项目:consulo-csharp    文件:ExpressionParsing.java   
@Nullable
private static PsiBuilder.Marker parseReferenceTypeArgumentList(@NotNull CSharpBuilderWrapper builder, int flags)
{
    IElementType startElementType = BitUtil.isSet(flags, INSIDE_DOC) ? LBRACE : LT;

    if(builder.getTokenType() != startElementType)
    {
        return null;
    }

    if(BitUtil.isSet(flags, ALLOW_EMPTY_TYPE_ARGUMENTS))
    {
        if(BitUtil.isSet(flags, STUB_SUPPORT))
        {
            throw new IllegalArgumentException("Empty type arguments is not allowed inside stub tree");
        }
        PsiBuilder.Marker marker = parseReferenceEmptyTypeArgumentListImpl(builder);
        if(marker != null)
        {
            return marker;
        }
    }
    return parseReferenceTypeArgumentListImpl(builder, flags);
}
项目:consulo-csharp    文件:CSharpElementCompareUtil.java   
@RequiredReadAction
private static boolean compareVirtualImpl(@NotNull PsiElement o1, @NotNull PsiElement o2, int flags, @NotNull PsiElement scope)
{
    if(!BitUtil.isSet(flags, CHECK_VIRTUAL_IMPL_TYPE))
    {
        return true;
    }
    DotNetType type1 = ((DotNetVirtualImplementOwner) o1).getTypeForImplement();
    DotNetType type2 = ((DotNetVirtualImplementOwner) o2).getTypeForImplement();

    if(type1 == null && type2 == null)
    {
        return true;
    }

    if(type1 == null || type2 == null)
    {
        return false;
    }
    // we need call getTypeRefForImplement() due light element have ref for original DotNetType but getTypeRefForImplement() ill return another
    return CSharpTypeUtil.isTypeEqual(((DotNetVirtualImplementOwner) o1).getTypeRefForImplement(), ((DotNetVirtualImplementOwner) o2).getTypeRefForImplement(), scope);
}
项目:consulo-csharp    文件:CSharpTypeStubElementType.java   
@Override
@RequiredReadAction
public void indexStub(@NotNull CSharpTypeDeclStub stub, @NotNull IndexSink indexSink)
{
    String name = getName(stub);
    if(!StringUtil.isEmpty(name))
    {
        indexSink.occurrence(CSharpIndexKeys.TYPE_INDEX, name);

        String parentQName = stub.getParentQName();
        if(!stub.isNested())
        {
            DotNetNamespaceStubUtil.indexStub(indexSink, CSharpIndexKeys.MEMBER_BY_NAMESPACE_QNAME_INDEX, CSharpIndexKeys.MEMBER_BY_ALL_NAMESPACE_QNAME_INDEX, parentQName, name);

            if(BitUtil.isSet(stub.getOtherModifierMask(), CSharpTypeDeclStub.HAVE_EXTENSIONS))
            {
                indexSink.occurrence(CSharpIndexKeys.TYPE_WITH_EXTENSION_METHODS_INDEX, DotNetNamespaceStubUtil.getIndexableNamespace(parentQName));
            }
        }

        indexSink.occurrence(CSharpIndexKeys.TYPE_BY_QNAME_INDEX, getNameWithNamespaceForIndexing(parentQName, name));

        indexSink.occurrence(CSharpIndexKeys.TYPE_BY_VMQNAME_INDEX, stub.getVmQName());
    }
}
项目:consulo-csharp    文件:CSharpElementTreeNode.java   
@Nullable
@Override
@RequiredDispatchThread
protected Collection<AbstractTreeNode> getChildrenImpl()
{
    final ViewSettings settings = getSettings();
    if(!settings.isShowMembers() && !BitUtil.isSet(myFlags, FORCE_EXPAND))
    {
        return Collections.emptyList();
    }

    DotNetNamedElement[] members = filterNamespaces(getValue());
    if(members.length == 0)
    {
        return Collections.emptyList();
    }

    List<AbstractTreeNode> list = new ArrayList<>(members.length);
    for(DotNetNamedElement dotNetElement : members)
    {
        list.add(new CSharpElementTreeNode(dotNetElement, settings, 0));
    }
    return list;
}
项目:consulo-csharp    文件:CSharpElementTreeNode.java   
@Override
@RequiredDispatchThread
protected void updateImpl(PresentationData presentationData)
{
    DotNetNamedElement value = getValue();

    presentationData.setPresentableText(getPresentableText(value));

    if(BitUtil.isSet(myFlags, ALLOW_GRAY_FILE_NAME))
    {
        PsiFile containingFile = value.getContainingFile();
        if(containingFile != null)
        {
            if(!Comparing.equal(FileUtil.getNameWithoutExtension(containingFile.getName()), value.getName()))
            {
                presentationData.setLocationString(containingFile.getName());
            }
        }
    }
}
项目:consulo-dotnet    文件:DotNetTypeRefCacheUtil.java   
@Exported
@NotNull
@RequiredReadAction
private static <E extends PsiElement> DotNetTypeRef getResultCacheResultImpl(@NotNull Key<CachedValue<DotNetTypeRef>> cachedValueKey,
        @NotNull E element,
        @NotNull Key dropKey,
        @NotNull final NotNullFunction<E, DotNetTypeRef> resolver)
{
    Class<? extends NotNullFunction> aClass = resolver.getClass();
    if(!BitUtil.isSet(aClass.getModifiers(), Modifier.STATIC))
    {
        throw new IllegalArgumentException("Accepted only static resolver");
    }

    CachedValue<DotNetTypeRef> cachedValue = element.getUserData(cachedValueKey);
    if(cachedValue == null)
    {
        DotNetTypeRefCachedValueProvider<E> provider = new DotNetTypeRefCachedValueProvider<>(dropKey, element, resolver);

        cachedValue = ((UserDataHolderEx) element).putUserDataIfAbsent(cachedValueKey, CachedValuesManager.getManager(element.getProject()).createCachedValue(provider, false));

        return cachedValue.getValue();
    }
    return cachedValue.getValue();
}
项目:consulo-dotnet    文件:DotNetElementPresentationUtil.java   
@NotNull
@Deprecated
public static String formatMethod(@NotNull DotNetLikeMethodDeclaration methodDeclaration, int flags)
{
    StringBuilder builder = new StringBuilder();

    if(BitUtil.isSet(flags, METHOD_WITH_RETURN_TYPE) && !BitUtil.isSet(flags, METHOD_SCALA_FORMAT))
    {
        if(!(methodDeclaration instanceof DotNetConstructorDeclaration))
        {
            builder.append(methodDeclaration.getReturnTypeRef().getPresentableText()).append(" ");
        }
    }

    if(methodDeclaration instanceof DotNetConstructorDeclaration && ((DotNetConstructorDeclaration) methodDeclaration).isDeConstructor())
    {
        builder.append("~");
    }

    builder.append(methodDeclaration.getName());
    formatTypeGenericParameters(methodDeclaration.getGenericParameters(), builder);
    formatParameters(methodDeclaration, builder, flags);
    return builder.toString();
}
项目:consulo    文件:GwtTransportServiceImpl.java   
@Nonnull
public static GwtTextAttributes createTextAttributes(TextAttributes textAttributes) {
  GwtColor foreground = null;
  GwtColor background = null;

  Color foregroundColor = textAttributes.getForegroundColor();
  if (foregroundColor != null) {
    foreground = createColor(foregroundColor);
  }

  Color backgroundColor = textAttributes.getBackgroundColor();
  if (backgroundColor != null) {
    background = createColor(backgroundColor);
  }

  int flags = 0;
  flags = BitUtil.set(flags, GwtTextAttributes.BOLD, (textAttributes.getFontType() & Font.BOLD) != 0);
  flags = BitUtil.set(flags, GwtTextAttributes.ITALIC, (textAttributes.getFontType() & Font.ITALIC) != 0);
  flags = BitUtil.set(flags, GwtTextAttributes.UNDERLINE, textAttributes.getEffectType() == EffectType.LINE_UNDERSCORE);
  flags = BitUtil.set(flags, GwtTextAttributes.LINE_THROUGH, textAttributes.getEffectType() == EffectType.STRIKEOUT);

  return new GwtTextAttributes(foreground, background, flags);
}
项目:consulo    文件:MouseShortcut.java   
@JdkConstants.InputEventMask
private static int mapOldModifiers(@JdkConstants.InputEventMask int modifiers) {
  if (BitUtil.isSet(modifiers, InputEvent.SHIFT_MASK)) {
    modifiers |= InputEvent.SHIFT_DOWN_MASK;
  }
  if (BitUtil.isSet(modifiers, InputEvent.ALT_MASK)) {
    modifiers |= InputEvent.ALT_DOWN_MASK;
  }
  if (BitUtil.isSet(modifiers, InputEvent.ALT_GRAPH_MASK)) {
    modifiers |= InputEvent.ALT_GRAPH_DOWN_MASK;
  }
  if (BitUtil.isSet(modifiers, InputEvent.CTRL_MASK)) {
    modifiers |= InputEvent.CTRL_DOWN_MASK;
  }
  if (BitUtil.isSet(modifiers, InputEvent.META_MASK)) {
    modifiers |= InputEvent.META_DOWN_MASK;
  }

  modifiers &= InputEvent.SHIFT_DOWN_MASK
               | InputEvent.ALT_DOWN_MASK
               | InputEvent.ALT_GRAPH_DOWN_MASK
               | InputEvent.CTRL_DOWN_MASK
               | InputEvent.META_DOWN_MASK;

  return modifiers;
}
项目:consulo    文件:RequestFocusHttpRequestHandler.java   
public static boolean activateFrame(@Nullable final Frame frame) {
  if (frame != null) {
    Runnable runnable = new Runnable() {
      @Override
      public void run() {
        int extendedState = frame.getExtendedState();
        if (BitUtil.isSet(extendedState, Frame.ICONIFIED)) {
          extendedState = BitUtil.set(extendedState, Frame.ICONIFIED, false);
          frame.setExtendedState(extendedState);
        }

        // fixme [vistall] dirty hack - show frame on top
        frame.setAlwaysOnTop(true);
        frame.setAlwaysOnTop(false);
        IdeFocusManager.getGlobalInstance().doForceFocusWhenFocusSettlesDown(frame);
      }
    };
    //noinspection SSBasedInspection
    SwingUtilities.invokeLater(runnable);
    return true;
  }
  return false;
}
项目:consulo    文件:EditorTabbedContainer.java   
@RequiredDispatchThread
@Override
public void actionPerformed(final AnActionEvent e) {
  final FileEditorManagerEx mgr = FileEditorManagerEx.getInstanceEx(myProject);
  consulo.fileEditor.impl.EditorWindow window;
  final VirtualFile file = (VirtualFile)myTabInfo.getObject();
  if (ActionPlaces.EDITOR_TAB.equals(e.getPlace())) {
    window = myWindow;
  }
  else {
    window = mgr.getCurrentWindow();
  }

  if (window != null) {
    if (BitUtil.isSet(e.getModifiers(), InputEvent.ALT_MASK)) {
      window.closeAllExcept(file);
    }
    else {
      if (window.findFileComposite(file) != null) {
        mgr.closeFile(file, window);
      }
    }
  }
}
项目:consulo    文件:ReopenProjectAction.java   
@RequiredDispatchThread
@Override
public void actionPerformed(@Nonnull AnActionEvent e) {
  //Force move focus to IdeFrame
  IdeEventQueue.getInstance().getPopupManager().closeAllPopups();

  final int modifiers = e.getModifiers();
  final boolean forceOpenInNewFrame = BitUtil.isSet(modifiers, InputEvent.CTRL_MASK) || BitUtil.isSet(modifiers, InputEvent.SHIFT_MASK) || e.getPlace() == ActionPlaces.WELCOME_SCREEN;

  Project project = e.getData(CommonDataKeys.PROJECT);
  if (!new File(myProjectPath).exists()) {
    if (Messages.showDialog(project, "The path " +
                                     FileUtil.toSystemDependentName(myProjectPath) +
                                     " does not exist.\n" +
                                     "If it is on a removable or network drive, please make sure that the drive is connected.", "Reopen Project", new String[]{"OK", "&Remove From List"}, 0,
                            Messages.getErrorIcon()) == 1) {
      RecentProjectsManager.getInstance().removePath(myProjectPath);
    }
    return;
  }

  Platform.hacky(() -> ProjectUtil.open(myProjectPath, project, forceOpenInNewFrame), () -> ProjectUtil.openAsync(myProjectPath, null, forceOpenInNewFrame, UIAccess.get()));
}
项目:consulo    文件:ToolkitBugsProcessor.java   
public ToolkitBugsProcessor() {
  Class<?>[] classes = getClass().getDeclaredClasses();
  for (Class<?> each : classes) {
    if (!BitUtil.isSet(each.getModifiers(), Modifier.ABSTRACT) && Handler.class.isAssignableFrom(each)) {
      try {
        Handler eachHandler = (Handler)each.newInstance();
        if (eachHandler.isActual()) {
          myHandlers.add(eachHandler);
        }
      }
      catch (Throwable e) {
        LOG.error(e);
      }
    }
  }
}
项目:consulo    文件:DesktopToolWindowHeader.java   
@Override
@RequiredDispatchThread
public void actionPerformed(final ActionEvent e) {
  AnAction action =
          myAlternativeAction != null && BitUtil.isSet(e.getModifiers(), InputEvent.ALT_MASK) ? myAlternativeAction : myAction;
  final DataContext dataContext = DataManager.getInstance().getDataContext(this);
  final ActionManagerEx actionManager = ActionManagerEx.getInstanceEx();
  InputEvent inputEvent = e.getSource() instanceof InputEvent ? (InputEvent) e.getSource() : null;
  final AnActionEvent event =
          new AnActionEvent(inputEvent, dataContext, ActionPlaces.TOOLWINDOW_TITLE, action.getTemplatePresentation(),
                            ActionManager.getInstance(),
                            0);
  actionManager.fireBeforeActionPerformed(action, dataContext, event);
  final Component component = dataContext.getData(PlatformDataKeys.CONTEXT_COMPONENT);
  if (component != null && !component.isShowing()) {
    return;
  }

  action.actionPerformed(event);
}
项目:consulo-java    文件:ExceptionUtil.java   
private static boolean blockCompletesAbruptly(@NotNull final PsiCodeBlock finallyBlock)
{
    try
    {
        ControlFlow flow = ControlFlowFactory.getInstance(finallyBlock.getProject()).getControlFlow(finallyBlock, LocalsOrMyInstanceFieldsControlFlowPolicy.getInstance(), false);
        int completionReasons = ControlFlowUtil.getCompletionReasons(flow, 0, flow.getSize());
        if(!BitUtil.isSet(completionReasons, ControlFlowUtil.NORMAL_COMPLETION_REASON))
        {
            return true;
        }
    }
    catch(AnalysisCanceledException e)
    {
        return true;
    }
    return false;
}
项目:consulo-java    文件:PsiModifierListImpl.java   
private Set<String> calcExplicitModifiers()
{
    Set<String> explicitModifiers = ContainerUtil.newHashSet();
    PsiModifierListStub stub = getGreenStub();
    if(stub != null)
    {
        int mask = stub.getModifiersMask();
        for(int i = 0; i < 31; i++)
        {
            int flag = 1 << i;
            if(BitUtil.isSet(mask, flag))
            {
                ContainerUtil.addIfNotNull(explicitModifiers, ModifierFlags.MODIFIER_FLAG_TO_NAME_MAP.get(flag));
            }
        }
    }
    else
    {
        for(ASTNode child : getNode().getChildren(null))
        {
            ContainerUtil.addIfNotNull(explicitModifiers, KEYWORD_TYPE_TO_NAME_MAP.get(child.getElementType()));
        }
    }

    return explicitModifiers;
}
项目:intellij-ce-playground    文件:ToolWindowHeader.java   
public void actionPerformed(final ActionEvent e) {
  AnAction action =
    myAlternativeAction != null && BitUtil.isSet(e.getModifiers(), InputEvent.ALT_MASK) ? myAlternativeAction : myAction;
  final DataContext dataContext = DataManager.getInstance().getDataContext(this);
  final ActionManagerEx actionManager = ActionManagerEx.getInstanceEx();
  InputEvent inputEvent = e.getSource() instanceof InputEvent ? (InputEvent) e.getSource() : null;
  final AnActionEvent event = AnActionEvent.createFromAnAction(action, inputEvent, ActionPlaces.TOOLWINDOW_TITLE, dataContext);
  actionManager.fireBeforeActionPerformed(action, dataContext, event);
  final Component component = PlatformDataKeys.CONTEXT_COMPONENT.getData(dataContext);
  if (component != null && !component.isShowing()) {
    return;
  }

  action.actionPerformed(event);
}
项目:intellij-ce-playground    文件:ProjectWindowAction.java   
@Override
public void setSelected(@Nullable AnActionEvent e, boolean selected) {

  if (e == null) return;
  boolean macMainMenu = SystemInfo.isMac && ActionPlaces.isMainMenuOrActionSearch(e.getPlace());

  if (!selected && !macMainMenu) {
    return;
  }

  final Project project = findProject();
  if (project == null) {
    return;
  }
  final JFrame projectFrame = WindowManager.getInstance().getFrame(project);
  final int frameState = projectFrame.getExtendedState();

  if (macMainMenu && !(e.getInputEvent().getSource() instanceof ActionMenuItem) && (projectFrame.getExtendedState() & Frame.ICONIFIED) != 0) {
    // On Mac minimized window should not be restored this way
    return;
  }

  if (BitUtil.isSet(frameState, Frame.ICONIFIED)) {
    // restore the frame if it is minimized
    projectFrame.setExtendedState(frameState ^ Frame.ICONIFIED);
  }
  projectFrame.toFront();
  projectFrame.requestFocus();
  //ProjectUtil.focusProjectWindow(project, true);
}
项目:intellij-ce-playground    文件:IntToIntBtree.java   
@Override
protected void doInitFlags(int flags) {
  super.doInitFlags(flags);
  flags = (flags >> FLAGS_SHIFT) & 0xFF;
  isHashedLeaf = BitUtil.isSet(flags, HASHED_LEAF_MASK);
  isIndexLeaf = BitUtil.isSet(flags, INDEX_LEAF_MASK);
}
项目:intellij-ce-playground    文件:BreadcrumbsXmlWrapper.java   
@Override
public void itemSelected(@NotNull final BreadcrumbsPsiItem item, final int modifiers) {
  final PsiElement psiElement = item.getPsiElement();
  moveEditorCaretTo(psiElement);

  if (BitUtil.isSet(modifiers, Event.SHIFT_MASK) || BitUtil.isSet(modifiers, Event.META_MASK)) {
    final TextRange range = psiElement.getTextRange();
    myEditor.getSelectionModel().setSelection(range.getStartOffset(), range.getEndOffset());
  }
}
项目:consulo-csharp    文件:SharedParsingHelpers.java   
private static PsiBuilder.Marker parseAttribute(CSharpBuilderWrapper builder, ModifierSet set, int flags)
{
    PsiBuilder.Marker mark = builder.mark();
    if(ExpressionParsing.parseQualifiedReference(builder, null, flags, TokenSet.EMPTY) == null)
    {
        mark.drop();
        return null;
    }

    ExpressionParsing.parseArgumentList(builder, true, set);

    mark.done(BitUtil.isSet(flags, STUB_SUPPORT) ? CSharpStubElements.ATTRIBUTE : CSharpElements.ATTRIBUTE);
    return mark;
}
项目:consulo-csharp    文件:SharedParsingHelpers.java   
protected static Pair<PsiBuilder.Marker, ModifierSet> parseModifierListWithAttributes(CSharpBuilderWrapper builder, int flags)
{
    if(MODIFIERS.contains(builder.getTokenType()))
    {
        return parseModifierList(builder, flags);
    }
    else
    {
        Set<IElementType> set = new THashSet<>();
        PsiBuilder.Marker marker = builder.mark();
        if(!parseAttributeList(builder, ModifierSet.EMPTY, flags))
        {
            // FIXME [VISTALL] dummy
            set.add(BitUtil.isSet(flags, STUB_SUPPORT) ? CSharpStubElements.ATTRIBUTE : CSharpElements.ATTRIBUTE);
        }
        while(!builder.eof())
        {
            if(MODIFIERS.contains(builder.getTokenType()))
            {
                set.add(builder.getTokenType());

                builder.advanceLexer();
            }
            else
            {
                break;
            }
        }
        marker.done(BitUtil.isSet(flags, STUB_SUPPORT) ? CSharpStubElements.MODIFIER_LIST : CSharpElements.MODIFIER_LIST);
        return Pair.create(marker, ModifierSet.create(set));
    }
}
项目:consulo-csharp    文件:SharedParsingHelpers.java   
public static void reportIdentifier(PsiBuilder builder, int flags)
{
    PsiBuilder.Marker mark = builder.mark();
    builder.error("Expected identifier");
    mark.done(BitUtil.isSet(flags, STUB_SUPPORT) ? CSharpStubElements.IDENTIFIER : CSharpElements.IDENTIFIER);
    mark.setCustomEdgeTokenBinders(WhitespacesBinders.GREEDY_LEFT_BINDER, null);
}
项目:consulo-csharp    文件:MethodParsing.java   
public static void parseParameterList(CSharpBuilderWrapper builder, int flags, IElementType end, ModifierSet set)
{
    PsiBuilder.Marker mark = builder.mark();

    builder.advanceLexer();

    if(builder.getTokenType() != end)
    {
        while(!builder.eof())
        {
            parseParameter(builder, end, flags, set);

            if(builder.getTokenType() == COMMA)
            {
                builder.advanceLexer();
            }
            else if(builder.getTokenType() == end)
            {
                break;
            }
            else
            {
                PsiBuilder.Marker errorMarker = builder.mark();
                builder.advanceLexer();
                errorMarker.error("Expected comma");
            }
        }
    }

    expect(builder, end, "')' expected");
    mark.done(BitUtil.isSet(flags, STUB_SUPPORT) ? CSharpStubElements.PARAMETER_LIST : CSharpElements.PARAMETER_LIST);
}
项目:consulo-csharp    文件:MethodParsing.java   
private static void parseParameter(CSharpBuilderWrapper builder, IElementType end, int flags, ModifierSet set)
{
    PsiBuilder.Marker mark = builder.mark();

    Pair<PsiBuilder.Marker, ModifierSet> modifierPair = parseModifierListWithAttributes(builder, flags);

    TypeInfo typeInfo = parseType(builder, flags);
    if(typeInfo == null)
    {
        if(modifierPair.getSecond().isEmpty())
        {
            // if no modifiers but we failed parse type - need go advance, due ill infinity loop inside parseParameterList,
            // but dont eat close brace
            if(builder.getTokenType() != end)
            {
                builder.advanceLexer();
            }
        }
        mark.error("Type expected");
    }
    else
    {
        if(typeInfo.nativeElementType != CSharpTokens.__ARGLIST_KEYWORD)
        {
            expectOrReportIdentifier(builder, flags);

            if(expect(builder, EQ, null))
            {
                if(ExpressionParsing.parse(builder, set) == null)
                {
                    builder.error("Expression expected.");
                }
            }
        }
        mark.done(BitUtil.isSet(flags, STUB_SUPPORT) ? CSharpStubElements.PARAMETER : CSharpElements.PARAMETER);
    }
}
项目:consulo-csharp    文件:CSharpElementCompareUtil.java   
@RequiredReadAction
private static boolean compareReturnTypeRef(@NotNull PsiElement o1, @NotNull PsiElement o2, int flags, @NotNull PsiElement scope)
{
    if(!BitUtil.isSet(flags, CHECK_RETURN_TYPE))
    {
        return true;
    }
    DotNetTypeRef returnTypeRef1 = ((DotNetLikeMethodDeclaration) o1).getReturnTypeRef();
    DotNetTypeRef returnTypeRef2 = ((DotNetLikeMethodDeclaration) o2).getReturnTypeRef();
    return CSharpTypeUtil.isTypeEqual(returnTypeRef1, returnTypeRef2, scope);
}
项目:consulo-csharp    文件:CSharpMethodDeclarationImpl.java   
@Override
public boolean isDelegate()
{
    CSharpMethodDeclStub stub = getGreenStub();
    if(stub != null)
    {
        return BitUtil.isSet(stub.getOtherModifierMask(), CSharpMethodDeclStub.DELEGATE_MASK);
    }
    return findChildByType(CSharpTokens.DELEGATE_KEYWORD) != null;
}
项目:consulo-csharp    文件:CSharpMethodDeclarationImpl.java   
@Override
public boolean isExtension()
{
    CSharpMethodDeclStub stub = getGreenStub();
    if(stub != null)
    {
        return BitUtil.isSet(stub.getOtherModifierMask(), CSharpMethodDeclStub.EXTENSION_MASK);
    }
    return CSharpMethodImplUtil.isExtensionMethod(this);
}
项目:consulo-csharp    文件:CSharpConstructorDeclarationImpl.java   
@Override
public boolean isDeConstructor()
{
    CSharpMethodDeclStub stub = getGreenStub();
    if(stub != null)
    {
        return BitUtil.isSet(stub.getOtherModifierMask(), CSharpMethodDeclStub.DE_CONSTRUCTOR_MASK);
    }

    return findChildByType(CSharpTokens.TILDE) != null;
}
项目:consulo-csharp    文件:CSharpMethodStubElementType.java   
@Override
@RequiredReadAction
public void indexStub(@NotNull CSharpMethodDeclStub stub, @NotNull IndexSink indexSink)
{
    String name = getName(stub);
    if(!StringUtil.isEmpty(name))
    {
        indexSink.occurrence(CSharpIndexKeys.METHOD_INDEX, name);

        if(!stub.isNested())
        {
            if(BitUtil.isSet(stub.getOtherModifierMask(), CSharpMethodDeclStub.DELEGATE_MASK))
            {
                String parentQName = stub.getParentQName();

                DotNetNamespaceStubUtil.indexStub(indexSink, CSharpIndexKeys.MEMBER_BY_NAMESPACE_QNAME_INDEX, CSharpIndexKeys.MEMBER_BY_ALL_NAMESPACE_QNAME_INDEX, parentQName, name);
            }
        }

        if(BitUtil.isSet(stub.getOtherModifierMask(), CSharpMethodDeclStub.EXTENSION_MASK))
        {
            indexSink.occurrence(CSharpIndexKeys.EXTENSION_METHOD_BY_NAME_INDEX, name);
        }

        if(BitUtil.isSet(stub.getOtherModifierMask(), CSharpMethodDeclStub.DELEGATE_MASK))
        {
            indexSink.occurrence(CSharpIndexKeys.DELEGATE_METHOD_BY_NAME_INDEX, name);
        }
    }
}
项目:consulo-csharp    文件:CSharpVariableDeclStub.java   
@RequiredReadAction
public static int getOtherModifierMask(DotNetVariable variable)
{
    int i = 0;
    i |= BitUtil.set(i, CONSTANT_MASK, variable.isConstant());
    if(variable instanceof CSharpStubVariableImpl)
    {
        i |= BitUtil.set(i, MULTIPLE_DECLARATION_MASK, CSharpStubVariableImplUtil.isMultipleDeclaration((CSharpStubVariableImpl<?>) variable));
    }
    if(variable instanceof CSharpStubParameterImpl)
    {
        i |= BitUtil.set(i, OPTIONAL, variable.getInitializer() != null);
    }
    return i;
}
项目:consulo-csharp    文件:CSharpElementPresentationUtil.java   
@NotNull
@RequiredReadAction
public static String formatProperty(@NotNull DotNetPropertyDeclaration propertyDeclaration, int flags)
{
    StringBuilder builder = new StringBuilder();

    if(BitUtil.isSet(flags, WITH_VIRTUAL_IMPL_TYPE))
    {
        DotNetTypeRef typeRefForImplement = propertyDeclaration.getTypeRefForImplement();
        if(typeRefForImplement != DotNetTypeRef.ERROR_TYPE)
        {
            CSharpTypeRefPresentationUtil.appendTypeRef(propertyDeclaration, builder, typeRefForImplement, typeRefMask(flags));
            builder.append(".");
        }
    }

    if(BitUtil.isSet(flags, SCALA_FORMAT))
    {
        builder.append(propertyDeclaration.getName());
        builder.append(":");
        CSharpTypeRefPresentationUtil.appendTypeRef(propertyDeclaration, builder, propertyDeclaration.toTypeRef(true), typeRefMask(flags));

    }
    else
    {
        CSharpTypeRefPresentationUtil.appendTypeRef(propertyDeclaration, builder, propertyDeclaration.toTypeRef(true), typeRefMask(flags));

        builder.append(" ");
        builder.append(propertyDeclaration.getName());
    }
    return builder.toString();
}
项目:consulo-csharp    文件:CSharpElementPresentationUtil.java   
private static int typeRefMask(int flags)
{
    if(BitUtil.isSet(flags, NON_QUALIFIED_TYPE))
    {
        return CSharpTypeRefPresentationUtil.TYPE_KEYWORD;
    }
    return CSharpTypeRefPresentationUtil.QUALIFIED_NAME_WITH_KEYWORD;
}
项目:consulo-dotnet    文件:MsilModifierListStub.java   
public MsilModifierListStub(StubElement parent, IStubElementType elementType, MsilModifierList modifiers)
{
    super(parent, elementType);

    int mod = 0;
    for(DotNetModifier dotNetModifier : modifiers.getModifiers())
    {
        mod |= BitUtil.set(mod, getMask((MsilModifierElementType) dotNetModifier), true);
    }
    myModifiers = mod;
}
项目:consulo-dotnet    文件:MsilGenericParameterStub.java   
public static int toModifiers(MsilGenericParameter parameter)
{
    int i = 0;
    i = BitUtil.set(i, COVARIANT, parameter.hasModifier(DotNetModifier.COVARIANT));
    i = BitUtil.set(i, CONTRAVARIANT, parameter.hasModifier(DotNetModifier.CONTRAVARIANT));
    i = BitUtil.set(i, HAS_DEFAULT_CONSTRUCTOR, parameter.hasDefaultConstructor());
    return i;
}