Commit 2baac69a authored by Vladimir Krivosheev's avatar Vladimir Krivosheev
Browse files

request FileEditorManager on demand

parent 8a1b0f60
Showing with 25 additions and 128 deletions
+25 -128
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.designer; package com.intellij.designer;
import com.intellij.ide.util.PropertiesComponent; import com.intellij.ide.util.PropertiesComponent;
...@@ -49,7 +35,6 @@ public abstract class LightToolWindowManager implements Disposable { ...@@ -49,7 +35,6 @@ public abstract class LightToolWindowManager implements Disposable {
private final MergingUpdateQueue myWindowQueue = new MergingUpdateQueue(getComponentName(), 200, true, null, this); private final MergingUpdateQueue myWindowQueue = new MergingUpdateQueue(getComponentName(), 200, true, null, this);
protected final Project myProject; protected final Project myProject;
protected final FileEditorManager myFileEditorManager;
protected volatile ToolWindow myToolWindow; protected volatile ToolWindow myToolWindow;
private final PropertiesComponent myPropertiesComponent; private final PropertiesComponent myPropertiesComponent;
...@@ -59,9 +44,8 @@ public abstract class LightToolWindowManager implements Disposable { ...@@ -59,9 +44,8 @@ public abstract class LightToolWindowManager implements Disposable {
private MessageBusConnection myConnection; private MessageBusConnection myConnection;
protected LightToolWindowManager(Project project, FileEditorManager fileEditorManager) { protected LightToolWindowManager(Project project) {
myProject = project; myProject = project;
myFileEditorManager = fileEditorManager;
myPropertiesComponent = PropertiesComponent.getInstance(myProject); myPropertiesComponent = PropertiesComponent.getInstance(myProject);
myEditorModeKey = EDITOR_MODE + getComponentName() + ".STATE"; myEditorModeKey = EDITOR_MODE + getComponentName() + ".STATE";
...@@ -109,7 +93,7 @@ public abstract class LightToolWindowManager implements Disposable { ...@@ -109,7 +93,7 @@ public abstract class LightToolWindowManager implements Disposable {
@Nullable @Nullable
public DesignerEditorPanelFacade getActiveDesigner() { public DesignerEditorPanelFacade getActiveDesigner() {
for (FileEditor editor : myFileEditorManager.getSelectedEditors()) { for (FileEditor editor : FileEditorManager.getInstance(myProject).getSelectedEditors()) {
DesignerEditorPanelFacade designer = getDesigner(editor); DesignerEditorPanelFacade designer = getDesigner(editor);
if (designer != null) { if (designer != null) {
return designer; return designer;
...@@ -231,7 +215,7 @@ public abstract class LightToolWindowManager implements Disposable { ...@@ -231,7 +215,7 @@ public abstract class LightToolWindowManager implements Disposable {
private final Consumer<DesignerEditorPanelFacade> myDisposeAction = designer -> disposeContent(designer); private final Consumer<DesignerEditorPanelFacade> myDisposeAction = designer -> disposeContent(designer);
private void runUpdateContent(Consumer<? super DesignerEditorPanelFacade> action) { private void runUpdateContent(Consumer<? super DesignerEditorPanelFacade> action) {
for (FileEditor editor : myFileEditorManager.getAllEditors()) { for (FileEditor editor : FileEditorManager.getInstance(myProject).getAllEditors()) {
DesignerEditorPanelFacade designer = getDesigner(editor); DesignerEditorPanelFacade designer = getDesigner(editor);
if (designer != null) { if (designer != null) {
action.accept(designer); action.accept(designer);
......
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.designer; package com.intellij.designer;
import com.intellij.designer.palette.PaletteToolWindowManager; import com.intellij.designer.palette.PaletteToolWindowManager;
import com.intellij.openapi.fileEditor.FileEditor; import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ToolWindowAnchor; import com.intellij.openapi.wm.ToolWindowAnchor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
/** /**
* @author Alexander Lobas * @author Alexander Lobas
*/ */
public abstract class AbstractToolWindowManager extends LightToolWindowManager { public abstract class AbstractToolWindowManager extends LightToolWindowManager {
protected AbstractToolWindowManager(Project project, FileEditorManager fileEditorManager) { protected AbstractToolWindowManager(@NotNull Project project) {
super(project, fileEditorManager); super(project);
} }
@Nullable @Nullable
......
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.designer; package com.intellij.designer;
import com.intellij.designer.designSurface.DesignerEditorPanel; import com.intellij.designer.designSurface.DesignerEditorPanel;
import com.intellij.icons.AllIcons; import com.intellij.icons.AllIcons;
import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.wm.ToolWindowAnchor; import com.intellij.openapi.wm.ToolWindowAnchor;
...@@ -42,8 +27,8 @@ public final class DesignerToolWindowManager extends AbstractToolWindowManager { ...@@ -42,8 +27,8 @@ public final class DesignerToolWindowManager extends AbstractToolWindowManager {
// //
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
public DesignerToolWindowManager(Project project, FileEditorManager fileEditorManager) { public DesignerToolWindowManager(@NotNull Project project) {
super(project, fileEditorManager); super(project);
} }
public static DesignerToolWindow getInstance(DesignerEditorPanel designer) { public static DesignerToolWindow getInstance(DesignerEditorPanel designer) {
......
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.designer.palette; package com.intellij.designer.palette;
import com.intellij.designer.AbstractToolWindowManager; import com.intellij.designer.AbstractToolWindowManager;
...@@ -21,7 +7,6 @@ import com.intellij.designer.DesignerEditorPanelFacade; ...@@ -21,7 +7,6 @@ import com.intellij.designer.DesignerEditorPanelFacade;
import com.intellij.designer.LightToolWindow; import com.intellij.designer.LightToolWindow;
import com.intellij.designer.designSurface.DesignerEditorPanel; import com.intellij.designer.designSurface.DesignerEditorPanel;
import com.intellij.icons.AllIcons; import com.intellij.icons.AllIcons;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.wm.ToolWindowAnchor; import com.intellij.openapi.wm.ToolWindowAnchor;
...@@ -43,8 +28,8 @@ public class PaletteToolWindowManager extends AbstractToolWindowManager { ...@@ -43,8 +28,8 @@ public class PaletteToolWindowManager extends AbstractToolWindowManager {
// //
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
public PaletteToolWindowManager(Project project, FileEditorManager fileEditorManager) { public PaletteToolWindowManager(Project project) {
super(project, fileEditorManager); super(project);
} }
public static PalettePanel getInstance(DesignerEditorPanel designer) { public static PalettePanel getInstance(DesignerEditorPanel designer) {
......
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.ide.palette.impl; package com.intellij.ide.palette.impl;
import com.intellij.designer.DesignerEditorPanelFacade; import com.intellij.designer.DesignerEditorPanelFacade;
...@@ -22,7 +8,6 @@ import com.intellij.ide.IdeBundle; ...@@ -22,7 +8,6 @@ import com.intellij.ide.IdeBundle;
import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.DefaultActionGroup; import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.wm.ToolWindowAnchor; import com.intellij.openapi.wm.ToolWindowAnchor;
...@@ -40,8 +25,9 @@ import org.jetbrains.annotations.Nullable; ...@@ -40,8 +25,9 @@ import org.jetbrains.annotations.Nullable;
public class PaletteToolWindowManager extends AbstractToolWindowManager { public class PaletteToolWindowManager extends AbstractToolWindowManager {
private final PaletteWindow myToolWindowPanel; private final PaletteWindow myToolWindowPanel;
public PaletteToolWindowManager(Project project, FileEditorManager fileEditorManager) { public PaletteToolWindowManager(Project project) {
super(project, fileEditorManager); super(project);
myToolWindowPanel = ApplicationManager.getApplication().isHeadlessEnvironment() ? null : new PaletteWindow(project); myToolWindowPanel = ApplicationManager.getApplication().isHeadlessEnvironment() ? null : new PaletteWindow(project);
if (myToolWindowPanel != null) { if (myToolWindowPanel != null) {
Disposer.register(this, () -> myToolWindowPanel.dispose()); Disposer.register(this, () -> myToolWindowPanel.dispose());
......
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2018 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.uiDesigner; package com.intellij.uiDesigner;
import com.intellij.designer.DesignerEditorPanelFacade; import com.intellij.designer.DesignerEditorPanelFacade;
...@@ -20,7 +6,6 @@ import com.intellij.designer.LightToolWindowManager; ...@@ -20,7 +6,6 @@ import com.intellij.designer.LightToolWindowManager;
import com.intellij.designer.ToggleEditorModeAction; import com.intellij.designer.ToggleEditorModeAction;
import com.intellij.ide.palette.impl.PaletteToolWindowManager; import com.intellij.ide.palette.impl.PaletteToolWindowManager;
import com.intellij.openapi.fileEditor.FileEditor; import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ToolWindowAnchor; import com.intellij.openapi.wm.ToolWindowAnchor;
import com.intellij.uiDesigner.editor.UIFormEditor; import com.intellij.uiDesigner.editor.UIFormEditor;
...@@ -31,8 +16,8 @@ import org.jetbrains.annotations.Nullable; ...@@ -31,8 +16,8 @@ import org.jetbrains.annotations.Nullable;
* @author Alexander Lobas * @author Alexander Lobas
*/ */
public abstract class AbstractToolWindowManager extends LightToolWindowManager { public abstract class AbstractToolWindowManager extends LightToolWindowManager {
protected AbstractToolWindowManager(Project project, FileEditorManager fileEditorManager) { protected AbstractToolWindowManager(Project project) {
super(project, fileEditorManager); super(project);
} }
@Nullable @Nullable
......
/* // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.uiDesigner.propertyInspector; package com.intellij.uiDesigner.propertyInspector;
import com.intellij.designer.DesignerEditorPanelFacade; import com.intellij.designer.DesignerEditorPanelFacade;
...@@ -20,7 +6,6 @@ import com.intellij.designer.LightToolWindow; ...@@ -20,7 +6,6 @@ import com.intellij.designer.LightToolWindow;
import com.intellij.icons.AllIcons; import com.intellij.icons.AllIcons;
import com.intellij.openapi.Disposable; import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.wm.ToolWindowAnchor; import com.intellij.openapi.wm.ToolWindowAnchor;
...@@ -40,8 +25,9 @@ import org.jetbrains.annotations.Nullable; ...@@ -40,8 +25,9 @@ import org.jetbrains.annotations.Nullable;
public class DesignerToolWindowManager extends AbstractToolWindowManager implements Disposable { public class DesignerToolWindowManager extends AbstractToolWindowManager implements Disposable {
private final DesignerToolWindow myToolWindowPanel; private final DesignerToolWindow myToolWindowPanel;
public DesignerToolWindowManager(Project project, FileEditorManager fileEditorManager) { public DesignerToolWindowManager(@NotNull Project project) {
super(project, fileEditorManager); super(project);
myToolWindowPanel = ApplicationManager.getApplication().isHeadlessEnvironment() ? null : new DesignerToolWindow(project); myToolWindowPanel = ApplicationManager.getApplication().isHeadlessEnvironment() ? null : new DesignerToolWindow(project);
if (myToolWindowPanel != null) { if (myToolWindowPanel != null) {
Disposer.register(this, () -> myToolWindowPanel.dispose()); Disposer.register(this, () -> myToolWindowPanel.dispose());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment