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


Java SelectInTarget.canSelect方法代码示例

本文整理汇总了Java中com.intellij.ide.SelectInTarget.canSelect方法的典型用法代码示例。如果您正苦于以下问题:Java SelectInTarget.canSelect方法的具体用法?Java SelectInTarget.canSelect怎么用?Java SelectInTarget.canSelect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.ide.SelectInTarget的用法示例。


在下文中一共展示了SelectInTarget.canSelect方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: selectElementFromEditor

import com.intellij.ide.SelectInTarget; //导入方法依赖的package包/类
@Override
protected void selectElementFromEditor(@Nonnull FileEditor editor) {
  final VirtualFile file = FileEditorManagerEx.getInstanceEx(myProject).getFile(editor);
  if (file != null) {
    final PsiFile psiFile = PsiManager.getInstance(myProject).findFile(file);
    if (psiFile != null) {
      final SelectInTarget target = mySelectInTarget;
      if (target != null) {
        final SelectInContext selectInContext = SelectInContextImpl.createEditorContext(myProject, editor);

        if (target.canSelect(selectInContext)) {
          target.selectIn(selectInContext, false);
        }
      }
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:FavoritesAutoscrollFromSourceHandler.java

示例2: canSelect

import com.intellij.ide.SelectInTarget; //导入方法依赖的package包/类
@Override
public boolean canSelect(SelectInContext context) {
  ProjectView projectView = ProjectView.getInstance(context.getProject());
  Collection<SelectInTarget> targets = projectView.getSelectInTargets();
  for (SelectInTarget projectViewTarget : targets) {
    if (projectViewTarget.canSelect(context)) return true;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ProjectViewSelectInGroupTarget.java

示例3: selectIn

import com.intellij.ide.SelectInTarget; //导入方法依赖的package包/类
@Override
public void selectIn(final SelectInContext context, final boolean requestFocus) {
  ProjectView projectView = ProjectView.getInstance(context.getProject());
  Collection<SelectInTarget> targets = projectView.getSelectInTargets();
  Collection<SelectInTarget> targetsToCheck = new LinkedHashSet<SelectInTarget>();
  String currentId = projectView.getCurrentViewId();
  for (SelectInTarget projectViewTarget : targets) {
    if (Comparing.equal(currentId, projectViewTarget.getMinorViewId())) {
      targetsToCheck.add(projectViewTarget);
      break;
    }
  }
  targetsToCheck.addAll(targets);
  for (final SelectInTarget target : targetsToCheck) {
    if (target.canSelect(context)) {
      if (requestFocus) {
        IdeFocusManager.getInstance(context.getProject()).requestFocus(new FocusCommand() {
          @NotNull
          @Override
          public ActionCallback run() {
            target.selectIn(context, requestFocus);
            return ActionCallback.DONE;
          }
        }, true);
      }
      else {
        target.selectIn(context, requestFocus);
      }
      break;
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:ProjectViewSelectInGroupTarget.java

示例4: selectIn

import com.intellij.ide.SelectInTarget; //导入方法依赖的package包/类
@Override
public void selectIn(final SelectInContext context, final boolean requestFocus) {
  ProjectView projectView = ProjectView.getInstance(context.getProject());
  Collection<SelectInTarget> targets = projectView.getSelectInTargets();
  Collection<SelectInTarget> targetsToCheck = new LinkedHashSet<SelectInTarget>();
  String currentId = projectView.getCurrentViewId();
  for (SelectInTarget projectViewTarget : targets) {
    if (Comparing.equal(currentId, projectViewTarget.getMinorViewId())) {
      targetsToCheck.add(projectViewTarget);
      break;
    }
  }
  targetsToCheck.addAll(targets);
  for (final SelectInTarget target : targetsToCheck) {
    if (target.canSelect(context)) {
      if (requestFocus) {
        IdeFocusManager.getInstance(context.getProject()).requestFocus(new FocusCommand() {
          @NotNull
          @Override
          public ActionCallback run() {
            target.selectIn(context, requestFocus);
            return new ActionCallback.Done();
          }
        }, true);
      }
      else {
        target.selectIn(context, requestFocus);
      }
      break;
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:33,代码来源:ProjectViewSelectInGroupTarget.java

示例5: navigateInProjectView

import com.intellij.ide.SelectInTarget; //导入方法依赖的package包/类
private void navigateInProjectView(boolean requestFocus) {
  SelectInContext context = new SelectInContext() {
    @Override
    @Nonnull
    public Project getProject() {
      return myProject;
    }

    @Override
    @Nonnull
    public VirtualFile getVirtualFile() {
      return myFile;
    }

    @Override
    @Nullable
    public Object getSelectorInFile() {
      return null;
    }
  };

  for (SelectInTarget target : SelectInManager.getInstance(myProject).getTargets()) {
    if (target.canSelect(context)) {
      target.selectIn(context, requestFocus);
      return;
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:29,代码来源:OpenFileDescriptor.java


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