fix trailing whitespaces and line endings to be unix style

This commit is contained in:
Timotei Dolean 2010-05-15 19:26:55 +00:00
parent 413865e60b
commit 3db682f822
11 changed files with 295 additions and 295 deletions

View file

@ -14,7 +14,7 @@ public class Activator extends AbstractUIPlugin {
// The shared instance
private static Activator plugin;
/**
* The constructor
*/

View file

@ -1,32 +1,32 @@
/**
*
*/
package wesnoth_eclipse_plugin;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
/**
* @author Timotei Dolean
*
*/
public class Logger {
/**
* Prints a message to the error log (severity: info)
* @param message the message to print
*/
public static void print(String message)
{
print(message, IStatus.INFO);
}
/**
* Prints a message to the error log with the specified severity
* @param message the message to print
* @param severity the severity level from IStatus enum
*/
public static void print(String message, int severity)
{
Activator.getDefault().getLog().log(new Status(IStatus.INFO,"wesnoth_plugin",message));
}
}
/**
*
*/
package wesnoth_eclipse_plugin;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
/**
* @author Timotei Dolean
*
*/
public class Logger {
/**
* Prints a message to the error log (severity: info)
* @param message the message to print
*/
public static void print(String message)
{
print(message, IStatus.INFO);
}
/**
* Prints a message to the error log with the specified severity
* @param message the message to print
* @param severity the severity level from IStatus enum
*/
public static void print(String message, int severity)
{
Activator.getDefault().getLog().log(new Status(IStatus.INFO,"wesnoth_plugin",message));
}
}

View file

@ -1,16 +1,16 @@
/**
* @author Timotei Dolean
*/
package wesnoth_eclipse_plugin;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class StringUtils {
public static boolean startsWith(String target, String sequence)
{
Pattern pattern = Pattern.compile("[\t| ]*"+sequence);
Matcher matcher = pattern.matcher(target);
return (matcher.find() && matcher.start() == 0);
}
}
/**
* @author Timotei Dolean
*/
package wesnoth_eclipse_plugin;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class StringUtils {
public static boolean startsWith(String target, String sequence)
{
Pattern pattern = Pattern.compile("[\t| ]*"+sequence);
Matcher matcher = pattern.matcher(target);
return (matcher.find() && matcher.start() == 0);
}
}

View file

@ -56,7 +56,7 @@ public class CampaignNewWizard extends Wizard implements INewWizard {
public CampaignNewWizard() {
setWindowTitle("Create a new Campaign");
setNeedsProgressMonitor(true);
}
@Override
@ -218,10 +218,10 @@ public class CampaignNewWizard extends Wizard implements INewWizard {
}catch (CoreException e) {
Logger.print("Error creating the resource"+resourceName, IStatus.ERROR);
ErrorDialog dlgDialog = new ErrorDialog(getShell(), "Error creating the file", "There was an error creating the resource: "+resourceName,
ErrorDialog dlgDialog = new ErrorDialog(getShell(), "Error creating the file", "There was an error creating the resource: "+resourceName,
new Status(IStatus.ERROR,"wesnoth_plugin","error"),0);
dlgDialog.open();
e.printStackTrace();
}
}
}
}

View file

