use of com.intellij.openapi.wm.ToolWindow in project intellij-community by JetBrains.
the class StudyNavigator method navigateToTask.
public static void navigateToTask(@NotNull Project project, @NotNull Task task) {
for (VirtualFile file : FileEditorManager.getInstance(project).getOpenFiles()) {
FileEditorManager.getInstance(project).closeFile(file);
}
Map<String, TaskFile> taskFiles = task.getTaskFiles();
VirtualFile taskDir = task.getTaskDir(project);
if (taskDir == null) {
return;
}
VirtualFile srcDir = taskDir.findChild(EduNames.SRC);
if (srcDir != null) {
taskDir = srcDir;
}
if (taskFiles.isEmpty()) {
ProjectView.getInstance(project).select(taskDir, taskDir, false);
return;
}
VirtualFile fileToActivate = getFirstTaskFile(taskDir, project);
for (Map.Entry<String, TaskFile> entry : taskFiles.entrySet()) {
final TaskFile taskFile = entry.getValue();
if (taskFile.getActivePlaceholders().isEmpty()) {
continue;
}
VirtualFile virtualFile = taskDir.findFileByRelativePath(entry.getKey());
if (virtualFile == null) {
continue;
}
FileEditorManager.getInstance(project).openFile(virtualFile, true);
fileToActivate = virtualFile;
}
EduUsagesCollector.taskNavigation();
if (fileToActivate != null) {
updateProjectView(project, fileToActivate);
}
StudyUtils.selectFirstAnswerPlaceholder(StudyUtils.getSelectedStudyEditor(project), project);
ToolWindow runToolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.RUN);
if (runToolWindow != null) {
runToolWindow.hide(null);
}
}
use of com.intellij.openapi.wm.ToolWindow in project intellij-community by JetBrains.
the class SvnMergeSourceDetails method showMe.
public static void showMe(final Project project, final SvnFileRevision revision, final VirtualFile file) {
if (ModalityState.NON_MODAL.equals(ModalityState.current())) {
ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.VCS);
final ContentManager contentManager = toolWindow.getContentManager();
final MyDialog dialog = new MyDialog(project, revision, file);
// TODO: Temporary memory leak fix - rewrite this part not to create dialog if only createCenterPanel(), but not show() is invoked
Disposer.register(project, dialog.getDisposable());
Content content = ContentFactory.SERVICE.getInstance().createContent(dialog.createCenterPanel(), SvnBundle.message("merge.source.details.title", (file == null) ? revision.getURL() : file.getName(), revision.getRevisionNumber().asString()), true);
ContentsUtil.addOrReplaceContent(contentManager, content, true);
toolWindow.activate(null);
} else {
new MyDialog(project, revision, file).show();
}
}
use of com.intellij.openapi.wm.ToolWindow in project intellij-community by JetBrains.
the class ProblemsViewImpl method updateIcon.
private void updateIcon() {
UIUtil.invokeLaterIfNeeded(() -> {
if (!myProject.isDisposed()) {
final ToolWindow tw = ToolWindowManager.getInstance(myProject).getToolWindow(PROBLEMS_TOOLWINDOW_ID);
if (tw != null) {
final boolean active = myPanel.getErrorViewStructure().hasMessages(EnumSet.of(ErrorTreeElementKind.ERROR, ErrorTreeElementKind.WARNING, ErrorTreeElementKind.NOTE));
tw.setIcon(active ? myActiveIcon : myPassiveIcon);
}
}
});
}
use of com.intellij.openapi.wm.ToolWindow in project intellij-community by JetBrains.
the class InternalCompilerRefServiceView method createViewTab.
private static InternalCompilerRefServiceView createViewTab(PsiElement element) {
Project project = element.getProject();
final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
ToolWindow toolWindow = toolWindowManager.getToolWindow(TOOL_WINDOW_ID);
if (toolWindow == null) {
toolWindow = toolWindowManager.registerToolWindow(TOOL_WINDOW_ID, true, ToolWindowAnchor.TOP);
}
final InternalCompilerRefServiceView view = new InternalCompilerRefServiceView(project);
ToolWindow finalToolWindow = toolWindow;
toolWindow.activate(() -> {
final String text = SymbolPresentationUtil.getSymbolPresentableText(element);
final ContentImpl content = new ContentImpl(view, text, true);
finalToolWindow.getContentManager().addContent(content);
finalToolWindow.getContentManager().setSelectedContent(content, true);
});
return view;
}
use of com.intellij.openapi.wm.ToolWindow in project intellij-community by JetBrains.
the class ExternalSystemUtil method ensureToolWindowInitialized.
public static void ensureToolWindowInitialized(@NotNull Project project, @NotNull ProjectSystemId externalSystemId) {
try {
ToolWindowManager manager = ToolWindowManager.getInstance(project);
if (!(manager instanceof ToolWindowManagerEx)) {
return;
}
ToolWindowManagerEx managerEx = (ToolWindowManagerEx) manager;
String id = externalSystemId.getReadableName();
ToolWindow window = manager.getToolWindow(id);
if (window != null) {
return;
}
ToolWindowEP[] beans = Extensions.getExtensions(ToolWindowEP.EP_NAME);
for (final ToolWindowEP bean : beans) {
if (id.equals(bean.id)) {
managerEx.initToolWindow(bean);
}
}
} catch (Exception e) {
LOG.error(String.format("Unable to initialize %s tool window", externalSystemId.getReadableName()), e);
}
}
Aggregations