Search in sources :

Example 11 with ToolWindowAnchor

use of com.intellij.openapi.wm.ToolWindowAnchor in project intellij-community by JetBrains.

the class LightToolWindowManager method setEditorMode.

protected final void setEditorMode(@Nullable ToolWindowAnchor newState) {
    ToolWindowAnchor oldState = getEditorMode();
    myPropertiesComponent.setValue(myEditorModeKey, newState == null ? "ToolWindow" : newState.toString());
    if (oldState != null && newState != null) {
        runUpdateContent(myUpdateAnchorAction);
    } else if (newState != null) {
        removeListeners();
        updateToolWindow(null);
        runUpdateContent(myCreateAction);
    } else {
        runUpdateContent(myDisposeAction);
        initListeners();
        bindToDesigner(getActiveDesigner());
    }
}
Also used : ToolWindowAnchor(com.intellij.openapi.wm.ToolWindowAnchor)

Example 12 with ToolWindowAnchor

use of com.intellij.openapi.wm.ToolWindowAnchor in project android by JetBrains.

the class LayersManager method createContent.

@Override
protected LightToolWindow createContent(@NotNull DesignerEditorPanelFacade designer) {
    if (!(designer instanceof LayeredImageEditorPanel)) {
        return null;
    }
    LightToolWindow toolWindow = (LightToolWindow) designer.getClientProperty(getComponentName());
    if (toolWindow != null) {
        return toolWindow;
    }
    LayersPanel layersPanel = new LayersPanel();
    layersPanel.setImage(getImage(designer));
    PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(myProject);
    // When LightToolWindowManager#getEditorMode() is public (or a constructor which lets
    // me not specify it) is available and upstreamed, replace the following with just
    // anchor = getEditorMode() :
    String value = propertiesComponent.getValue(myEditorModeKey);
    ToolWindowAnchor anchor;
    if (value == null) {
        anchor = getAnchor();
    } else {
        anchor = value.equals("ToolWindow") ? null : ToolWindowAnchor.fromText(value);
    }
    ThreeComponentsSplitter contentSplitter = designer.getContentSplitter();
    if (contentSplitter.getInnerComponent() == null) {
        // This is a fix for http://b.android.com/219047
        return null;
    }
    return new LightToolWindow(layersPanel, "Image Layers", AllIcons.Toolwindows.ToolWindowPalette, layersPanel, layersPanel, contentSplitter, anchor, this, myProject, propertiesComponent, getVisibilityKeyName(designer), 200, null);
}
Also used : LightToolWindow(com.intellij.designer.LightToolWindow) ToolWindowAnchor(com.intellij.openapi.wm.ToolWindowAnchor) PropertiesComponent(com.intellij.ide.util.PropertiesComponent) ThreeComponentsSplitter(com.intellij.openapi.ui.ThreeComponentsSplitter)

Example 13 with ToolWindowAnchor

use of com.intellij.openapi.wm.ToolWindowAnchor in project android by JetBrains.

the class NlAbstractWindowManager method initToolWindow.

protected void initToolWindow(@NotNull final String id, @NotNull Icon icon) {
    myToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(id, false, getAnchor(), myProject, true);
    myToolWindow.setIcon(icon);
    myToolWindow.setAvailable(false, null);
    myToolWindow.setAutoHide(false);
    myPreviousWindowType = myToolWindow.getType();
    myPreviousWindowAnchor = getEditorMode();
    ((ToolWindowManagerEx) ToolWindowManager.getInstance(myProject)).addToolWindowManagerListener(new ToolWindowManagerAdapter() {

        @Override
        public void stateChanged() {
            if (myProject.isDisposed()) {
                return;
            }
            final ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(id);
            ToolWindowType newWindowType = window.getType();
            ToolWindowAnchor newWindowAnchor = getEditorMode();
            if (newWindowType != myPreviousWindowType || newWindowAnchor != myPreviousWindowAnchor) {
                // TODO: Report the window docking state
                NlUsageTrackerManager.getInstance(myDesignSurface).logAction(LayoutEditorEvent.LayoutEditorEventType.UNKNOWN_EVENT_TYPE);
                myPreviousWindowType = newWindowType;
                myPreviousWindowAnchor = newWindowAnchor;
            }
        }
    }, myProject);
    initGearActions();
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) LightToolWindow(com.intellij.designer.LightToolWindow) ToolWindowManagerAdapter(com.intellij.openapi.wm.ex.ToolWindowManagerAdapter) ToolWindowAnchor(com.intellij.openapi.wm.ToolWindowAnchor) ToolWindowType(com.intellij.openapi.wm.ToolWindowType) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Aggregations

ToolWindowAnchor (com.intellij.openapi.wm.ToolWindowAnchor)13 ToolWindow (com.intellij.openapi.wm.ToolWindow)3 LightToolWindow (com.intellij.designer.LightToolWindow)2 PropertiesComponent (com.intellij.ide.util.PropertiesComponent)1 ThreeComponentsSplitter (com.intellij.openapi.ui.ThreeComponentsSplitter)1 ToolWindowType (com.intellij.openapi.wm.ToolWindowType)1 ToolWindowEx (com.intellij.openapi.wm.ex.ToolWindowEx)1 ToolWindowManagerAdapter (com.intellij.openapi.wm.ex.ToolWindowManagerAdapter)1 ToolWindowManagerEx (com.intellij.openapi.wm.ex.ToolWindowManagerEx)1 AffineTransform (java.awt.geom.AffineTransform)1 BufferedImage (java.awt.image.BufferedImage)1 Nullable (org.jetbrains.annotations.Nullable)1