+ synchronized (statusBar) {
+ if (statusBarClearTimerTask != null) {
+ statusBarClearTimerTask.cancel();
+ }
+ statusBarClearTimerTask = new TimerTask() {
+
+ @SuppressWarnings("synthetic-access")
+ @Override
+ public void run() {
+ statusBar.setText("\u00a0");
+ }
+
+ };
+ statusBarClearTimer.schedule(statusBarClearTimerTask, statusBarClearDelay);
+ }
+ }
+
+ /**
+ * Returns the status bar clear delay (in milliseconds).
+ *
+ * @return The status bar clear delay
+ */
+ public int getStatusBarClearDelay() {
+ return statusBarClearDelay;
+ }
+
+ /**
+ * Sets the status bar clear delay (in milliseconds).
+ *
+ * @param statusBarClearDelay
+ * The status bar clear delay
+ */
+ public void setStatusBarClearDelay(int statusBarClearDelay) {
+ this.statusBarClearDelay = statusBarClearDelay;
+ }
+
+ /**
+ * Sets whether the advanced mode is activated.
+ *
+ * @param advancedMode
+ * <code>true</code> if the advanced mode is activated,
+ * <code>false</code> if the simple mode is activated
+ */
+ public void setAdvancedMode(boolean advancedMode) {
+ connectMenu.setVisible(advancedMode);
+ connectMenuItem.setVisible(!advancedMode);
+ disconnectMenu.setVisible(advancedMode);
+ disconnectMenuItem.setVisible(!advancedMode);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Container getContentPane() {
+ return contentPane;
+ }
+
+ /**
+ * Returns the currently selected project.
+ *
+ * @return The currently selected project
+ */
+ public Project getSelectedProject() {
+ return null;
+ }
+
+ //
+ // ACTIONS
+ //
+
+ /**
+ * Refreshes the menu items in the “connect” and “disconnect” menus.
+ */
+ void refreshNodeMenuItems() {
+ connectMenu.removeAll();
+ for (Action nodeConnectAction: swingInterface.getNodeConnectActions()) {
+ connectMenu.add(nodeConnectAction);
+ }
+ if (connectMenu.getMenuComponentCount() == 0) {
+ JMenuItem noNodeAvailableItem = new JMenuItem(I18n.get("mainWindow.menu.connectNoNodeAvailable.name"));
+ noNodeAvailableItem.setEnabled(false);
+ connectMenu.add(noNodeAvailableItem);
+ }
+ disconnectMenu.removeAll();
+ for (Action nodeDisconnectAction: swingInterface.getNodeDisconnectActions()) {
+ disconnectMenu.add(nodeDisconnectAction);
+ }
+ if (disconnectMenu.getMenuComponentCount() == 0) {
+ JMenuItem noNodeAvailableItem = new JMenuItem(I18n.get("mainWindow.menu.disconnectNoNodeAvailable.name"));
+ noNodeAvailableItem.setEnabled(false);
+ disconnectMenu.add(noNodeAvailableItem);
+ }
+ }
+
+ /**
+ * Adds a project to the project pane.
+ *
+ * @param project
+ * The project to add
+ * @param switchToProject
+ * <code>true</code> to switch to the new panel,
+ * <code>false</code> to not change the current panel
+ */
+ void addProject(Project project, boolean switchToProject) {
+ ProjectPanel projectPanel = new ProjectPanel(swingInterface, project);
+ int newTabIndex = projectPane.getTabCount();
+ projectPane.add(project.getName(), projectPanel);
+ projectPane.setToolTipTextAt(newTabIndex, project.getDescription());
+ project.addPropertyChangeListener(this);
+ if (switchToProject) {
+ projectPane.setSelectedIndex(newTabIndex);
+ }