use of com.intellij.openapi.wm.ToolWindow in project intellij-community by JetBrains.
the class PythonConsoleToolWindow method doInit.
private void doInit(@NotNull final ToolWindow toolWindow) {
myInitialized = true;
toolWindow.setToHideOnEmptyContent(true);
((ToolWindowManagerEx) ToolWindowManager.getInstance(myProject)).addToolWindowManagerListener(new ToolWindowManagerListener() {
@Override
public void toolWindowRegistered(@NotNull String id) {
}
@Override
public void stateChanged() {
ToolWindow window = getToolWindow(myProject);
if (window != null) {
boolean visible = window.isVisible();
if (visible && toolWindow.getContentManager().getContentCount() == 0) {
PydevConsoleRunner runner = PythonConsoleRunnerFactory.getInstance().createConsoleRunner(myProject, null);
runner.run();
}
}
}
});
}
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 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 WorkingCopiesContent method show.
public static void show(@NotNull Project project) {
final ToolWindowManager manager = ToolWindowManager.getInstance(project);
if (manager != null) {
final ToolWindow window = manager.getToolWindow(ChangesViewContentManager.TOOLWINDOW_ID);
if (window != null) {
window.show(null);
final ContentManager cm = window.getContentManager();
final Content content = cm.findContent(TAB_NAME);
if (content != null) {
cm.setSelectedContent(content, true);
}
}
}
}
use of com.intellij.openapi.wm.ToolWindow in project intellij-community by JetBrains.
the class BrowseRepositoryAction method actionPerformed.
public void actionPerformed(AnActionEvent e) {
Project project = e.getData(CommonDataKeys.PROJECT);
if (project == null) {
RepositoryBrowserDialog dialog = new RepositoryBrowserDialog(ProjectManager.getInstance().getDefaultProject());
dialog.show();
} else {
ToolWindowManager manager = ToolWindowManager.getInstance(project);
ToolWindow w = manager.getToolWindow(REPOSITORY_BROWSER_TOOLWINDOW);
if (w == null) {
RepositoryToolWindowPanel component = new RepositoryToolWindowPanel(project);
w = manager.registerToolWindow(REPOSITORY_BROWSER_TOOLWINDOW, true, ToolWindowAnchor.BOTTOM, project, true);
final Content content = ContentFactory.SERVICE.getInstance().createContent(component, "", false);
Disposer.register(content, component);
w.getContentManager().addContent(content);
}
w.show(null);
w.activate(null);
}
}
Aggregations