make delete and clone buttons project specific
[jSite2.git] / src / net / pterodactylus / jsite / gui / MainWindow.java
index d09c352..843eaa1 100644 (file)
@@ -41,6 +41,7 @@ import javax.swing.JButton;
 import javax.swing.JFrame;
 import javax.swing.JMenu;
 import javax.swing.JMenuBar;
+import javax.swing.JOptionPane;
 import javax.swing.JPanel;
 import javax.swing.JTabbedPane;
 import javax.swing.JToolBar;
@@ -137,6 +138,7 @@ public class MainWindow extends JFrame implements WindowListener, I18nable, Prop
                SwingUtils.center(this);
                I18n.registerI18nable(this);
                addWindowListener(this);
+               setIconImage(IconLoader.loadImage("/jSite-frame-icon.png"));
        }
 
        //
@@ -215,6 +217,36 @@ public class MainWindow extends JFrame implements WindowListener, I18nable, Prop
                return null;
        }
 
+       /**
+        * Sets the given node to the “online” state.
+        * 
+        * @param node
+        *            The node to set online
+        */
+       public void setOnline(Node node) {
+               nodeLabels.get(node).setOnline();
+       }
+
+       /**
+        * Sets the given node to the “offline” state in the status bar.
+        * 
+        * @param node
+        *            The node to set offline
+        */
+       public void setOffline(Node node) {
+               nodeLabels.get(node).setOffline();
+       }
+
+       /**
+        * Sets the given node to the “error” state in the status bar.
+        * 
+        * @param node
+        *            The node to set the error state for
+        */
+       public void setError(Node node) {
+               nodeLabels.get(node).setError();
+       }
+
        //
        // ACTIONS
        //
@@ -269,6 +301,10 @@ public class MainWindow extends JFrame implements WindowListener, I18nable, Prop
                project.addPropertyChangeListener(this);
                if (switchToProject) {
                        projectPane.setSelectedIndex(newTabIndex);
+                       while (project.getBasePath().length() == 0) {
+                               JOptionPane.showMessageDialog(this, I18n.get("mainWindow.information.changeProjectBasePath.message"), I18n.get("mainWindow.information.changeProjectBasePath.title"), JOptionPane.INFORMATION_MESSAGE);
+                               projectPanel.changeBasePath();
+                       }
                }
        }
 
@@ -442,8 +478,6 @@ public class MainWindow extends JFrame implements WindowListener, I18nable, Prop
                swingInterface.getQuitAction().updateI18n();
                swingInterface.getAddNodeAction().updateI18n();
                swingInterface.getAddProjectAction().updateI18n();
-               swingInterface.getCloneProjectAction().updateI18n();
-               swingInterface.getDeleteProjectAction().updateI18n();
                swingInterface.getHelpAboutAction().updateI18n();
                jSiteMenu.updateI18n();
                nodeMenu.updateI18n();
@@ -454,6 +488,10 @@ public class MainWindow extends JFrame implements WindowListener, I18nable, Prop
                        swingInterface.getNodeEditAction(node).updateI18n();
                        swingInterface.getNodeDeleteAction(node).updateI18n();
                }
+               for (Project project: swingInterface.getProjects()) {
+                       swingInterface.getCloneProjectAction(project).updateI18n();
+                       swingInterface.getDeleteProjectAction(project).updateI18n();
+               }
                for (I18nAction languageAction: swingInterface.getLanguageActions()) {
                        languageAction.updateI18n();
                }