@ -14,10 +14,10 @@ public class CampaignPage0 extends WizardNewProjectCreationPage {
*/
@Override
public void createControl(Composite parent) {
super.createControl(parent);
super.createControl(parent);
setMessage("Specify the name of the campaign project.");
}
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.WizardPage#canFlipToNextPage()
*/

View file

@ -1,213 +1,213 @@
/**
* @author Timotei Dolean
*/
package wesnoth_eclipse_plugin.wizards;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import wesnoth_eclipse_plugin.StringUtils;
public class CampaignPage1 extends WizardPage {
private Text txtCampaignName_;
private Text txtVersion_;
private Text txtTranslationDir_;
private Text txtAuthor_;
private Text txtEmail_;
private Text txtDescription_;
private Text txtPassphrase_;
private Text txtIcon_;
private Button chkMultiCampaign_;
/**
* Create the wizard.
*/
public CampaignPage1() {
super("wizardPage");
setTitle("Create New Campaign");
setDescription("Creates a new campaign and the files structure.");
setPageComplete(false);
}
/**
* Create contents of the wizard.
* @param parent
*/
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
setControl(container);
ModifyListener updatePageCompleteListener = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
updateIsPageComplete();
}
};
txtCampaignName_ = new Text(container, SWT.BORDER);
txtCampaignName_.setBounds(122, 7, 206, 21);
txtCampaignName_.addModifyListener(updatePageCompleteListener);
Label _lblCampaignName = new Label(container, SWT.NONE);
_lblCampaignName.setBounds(10, 10, 96, 15);
_lblCampaignName.setText("Campaign name* :");
Label lblVersion = new Label(container, SWT.NONE);
lblVersion.setText("Version* :");
lblVersion.setBounds(10, 37, 96, 15);
txtVersion_ = new Text(container, SWT.BORDER);
txtVersion_.setBounds(122, 34, 206, 21);
txtVersion_.addModifyListener(updatePageCompleteListener);
Label lblTranslationsDir = new Label(container, SWT.NONE);
lblTranslationsDir.setText("Translations folder:");
lblTranslationsDir.setBounds(10, 64, 106, 15);
txtTranslationDir_ = new Text(container, SWT.BORDER);
txtTranslationDir_.setBounds(122, 61, 206, 21);
Label lblRelativeToThe = new Label(container, SWT.NONE);
lblRelativeToThe.setBounds(334, 64, 174, 15);
lblRelativeToThe.setText("Relative to the data folder");
txtAuthor_ = new Text(container, SWT.BORDER);
txtAuthor_.setBounds(122, 121, 206, 21);
Label lblAuthor = new Label(container, SWT.NONE);
lblAuthor.setText("Author:");
lblAuthor.setBounds(10, 124, 96, 15);
txtEmail_ = new Text(container, SWT.BORDER);
txtEmail_.setBounds(122, 148, 206, 21);
Label lblDescription = new Label(container, SWT.NONE);
lblDescription.setText("Email:");
lblDescription.setBounds(10, 151, 96, 15);
txtDescription_ = new Text(container, SWT.BORDER);
txtDescription_.setBounds(122, 175, 206, 21);
Label lblDescription_1 = new Label(container, SWT.NONE);
lblDescription_1.setText("Description:");
lblDescription_1.setBounds(10, 178, 96, 15);
txtPassphrase_ = new Text(container, SWT.BORDER);
txtPassphrase_.setBounds(122, 202, 206, 21);
Label lblIcon = new Label(container, SWT.NONE);
lblIcon.setText("Passphrase:");
lblIcon.setBounds(10, 205, 96, 15);
Label lblFormat = new Label(container, SWT.NONE);
lblFormat.setToolTipText("Displayed to the right of the title, it is just text. However,\r\nstarting with Wesnoth 1.6, the required format is x.y.z \r\nwhere x, y and z are numbers and a value for x greater than 0 \r\nimplies the campaign is complete and balanced. \r\nTrailing non-numeric elements are ok, but nothing should\r\nappear before the numbers. This is necessary for the Update \r\nadd-ons button to work correctly.");
lblFormat.setBounds(334, 37, 72, 15);
lblFormat.setText("Format: x.y.z");
Label lblIcon_1 = new Label(container, SWT.NONE);
lblIcon_1.setText("Icon:");
lblIcon_1.setBounds(10, 232, 96, 15);
txtIcon_ = new Text(container, SWT.BORDER);
txtIcon_.setBounds(122, 229, 206, 21);
Label lblRelativeToThe_1 = new Label(container, SWT.NONE);
lblRelativeToThe_1.setToolTipText("An image, displayed leftmost on the \"download campaigns\" screen.\r\nIt must be a standard Wesnoth graphic and not a custom one. \r\n(Well, a custom graphic will work if the user already has the campaign \r\ninstalled, or if it is a custom graphic from a different campaign that the \r\nuser has installed but others won't see it!) (Note that the icon used to \r\ndisplay your campaign for when it is played can be custom; for more\r\ninformation see CampaignWML.) If the icon is a unit with magenta color,\r\nplease use ImagePathFunctionWML to team-color it. ");
lblRelativeToThe_1.setBounds(334, 232, 230, 15);
lblRelativeToThe_1.setText("Relative to the data/core/images folder");
chkMultiCampaign_ = new Button(container, SWT.CHECK);
chkMultiCampaign_.setBounds(10, 86, 181, 16);
chkMultiCampaign_.setText("This is a multiplayer campaign");
updateIsPageComplete();
}
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.WizardPage#canFlipToNextPage()
*/
@Override
public boolean canFlipToNextPage() {
return (isPageComplete() && getNextPage() != null);
}
public void updateIsPageComplete()
{
setPageComplete(false);
if (txtCampaignName_.getText().length() == 0)
{
setErrorMessage("Campaign name is mandatory");
return;
}
// match the pattern x.y.z
if (txtVersion_.getText().length() == 0 ||
!(txtVersion_.getText().matches("[\\d]+\\.[\\d]+\\.\\d[\\w\\W\\d\\D\\s\\S]*")))
{
setErrorMessage("The version must have the format: x.y.z");
return;
}
setErrorMessage(null);
setPageComplete(true);
}
/**
* @return the Campaign Name
*/
public String getCampaignName() {
return txtCampaignName_.getText();
}
/**
* @return the author
*/
public String getAuthor() {
return txtAuthor_.getText();
}
/**
* @return the version
*/
public String getVersion() {
return txtVersion_.getText();
}
/**
* @return the description
*/
public String getDescription() {
return txtDescription_.getText();
}
/**
* @return the Icon
*/
public String getIconPath() {
return txtIcon_.getText();
}
/**
* @return the email
*/
public String getEmail() {
return txtEmail_.getText();
}
/**
* @return the passphrase
*/
public String getPassphrase() {
return txtPassphrase_.getText();
}
/**
* @return the translation directory
*/
public String getTranslationDir() {
return txtTranslationDir_.getText();
}
/**
* @return true if the campaign is multiplayer
*/
public boolean isMultiplayer(){
return chkMultiCampaign_.getSelection();
}
}
/**
* @author Timotei Dolean
*/
package wesnoth_eclipse_plugin.wizards;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import wesnoth_eclipse_plugin.StringUtils;
public class CampaignPage1 extends WizardPage {
private Text txtCampaignName_;
private Text txtVersion_;
private Text txtTranslationDir_;
private Text txtAuthor_;
private Text txtEmail_;
private Text txtDescription_;
private Text txtPassphrase_;
private Text txtIcon_;
private Button chkMultiCampaign_;
/**
* Create the wizard.
*/
public CampaignPage1() {
super("wizardPage");
setTitle("Create New Campaign");
setDescription("Creates a new campaign and the files structure.");
setPageComplete(false);
}
/**
* Create contents of the wizard.
* @param parent
*/
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
setControl(container);
ModifyListener updatePageCompleteListener = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
updateIsPageComplete();
}
};
txtCampaignName_ = new Text(container, SWT.BORDER);
txtCampaignName_.setBounds(122, 7, 206, 21);
txtCampaignName_.addModifyListener(updatePageCompleteListener);
Label _lblCampaignName = new Label(container, SWT.NONE);
_lblCampaignName.setBounds(10, 10, 96, 15);
_lblCampaignName.setText("Campaign name* :");
Label lblVersion = new Label(container, SWT.NONE);
lblVersion.setText("Version* :");
lblVersion.setBounds(10, 37, 96, 15);
txtVersion_ = new Text(container, SWT.BORDER);
txtVersion_.setBounds(122, 34, 206, 21);
txtVersion_.addModifyListener(updatePageCompleteListener);
Label lblTranslationsDir = new Label(container, SWT.NONE);
lblTranslationsDir.setText("Translations folder:");
lblTranslationsDir.setBounds(10, 64, 106, 15);
txtTranslationDir_ = new Text(container, SWT.BORDER);
txtTranslationDir_.setBounds(122, 61, 206, 21);
Label lblRelativeToThe = new Label(container, SWT.NONE);
lblRelativeToThe.setBounds(334, 64, 174, 15);
lblRelativeToThe.setText("Relative to the data folder");
txtAuthor_ = new Text(container, SWT.BORDER);
txtAuthor_.setBounds(122, 121, 206, 21);
Label lblAuthor = new Label(container, SWT.NONE);
lblAuthor.setText("Author:");
lblAuthor.setBounds(10, 124, 96, 15);
txtEmail_ = new Text(container, SWT.BORDER);
txtEmail_.setBounds(122, 148, 206, 21);
Label lblDescription = new Label(container, SWT.NONE);
lblDescription.setText("Email:");
lblDescription.setBounds(10, 151, 96, 15);
txtDescription_ = new Text(container, SWT.BORDER);
txtDescription_.setBounds(122, 175, 206, 21);
Label lblDescription_1 = new Label(container, SWT.NONE);
lblDescription_1.setText("Description:");
lblDescription_1.setBounds(10, 178, 96, 15);
txtPassphrase_ = new Text(container, SWT.BORDER);
txtPassphrase_.setBounds(122, 202, 206, 21);
Label lblIcon = new Label(container, SWT.NONE);
lblIcon.setText("Passphrase:");
lblIcon.setBounds(10, 205, 96, 15);
Label lblFormat = new Label(container, SWT.NONE);
lblFormat.setToolTipText("Displayed to the right of the title, it is just text. However,\r\nstarting with Wesnoth 1.6, the required format is x.y.z \r\nwhere x, y and z are numbers and a value for x greater than 0 \r\nimplies the campaign is complete and balanced. \r\nTrailing non-numeric elements are ok, but nothing should\r\nappear before the numbers. This is necessary for the Update \r\nadd-ons button to work correctly.");
lblFormat.setBounds(334, 37, 72, 15);
lblFormat.setText("Format: x.y.z");
Label lblIcon_1 = new Label(container, SWT.NONE);
lblIcon_1.setText("Icon:");
lblIcon_1.setBounds(10, 232, 96, 15);
txtIcon_ = new Text(container, SWT.BORDER);
txtIcon_.setBounds(122, 229, 206, 21);
Label lblRelativeToThe_1 = new Label(container, SWT.NONE);
lblRelativeToThe_1.setToolTipText("An image, displayed leftmost on the \"download campaigns\" screen.\r\nIt must be a standard Wesnoth graphic and not a custom one. \r\n(Well, a custom graphic will work if the user already has the campaign \r\ninstalled, or if it is a custom graphic from a different campaign that the \r\nuser has installed but others won't see it!) (Note that the icon used to \r\ndisplay your campaign for when it is played can be custom; for more\r\ninformation see CampaignWML.) If the icon is a unit with magenta color,\r\nplease use ImagePathFunctionWML to team-color it. ");
lblRelativeToThe_1.setBounds(334, 232, 230, 15);
lblRelativeToThe_1.setText("Relative to the data/core/images folder");
chkMultiCampaign_ = new Button(container, SWT.CHECK);
chkMultiCampaign_.setBounds(10, 86, 181, 16);
chkMultiCampaign_.setText("This is a multiplayer campaign");
updateIsPageComplete();
}
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.WizardPage#canFlipToNextPage()
*/
@Override
public boolean canFlipToNextPage() {
return (isPageComplete() && getNextPage() != null);
}
public void updateIsPageComplete()
{
setPageComplete(false);
if (txtCampaignName_.getText().length() == 0)
{
setErrorMessage("Campaign name is mandatory");
return;
}
// match the pattern x.y.z
if (txtVersion_.getText().length() == 0 ||
!(txtVersion_.getText().matches("[\\d]+\\.[\\d]+\\.\\d[\\w\\W\\d\\D\\s\\S]*")))
{
setErrorMessage("The version must have the format: x.y.z");
return;
}
setErrorMessage(null);
setPageComplete(true);
}
/**
* @return the Campaign Name
*/
public String getCampaignName() {
return txtCampaignName_.getText();
}
/**
* @return the author
*/
public String getAuthor() {
return txtAuthor_.getText();
}
/**
* @return the version
*/
public String getVersion() {
return txtVersion_.getText();
}
/**
* @return the description
*/
public String getDescription() {
return txtDescription_.getText();
}
/**
* @return the Icon
*/
public String getIconPath() {
return txtIcon_.getText();
}
/**
* @return the email
*/
public String getEmail() {
return txtEmail_.getText();
}
/**
* @return the passphrase
*/
public String getPassphrase() {
return txtPassphrase_.getText();
}
/**
* @return the translation directory
*/
public String getTranslationDir() {
return txtTranslationDir_.getText();
}
/**
* @return true if the campaign is multiplayer
*/
public boolean isMultiplayer(){
return chkMultiCampaign_.getSelection();
}
}

