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


Java ChooseByNamePopup类代码示例

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


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

示例1: calcPopupElements

import com.intellij.ide.util.gotoByName.ChooseByNamePopup; //导入依赖的package包/类
private List<Object> calcPopupElements(ChooseByNamePopup popup, String text, boolean checkboxState) {
    List<Object> elements = new ArrayList<>();
    CountDownLatch latch = new CountDownLatch(1);
    SwingUtilities.invokeLater(() ->
            popup.scheduleCalcElements(text, checkboxState, ModalityState.NON_MODAL,
                    set -> {
                        elements.addAll(set);
                        latch.countDown();
                    }));
    try {
        if (!latch.await(10, TimeUnit.SECONDS)) {
            Assert.fail();
        }
    } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
    }
    return elements;
}
 
开发者ID:protostuff,项目名称:protobuf-jetbrains-plugin,代码行数:19,代码来源:GoToClassTest.java

示例2: gotoActionPerformed

import com.intellij.ide.util.gotoByName.ChooseByNamePopup; //导入依赖的package包/类
@Override
public void gotoActionPerformed(@NotNull final AnActionEvent e) {
  final Project project = e.getData(CommonDataKeys.PROJECT);
  final Component component = e.getData(PlatformDataKeys.CONTEXT_COMPONENT);
  Editor editor = e.getData(CommonDataKeys.EDITOR);
  PsiFile file = e.getData(CommonDataKeys.PSI_FILE);

  FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.popup.action");
  GotoActionModel model = new GotoActionModel(project, component, editor, file);
  GotoActionCallback<Object> callback = new GotoActionCallback<Object>() {
    @Override
    public void elementChosen(@NotNull ChooseByNamePopup popup, @NotNull Object element) {
      String enteredText = popup.getTrimmedText();
      openOptionOrPerformAction(((GotoActionModel.MatchedValue)element).value, enteredText, project, component, e);
    }
  };

  Pair<String, Integer> start = getInitialText(false, e);
  showNavigationPopup(callback, null, createPopup(project, model, start.first, start.second, component, e), false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:GotoActionAction.java

示例3: processOptionInplace

import com.intellij.ide.util.gotoByName.ChooseByNamePopup; //导入依赖的package包/类
private static boolean processOptionInplace(Object value, ChooseByNamePopup popup, Component component, AnActionEvent e) {
  if (value instanceof BooleanOptionDescription) {
    BooleanOptionDescription option = (BooleanOptionDescription)value;
    option.setOptionState(!option.isOptionEnabled());
    repaint(popup);
    return true;
  }
  else if (value instanceof GotoActionModel.ActionWrapper) {
    AnAction action = ((GotoActionModel.ActionWrapper)value).getAction();
    if (action instanceof ToggleAction) {
      performAction(action, component, e);
      repaint(popup);
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GotoActionAction.java

示例4: filterElements

import com.intellij.ide.util.gotoByName.ChooseByNamePopup; //导入依赖的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

示例5: elementChosen

import com.intellij.ide.util.gotoByName.ChooseByNamePopup; //导入依赖的package包/类
@Override
public void elementChosen(final ChooseByNamePopup popup, final Object element) {
    if (element == null) return;
    ApplicationManager.getApplication().invokeLater(new Runnable() {
        @Override
        public void run() {
            if (!(element instanceof PomWrapper)) {
                return;
            }
            PomWrapper wrapper = (PomWrapper) element;
            if (wrapper.getVirtualFile() == null) return;
            Navigatable n = new OpenFileDescriptor(project, wrapper.getVirtualFile(), popup.getLinePosition(),
                    popup.getColumnPosition()).setUseCurrentWindow(popup.isOpenInCurrentWindowRequested());

            if (!n.canNavigate()) return;
            n.navigate(true);
        }
    }, ModalityState.NON_MODAL);
}
 
开发者ID:shlxue,项目名称:MvnRunner,代码行数:20,代码来源:GotoPomAction.java

示例6: gotoActionPerformed

import com.intellij.ide.util.gotoByName.ChooseByNamePopup; //导入依赖的package包/类
@Override
public void gotoActionPerformed(final AnActionEvent e) {
  final Project project = e.getData(PlatformDataKeys.PROJECT);
  final Component component = e.getData(PlatformDataKeys.CONTEXT_COMPONENT);

  FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.popup.action");
  final GotoActionModel model = new GotoActionModel(project, component);
  final GotoActionCallback<Object> callback = new GotoActionCallback<Object>() {
    @Override
    public void elementChosen(ChooseByNamePopup popup, final Object element) {
      final String enteredText = popup.getEnteredText();
      openOptionOrPerformAction(element, enteredText, project, component, e);
    }
  };

  Pair<String, Integer> start = getInitialText(false, e);
  showNavigationPopup(callback, null, createPopup(project, model, start.first, start.second));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:GotoActionAction.java

示例7: CurrentInputText

import com.intellij.ide.util.gotoByName.ChooseByNamePopup; //导入依赖的package包/类
CurrentInputText(Project project) {
  ChooseByNamePopup chooseByNamePopup =
      project.getUserData(ChooseByNamePopup.CHOOSE_BY_NAME_POPUP_IN_PROJECT_KEY);
  if (chooseByNamePopup == null) {
    buildDir = null;
    hasBuildRule = false;
    return;
  }
  String currentText =
      chooseByNamePopup
          .getEnteredText()
          // Remove the begining //
          .replaceFirst("^/*", "");

  // check if we have as input a proper target
  int targetSeparatorIndex = currentText.lastIndexOf(TARGET_NAME_SEPARATOR);
  if (targetSeparatorIndex != -1) {
    hasBuildRule = true;
    buildDir = currentText.substring(0, targetSeparatorIndex);
  } else {
    hasBuildRule = false;
    buildDir = currentText;
  }
}
 
开发者ID:facebook,项目名称:buck,代码行数:25,代码来源:ChooseTargetContributor.java

示例8: gotoActionPerformed

import com.intellij.ide.util.gotoByName.ChooseByNamePopup; //导入依赖的package包/类
@Override
public void gotoActionPerformed(@Nonnull final AnActionEvent e) {
  final Project project = e.getData(CommonDataKeys.PROJECT);
  final Component component = e.getData(PlatformDataKeys.CONTEXT_COMPONENT);
  Editor editor = e.getData(CommonDataKeys.EDITOR);
  PsiFile file = e.getData(CommonDataKeys.PSI_FILE);

  FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.popup.action");
  GotoActionModel model = new GotoActionModel(project, component, editor, file);
  GotoActionCallback<Object> callback = new GotoActionCallback<Object>() {
    @Override
    public void elementChosen(@Nonnull ChooseByNamePopup popup, @Nonnull Object element) {
      String enteredText = popup.getEnteredText();
      openOptionOrPerformAction(((GotoActionModel.MatchedValue)element).value, enteredText, project, component, e);
    }
  };

  Pair<String, Integer> start = getInitialText(false, e);
  showNavigationPopup(callback, null, createPopup(project, model, start.first, start.second, component, e), false);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:GotoActionAction.java

示例9: actionPerformed

import com.intellij.ide.util.gotoByName.ChooseByNamePopup; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  final Module module = e.getData(LangDataKeys.MODULE);
  if (module == null) return;
  final Project project = module.getProject();
  final ListChooseByNameModel<SetupTask> model = new ListChooseByNameModel<SetupTask>(project, "Enter setup.py task name",
                                                                                      "No tasks found",
                                                                                      SetupTaskIntrospector.getTaskList(module));
  final ChooseByNamePopup popup = ChooseByNamePopup.createPopup(project, model, GotoActionBase.getPsiContext(e));
  popup.setShowListForEmptyPattern(true);

  popup.invoke(new ChooseByNamePopupComponent.Callback() {
    public void onClose() {
    }

    public void elementChosen(Object element) {
      if (element != null) {
        final SetupTask task = (SetupTask) element;
        ApplicationManager.getApplication().invokeLater(new Runnable() {
          public void run() {
            runSetupTask(task.getName(), module);
          }
        }, ModalityState.NON_MODAL);
      }
    }
  }, ModalityState.current(), false);

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:SetupTaskChooserAction.java

示例10: gotoActionPerformed

import com.intellij.ide.util.gotoByName.ChooseByNamePopup; //导入依赖的package包/类
@Override
protected void gotoActionPerformed(AnActionEvent e) {
  final Project project = e.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    return;
  }

  final ChooseTargetModel model = new ChooseTargetModel(project);
  GotoActionCallback<BuckBuildTarget> callback = new GotoActionCallback<BuckBuildTarget>() {
    @Override
    public void elementChosen(ChooseByNamePopup chooseByNamePopup, Object element) {
      if (element == null) {
        return;
      }

      BuckSettingsProvider buckSettingsProvider = BuckSettingsProvider.getInstance();
      if (buckSettingsProvider == null || buckSettingsProvider.getState() == null) {
        return;
      }

      ChooseTargetItem item = (ChooseTargetItem) element;
      if (buckSettingsProvider.getState().lastAlias != null) {
        buckSettingsProvider.getState().lastAlias.put(
            project.getBasePath(), item.getBuildTarget());
      }
      BuckToolWindowFactory.updateBuckToolWindowTitle(project);
    }
  };

  DefaultChooseByNameItemProvider provider =
      new DefaultChooseByNameItemProvider(getPsiContext(e));
  showNavigationPopup(e, model, callback, "Choose Build Target", true, false, provider);
}
 
开发者ID:wangyanxing,项目名称:Buck-IntelliJ-Plugin,代码行数:34,代码来源:ChooseTargetAction.java

示例11: showNavigationPopup

import com.intellij.ide.util.gotoByName.ChooseByNamePopup; //导入依赖的package包/类
protected <T> void showNavigationPopup(AnActionEvent e,
                                       ChooseByNameModel model,
                                       final GotoActionCallback<T> callback,
                                       @Nullable final String findUsagesTitle,
                                       boolean useSelectionFromEditor) {
  final Project project = e.getData(PlatformDataKeys.PROJECT);
  boolean mayRequestOpenInCurrentWindow = model.willOpenEditor() && FileEditorManagerEx.getInstanceEx(project).hasSplitOrUndockedWindows();
  Pair<String, Integer> start = getInitialText(useSelectionFromEditor, e);
  showNavigationPopup(callback, findUsagesTitle,
                      ChooseByNamePopup.createPopup(project, model, getPsiContext(e), start.first,
                                                    mayRequestOpenInCurrentWindow, start.second));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:GotoActionBase.java

示例12: createPopup

import com.intellij.ide.util.gotoByName.ChooseByNamePopup; //导入依赖的package包/类
private static ChooseByNamePopup createPopup(Project project, GotoActionModel model, String initialText, int initialIndex) {
  return ChooseByNamePopup.createPopup(project,
                                       model,
                                       new DefaultChooseByNameItemProvider(null) {
                                         @Override
                                         protected void sortNamesList(@NotNull String namePattern, @NotNull List<MatchResult> namesList) {
                                           Collections.sort(namesList, ELEMENTS_COMPARATOR);
                                         }
                                       },
                                       initialText,
                                       false,
                                       initialIndex);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:GotoActionAction.java

示例13: getBuildTargetFromBuildProjectFile

import com.intellij.ide.util.gotoByName.ChooseByNamePopup; //导入依赖的package包/类
private List<String> getBuildTargetFromBuildProjectFile(Project project, String buildDir) {
  List<String> names = new ArrayList<>();
  names.add(getAllBuildTargetsInSameDirectory(buildDir));
  names.addAll(
      BuckQueryAction.execute(
          project,
          "//" + buildDir + TARGET_NAME_SEPARATOR,
          new Function<List<String>, Void>() {
            @Nullable
            @Override
            public Void apply(@Nullable List<String> strings) {
              ApplicationManager.getApplication()
                  .invokeLater(
                      new Runnable() {
                        public void run() {
                          ChooseByNamePopup chooseByNamePopup =
                              project.getUserData(
                                  ChooseByNamePopup.CHOOSE_BY_NAME_POPUP_IN_PROJECT_KEY);
                          // the user might have closed the window
                          if (chooseByNamePopup != null) {
                            // if we don't have them, just refresh the view when we do, if the
                            // window is still open
                            chooseByNamePopup.rebuildList(true);
                          }
                        }
                      });
              return null;
            }
          }));
  return names;
}
 
开发者ID:facebook,项目名称:buck,代码行数:32,代码来源:ChooseTargetContributor.java

示例14: create

import com.intellij.ide.util.gotoByName.ChooseByNamePopup; //导入依赖的package包/类
public SearchStringFilter create(ChooseByNamePopup popup, SearchStringModel model) {
    return new SearchStringFilter(popup, model, project);
}
 
开发者ID:konifar,项目名称:android-strings-search-plugin,代码行数:4,代码来源:SearchStringFilterFactory.java

示例15: SearchStringFilter

import com.intellij.ide.util.gotoByName.ChooseByNamePopup; //导入依赖的package包/类
private SearchStringFilter(ChooseByNamePopup popup, SearchStringModel model, Project project) {
    super(popup, model, SearchStringConfiguration.getInstance(project), project);
}
 
开发者ID:konifar,项目名称:android-strings-search-plugin,代码行数:4,代码来源:SearchStringFilterFactory.java


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