mail[Wesnoth-commits] r44770 - in /trunk/utils/java/eclipse_plugin: ./ src/wesnoth_eclipse_plugin/ src/wesnoth_eclipse_plugin/handlers/ src/wesnot...


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by timotei_cluj on July 27, 2010 - 21:08:
Author: timotei
Date: Tue Jul 27 21:08:22 2010
New Revision: 44770

URL: http://svn.gna.org/viewcvs/wesnoth?rev=44770&view=rev
Log:
eclipse plugin: add guidance for first-time users on the plugin

Added:
    trunk/utils/java/eclipse_plugin/README.txt
Modified:
    trunk/utils/java/eclipse_plugin/Makefile
    trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/Activator.java
    
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/handlers/SetupWorkspaceHandler.java
    
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/WorkspaceUtils.java

Modified: trunk/utils/java/eclipse_plugin/Makefile
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/java/eclipse_plugin/Makefile?rev=44770&r1=44769&r2=44770&view=diff
==============================================================================
--- trunk/utils/java/eclipse_plugin/Makefile (original)
+++ trunk/utils/java/eclipse_plugin/Makefile Tue Jul 27 21:08:22 2010
@@ -2,3 +2,4 @@
        cd readme; pdflatex README.tex
        # cleanup non-needed files
        cd readme; rm README.log; rm README.aux;
+       cd readme; cp README.pdf ..;

Added: trunk/utils/java/eclipse_plugin/README.txt
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/java/eclipse_plugin/README.txt?rev=44770&view=auto
==============================================================================
--- trunk/utils/java/eclipse_plugin/README.txt (added)
+++ trunk/utils/java/eclipse_plugin/README.txt Tue Jul 27 21:08:22 2010
@@ -1,0 +1,1 @@
+For the README execute 'make' in this directory, and the open the 
'README.pdf' file.

Modified: 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/Activator.java
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/Activator.java?rev=44770&r1=44769&r2=44770&view=diff
==============================================================================
--- trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/Activator.java 
(original)
+++ trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/Activator.java 
Tue Jul 27 21:08:22 2010
@@ -8,10 +8,15 @@
  
*******************************************************************************/
 package wesnoth_eclipse_plugin;
 
+import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.BundleContext;
+
+import wesnoth_eclipse_plugin.preferences.Preferences;
+import wesnoth_eclipse_plugin.utils.GUIUtils;
+import wesnoth_eclipse_plugin.utils.WorkspaceUtils;
 
 /**
  * The activator class controls the plug-in life cycle
@@ -33,6 +38,17 @@
                super.start(context);
                plugin = this;
                Logger.getInstance().startLogger();
+               if (!checkConditions())
+               {
+                       GUIUtils.showInfoMessageBox(
+                                       "Hello!\n" +
+                                       "Welcome to 'Wesnoth User Made 
Content Eclipse Plugin'.\n" +
+                                       "Since this is the first time you are 
using it " +
+                                       "I'll guide you through setting it 
up.\n\n" +
+                                       "First you'll have to setup your 
preferences.\n" +
+                                       "Press OK to continue.");
+                       WorkspaceUtils.setupWorkspace(true);
+               }
        }
 
        @Override
@@ -74,4 +90,25 @@
        {
                return plugin.getWorkbench().getDisplay().getActiveShell();
        }
+
+       /**
+        * Checks if the user has set some needed preferences and if the 
workspace
+        * is setup (there exists the "User Addons" project)
+        */
+       private static boolean checkConditions()
+       {
+               String execDir = 
Preferences.getString(Constants.P_WESNOTH_EXEC_PATH);
+               String userDir = 
Preferences.getString(Constants.P_WESNOTH_USER_DIR);
+               String wmltoolsDir = 
Preferences.getString(Constants.P_WESNOTH_WMLTOOLS_DIR);
+               String workingDir = 
Preferences.getString(Constants.P_WESNOTH_WORKING_DIR);
+
+               if (!WorkspaceUtils.validPath(execDir) || 
!WorkspaceUtils.validPath(userDir) ||
+                       !WorkspaceUtils.validPath(wmltoolsDir) || 
!WorkspaceUtils.validPath(workingDir) ||
+                       
!ResourcesPlugin.getWorkspace().getRoot().getProject("User Addons").exists())
+               {
+                       return false;
+               }
+               return true;
+       }
+
 }

Modified: 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/handlers/SetupWorkspaceHandler.java
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/handlers/SetupWorkspaceHandler.java?rev=44770&r1=44769&r2=44770&view=diff
==============================================================================
--- 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/handlers/SetupWorkspaceHandler.java
 (original)
+++ 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/handlers/SetupWorkspaceHandler.java
 Tue Jul 27 21:08:22 2010
@@ -17,7 +17,7 @@
 {
        @Override
        public Object execute(ExecutionEvent event) {
-               WorkspaceUtils.setupWorkspace();
+               WorkspaceUtils.setupWorkspace(false);
                return null;
        }
 }

Modified: 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/WorkspaceUtils.java
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/WorkspaceUtils.java?rev=44770&r1=44769&r2=44770&view=diff
==============================================================================
--- 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/WorkspaceUtils.java
 (original)
+++ 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/WorkspaceUtils.java
 Tue Jul 27 21:08:22 2010
@@ -267,7 +267,7 @@
         *      If not, the preferences window will open
         * 2) The project "User addons" exists. If not, it will be created
         */
-       public static void setupWorkspace()
+       public static void setupWorkspace(boolean guided)
        {
                if (!checkConditions(false))
                {
@@ -275,8 +275,20 @@
                                        Activator.getShell(), 
"plugin_preferences", null, null);
                        if (pref.open() == Window.CANCEL || 
!checkConditions(true))
                        {
-                               GUIUtils.showErrorMessageBox("The workspace 
was not setup");
+                               GUIUtils.showErrorMessageBox("The workspace 
was not setup. " +
+                                               "Please check the logs for 
errors.");
                                return;
+                       }
+
+                       if (guided)
+                       {
+                               GUIUtils.showInfoMessageBox(
+                                               "Good. The preferences were 
set.\n" +
+                                               "Now, I'll make a simple 
project which will " +
+                                               "correspond to\n" +
+                                               "'<your wesnoth user 
directory>/data/addons' directory " +
+                                               "where the addons will be 
stored.\n" +
+                                               "Press OK to continue.");
                        }
                }
 
@@ -328,8 +340,18 @@
                                
ProjectUtils.setPropertiesForProject(projectToCreate, props);
                        }
 
-                       Logger.getInstance().log("setupWorkspace was 
successful",
-                                       "Workspace was set up successfully.");
+                       if (guided)
+                       {
+                               GUIUtils.showInfoMessageBox(
+                                               "Congrats!\n" +
+                                               "Everything is set up. Now 
you can use the plugin.\n\n" +
+                                               "Good luck and have fun!");
+                       }
+                       else
+                       {
+                               Logger.getInstance().log("setupWorkspace was 
successful",
+                                               "Workspace was set up 
successfully.");
+                       }
                } catch (Exception e)
                {
                        Logger.getInstance().logException(e);




Related Messages


Powered by MHonArc, Updated Tue Jul 27 21:20:16 2010