View file

@ -35,61 +35,61 @@ public class CampaignPage2 extends WizardPage {
setControl(container);
ModifyListener modifyListener = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
updatePageIsComplete();
}
};
Label lblAbbreviation = new Label(container, SWT.NONE);
lblAbbreviation.setText("Abbreviation* :");
lblAbbreviation.setBounds(10, 13, 76, 13);
txtAbbrev_ = new Text(container, SWT.BORDER);
txtAbbrev_.setBounds(92, 10, 179, 19);
txtAbbrev_.addModifyListener(modifyListener);
Label lblDefine = new Label(container, SWT.NONE);
lblDefine.setText("Define* :");
lblDefine.setBounds(10, 35, 49, 13);
txtDefine_ = new Text(container, SWT.BORDER);
txtDefine_.setBounds(92, 32, 179, 19);
txtDefine_.addModifyListener(modifyListener);
Label lblDifficulties = new Label(container, SWT.NONE);
lblDifficulties.setText("Difficulties:");
lblDifficulties.setBounds(10, 57, 63, 13);
txtDifficulties_ = new Text(container, SWT.BORDER);
txtDifficulties_.setBounds(92, 54, 179, 19);
Label lblFirstScenario = new Label(container, SWT.NONE);
lblFirstScenario.setText("First Scenario:");
lblFirstScenario.setBounds(10, 90, 76, 13);
txtFirstScenario_ = new Text(container, SWT.BORDER);
txtFirstScenario_.setBounds(92, 87, 179, 19);
updatePageIsComplete();
}
public void updatePageIsComplete()
{
setPageComplete(false);
setPageComplete(false);
if (txtAbbrev_.getText().length() == 0)
{
setErrorMessage("Please specify an abbreviation.");
return;
}
if (txtDefine_.getText().length() == 0)
{
setErrorMessage("Please specify a define.");
return;
}
setErrorMessage(null);
setPageComplete(true);
}

