eclipse plugin: fix the ID textbox not firing the modify event
This commit is contained in:
parent
70c60d2b2a
commit
bce6bdae0c
1 changed files with 46 additions and 31 deletions
|
@ -18,12 +18,13 @@ import org.eclipse.swt.widgets.Text;
|
|||
|
||||
import wesnoth_eclipse_plugin.utils.StringUtils;
|
||||
|
||||
public class CampaignPage2 extends WizardPage {
|
||||
private Text txtAbbrev_;
|
||||
private Text txtDefine_;
|
||||
private Text txtDifficulties_;
|
||||
private Text txtFirstScenario_;
|
||||
private Text txtID_;
|
||||
public class CampaignPage2 extends WizardPage
|
||||
{
|
||||
private Text txtAbbrev_;
|
||||
private Text txtDefine_;
|
||||
private Text txtDifficulties_;
|
||||
private Text txtFirstScenario_;
|
||||
private Text txtID_;
|
||||
|
||||
/**
|
||||
* Create the wizard.
|
||||
|
@ -38,13 +39,16 @@ public class CampaignPage2 extends WizardPage {
|
|||
* Create contents of the wizard.
|
||||
* @param parent
|
||||
*/
|
||||
public void createControl(Composite parent) {
|
||||
@Override
|
||||
public void createControl(Composite parent)
|
||||
{
|
||||
Composite container = new Composite(parent, SWT.NULL);
|
||||
|
||||
setControl(container);
|
||||
ModifyListener modifyListener = new ModifyListener() {
|
||||
ModifyListener modifyListener = new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
public void modifyText(ModifyEvent e)
|
||||
{
|
||||
updatePageIsComplete();
|
||||
}
|
||||
};
|
||||
|
@ -55,20 +59,20 @@ public class CampaignPage2 extends WizardPage {
|
|||
{
|
||||
if (!(e.getSource() instanceof Button))
|
||||
return;
|
||||
String dif = ((Button)e.getSource()).getText();
|
||||
String dif = ((Button) e.getSource()).getText();
|
||||
|
||||
if (!txtDifficulties_.getText().contains(dif))
|
||||
{
|
||||
txtDifficulties_.append(","+dif);
|
||||
txtDifficulties_.append("," + dif);
|
||||
}
|
||||
else
|
||||
{
|
||||
txtDifficulties_.setText(txtDifficulties_.getText().replace(dif, ""));
|
||||
}
|
||||
|
||||
txtDifficulties_.setText(StringUtils.removeIncorrectCharacters(txtDifficulties_.getText(), ',',
|
||||
true,true));
|
||||
txtDifficulties_.setText(StringUtils.removeIncorrectCharacters(txtDifficulties_.getText(), ',', true, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e)
|
||||
{
|
||||
|
@ -77,11 +81,12 @@ public class CampaignPage2 extends WizardPage {
|
|||
|
||||
container.setLayout(new GridLayout(5, false));
|
||||
|
||||
Label lblId = new Label(container, SWT.NONE);
|
||||
lblId.setText("ID* :");
|
||||
Label lblId = new Label(container, SWT.NONE);
|
||||
lblId.setText("ID* :");
|
||||
|
||||
txtID_ = new Text(container, SWT.BORDER);
|
||||
txtID_.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
|
||||
txtID_ = new Text(container, SWT.BORDER);
|
||||
txtID_.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
|
||||
txtID_.addModifyListener(modifyListener);
|
||||
new Label(container, SWT.NONE);
|
||||
new Label(container, SWT.NONE);
|
||||
new Label(container, SWT.NONE);
|
||||
|
@ -118,17 +123,17 @@ public class CampaignPage2 extends WizardPage {
|
|||
gd_txtDifficulties_.widthHint = 208;
|
||||
txtDifficulties_.setLayoutData(gd_txtDifficulties_);
|
||||
|
||||
Button chkDiffEasy_ = new Button(container, SWT.CHECK);
|
||||
chkDiffEasy_.setText("EASY");
|
||||
chkDiffEasy_.addSelectionListener(selectionListener);
|
||||
Button chkDiffEasy_ = new Button(container, SWT.CHECK);
|
||||
chkDiffEasy_.setText("EASY");
|
||||
chkDiffEasy_.addSelectionListener(selectionListener);
|
||||
|
||||
Button chkDiffNormal_ = new Button(container, SWT.CHECK);
|
||||
chkDiffNormal_.setText("NORMAL");
|
||||
chkDiffNormal_.addSelectionListener(selectionListener);
|
||||
Button chkDiffNormal_ = new Button(container, SWT.CHECK);
|
||||
chkDiffNormal_.setText("NORMAL");
|
||||
chkDiffNormal_.addSelectionListener(selectionListener);
|
||||
|
||||
Button chkDiffHard_ = new Button(container, SWT.CHECK);
|
||||
chkDiffHard_.setText("HARD");
|
||||
chkDiffHard_.addSelectionListener(selectionListener);
|
||||
Button chkDiffHard_ = new Button(container, SWT.CHECK);
|
||||
chkDiffHard_.setText("HARD");
|
||||
chkDiffHard_.addSelectionListener(selectionListener);
|
||||
|
||||
Label lblFirstScenario = new Label(container, SWT.NONE);
|
||||
lblFirstScenario.setText("First Scenario:");
|
||||
|
@ -172,31 +177,41 @@ public class CampaignPage2 extends WizardPage {
|
|||
setErrorMessage(null);
|
||||
setPageComplete(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return returns the abbreviation of the campaign
|
||||
*/
|
||||
public String getAbbrev() {
|
||||
public String getAbbrev()
|
||||
{
|
||||
return txtAbbrev_.getText();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return returns the define of the campaign
|
||||
*/
|
||||
public String getDefine() {
|
||||
public String getDefine()
|
||||
{
|
||||
return txtDefine_.getText();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return returns the difficulties of the campaign
|
||||
*/
|
||||
public String getDifficulties() {
|
||||
public String getDifficulties()
|
||||
{
|
||||
return txtDifficulties_.getText();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return returns the first scenario of the campaign
|
||||
*/
|
||||
public String getFirstScenario() {
|
||||
public String getFirstScenario()
|
||||
{
|
||||
return txtFirstScenario_.getText();
|
||||
}
|
||||
public String getCampaignId(){
|
||||
|
||||
public String getCampaignId()
|
||||
{
|
||||
return txtID_.getText();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue