当前位置: 首页>>代码示例>>Java>>正文


Java ChooseByNameBase类代码示例

本文整理汇总了Java中com.intellij.ide.util.gotoByName.ChooseByNameBase的典型用法代码示例。如果您正苦于以下问题:Java ChooseByNameBase类的具体用法?Java ChooseByNameBase怎么用?Java ChooseByNameBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ChooseByNameBase类属于com.intellij.ide.util.gotoByName包,在下文中一共展示了ChooseByNameBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: filterElements

import com.intellij.ide.util.gotoByName.ChooseByNameBase; //导入依赖的package包/类
@Override
public boolean filterElements(@NotNull ChooseByNameBase base, @NotNull String pattern, boolean everywhere, @NotNull ProgressIndicator indicator, @NotNull Processor<Object> consumer) {
    Collection<SearchResultElement> elements = getAllFilterItems();

    if (elements != null) {
        for (SearchResultElement element : elements) {
            String value = element.getValue();

            if (value == null) {
                return false;
            }

            if (value.toLowerCase().contains(pattern.toLowerCase()) && !consumer.process(element)) {
                return false;
            }
        }
    }

    return false;
}
 
开发者ID:hoai265,项目名称:SearchResourcePlugin,代码行数:21,代码来源:SearchResultItemProvider.java

示例2: filterElements

import com.intellij.ide.util.gotoByName.ChooseByNameBase; //导入依赖的package包/类
@Override
public boolean filterElements(@NotNull ChooseByNameBase base,
                              @NotNull String pattern,
                              boolean everywhere,
                              @NotNull ProgressIndicator indicator,
                              @NotNull Processor<Object> consumer) {
    Collection<StringElement> elements = ((SearchStringModel) base.getModel()).getFilterItems();

    if (elements != null) {
        for (StringElement element : elements) {
            String value = element.getValue();

            if (value == null) {
                return false;
            }

            if (value.toLowerCase().contains(pattern.toLowerCase()) && !consumer.process(element)) {
                return false;
            }
        }
    }

    return false;
}
 
开发者ID:konifar,项目名称:android-strings-search-plugin,代码行数:25,代码来源:SearchStringItemProvider.java

示例3: filterElements

