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());
}
}
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);
}
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();
}
Aggregations