Add and expose “Insert Project” actions.
[jSite2.git] / src / net / pterodactylus / jsite / gui / SwingInterface.java
index 92b6dc2..f8a43d0 100644 (file)
@@ -115,6 +115,9 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh
        /** The “add project” action. */
        private I18nAction addProjectAction;
 
+       /** The “insert project” actions. */
+       private Map<Project, I18nAction> insertProjectActions = new HashMap<Project, I18nAction>();
+
        /** The “clone project” actions. */
        private Map<Project, I18nAction> cloneProjectActions = new HashMap<Project, I18nAction>();
 
@@ -353,6 +356,17 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh
        }
 
        /**
+        * Returns the “insert project” action for the given project.
+        *
+        * @param project
+        *            The project to get the “insert project” action for
+        * @return The “insert project” action
+        */
+       I18nAction getInsertProjectAction(Project project) {
+               return insertProjectActions.get(project);
+       }
+
+       /**
         * Returns the “clone project” action for the given project.
         *
         * @param project
@@ -546,7 +560,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh
                        }
                };
                List<Locale> availableLanguages = I18n.findAvailableLanguages();
-               for (final Locale locale: availableLanguages) {
+               for (final Locale locale : availableLanguages) {
                        String language = locale.getLanguage();
                        I18nAction languageAction = new I18nAction("general.language." + language, IconLoader.loadIcon("/flag-" + language + ".png")) {
 
@@ -744,7 +758,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh
         *            The action that triggered the change
         */
        private void changeLanguage(Locale newLocale, I18nAction languageAction) {
-               for (I18nAction i18nAction: languageActions) {
+               for (I18nAction i18nAction : languageActions) {
                        i18nAction.setEnabled(i18nAction != languageAction);
                }
                I18n.setLocale(newLocale);
@@ -804,7 +818,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh
         */
        public void loadingProjectsDone(String directory) {
                mainWindow.setStatusBarText(I18n.get("mainWindow.statusBar.projectLoadingDone"));
-               for (Project project: core.getProjects()) {
+               for (Project project : core.getProjects()) {
                        projectAdded(project, false);
                }
        }