import com.intellij.ide.util.gotoByName.ChooseByNameBase; //导入依赖的package包/类
@Override
public boolean filterElements(@NotNull ChooseByNameBase base,
                              @NotNull String pattern,
                              boolean everywhere,
                              @NotNull ProgressIndicator indicator,
                              @NotNull Processor<Object> consumer) {
  if (pattern.contains("/") || pattern.contains("\\")) {
    String path = FileUtil.toSystemIndependentName(ChooseByNamePopup.getTransformedPattern(pattern, myModel));
    VirtualFile vFile = LocalFileSystem.getInstance().findFileByPathIfCached(path);
    if (vFile != null) {
      ProjectFileIndex index = ProjectFileIndex.SERVICE.getInstance(myProject);
      if (index.isInContent(vFile) || index.isInLibraryClasses(vFile) || index.isInLibrarySource(vFile)) {
        PsiFileSystemItem fileOrDir = vFile.isDirectory() ?
                                      PsiManager.getInstance(myProject).findDirectory(vFile) :
                                      PsiManager.getInstance(myProject).findFile(vFile);
        if (fileOrDir != null && !consumer.process(fileOrDir)) {
          return false;
        }
      }
    }
  }

  return super.filterElements(base, pattern, everywhere, indicator, consumer);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:GotoFileItemProvider.java

示例4: filterElements

import com.intellij.ide.util.gotoByName.ChooseByNameBase; //导入依赖的package包/类
@Override
public boolean filterElements(@Nonnull ChooseByNameBase base,
                              @Nonnull String pattern,
                              boolean everywhere,
                              @Nonnull ProgressIndicator indicator,
                              @Nonnull Processor<Object> consumer) {
  if (pattern.contains("/") || pattern.contains("\\")) {
    VirtualFile vFile = LocalFileSystem.getInstance().findFileByPathIfCached(FileUtil.toSystemIndependentName(pattern));
    if (vFile != null) {
      ProjectFileIndex index = ProjectFileIndex.SERVICE.getInstance(myProject);
      if (index.isInContent(vFile) || index.isInLibraryClasses(vFile) || index.isInLibrarySource(vFile)) {
        PsiFileSystemItem fileOrDir = vFile.isDirectory() ?
                                      PsiManager.getInstance(myProject).findDirectory(vFile) :
                                      PsiManager.getInstance(myProject).findFile(vFile);
        if (fileOrDir != null && !consumer.process(fileOrDir)) {
          return false;
        }
      }
    }
  }

  return super.filterElements(base, pattern, everywhere, indicator, consumer);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:GotoFileItemProvider.java

示例5: createToolWindow

import com.intellij.ide.util.gotoByName.ChooseByNameBase; //导入依赖的package包/类
@Override
public void createToolWindow(PsiElement element, PsiElement originalElement) {
  super.createToolWindow(element, originalElement);

  if (myToolWindow != null) {
    myToolWindow.getComponent().putClientProperty(ChooseByNameBase.TEMPORARILY_FOCUSABLE_COMPONENT_KEY, Boolean.TRUE);
    
    if (myRestorePopupAction != null) {
      ShortcutSet quickDocShortcut = ActionManager.getInstance().getAction(IdeActions.ACTION_QUICK_JAVADOC).getShortcutSet();
      myRestorePopupAction.registerCustomShortcutSet(quickDocShortcut, myToolWindow.getComponent());
      myRestorePopupAction = null;
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:DocumentationManager.java

示例6: beforeShown

import com.intellij.ide.util.gotoByName.ChooseByNameBase; //导入依赖的package包/类
@Override
public void beforeShown(final LightweightWindowEvent windowEvent) {
  final Lookup activeLookup = LookupManager.getInstance(myProject).getActiveLookup();
  if (activeLookup != null) {
    activeLookup.addLookupListener(new LookupAdapter() {
      @Override
      public void currentItemChanged(LookupEvent event) {
        if (windowEvent.asPopup().isVisible()) { //was not canceled yet
          final LookupElement item = event.getItem();
          if (item != null) {
            PsiElement targetElement = CompletionUtil.getTargetElement(item);
            if (targetElement == null) {
              targetElement = DocumentationManager.getInstance(myProject).getElementFromLookup(activeLookup.getEditor(), activeLookup.getPsiFile());
            }

            updatePopup(targetElement); //open next
          }
        } else {
          activeLookup.removeLookupListener(this);
        }
      }
    });
  }
  else {
    final Component focusedComponent = WindowManagerEx.getInstanceEx().getFocusedComponent(myProject);
    boolean fromQuickSearch = focusedComponent != null && focusedComponent.getParent() instanceof ChooseByNameBase.JPanelProvider;
    if (fromQuickSearch) {
      ChooseByNameBase.JPanelProvider panelProvider = (ChooseByNameBase.JPanelProvider)focusedComponent.getParent();
      panelProvider.registerHint(windowEvent.asPopup());
    }
    else if (focusedComponent instanceof JComponent) {
      HintUpdateSupply supply = HintUpdateSupply.getSupply((JComponent)focusedComponent);
      if (supply != null) supply.registerHint(windowEvent.asPopup());
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:PopupUpdateProcessor.java

示例7: processTasks

import com.intellij.ide.util.gotoByName.ChooseByNameBase; //导入依赖的package包/类
private boolean processTasks(List<Task> tasks, Processor<Object> consumer, ProgressIndicator cancelled) {
  if (!tasks.isEmpty() && !consumer.process(ChooseByNameBase.NON_PREFIX_SEPARATOR)) {
    return false;
  }
  PsiManager psiManager = PsiManager.getInstance(myProject);
  for (Task task : tasks) {
    cancelled.checkCanceled();
    if (!consumer.process(new TaskPsiElement(psiManager, task))) return false;
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:TaskItemProvider.java

示例8: getListCellRendererComponent

import com.intellij.ide.util.gotoByName.ChooseByNameBase; //导入依赖的package包/类
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean sel, boolean focus) {
  final JPanel panel = new JPanel(new BorderLayout());
  panel.setOpaque(true);

  final Color bg = sel ? UIUtil.getListSelectionBackground() : UIUtil.getListBackground();
  final Color fg = sel ? UIUtil.getListSelectionForeground() : UIUtil.getListForeground();
  panel.setBackground(bg);
  panel.setForeground(fg);

  SimpleTextAttributes attr = sel ? SELECTED : PLAIN;
  if (value instanceof InspectionToolWrapper) {
    final InspectionToolWrapper toolWrapper = (InspectionToolWrapper)value;
    final SimpleColoredComponent c = new SimpleColoredComponent();
    SpeedSearchUtil.appendColoredFragmentForMatcher("  " + toolWrapper.getDisplayName(), c, attr, myMatcher, bg, sel);
    panel.add(c, BorderLayout.WEST);

    final SimpleColoredComponent group = new SimpleColoredComponent();
    SpeedSearchUtil.appendColoredFragmentForMatcher(toolWrapper.getGroupDisplayName() + "  ", group, attr, myMatcher, bg, sel);
    final JPanel right = new JPanel(new BorderLayout());
    right.setBackground(bg);
    right.setForeground(fg);
    right.add(group, BorderLayout.CENTER);
    final JLabel icon = new JLabel(getIcon(toolWrapper));
    icon.setBackground(bg);
    icon.setForeground(fg);
    right.add(icon, BorderLayout.EAST);
    panel.add(right, BorderLayout.EAST);
  }
  else {
    // E.g. "..." item
    return value == ChooseByNameBase.NON_PREFIX_SEPARATOR ? ChooseByNameBase.renderNonPrefixSeparatorComponent(UIUtil.getListBackground()) :
           super.getListCellRendererComponent(list, value, index, sel, focus);
  }

  return panel;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:38,代码来源:InspectionListCellRenderer.java

示例9: beforeShown

import com.intellij.ide.util.gotoByName.ChooseByNameBase; //导入依赖的package包/类
@Override
public void beforeShown(final LightweightWindowEvent windowEvent) {
  final Lookup activeLookup = LookupManager.getInstance(myProject).getActiveLookup();
  if (activeLookup != null) {
    activeLookup.addLookupListener(new LookupAdapter() {
      @Override
      public void currentItemChanged(LookupEvent event) {
        if (windowEvent.asPopup().isVisible()) { //was not canceled yet
          final LookupElement item = event.getItem();
          if (item != null) {
            PsiElement targetElement = CompletionUtil.getTargetElement(item);
            if (targetElement == null) {
              targetElement = DocumentationManager.getInstance(myProject).getElementFromLookup(activeLookup.getEditor(), activeLookup.getPsiFile());
            }

            updatePopup(targetElement); //open next
          }
        } else {
          activeLookup.removeLookupListener(this);
        }
      }
    });
  }
  else {
    final Component focusedComponent = WindowManagerEx.getInstanceEx().getFocusedComponent(myProject);
    boolean fromQuickSearch = focusedComponent != null && focusedComponent.getParent() instanceof ChooseByNameBase.JPanelProvider;
    if (fromQuickSearch) {
      ChooseByNameBase.JPanelProvider panelProvider = (ChooseByNameBase.JPanelProvider)focusedComponent.getParent();
      panelProvider.registerHint(windowEvent.asPopup());
    } else if (focusedComponent != null) {
      if (focusedComponent instanceof JBListWithHintProvider) {
        ((JBListWithHintProvider)focusedComponent).registerHint(windowEvent.asPopup());
      } else if (focusedComponent instanceof JBTableWithHintProvider) {
        ((JBTableWithHintProvider)focusedComponent).registerHint(windowEvent.asPopup());
      } else if (focusedComponent instanceof JBTreeWithHintProvider) {
        ((JBTreeWithHintProvider)focusedComponent).registerHint(windowEvent.asPopup());
      }
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:41,代码来源:PopupUpdateProcessor.java

示例10: getListCellRendererComponent

import com.intellij.ide.util.gotoByName.ChooseByNameBase; //导入依赖的package包/类
@Override
public Component getListCellRendererComponent(JList jList, Object value, int i, boolean sel, boolean focus) {
    JPanel jPanel = new JPanel(new BorderLayout());
    jPanel.setOpaque(true);

    final Color bg = sel ? UIUtil.getListSelectionBackground() : UIUtil.getListBackground();
    final Color fg = sel ? UIUtil.getListSelectionForeground() : UIUtil.getListForeground();
    jPanel.setBackground(bg);
    jPanel.setForeground(fg);

    SimpleTextAttributes attr = sel ? SELECTED : PLAIN;
    if (value instanceof EmberItem) {
        EmberItem item = (EmberItem) value;
        final SimpleColoredComponent c = new SimpleColoredComponent();
        SpeedSearchUtil.appendColoredFragmentForMatcher("  " + item.getItemName(), c, attr, null, bg, sel);
        jPanel.add(c, BorderLayout.WEST);

        final SimpleColoredComponent group = new SimpleColoredComponent();
        SpeedSearchUtil.appendColoredFragmentForMatcher(item.getItemType() + "  ", group, attr, null, bg, sel);
        final JPanel right = new JPanel(new BorderLayout());
        right.setBackground(bg);
        right.setForeground(fg);
        right.add(group, BorderLayout.CENTER);
        jPanel.add(right, BorderLayout.EAST);
    }
    else {
        // E.g. "..." item
        return ChooseByNameBase.renderNonPrefixSeparatorComponent(UIUtil.getListBackground());
    }

    return jPanel;
}
 
开发者ID:kristianmandrup,项目名称:emberjs-plugin,代码行数:33,代码来源:GotoEmberModel.java

示例11: processTasks

import com.intellij.ide.util.gotoByName.ChooseByNameBase; //导入依赖的package包/类
private static boolean processTasks(List<Task> tasks,
                                    Processor<Object> consumer,
                                    boolean cachedTasksFound,
                                    ProgressIndicator cancelled,
                                    PsiManager psiManager) {
  if (!cachedTasksFound && !tasks.isEmpty() && !consumer.process(ChooseByNameBase.NON_PREFIX_SEPARATOR)) return false;

  for (Task task : tasks) {
    cancelled.checkCanceled();
    if (!consumer.process(new TaskPsiElement(psiManager, task))) return false;
  }
  return true;
}
 
开发者ID:consulo,项目名称:consulo-tasks,代码行数:14,代码来源:GotoTaskAction.java

示例12: createToolWindow

import com.intellij.ide.util.gotoByName.ChooseByNameBase; //导入依赖的package包/类
@Override
public void createToolWindow(PsiElement element, PsiElement originalElement) {
  super.createToolWindow(element, originalElement);

  if (myToolWindow != null) {
    myToolWindow.getComponent().putClientProperty(ChooseByNameBase.TEMPORARILY_FOCUSABLE_COMPONENT_KEY, Boolean.TRUE);

    if (myRestorePopupAction != null) {
      ShortcutSet quickDocShortcut = ActionManager.getInstance().getAction(IdeActions.ACTION_QUICK_JAVADOC).getShortcutSet();
      myRestorePopupAction.registerCustomShortcutSet(quickDocShortcut, myToolWindow.getComponent());
      myRestorePopupAction = null;
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:15,代码来源:DocumentationManager.java

示例13: fromQuickSearch

import com.intellij.ide.util.gotoByName.ChooseByNameBase; //导入依赖的package包/类
private boolean fromQuickSearch() {
  return myPreviouslyFocused != null && myPreviouslyFocused.getParent() instanceof ChooseByNameBase.JPanelProvider;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:DocumentationManager.java

示例14: value

import com.intellij.ide.util.gotoByName.ChooseByNameBase; //导入依赖的package包/类
@Override
public boolean value(final Project project) {
  final Component focusedComponent = WindowManagerEx.getInstanceEx().getFocusedComponent(project);
  boolean fromQuickSearch =  focusedComponent != null && focusedComponent.getParent() instanceof ChooseByNameBase.JPanelProvider;
  return !fromQuickSearch && LookupManager.getInstance(project).getActiveLookup() == null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:NotLookupOrSearchCondition.java

示例15: filterNames

import com.intellij.ide.util.gotoByName.ChooseByNameBase; //导入依赖的package包/类
@NotNull
@Override
public List<String> filterNames(@NotNull ChooseByNameBase base, @NotNull String[] names, @NotNull String pattern) {
  return ContainerUtil.emptyList();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:TaskItemProvider.java


注:本文中的com.intellij.ide.util.gotoByName.ChooseByNameBase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。