mail[Wesnoth-commits] r44638 - /trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/


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

Header


Content

Posted by timotei_cluj on July 24, 2010 - 18:28:
Author: timotei
Date: Sat Jul 24 18:28:02 2010
New Revision: 44638

URL: http://svn.gna.org/viewcvs/wesnoth?rev=44638&view=rev
Log:
eclipse plugin: use the wmlparser to get the scenario id

Modified:
    
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/GameUtils.java
    
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/ProjectUtils.java
    
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/WMLSaxHandler.java
    
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/WMLTools.java

Modified: 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/GameUtils.java
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/GameUtils.java?rev=44638&r1=44637&r2=44638&view=diff
==============================================================================
--- 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/GameUtils.java
 (original)
+++ 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/GameUtils.java
 Sat Jul 24 18:28:02 2010
@@ -27,7 +27,14 @@
         */
        public static void runCampaign()
        {
-               runCampaignScenario(false);
+               Thread gameThread = new Thread(new Runnable() {
+                       @Override
+                       public void run()
+                       {
+                               runCampaignScenario(false);
+                       }
+               });
+               gameThread.start();
        }
 
        /**
@@ -35,7 +42,14 @@
         */
        public static void runScenario()
        {
-               runCampaignScenario(true);
+               Thread gameThread = new Thread(new Runnable() {
+                       @Override
+                       public void run()
+                       {
+                               runCampaignScenario(true);
+                       }
+               });
+               gameThread.start();
        }
 
        protected static void runCampaignScenario(boolean scenario)
@@ -112,7 +126,6 @@
                        return;
                }
 
-
                if (extraArgs != null)
                        args.addAll(extraArgs);
 

Modified: 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/ProjectUtils.java
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/ProjectUtils.java?rev=44638&r1=44637&r2=44638&view=diff
==============================================================================
--- 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/ProjectUtils.java
 (original)
+++ 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/ProjectUtils.java
 Sat Jul 24 18:28:02 2010
@@ -244,11 +244,10 @@
         */
        public static String getScenarioID(IResource resource)
        {
-               return getConfigKeyValue(resource.getLocation().toOSString(), 
"id");
-//             WMLSaxHandler handler = 
getWMLHandlerFromResource(resource.getLocation().toOSString());
-//             if (handler == null)
-//                     return null;
-//             return handler.ScenarioId;
+               WMLSaxHandler handler = 
getWMLHandlerFromResource(resource.getLocation().toOSString());
+               if (handler == null)
+                       return null;
+               return handler.ScenarioId;
        }
 
        private static WMLSaxHandler getWMLHandlerFromResource(String 
resourcePath)

Modified: 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/WMLSaxHandler.java
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/WMLSaxHandler.java?rev=44638&r1=44637&r2=44638&view=diff
==============================================================================
--- 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/WMLSaxHandler.java
 (original)
+++ 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/WMLSaxHandler.java
 Sat Jul 24 18:28:02 2010
@@ -19,8 +19,8 @@
  */
 public class WMLSaxHandler extends DefaultHandler
 {
-       public String CampaignId;
-       public String ScenarioId;
+       public String CampaignId = null;
+       public String ScenarioId = null;
 
        private static Stack<String> stack;
        public WMLSaxHandler()
@@ -41,9 +41,9 @@
     {
        if (stack.peek().equals("id"))
        {
-                if (stack.contains("campaign"))
+                if (stack.get(stack.size() - 2).equals("campaign"))
                         CampaignId = new String(ch, start, length);
-                else if (stack.contains("scenario"))
+                else if (stack.get(stack.size() - 2).equals("scenario"))
                         ScenarioId = new String(ch, start, length);
        }
        super.characters(ch, start, length);

Modified: 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/WMLTools.java
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/WMLTools.java?rev=44638&r1=44637&r2=44638&view=diff
==============================================================================
--- 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/WMLTools.java
 (original)
+++ 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/utils/WMLTools.java
 Sat Jul 24 18:28:02 2010
@@ -88,6 +88,14 @@
                // wesnoth executable's path
                arguments.add("-w");
                
arguments.add(Preferences.getString(Constants.P_WESNOTH_EXEC_PATH));
+
+               // add user data directory
+               arguments.add("-c");
+               
arguments.add(Preferences.getString(Constants.P_WESNOTH_USER_DIR));
+
+               // add the working data directory
+               arguments.add("-a");
+               
arguments.add(Preferences.getString(Constants.P_WESNOTH_WORKING_DIR));
 
                // input file
                arguments.add("-i");




Related Messages


Powered by MHonArc, Updated Sat Jul 24 18:40:06 2010