eclipse plugin:

allow the user to reload cached defines

allow the user to choose whether to create or not 'build.xml'
This commit is contained in:
Timotei Dolean 2010-08-14 08:56:05 +00:00
parent 88795e0723
commit 84ce7b142e
5 changed files with 39 additions and 5 deletions

View File

@ -8,12 +8,17 @@
*******************************************************************************/
package wesnoth_eclipse_plugin.handlers;
import java.util.Map.Entry;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.resources.IProject;
import wesnoth_eclipse_plugin.schema.SchemaParser;
import wesnoth_eclipse_plugin.templates.TemplateProvider;
import wesnoth_eclipse_plugin.utils.GUIUtils;
import wesnoth_eclipse_plugin.utils.ProjectCache;
import wesnoth_eclipse_plugin.utils.ProjectUtils;
public class ReloadFilesHandler extends AbstractHandler
{
@ -23,6 +28,13 @@ public class ReloadFilesHandler extends AbstractHandler
SchemaParser.getInstance().parseSchema(true);
TemplateProvider.getInstance().loadTemplates();
// reload the cache only for already loaded files
for(Entry<IProject, ProjectCache> cache :
ProjectUtils.getProjectCaches().entrySet())
{
cache.getValue().readDefines(true);
}
GUIUtils.showInfoMessageBox("Files reloaded.");
return null;
}

View File

@ -88,7 +88,7 @@ public class CampaignNewWizard extends NewWizardTemplate
if (page0_.getLocationPath().equals(ResourcesPlugin.getWorkspace().getRoot().getLocation()))
{
ProjectUtils.createWesnothProject(currentProject, null,
true, false, monitor);
true, !page1_.isDataCampaignsProject(), monitor);
}
else
{
@ -96,7 +96,7 @@ public class CampaignNewWizard extends NewWizardTemplate
newProjectDescription(page0_.getProjectName());
newDescription.setLocation(page0_.getLocationPath());
ProjectUtils.createWesnothProject(currentProject, newDescription,
true, false, monitor);
true, !page1_.isDataCampaignsProject(), monitor);
}
monitor.worked(2);

View File

@ -32,6 +32,7 @@ public class CampaignPage1 extends NewWizardPageTemplate
private Text txtIcon_;
private Button chkMultiCampaign_;
private Button chkGeneratePBL_;
private Button chkDataCampaignProject_;
public CampaignPage1() {
super("campaignPage1");
@ -87,6 +88,10 @@ public class CampaignPage1 extends NewWizardPageTemplate
Label lblRelativeToThe = new Label(container, SWT.NONE);
lblRelativeToThe.setText("Relative to the data folder");
chkDataCampaignProject_ = new Button(container, SWT.CHECK);
chkDataCampaignProject_.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
chkDataCampaignProject_.setText("This is a 'data/campaigns/' project");
chkMultiCampaign_ = new Button(container, SWT.CHECK);
GridData gd_chkMultiCampaign_ = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
gd_chkMultiCampaign_.widthHint = 236;
@ -244,4 +249,9 @@ public class CampaignPage1 extends NewWizardPageTemplate
{
return chkGeneratePBL_.getSelection();
}
public boolean isDataCampaignsProject()
{
return chkDataCampaignProject_.getSelection();
}
}

View File

@ -90,8 +90,8 @@ public class EmptyProjectNewWizard extends NewWizardTemplate
// the project
if (page0_.getLocationPath().equals(ResourcesPlugin.getWorkspace().getRoot().getLocation()))
{
ProjectUtils.createWesnothProject(currentProject, null, true,
false, monitor);
ProjectUtils.createWesnothProject(currentProject, null, page1_.isDataCampaignsProject(),
!page1_.isDataCampaignsProject(), monitor);
}
else
{
@ -99,8 +99,9 @@ public class EmptyProjectNewWizard extends NewWizardTemplate
newProjectDescription(page0_.getProjectName());
newDescription.setLocation(page0_.getLocationPath());
ProjectUtils.createWesnothProject(currentProject, newDescription,
true, false, monitor);
true, !page1_.isDataCampaignsProject(), monitor);
}
monitor.worked(2);
String emptyProjectStructure = prepareTemplate("empty_project");

View File

@ -33,6 +33,7 @@ public class EmptyProjectPage1 extends NewWizardPageTemplate
private Text txtIcon_;
private Text txtType_;
private Button chkGeneratePBL_;
private Button chkDataCampaignsProject_;
public EmptyProjectPage1() {
@ -58,6 +59,11 @@ public class EmptyProjectPage1 extends NewWizardPageTemplate
};
container.setLayout(new GridLayout(3, false));
chkDataCampaignsProject_ = new Button(container, SWT.CHECK);
chkDataCampaignsProject_.setText("This is a 'data/campaigns/' project");
new Label(container, SWT.NONE);
new Label(container, SWT.NONE);
chkGeneratePBL_ = new Button(container, SWT.CHECK);
chkGeneratePBL_.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
chkGeneratePBL_.setText("Generate '_server.pbl' with the following information");
@ -258,4 +264,9 @@ public class EmptyProjectPage1 extends NewWizardPageTemplate
{
return chkGeneratePBL_.getSelection();
}
public boolean isDataCampaignsProject()
{
return chkDataCampaignsProject_.getSelection();
}
}