diff --git a/samples/toolWindow/.idea/ant.xml b/samples/toolWindow/.idea/ant.xml
new file mode 100644
index 000000000000..2581ca3fe84c
--- /dev/null
+++ b/samples/toolWindow/.idea/ant.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/samples/toolWindow/.idea/compiler.xml b/samples/toolWindow/.idea/compiler.xml
new file mode 100644
index 000000000000..97c9ca5c8b0a
--- /dev/null
+++ b/samples/toolWindow/.idea/compiler.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/toolWindow/.idea/copyright/profiles_settings.xml b/samples/toolWindow/.idea/copyright/profiles_settings.xml
new file mode 100644
index 000000000000..3572571ad83c
--- /dev/null
+++ b/samples/toolWindow/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/toolWindow/.idea/encodings.xml b/samples/toolWindow/.idea/encodings.xml
new file mode 100644
index 000000000000..e206d70d8595
--- /dev/null
+++ b/samples/toolWindow/.idea/encodings.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/samples/toolWindow/.idea/misc.xml b/samples/toolWindow/.idea/misc.xml
new file mode 100644
index 000000000000..f55b22d76ca9
--- /dev/null
+++ b/samples/toolWindow/.idea/misc.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/toolWindow/.idea/modules.xml b/samples/toolWindow/.idea/modules.xml
new file mode 100644
index 000000000000..77f0f0f79aaa
--- /dev/null
+++ b/samples/toolWindow/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/samples/toolWindow/toolWindow.ipr b/samples/toolWindow/.idea/uiDesigner.xml
similarity index 50%
rename from samples/toolWindow/toolWindow.ipr
rename to samples/toolWindow/.idea/uiDesigner.xml
index 956467dbb88e..3b0002030884 100644
--- a/samples/toolWindow/toolWindow.ipr
+++ b/samples/toolWindow/.idea/uiDesigner.xml
@@ -1,205 +1,125 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
- -
+
-
- -
+
-
- -
+
-
- -
+
-
- -
+
-
- -
+
-
- -
+
-
- -
+
-
- -
+
-
- -
+
-
- -
+
-
- -
+
-
- -
+
-
- -
+
-
- -
+
-
- -
+
-
- -
+
-
- -
+
-
- -
+
-
- -
+
-
- -
+
-
- -
+
-
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/samples/toolWindow/.idea/vcs.xml b/samples/toolWindow/.idea/vcs.xml
new file mode 100644
index 000000000000..def6a6a18457
--- /dev/null
+++ b/samples/toolWindow/.idea/vcs.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/samples/toolWindow/build/build.xml b/samples/toolWindow/build/build.xml
deleted file mode 100644
index cd5ff41197b0..000000000000
--- a/samples/toolWindow/build/build.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/samples/toolWindow/src/META-INF/plugin.xml b/samples/toolWindow/src/META-INF/plugin.xml
index a7bdf8f9e8bd..6d2aceb4b87b 100644
--- a/samples/toolWindow/src/META-INF/plugin.xml
+++ b/samples/toolWindow/src/META-INF/plugin.xml
@@ -1,28 +1,28 @@
-
-
-
- SimpleToolWindow
-
-
- An example of installing a tool window
-
-
+
+ Tool Window
+ This sample plugin illustrates how to contribute to the toolWindow extension point
1.0
+ JetBrains
+
+
+
+
-
- IntelliJ
-
-
-
-
-
-
-
- com.intellij.openapi.samples.SimpleToolWindowPlugin
-
-
- com.intellij.openapi.samples.SimpleToolWindowPlugin
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/toolWindow/src/com/intellij/openapi/samples/Calendar-icon.png b/samples/toolWindow/src/com/intellij/openapi/samples/Calendar-icon.png
new file mode 100644
index 000000000000..5e4d507a7c61
Binary files /dev/null and b/samples/toolWindow/src/com/intellij/openapi/samples/Calendar-icon.png differ
diff --git a/samples/toolWindow/src/com/intellij/openapi/samples/MyToolWindowFactory.java b/samples/toolWindow/src/com/intellij/openapi/samples/MyToolWindowFactory.java
new file mode 100644
index 000000000000..f3bef294c785
--- /dev/null
+++ b/samples/toolWindow/src/com/intellij/openapi/samples/MyToolWindowFactory.java
@@ -0,0 +1,34 @@
+package com.intellij.openapi.samples;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.wm.ToolWindow;
+import com.intellij.openapi.wm.ToolWindowEP;
+import com.intellij.openapi.wm.ToolWindowFactory;
+import com.intellij.ui.content.Content;
+import com.intellij.ui.content.ContentFactory;
+import com.intellij.util.ui.UIUtil;
+
+import javax.swing.*;
+import java.awt.*;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Alexey.Chursin
+ * Date: Aug 25, 2010
+ * Time: 2:09:00 PM
+ */
+public class MyToolWindowFactory implements ToolWindowFactory {
+
+ // Creates the tool window content.
+ public void createToolWindowContent(Project project, ToolWindow toolWindow) {
+ ToolDialog myDialog = new ToolDialog();
+ myDialog.toolWin = toolWindow;
+ myDialog.currentDateTime();
+ JPanel myContentPanel = myDialog.getPanel();
+ ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
+ Content content = contentFactory.createContent(myContentPanel, "", false);
+ toolWindow.getContentManager().addContent(content);
+
+ }
+
+}
diff --git a/samples/toolWindow/src/com/intellij/openapi/samples/SimpleToolWindowPlugin.java b/samples/toolWindow/src/com/intellij/openapi/samples/SimpleToolWindowPlugin.java
deleted file mode 100644
index 300b1e83d779..000000000000
--- a/samples/toolWindow/src/com/intellij/openapi/samples/SimpleToolWindowPlugin.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright 2000-2005 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.openapi.samples;
-
-import com.intellij.openapi.components.ProjectComponent;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.wm.ToolWindow;
-import com.intellij.openapi.wm.ToolWindowAnchor;
-import com.intellij.openapi.wm.ToolWindowManager;
-import com.intellij.util.ui.UIUtil;
-import com.intellij.peer.PeerFactory;
-import com.intellij.ui.content.Content;
-import com.intellij.ui.content.ContentFactory;
-
-import javax.swing.*;
-import java.awt.*;
-
-public class SimpleToolWindowPlugin implements ProjectComponent {
- private final Project myProject;
-
- private ToolWindow myToolWindow;
- private JPanel myContentPanel;
-
- public static final String TOOL_WINDOW_ID = "SimpleToolWindow";
-
- public SimpleToolWindowPlugin(Project project) {
- myProject = project;
- }
-
- public void projectOpened() {
- initToolWindow();
- }
-
- public void projectClosed() {
- unregisterToolWindow();
- }
-
- public void initComponent() {
- // empty
- }
-
- public void disposeComponent() {
- // empty
- }
-
- public String getComponentName() {
- return "SimpleToolWindow.SimpleToolWindowPlugin";
- }
-
- private void initToolWindow() {
- ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject);
-
- myContentPanel = new JPanel(new BorderLayout());
-
- myContentPanel.setBackground(UIUtil.getTreeTextBackground());
- myContentPanel.add(new JLabel("Hello World!", JLabel.CENTER), BorderLayout.CENTER);
-
- myToolWindow = toolWindowManager.registerToolWindow(TOOL_WINDOW_ID, false, ToolWindowAnchor.LEFT);
- ContentFactory contentFactory = PeerFactory.getInstance().getContentFactory();
- Content content = contentFactory.createContent(myContentPanel, "SimpleWindow", false);
- myToolWindow.getContentManager().addContent(content);
- }
-
- private void unregisterToolWindow() {
- ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject);
- toolWindowManager.unregisterToolWindow(TOOL_WINDOW_ID);
- }
-}
diff --git a/samples/toolWindow/src/com/intellij/openapi/samples/Time-icon.png b/samples/toolWindow/src/com/intellij/openapi/samples/Time-icon.png
new file mode 100644
index 000000000000..b9cbf33cc111
Binary files /dev/null and b/samples/toolWindow/src/com/intellij/openapi/samples/Time-icon.png differ
diff --git a/samples/toolWindow/src/com/intellij/openapi/samples/Time-zone-icon.png b/samples/toolWindow/src/com/intellij/openapi/samples/Time-zone-icon.png
new file mode 100644
index 000000000000..63843d352b37
Binary files /dev/null and b/samples/toolWindow/src/com/intellij/openapi/samples/Time-zone-icon.png differ
diff --git a/samples/toolWindow/src/com/intellij/openapi/samples/ToolDialog.form b/samples/toolWindow/src/com/intellij/openapi/samples/ToolDialog.form
new file mode 100644
index 000000000000..9c708ef87420
--- /dev/null
+++ b/samples/toolWindow/src/com/intellij/openapi/samples/ToolDialog.form
@@ -0,0 +1,83 @@
+
+
diff --git a/samples/toolWindow/src/com/intellij/openapi/samples/ToolDialog.java b/samples/toolWindow/src/com/intellij/openapi/samples/ToolDialog.java
new file mode 100644
index 000000000000..10292664f378
--- /dev/null
+++ b/samples/toolWindow/src/com/intellij/openapi/samples/ToolDialog.java
@@ -0,0 +1,98 @@
+package com.intellij.openapi.samples;
+
+import com.intellij.openapi.wm.ToolWindow;
+
+import javax.swing.*;
+import java.awt.event.*;
+import java.util.Calendar;
+
+public class ToolDialog extends JDialog {
+ private JPanel contentPane;
+ private JButton buttonRefresh;
+ private JButton buttonHide;
+
+ private JLabel Date22;
+ private JLabel Time22;
+ private JLabel TimeZone;
+ public ToolWindow toolWin;
+
+
+
+ public ToolDialog() {
+ setContentPane(contentPane);
+ setModal(true);
+ getRootPane().setDefaultButton(buttonRefresh);
+
+
+
+
+
+ buttonRefresh.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ onOK();
+ }
+ });
+
+ buttonHide.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ onCancel();
+ }
+ });
+
+// call onCancel() when cross is clicked
+ setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
+ addWindowListener(new WindowAdapter() {
+ public void windowClosing(WindowEvent e) {
+ onCancel();
+ }
+ });
+
+// call onCancel() on ESCAPE
+ contentPane.registerKeyboardAction(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ onCancel();
+ }
+ }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+ }
+
+ private void onOK() {
+// Refresh tool window.
+ this.currentDateTime();
+ dispose();
+ }
+
+ private void onCancel() {
+// Hide tool window.
+ toolWin.hide(null);
+ dispose();
+ }
+
+ public JPanel getPanel() {
+ return contentPane;
+ }
+
+ public void currentDateTime()
+ {
+ // Get current date and time
+ Calendar instance = Calendar.getInstance();
+ Date22.setText(String.valueOf(instance.get(Calendar.DAY_OF_MONTH)) + "/"
+ + String.valueOf(instance.get(Calendar.MONTH)+1) + "/" + String.valueOf(instance.get(Calendar.YEAR)) );
+ Date22.setIcon(new ImageIcon(getClass().getResource("/com/intellij/openapi/samples/Calendar-icon.png")));
+ int min = instance.get(Calendar.MINUTE);
+ String strMin;
+ if ( min < 10) {strMin = "0" + String.valueOf(min);}
+ else { strMin = String.valueOf(min);}
+ Time22.setText(instance.get(Calendar.HOUR_OF_DAY) + ":" + strMin);
+ Time22.setIcon(new ImageIcon(getClass().getResource("/com/intellij/openapi/samples/Time-icon.png")));
+ // Get time zone
+ long gmt_Offset = instance.get(Calendar.ZONE_OFFSET); // offset from GMT in milliseconds
+ String str_gmt_Offset = String.valueOf(gmt_Offset/3600000);
+ str_gmt_Offset = (gmt_Offset > 0) ? "GMT + " + str_gmt_Offset : "GMT - " + str_gmt_Offset;
+ TimeZone.setText(str_gmt_Offset);
+ TimeZone.setIcon(new ImageIcon(getClass().getResource("/com/intellij/openapi/samples/Time-zone-icon.png")));
+
+
+
+
+ }
+}
diff --git a/samples/toolWindow/src/com/intellij/openapi/samples/plus.png b/samples/toolWindow/src/com/intellij/openapi/samples/plus.png
new file mode 100644
index 000000000000..f5b3c6e3a4f6
Binary files /dev/null and b/samples/toolWindow/src/com/intellij/openapi/samples/plus.png differ
diff --git a/samples/toolWindow/toolWindow.iml b/samples/toolWindow/toolWindow.iml
index f4a7753e79e3..6bada6d4c479 100644
--- a/samples/toolWindow/toolWindow.iml
+++ b/samples/toolWindow/toolWindow.iml
@@ -1,16 +1,13 @@
-
+
-
-
-
+
-
+
-