View file

@ -16,9 +16,9 @@ import org.eclipse.ui.*;
import org.eclipse.ui.ide.IDE;
/**
* This is a sample new wizard. Its role is to create a new file
* This is a sample new wizard. Its role is to create a new file
* resource in the provided container. If the container resource
* (a folder or a project) is selected in the workspace
* (a folder or a project) is selected in the workspace
* when the wizard is opened, it will accept it as the target
* container. The wizard creates one file with the extension
* "cfg". If a sample multi-page editor (also available
@ -37,7 +37,7 @@ public class ScenarioNewWizard extends Wizard implements INewWizard {
super();
setNeedsProgressMonitor(true);
}
/**
* Adding the page to the wizard.
*/
@ -77,7 +77,7 @@ public class ScenarioNewWizard extends Wizard implements INewWizard {
}
return true;
}
/**
* The worker method. It will find the container, create the
* file if missing or just replace its contents, and open
@ -122,7 +122,7 @@ public class ScenarioNewWizard extends Wizard implements INewWizard {
});
monitor.worked(1);
}
/**
* We will initialize file contents with a sample text.
*/

View file

@ -32,12 +32,12 @@ public class ScenarioNewWizardPage extends WizardPage {
private Text fileText;
private Text scenarioIdText;
private Text scenarioNameText;
private ISelection selection;
/**
* Constructor for SampleNewWizardPage.
*
*
* @param pageName
*/
public ScenarioNewWizardPage(ISelection selection) {
@ -56,7 +56,7 @@ public class ScenarioNewWizardPage extends WizardPage {
container.setLayout(layout);
layout.numColumns = 3;
layout.verticalSpacing = 9;
Label label = new Label(container, SWT.NULL);
label.setText("&Container:");
containerText = new Text(container, SWT.BORDER | SWT.SINGLE);
@ -77,7 +77,7 @@ public class ScenarioNewWizardPage extends WizardPage {
});
label = new Label(container, SWT.NULL);
label.setText("&File name:");
label.setText("&File name:");
fileText = new Text(container, SWT.BORDER | SWT.SINGLE);
gd = new GridData(GridData.FILL_HORIZONTAL);
fileText.setLayoutData(gd);
@ -108,7 +108,7 @@ public class ScenarioNewWizardPage extends WizardPage {
dialogChanged();
}
});
initialize();
dialogChanged();
setControl(container);

View file

@ -1,5 +1,5 @@
/**
*
*
*/
package wesnoth_eclipse_plugin.wizards;

View file

@ -9,13 +9,13 @@
name= _ "$$campaign_name"
abbrev="$$abrev"
define="$$define"
icon= $$icon
description= _ "$$description"
difficulties=$$difficulties
first_scenario=$$first_scenario
#ifdef $$define
# add here custom code
{campaigns/$$project_name/scenarios}