use of com.intellij.openapi.wm.ex.ToolWindowManagerEx in project intellij-community by JetBrains.
the class HideAllToolWindowsAction method update.
public void update(AnActionEvent event) {
Presentation presentation = event.getPresentation();
Project project = event.getProject();
if (project == null) {
presentation.setEnabled(false);
return;
}
ToolWindowManagerEx toolWindowManager = ToolWindowManagerEx.getInstanceEx(project);
String[] ids = toolWindowManager.getToolWindowIds();
for (String id : ids) {
if (HideToolWindowAction.shouldBeHiddenByShortCut(toolWindowManager, id)) {
presentation.setEnabled(true);
presentation.setText(IdeBundle.message("action.hide.all.windows"), true);
return;
}
}
final DesktopLayout layout = toolWindowManager.getLayoutToRestoreLater();
if (layout != null) {
presentation.setEnabled(true);
presentation.setText(IdeBundle.message("action.restore.windows"));
return;
}
presentation.setEnabled(false);
}
use of com.intellij.openapi.wm.ex.ToolWindowManagerEx in project intellij-community by JetBrains.
the class HideAllToolWindowsAction method performAction.
public static void performAction(final Project project) {
ToolWindowManagerEx toolWindowManager = ToolWindowManagerEx.getInstanceEx(project);
DesktopLayout layout = new DesktopLayout();
layout.copyFrom(toolWindowManager.getLayout());
// to clear windows stack
toolWindowManager.clearSideStack();
//toolWindowManager.activateEditorComponent();
String[] ids = toolWindowManager.getToolWindowIds();
boolean hasVisible = false;
for (String id : ids) {
if (HideToolWindowAction.shouldBeHiddenByShortCut(toolWindowManager, id)) {
toolWindowManager.getToolWindow(id).hide(null);
hasVisible = true;
}
}
if (hasVisible) {
toolWindowManager.setLayoutToRestoreLater(layout);
toolWindowManager.activateEditorComponent();
} else {
final DesktopLayout restoredLayout = toolWindowManager.getLayoutToRestoreLater();
if (restoredLayout != null) {
toolWindowManager.setLayoutToRestoreLater(null);
toolWindowManager.setLayout(restoredLayout);
}
}
}
use of com.intellij.openapi.wm.ex.ToolWindowManagerEx in project intellij-community by JetBrains.
the class HideSideWindowsAction method actionPerformed.
public void actionPerformed(AnActionEvent e) {
Project project = e.getProject();
if (project == null) {
return;
}
ToolWindowManagerEx toolWindowManager = ToolWindowManagerEx.getInstanceEx(project);
String id = toolWindowManager.getActiveToolWindowId();
if (id == null) {
id = toolWindowManager.getLastActiveToolWindowId();
}
if (HideToolWindowAction.shouldBeHiddenByShortCut(toolWindowManager, id)) {
toolWindowManager.hideToolWindow(id, true);
}
}
use of com.intellij.openapi.wm.ex.ToolWindowManagerEx in project intellij-community by JetBrains.
the class HideToolWindowAction method update.
public void update(AnActionEvent event) {
Presentation presentation = event.getPresentation();
Project project = event.getProject();
if (project == null) {
presentation.setEnabled(false);
return;
}
ToolWindowManagerEx toolWindowManager = ToolWindowManagerEx.getInstanceEx(project);
String id = toolWindowManager.getActiveToolWindowId();
if (id == null) {
id = toolWindowManager.getLastActiveToolWindowId();
}
presentation.setEnabled(shouldBeHiddenByShortCut(toolWindowManager, id));
}
use of com.intellij.openapi.wm.ex.ToolWindowManagerEx in project android by JetBrains.
the class AndroidThemePreviewToolWindowManager method initToolWindow.
private void initToolWindow() {
myToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(TOOL_WINDOW_ID, false, ToolWindowAnchor.RIGHT, myProject, false);
myToolWindow.setIcon(AndroidIcons.ThemesPreview);
myToolWindow.setAvailable(false, null);
myToolWindow.setAutoHide(false);
// Add a listener so we only update the preview when it's visible
((ToolWindowManagerEx) ToolWindowManager.getInstance(myProject)).addToolWindowManagerListener(new ToolWindowManagerAdapter() {
@Override
public void stateChanged() {
if (myProject.isDisposed()) {
return;
}
final ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(TOOL_WINDOW_ID);
if (window != null && window.isAvailable()) {
final boolean visible = window.isVisible();
AndroidEditorSettings.getInstance().getGlobalState().setVisible(visible);
if (visible && !myIsToolWindowVisible) {
updatePreview();
}
myIsToolWindowVisible = visible;
}
}
});
}
Aggregations