本文整理汇总了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);
}
}
}
}
}
示例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;
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}