mail[Wesnoth-commits] r44461 - /trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/wizards/scenario/ScenarioNewWizard.java


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

Header


Content

Posted by timotei_cluj on July 21, 2010 - 00:01:
Author: timotei
Date: Wed Jul 21 00:01:41 2010
New Revision: 44461

URL: http://svn.gna.org/viewcvs/wesnoth?rev=44461&view=rev
Log:
eclipse plugin: skip adding page for starting gold if there are no preferences

Modified:
    
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/wizards/scenario/ScenarioNewWizard.java

Modified: 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/wizards/scenario/ScenarioNewWizard.java
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/wizards/scenario/ScenarioNewWizard.java?rev=44461&r1=44460&r2=44461&view=diff
==============================================================================
--- 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/wizards/scenario/ScenarioNewWizard.java
 (original)
+++ 
trunk/utils/java/eclipse_plugin/src/wesnoth_eclipse_plugin/wizards/scenario/ScenarioNewWizard.java
 Wed Jul 21 00:01:41 2010
@@ -14,6 +14,7 @@
 import java.io.InputStream;
 import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
+import java.util.Properties;
 
 import org.eclipse.core.resources.IContainer;
 import org.eclipse.core.resources.IFile;
@@ -31,6 +32,7 @@
 
 import wesnoth_eclipse_plugin.Logger;
 import wesnoth_eclipse_plugin.utils.GUIUtils;
+import wesnoth_eclipse_plugin.utils.ProjectUtils;
 import wesnoth_eclipse_plugin.utils.ResourceUtils;
 import wesnoth_eclipse_plugin.utils.WorkspaceUtils;
 import wesnoth_eclipse_plugin.wizards.NewWizardTemplate;
@@ -69,8 +71,15 @@
                page0_ = new ScenarioPage0();
                addPage(page0_);
 
-               page1_ = new ScenarioPage1();
-               addPage(page1_);
+               if (selectionContainer_ != null)
+               {
+                       Properties props = 
ProjectUtils.getPropertiesForProject(selectionContainer_.getProject());
+                       if (props != null && 
props.getProperty("difficulties") != null)
+                       {
+                               page1_ = new ScenarioPage1();
+                               addPage(page1_);
+                       }
+               }
 
                page2_ = new ScenarioPage2();
                addPage(page2_);
@@ -212,9 +221,13 @@
                params.add(new ReplaceableParameter("$$map_data", mapData));
                params.add(new ReplaceableParameter("$$turns_number", 
String.valueOf(page0_.getTurnsNumber())));
 
-               String startingGold = page1_.getStartingGoldByDifficulties();
-               if (startingGold == null)
-                       throw new Exception("incorrenct argument");
+               String startingGold = "";
+               if (page1_ != null)
+               {
+                       startingGold = page1_.getStartingGoldByDifficulties();
+                       if (startingGold == null)
+                               throw new Exception("incorrect arguments");
+               }
                params.add(new ReplaceableParameter("$$starting_gold", 
startingGold));
 
                // multiplayer only variables




Related Messages


Powered by MHonArc, Updated Wed Jul 21 00:20:13 2010