use of com.intellij.ide.projectView.ProjectView in project intellij-community by JetBrains.
the class AbstractProjectViewPane method doSelectModuleOrGroup.
private void doSelectModuleOrGroup(final Object toSelect, final boolean requestFocus) {
ToolWindowManager windowManager = ToolWindowManager.getInstance(myProject);
final Runnable runnable = () -> {
ProjectView projectView = ProjectView.getInstance(myProject);
if (requestFocus) {
projectView.changeView(getId(), getSubId());
}
((BaseProjectTreeBuilder) getTreeBuilder()).selectInWidth(toSelect, requestFocus, node -> node instanceof AbstractModuleNode || node instanceof ModuleGroupNode || node instanceof AbstractProjectNode);
};
if (requestFocus) {
windowManager.getToolWindow(ToolWindowId.PROJECT_VIEW).activate(runnable);
} else {
runnable.run();
}
}
use of com.intellij.ide.projectView.ProjectView in project intellij-community by JetBrains.
the class AbstractProjectViewPane method installComparator.
public void installComparator(AbstractTreeBuilder treeBuilder) {
final ProjectView projectView = ProjectView.getInstance(myProject);
treeBuilder.setNodeDescriptorComparator(new GroupByTypeComparator(projectView, getId()));
}
use of com.intellij.ide.projectView.ProjectView in project intellij-community by JetBrains.
the class ProjectViewFixture method selectAndroidPane.
@NotNull
public PaneFixture selectAndroidPane() {
activate();
final ProjectView projectView = ProjectView.getInstance(myProject);
pause(new Condition("Project view is initialized") {
@Override
public boolean test() {
//noinspection ConstantConditions
return field("isInitialized").ofType(boolean.class).in(projectView).get();
}
}, SHORT_TIMEOUT);
final String id = "AndroidView";
GuiActionRunner.execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
projectView.changeView(id);
}
});
return new PaneFixture(projectView.getProjectViewPaneById(id));
}
use of com.intellij.ide.projectView.ProjectView in project intellij-community by JetBrains.
the class ProjectViewFixture method selectProjectPane.
@NotNull
public PaneFixture selectProjectPane() {
activate();
final ProjectView projectView = ProjectView.getInstance(myProject);
pause(new Condition("Project view is initialized") {
@Override
public boolean test() {
//noinspection ConstantConditions
return field("isInitialized").ofType(boolean.class).in(projectView).get();
}
}, SHORT_TIMEOUT);
final String id = "ProjectPane";
GuiActionRunner.execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
projectView.changeView(id);
}
});
return new PaneFixture(projectView.getProjectViewPaneById(id));
}
use of com.intellij.ide.projectView.ProjectView in project intellij-community by JetBrains.
the class ProjectViewSelectInGroupTarget method selectIn.
@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<>();
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;
}
}
}
Aggregations