mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Rename package (class names conflict with ui-designer)
This commit is contained in:
+1
-1
@@ -19,7 +19,7 @@ import com.intellij.openapi.fileEditor.FileEditorState;
|
||||
import com.intellij.openapi.fileEditor.FileEditorStateLevel;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.uiDesigner.DesignerEditor;
|
||||
import com.intellij.designer.DesignerEditor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
<id>com.intellij.ui-designer-new</id>
|
||||
<vendor logo="/general/ijLogo.png">JetBrains</vendor>
|
||||
|
||||
<resource-bundle>messages.UIDesignerBundle</resource-bundle>
|
||||
<resource-bundle>messages.DesignerBundle</resource-bundle>
|
||||
|
||||
<depends>com.intellij.java-i18n</depends>
|
||||
<depends>com.intellij.properties</depends>
|
||||
|
||||
<project-components>
|
||||
<component>
|
||||
<implementation-class>com.intellij.uiDesigner.UIDesignerToolWindowManager</implementation-class>
|
||||
<implementation-class>com.intellij.designer.DesignerToolWindowManager</implementation-class>
|
||||
</component>
|
||||
</project-components>
|
||||
|
||||
|
||||
+4
-4
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.uiDesigner;
|
||||
package com.intellij.designer;
|
||||
|
||||
import com.intellij.CommonBundle;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -26,12 +26,12 @@ import java.util.ResourceBundle;
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class UIDesignerBundle {
|
||||
public class DesignerBundle {
|
||||
private static Reference<ResourceBundle> ourBundle;
|
||||
|
||||
@NonNls private static final String BUNDLE = "messages.UIDesignerBundle";
|
||||
@NonNls private static final String BUNDLE = "messages.DesignerBundle";
|
||||
|
||||
private UIDesignerBundle() {
|
||||
private DesignerBundle() {
|
||||
}
|
||||
|
||||
public static String message(@PropertyKey(resourceBundle = BUNDLE) String key, Object... params) {
|
||||
+8
-4
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.uiDesigner;
|
||||
package com.intellij.designer;
|
||||
|
||||
import com.intellij.codeHighlighting.BackgroundEditorHighlighter;
|
||||
import com.intellij.ide.structureView.StructureViewBuilder;
|
||||
@@ -25,7 +25,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.UserDataHolderBase;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.testFramework.LightVirtualFile;
|
||||
import com.intellij.uiDesigner.designSurface.DesignerEditorPanel;
|
||||
import com.intellij.designer.designSurface.DesignerEditorPanel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -48,14 +48,18 @@ public abstract class DesignerEditor extends UserDataHolderBase implements FileE
|
||||
myDesignerPanel = new DesignerEditorPanel(module, file);
|
||||
}
|
||||
|
||||
public final DesignerEditorPanel getDesignerPanel() {
|
||||
return myDesignerPanel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public JComponent getComponent() {
|
||||
public final JComponent getComponent() {
|
||||
return myDesignerPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent getPreferredFocusedComponent() {
|
||||
public final JComponent getPreferredFocusedComponent() {
|
||||
return myDesignerPanel.getPreferredFocusedComponent();
|
||||
}
|
||||
|
||||
+183
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.intellij.designer.componentTree.ComponentTree;
|
||||
import com.intellij.designer.designSurface.DesignerEditorPanel;
|
||||
import com.intellij.designer.propertyTable.PropertyTablePanel;
|
||||
import com.intellij.openapi.components.ProjectComponent;
|
||||
import com.intellij.openapi.fileEditor.FileEditor;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManagerEvent;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManagerListener;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.startup.StartupManager;
|
||||
import com.intellij.openapi.ui.Splitter;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.ToolWindow;
|
||||
import com.intellij.openapi.wm.ToolWindowAnchor;
|
||||
import com.intellij.openapi.wm.ToolWindowManager;
|
||||
import com.intellij.ui.IdeBorderFactory;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.ui.SideBorder;
|
||||
import com.intellij.ui.content.Content;
|
||||
import com.intellij.ui.content.ContentManager;
|
||||
import com.intellij.util.ui.update.MergingUpdateQueue;
|
||||
import com.intellij.util.ui.update.Update;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* @author Alexander Lobas
|
||||
*/
|
||||
public final class DesignerToolWindowManager implements ProjectComponent {
|
||||
private final MergingUpdateQueue myWindowQueue = new MergingUpdateQueue("designer.components.properties", 200, true, null);
|
||||
private final Project myProject;
|
||||
private final FileEditorManager myFileEditorManager;
|
||||
private ToolWindow myToolWindow;
|
||||
private ComponentTree myComponentTree;
|
||||
private PropertyTablePanel myPropertyTablePanel;
|
||||
private boolean myToolWindowReady;
|
||||
private boolean myToolWindowDisposed;
|
||||
|
||||
public DesignerToolWindowManager(Project project, FileEditorManager fileEditorManager) {
|
||||
myProject = project;
|
||||
myFileEditorManager = fileEditorManager;
|
||||
project.getMessageBus().connect(project).subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerListener() {
|
||||
@Override
|
||||
public void fileOpened(FileEditorManager source, VirtualFile file) {
|
||||
bindToDesigner(getActiveDesigner());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fileClosed(FileEditorManager source, VirtualFile file) {
|
||||
bindToDesigner(getActiveDesigner());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectionChanged(FileEditorManagerEvent event) {
|
||||
bindToDesigner(getDesigner(event.getNewEditor()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void projectOpened() {
|
||||
StartupManager.getInstance(myProject).registerPostStartupActivity(new Runnable() {
|
||||
public void run() {
|
||||
myToolWindowReady = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void projectClosed() {
|
||||
if (!myToolWindowDisposed) {
|
||||
myToolWindowDisposed = true;
|
||||
myComponentTree = null;
|
||||
myPropertyTablePanel = null;
|
||||
myToolWindow = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static DesignerToolWindowManager getInstance(Project project) {
|
||||
return project.getComponent(DesignerToolWindowManager.class);
|
||||
}
|
||||
|
||||
private static DesignerEditorPanel getDesigner(FileEditor editor) {
|
||||
if (editor instanceof DesignerEditor) {
|
||||
DesignerEditor designerEditor = (DesignerEditor)editor;
|
||||
return designerEditor.getDesignerPanel();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private DesignerEditorPanel getActiveDesigner() {
|
||||
FileEditor[] editors = myFileEditorManager.getSelectedEditors();
|
||||
return editors.length > 0 ? getDesigner(editors[0]) : null;
|
||||
}
|
||||
|
||||
private void bindToDesigner(final DesignerEditorPanel designer) {
|
||||
myWindowQueue.cancelAllUpdates();
|
||||
myWindowQueue.queue(new Update("update") {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!myToolWindowReady || myToolWindowDisposed) {
|
||||
return;
|
||||
}
|
||||
if (myToolWindow == null) {
|
||||
if (designer == null) {
|
||||
return;
|
||||
}
|
||||
initToolWindow();
|
||||
}
|
||||
if (designer == null) {
|
||||
myToolWindow.setAvailable(false, null);
|
||||
}
|
||||
else {
|
||||
myToolWindow.setAvailable(true, null);
|
||||
myToolWindow.show(null);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initToolWindow() {
|
||||
myComponentTree = new ComponentTree();
|
||||
JScrollPane treeScrollPane = ScrollPaneFactory.createScrollPane(myComponentTree);
|
||||
treeScrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.BOTTOM));
|
||||
treeScrollPane.setPreferredSize(new Dimension(250, -1));
|
||||
|
||||
myPropertyTablePanel = new PropertyTablePanel();
|
||||
|
||||
Splitter toolWindowPanel = new Splitter(true, 0.33f);
|
||||
toolWindowPanel.setFirstComponent(treeScrollPane);
|
||||
toolWindowPanel.setSecondComponent(myPropertyTablePanel);
|
||||
|
||||
myToolWindow =
|
||||
ToolWindowManager.getInstance(myProject)
|
||||
.registerToolWindow(DesignerBundle.message("designer.toolwindow.name"), false, ToolWindowAnchor.LEFT, myProject, true);
|
||||
myToolWindow.setIcon(IconLoader.getIcon("/com/intellij/designer/icons/toolWindow.png"));
|
||||
|
||||
ContentManager contentManager = myToolWindow.getContentManager();
|
||||
Content content =
|
||||
contentManager.getFactory().createContent(toolWindowPanel, DesignerBundle.message("designer.toolwindow.title"), false);
|
||||
content.setCloseable(false);
|
||||
content.setPreferredFocusableComponent(myComponentTree);
|
||||
contentManager.addContent(content);
|
||||
contentManager.setSelectedContent(content, true);
|
||||
myToolWindow.setAvailable(false, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initComponent() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeComponent() {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@NonNls
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return "UIDesignerToolWindowManager2";
|
||||
}
|
||||
}
|
||||
+8
-1
@@ -13,16 +13,23 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.uiDesigner.componentTree;
|
||||
package com.intellij.designer.componentTree;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.ui.treeStructure.Tree;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import javax.swing.tree.DefaultTreeModel;
|
||||
|
||||
/**
|
||||
* @author Alexander Lobas
|
||||
*/
|
||||
public final class ComponentTree extends Tree implements DataProvider {
|
||||
public ComponentTree() {
|
||||
super(new DefaultTreeModel(new DefaultMutableTreeNode()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getData(@NonNls String dataId) {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
+2
-2
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.uiDesigner.designSurface;
|
||||
package com.intellij.designer.designSurface;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.module.Module;
|
||||
@@ -30,7 +30,7 @@ import java.awt.*;
|
||||
public final class DesignerEditorPanel extends JPanel implements DataProvider {
|
||||
public DesignerEditorPanel(@NotNull Module module, @NotNull VirtualFile file) {
|
||||
setLayout(new BorderLayout());
|
||||
add(new JLabel("Design Surface"), BorderLayout.CENTER);
|
||||
add(new JLabel("Design Surface", JLabel.CENTER), BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 638 B |
+2
-2
@@ -13,9 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.uiDesigner.model;
|
||||
package com.intellij.designer.model;
|
||||
|
||||
import com.intellij.uiDesigner.propertyTable.Property;
|
||||
import com.intellij.designer.propertyTable.Property;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
+2
-2
@@ -13,9 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.uiDesigner.propertyTable;
|
||||
package com.intellij.designer.propertyTable;
|
||||
|
||||
import com.intellij.uiDesigner.model.RadComponent;
|
||||
import com.intellij.designer.model.RadComponent;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
+2
-2
@@ -13,9 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.uiDesigner.propertyTable;
|
||||
package com.intellij.designer.propertyTable;
|
||||
|
||||
import com.intellij.uiDesigner.model.RadComponent;
|
||||
import com.intellij.designer.model.RadComponent;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
+2
-2
@@ -13,9 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.uiDesigner.propertyTable;
|
||||
package com.intellij.designer.propertyTable;
|
||||
|
||||
import com.intellij.uiDesigner.model.RadComponent;
|
||||
import com.intellij.designer.model.RadComponent;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.uiDesigner.propertyTable;
|
||||
package com.intellij.designer.propertyTable;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.ui.table.JBTable;
|
||||
+2
-2
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.uiDesigner.propertyTable;
|
||||
package com.intellij.designer.propertyTable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -24,6 +24,6 @@ import java.awt.*;
|
||||
public final class PropertyTablePanel extends JPanel {
|
||||
public PropertyTablePanel() {
|
||||
setLayout(new BorderLayout());
|
||||
add(new JLabel("Design Surface"), BorderLayout.CENTER);
|
||||
add(new JLabel("Property Table", JLabel.CENTER), BorderLayout.CENTER);
|
||||
}
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* 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.uiDesigner;
|
||||
|
||||
import com.intellij.openapi.components.ProjectComponent;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Alexander Lobas
|
||||
*/
|
||||
public final class UIDesignerToolWindowManager implements ProjectComponent {
|
||||
@Override
|
||||
public void projectOpened() {
|
||||
// TODO: Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void projectClosed() {
|
||||
// TODO: Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initComponent() {
|
||||
// TODO: Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeComponent() {
|
||||
// TODO: Auto-generated method stub
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@NonNls
|
||||
@Override
|
||||
public String getComponentName() {
|
||||
return "UIDesignerToolWindowManager2";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
designer.toolwindow.name=Designer
|
||||
designer.toolwindow.title=Component Tree
|
||||
Reference in New Issue
Block a user