mirror of
https://github.com/AppleCommander/AppleCommander.git
synced 2024-12-31 22:30:16 +00:00
Preparing for internationalization as well as responding to the tighter
Eclipse 3.0 code checks.
This commit is contained in:
parent
b1017674b2
commit
72cb1f2983
@ -33,6 +33,7 @@ import org.eclipse.swt.widgets.Composite;
|
|||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
|
import com.webcodepro.applecommander.ui.TextBundle;
|
||||||
import com.webcodepro.applecommander.ui.swt.util.ImageCanvas;
|
import com.webcodepro.applecommander.ui.swt.util.ImageCanvas;
|
||||||
import com.webcodepro.applecommander.ui.swt.util.SwtUtil;
|
import com.webcodepro.applecommander.ui.swt.util.SwtUtil;
|
||||||
|
|
||||||
@ -41,6 +42,7 @@ import com.webcodepro.applecommander.ui.swt.util.SwtUtil;
|
|||||||
* @author Rob Greene
|
* @author Rob Greene
|
||||||
*/
|
*/
|
||||||
public abstract class Wizard {
|
public abstract class Wizard {
|
||||||
|
private TextBundle textBundle = TextBundle.getInstance();
|
||||||
private Shell parent;
|
private Shell parent;
|
||||||
private Shell dialog;
|
private Shell dialog;
|
||||||
private Image logo;
|
private Image logo;
|
||||||
@ -94,46 +96,46 @@ public abstract class Wizard {
|
|||||||
composite.setLayoutData(rowData);
|
composite.setLayoutData(rowData);
|
||||||
composite.setLayout(new FillLayout(SWT.HORIZONTAL));
|
composite.setLayout(new FillLayout(SWT.HORIZONTAL));
|
||||||
Button button = new Button(composite, SWT.PUSH);
|
Button button = new Button(composite, SWT.PUSH);
|
||||||
button.setText("Cancel");
|
button.setText(textBundle.get("CancelButton")); //$NON-NLS-1$
|
||||||
button.addSelectionListener(new SelectionAdapter() {
|
button.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
wizardCompleted = false;
|
setWizardCompleted(false);
|
||||||
dialog.close();
|
getDialog().close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
backButton = new Button(composite, SWT.PUSH);
|
backButton = new Button(composite, SWT.PUSH);
|
||||||
backButton.setEnabled(false);
|
backButton.setEnabled(false);
|
||||||
backButton.setText("< Back");
|
backButton.setText(textBundle.get("BackButton")); //$NON-NLS-1$
|
||||||
backButton.addSelectionListener(new SelectionAdapter() {
|
backButton.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
WizardPane current = (WizardPane) wizardPanes.pop();
|
WizardPane current = (WizardPane) getWizardPanes().pop();
|
||||||
WizardPane previous = (WizardPane) wizardPanes.peek();
|
WizardPane previous = (WizardPane) getWizardPanes().peek();
|
||||||
backButton.setEnabled(wizardPanes.size() > 1);
|
getBackButton().setEnabled(getWizardPanes().size() > 1);
|
||||||
current.dispose();
|
current.dispose();
|
||||||
previous.open();
|
previous.open();
|
||||||
dialog.pack();
|
getDialog().pack();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
nextButton = new Button(composite, SWT.PUSH);
|
nextButton = new Button(composite, SWT.PUSH);
|
||||||
nextButton.setText("Next >");
|
nextButton.setText(textBundle.get("NextButton")); //$NON-NLS-1$
|
||||||
nextButton.addSelectionListener(new SelectionAdapter() {
|
nextButton.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
WizardPane current = (WizardPane) wizardPanes.peek();
|
WizardPane current = (WizardPane) getWizardPanes().peek();
|
||||||
WizardPane next = current.getNextPane();
|
WizardPane next = current.getNextPane();
|
||||||
wizardPanes.add(next);
|
getWizardPanes().add(next);
|
||||||
backButton.setEnabled(wizardPanes.size() > 1);
|
getBackButton().setEnabled(getWizardPanes().size() > 1);
|
||||||
current.dispose();
|
current.dispose();
|
||||||
next.open();
|
next.open();
|
||||||
dialog.pack();
|
getDialog().pack();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
finishButton = new Button(composite, SWT.PUSH);
|
finishButton = new Button(composite, SWT.PUSH);
|
||||||
finishButton.setEnabled(false);
|
finishButton.setEnabled(false);
|
||||||
finishButton.setText("Finish");
|
finishButton.setText(textBundle.get("FinishButton")); //$NON-NLS-1$
|
||||||
finishButton.addSelectionListener(new SelectionAdapter() {
|
finishButton.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
wizardCompleted = true;
|
setWizardCompleted(true);
|
||||||
dialog.close();
|
getDialog().close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -208,4 +210,22 @@ public abstract class Wizard {
|
|||||||
public Shell getDialog() {
|
public Shell getDialog() {
|
||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @return Returns the backButton.
|
||||||
|
*/
|
||||||
|
protected Button getBackButton() {
|
||||||
|
return backButton;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @return Returns the wizardPanes.
|
||||||
|
*/
|
||||||
|
protected Stack getWizardPanes() {
|
||||||
|
return wizardPanes;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param wizardCompleted The wizardCompleted to set.
|
||||||
|
*/
|
||||||
|
protected void setWizardCompleted(boolean wizardCompleted) {
|
||||||
|
this.wizardCompleted = wizardCompleted;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ import org.eclipse.swt.widgets.Label;
|
|||||||
|
|
||||||
import com.webcodepro.applecommander.storage.Disk;
|
import com.webcodepro.applecommander.storage.Disk;
|
||||||
import com.webcodepro.applecommander.storage.FormattedDisk;
|
import com.webcodepro.applecommander.storage.FormattedDisk;
|
||||||
|
import com.webcodepro.applecommander.ui.TextBundle;
|
||||||
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
|
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
|
||||||
import com.webcodepro.applecommander.util.AppleUtil;
|
import com.webcodepro.applecommander.util.AppleUtil;
|
||||||
|
|
||||||
@ -35,6 +36,7 @@ import com.webcodepro.applecommander.util.AppleUtil;
|
|||||||
* @author Rob Greene
|
* @author Rob Greene
|
||||||
*/
|
*/
|
||||||
public class CompareDisksResultsPane extends WizardPane {
|
public class CompareDisksResultsPane extends WizardPane {
|
||||||
|
private TextBundle textBundle = TextBundle.getInstance();
|
||||||
private Composite parent;
|
private Composite parent;
|
||||||
private Object layoutData;
|
private Object layoutData;
|
||||||
private Composite control;
|
private Composite control;
|
||||||
@ -71,18 +73,18 @@ public class CompareDisksResultsPane extends WizardPane {
|
|||||||
label.setText(message);
|
label.setText(message);
|
||||||
|
|
||||||
label = new Label(control, SWT.WRAP);
|
label = new Label(control, SWT.WRAP);
|
||||||
label.setText("If you wish to compare more disks, click previous and start again.");
|
label.setText(textBundle.get("CompareDisksResultsPane.RestartText")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get the next pane. A null return indicates the end of the wizard.
|
* Get the next pane. A null return indicates the end of the wizard.
|
||||||
* @see com.webcodepro.applecommander.gui.WizardPane#getNextPane()
|
* @see com.webcodepro.applecommander.ui.swt.wizard.WizardPane#getNextPane()
|
||||||
*/
|
*/
|
||||||
public WizardPane getNextPane() {
|
public WizardPane getNextPane() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Dispose of resources.
|
* Dispose of resources.
|
||||||
* @see com.webcodepro.applecommander.gui.WizardPane#dispose()
|
* @see com.webcodepro.applecommander.ui.swt.wizard.WizardPane#dispose()
|
||||||
*/
|
*/
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
control.dispose();
|
control.dispose();
|
||||||
@ -95,41 +97,44 @@ public class CompareDisksResultsPane extends WizardPane {
|
|||||||
try {
|
try {
|
||||||
disk1 = new Disk(wizard.getDiskname1()).getFormattedDisks();
|
disk1 = new Disk(wizard.getDiskname1()).getFormattedDisks();
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
errorMessages.append("Unable to load disk #1: ");
|
errorMessages.append(textBundle.
|
||||||
errorMessages.append(t.getMessage());
|
format("CompareDisksResultsPane.UnableToLoadDiskN", //$NON-NLS-1$
|
||||||
errorMessages.append("\n");
|
new Object[] { new Integer(1), t.getLocalizedMessage() }));
|
||||||
}
|
}
|
||||||
FormattedDisk[] disk2 = null;
|
FormattedDisk[] disk2 = null;
|
||||||
try {
|
try {
|
||||||
disk2 = new Disk(wizard.getDiskname2()).getFormattedDisks();
|
disk2 = new Disk(wizard.getDiskname2()).getFormattedDisks();
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
errorMessages.append("Unable to load disk #2: ");
|
errorMessages.append(textBundle.
|
||||||
errorMessages.append(t.getMessage());
|
format("CompareDisksResultsPane.UnableToLoadDiskN", //$NON-NLS-1$
|
||||||
errorMessages.append("\n");
|
new Object[] { new Integer(2), t.getLocalizedMessage() }));
|
||||||
}
|
}
|
||||||
if (disk1 != null && disk2 != null) {
|
if (disk1 != null && disk2 != null) {
|
||||||
if (disk1.length != disk2.length) {
|
if (disk1.length != disk2.length) {
|
||||||
errorMessages.append("The two disks are of differing formats - unable to compare.\n");
|
errorMessages.append(textBundle.get(
|
||||||
|
"CompareDisksResultsPane.DifferentSizeError")); //$NON-NLS-1$
|
||||||
} else {
|
} else {
|
||||||
boolean disk1TSformat = disk1[0].isCpmFormat() || disk1[0].isDosFormat() || disk1[0].isRdosFormat();
|
boolean disk1TSformat = disk1[0].isCpmFormat() || disk1[0].isDosFormat() || disk1[0].isRdosFormat();
|
||||||
boolean disk2TSformat = disk2[0].isCpmFormat() || disk2[0].isDosFormat() || disk2[0].isRdosFormat();
|
boolean disk2TSformat = disk2[0].isCpmFormat() || disk2[0].isDosFormat() || disk2[0].isRdosFormat();
|
||||||
if (disk1TSformat && disk2TSformat) {
|
if (disk1TSformat && disk2TSformat) {
|
||||||
if (!AppleUtil.disksEqualByTrackAndSector(disk1[0], disk2[0])) {
|
if (!AppleUtil.disksEqualByTrackAndSector(disk1[0], disk2[0])) {
|
||||||
errorMessages.append("The two disks do not contain the same data.\n");
|
errorMessages.append(textBundle.get(
|
||||||
|
"CompareDisksResultsPane.DataDiffersMessage")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
} else if (!disk1TSformat && !disk2TSformat) {
|
} else if (!disk1TSformat && !disk2TSformat) {
|
||||||
if (!AppleUtil.disksEqualByBlock(disk1[0], disk2[0])) {
|
if (!AppleUtil.disksEqualByBlock(disk1[0], disk2[0])) {
|
||||||
errorMessages.append("The two disks do not contain the same data.\n");
|
errorMessages.append(textBundle.get(
|
||||||
|
"CompareDisksResultsPane.DataDiffersMessage")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
errorMessages.append("The two disks are not the same data format.\n");
|
errorMessages.append(textBundle.get(
|
||||||
|
"CompareDisksResultsPane.DifferentDataFormatError")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (errorMessages.length() == 0) {
|
if (errorMessages.length() == 0) {
|
||||||
return "The disk images match.";
|
return textBundle.get("CompareDisksResultsPane.DisksMatch"); //$NON-NLS-1$
|
||||||
} else {
|
|
||||||
return errorMessages.toString();
|
|
||||||
}
|
}
|
||||||
|
return errorMessages.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ import org.eclipse.swt.widgets.FileDialog;
|
|||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
|
import com.webcodepro.applecommander.ui.TextBundle;
|
||||||
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
|
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,6 +42,7 @@ import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
|
|||||||
* @author Rob Greene
|
* @author Rob Greene
|
||||||
*/
|
*/
|
||||||
public class CompareDisksStartPane extends WizardPane {
|
public class CompareDisksStartPane extends WizardPane {
|
||||||
|
private TextBundle textBundle = TextBundle.getInstance();
|
||||||
private Composite parent;
|
private Composite parent;
|
||||||
private Object layoutData;
|
private Object layoutData;
|
||||||
private Composite control;
|
private Composite control;
|
||||||
@ -73,10 +75,10 @@ public class CompareDisksStartPane extends WizardPane {
|
|||||||
layout.spacing = 3;
|
layout.spacing = 3;
|
||||||
control.setLayout(layout);
|
control.setLayout(layout);
|
||||||
Label label = new Label(control, SWT.WRAP);
|
Label label = new Label(control, SWT.WRAP);
|
||||||
label.setText("This wizard will compare two disk images. Please\n" +
"choose the images and click the next button.\n");
|
label.setText(textBundle.get("CompareDisksStartPane.Description")); //$NON-NLS-1$
|
||||||
|
|
||||||
label = new Label(control, SWT.WRAP);
|
label = new Label(control, SWT.WRAP);
|
||||||
label.setText("Please select disk image #1:");
|
label.setText(getDiskLabel(1));
|
||||||
|
|
||||||
diskname1Text = new Text(control, SWT.WRAP | SWT.BORDER);
|
diskname1Text = new Text(control, SWT.WRAP | SWT.BORDER);
|
||||||
if (wizard.getDiskname1() != null) diskname1Text.setText(wizard.getDiskname1());
|
if (wizard.getDiskname1() != null) diskname1Text.setText(wizard.getDiskname1());
|
||||||
@ -86,27 +88,26 @@ public class CompareDisksStartPane extends WizardPane {
|
|||||||
diskname1Text.addModifyListener(new ModifyListener() {
|
diskname1Text.addModifyListener(new ModifyListener() {
|
||||||
public void modifyText(ModifyEvent event) {
|
public void modifyText(ModifyEvent event) {
|
||||||
Text text = (Text) event.getSource();
|
Text text = (Text) event.getSource();
|
||||||
wizard.setDiskname1(text.getText());
|
getWizard().setDiskname1(text.getText());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Button button = new Button(control, SWT.PUSH);
|
Button button = new Button(control, SWT.PUSH);
|
||||||
button.setText("Browse...");
|
button.setText(textBundle.get("BrowseButton")); //$NON-NLS-1$
|
||||||
button.addSelectionListener(new SelectionAdapter() {
|
button.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
FileDialog fileDialog = new FileDialog(control.getShell());
|
FileDialog fileDialog = new FileDialog(getControl().getShell());
|
||||||
fileDialog.setFilterPath(diskname1Text.getText());
|
fileDialog.setFilterPath(getDiskname1Text().getText());
|
||||||
fileDialog.setText(
|
fileDialog.setText(getDiskLabel(1));
|
||||||
"Please disk image #1");
|
|
||||||
String filename = fileDialog.open();
|
String filename = fileDialog.open();
|
||||||
if (filename != null) {
|
if (filename != null) {
|
||||||
diskname1Text.setText(filename);
|
getDiskname1Text().setText(filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
label = new Label(control, SWT.WRAP);
|
label = new Label(control, SWT.WRAP);
|
||||||
label.setText("Please select disk image #2:");
|
label.setText(getDiskLabel(2));
|
||||||
|
|
||||||
diskname2Text = new Text(control, SWT.WRAP | SWT.BORDER);
|
diskname2Text = new Text(control, SWT.WRAP | SWT.BORDER);
|
||||||
if (wizard.getDiskname2() != null) diskname2Text.setText(wizard.getDiskname2());
|
if (wizard.getDiskname2() != null) diskname2Text.setText(wizard.getDiskname2());
|
||||||
@ -115,38 +116,53 @@ public class CompareDisksStartPane extends WizardPane {
|
|||||||
diskname2Text.addModifyListener(new ModifyListener() {
|
diskname2Text.addModifyListener(new ModifyListener() {
|
||||||
public void modifyText(ModifyEvent event) {
|
public void modifyText(ModifyEvent event) {
|
||||||
Text text = (Text) event.getSource();
|
Text text = (Text) event.getSource();
|
||||||
wizard.setDiskname2(text.getText());
|
getWizard().setDiskname2(text.getText());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
button = new Button(control, SWT.PUSH);
|
button = new Button(control, SWT.PUSH);
|
||||||
button.setText("Browse...");
|
button.setText(textBundle.get("BrowseButton")); //$NON-NLS-1$
|
||||||
button.addSelectionListener(new SelectionAdapter() {
|
button.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
FileDialog fileDialog = new FileDialog(control.getShell());
|
FileDialog fileDialog = new FileDialog(getControl().getShell());
|
||||||
fileDialog.setFilterPath(diskname2Text.getText());
|
fileDialog.setFilterPath(getDiskname2Text().getText());
|
||||||
fileDialog.setText(
|
fileDialog.setText(getDiskLabel(2));
|
||||||
"Please disk image #2");
|
|
||||||
String filename = fileDialog.open();
|
String filename = fileDialog.open();
|
||||||
if (filename != null) {
|
if (filename != null) {
|
||||||
diskname2Text.setText(filename);
|
getDiskname2Text().setText(filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get the next pane. A null return indicates the end of the wizard.
|
* Get the next pane. A null return indicates the end of the wizard.
|
||||||
* @see com.webcodepro.applecommander.gui.WizardPane#getNextPane()
|
* @see com.webcodepro.applecommander.ui.swt.wizard.WizardPane#getNextPane()
|
||||||
*/
|
*/
|
||||||
public WizardPane getNextPane() {
|
public WizardPane getNextPane() {
|
||||||
return new CompareDisksResultsPane(parent, wizard, layoutData);
|
return new CompareDisksResultsPane(parent, wizard, layoutData);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Dispose of resources.
|
* Dispose of resources.
|
||||||
* @see com.webcodepro.applecommander.gui.WizardPane#dispose()
|
* @see com.webcodepro.applecommander.ui.swt.wizard.WizardPane#dispose()
|
||||||
*/
|
*/
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
control.dispose();
|
control.dispose();
|
||||||
control = null;
|
control = null;
|
||||||
}
|
}
|
||||||
|
protected Composite getControl() {
|
||||||
|
return control;
|
||||||
|
}
|
||||||
|
protected Text getDiskname1Text() {
|
||||||
|
return diskname1Text;
|
||||||
|
}
|
||||||
|
protected Text getDiskname2Text() {
|
||||||
|
return diskname2Text;
|
||||||
|
}
|
||||||
|
protected CompareDisksWizard getWizard() {
|
||||||
|
return wizard;
|
||||||
|
}
|
||||||
|
protected String getDiskLabel(int diskNumber) {
|
||||||
|
return textBundle.format("CompareDisksStartPane.DiskNLabel", //$NON-NLS-1$
|
||||||
|
new Object[] { new Integer(diskNumber) });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ package com.webcodepro.applecommander.ui.swt.wizard.comparedisks;
|
|||||||
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
|
import com.webcodepro.applecommander.ui.TextBundle;
|
||||||
import com.webcodepro.applecommander.ui.swt.util.ImageManager;
|
import com.webcodepro.applecommander.ui.swt.util.ImageManager;
|
||||||
import com.webcodepro.applecommander.ui.swt.wizard.Wizard;
|
import com.webcodepro.applecommander.ui.swt.wizard.Wizard;
|
||||||
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
|
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
|
||||||
@ -37,11 +38,12 @@ public class CompareDisksWizard extends Wizard {
|
|||||||
* Constructor for ExportWizard.
|
* Constructor for ExportWizard.
|
||||||
*/
|
*/
|
||||||
public CompareDisksWizard(Shell parent, ImageManager imageManager) {
|
public CompareDisksWizard(Shell parent, ImageManager imageManager) {
|
||||||
super(parent, imageManager.get(ImageManager.LOGO_COMPARE_IMAGE_WIZARD), "Compare Disks Wizard");
|
super(parent, imageManager.get(ImageManager.LOGO_COMPARE_IMAGE_WIZARD),
|
||||||
|
TextBundle.getInstance().get("CompareDisksTitle")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Create the initial display used in the wizard.
|
* Create the initial display used in the wizard.
|
||||||
* @see com.webcodepro.applecommander.ui.swt.Wizard#createInitialWizardPane()
|
* @see com.webcodepro.applecommander.ui.swt.wizard.Wizard#createInitialWizardPane()
|
||||||
*/
|
*/
|
||||||
public WizardPane createInitialWizardPane() {
|
public WizardPane createInitialWizardPane() {
|
||||||
return new CompareDisksStartPane(getContentPane(), this, null);
|
return new CompareDisksStartPane(getContentPane(), this, null);
|
||||||
|
@ -33,6 +33,7 @@ import org.eclipse.swt.widgets.DirectoryDialog;
|
|||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
|
import com.webcodepro.applecommander.ui.TextBundle;
|
||||||
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
|
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -42,6 +43,7 @@ import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
|
|||||||
* @author Rob Greene
|
* @author Rob Greene
|
||||||
*/
|
*/
|
||||||
public class CompileFileStartPane extends WizardPane {
|
public class CompileFileStartPane extends WizardPane {
|
||||||
|
private TextBundle textBundle = TextBundle.getInstance();
|
||||||
private Composite parent;
|
private Composite parent;
|
||||||
private Object layoutData;
|
private Object layoutData;
|
||||||
private Composite control;
|
private Composite control;
|
||||||
@ -73,12 +75,10 @@ public class CompileFileStartPane extends WizardPane {
|
|||||||
layout.spacing = 3;
|
layout.spacing = 3;
|
||||||
control.setLayout(layout);
|
control.setLayout(layout);
|
||||||
Label label = new Label(control, SWT.WRAP);
|
Label label = new Label(control, SWT.WRAP);
|
||||||
label.setText("Please note that the current compiler is \n"
|
label.setText(textBundle.get("CompileFileWarning")); //$NON-NLS-1$
|
||||||
+ "very BETA and simply builds an assembly program \n"
|
|
||||||
+ "and stores it on your harddisk...");
|
|
||||||
|
|
||||||
label = new Label(control, SWT.WRAP);
|
label = new Label(control, SWT.WRAP);
|
||||||
label.setText("Please indicate the destination for the files:");
|
label.setText(textBundle.get("CompileFileDestinationPrompt")); //$NON-NLS-1$
|
||||||
|
|
||||||
directoryText = new Text(control, SWT.WRAP | SWT.BORDER);
|
directoryText = new Text(control, SWT.WRAP | SWT.BORDER);
|
||||||
if (wizard.getDirectory() != null) directoryText.setText(wizard.getDirectory());
|
if (wizard.getDirectory() != null) directoryText.setText(wizard.getDirectory());
|
||||||
@ -88,38 +88,51 @@ public class CompileFileStartPane extends WizardPane {
|
|||||||
directoryText.addModifyListener(new ModifyListener() {
|
directoryText.addModifyListener(new ModifyListener() {
|
||||||
public void modifyText(ModifyEvent event) {
|
public void modifyText(ModifyEvent event) {
|
||||||
Text text = (Text) event.getSource();
|
Text text = (Text) event.getSource();
|
||||||
wizard.setDirectory(text.getText());
|
getWizard().setDirectory(text.getText());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Button button = new Button(control, SWT.PUSH);
|
Button button = new Button(control, SWT.PUSH);
|
||||||
button.setText("Browse...");
|
button.setText(textBundle.get("BrowseButton")); //$NON-NLS-1$
|
||||||
button.addSelectionListener(new SelectionAdapter() {
|
button.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
DirectoryDialog directoryDialog = new DirectoryDialog(control.getShell());
|
DirectoryDialog directoryDialog = new DirectoryDialog(
|
||||||
directoryDialog.setFilterPath(directoryText.getText());
|
getControl().getShell());
|
||||||
directoryDialog.setMessage(
|
directoryDialog.setFilterPath(getDirectoryText().getText());
|
||||||
"Please choose the directory to which exported files will be written");
|
directoryDialog.setMessage(TextBundle.getInstance().
|
||||||
|
get("CompileFileDirectoryPrompt")); //$NON-NLS-1$
|
||||||
String directory = directoryDialog.open();
|
String directory = directoryDialog.open();
|
||||||
if (directory != null) {
|
if (directory != null) {
|
||||||
directoryText.setText(directory);
|
getDirectoryText().setText(directory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get the next pane. A null return indicates the end of the wizard.
|
* Get the next pane. A null return indicates the end of the wizard.
|
||||||
* @see com.webcodepro.applecommander.gui.WizardPane#getNextPane()
|
* @see com.webcodepro.applecommander.ui.swt.wizard.WizardPane#getNextPane()
|
||||||
*/
|
*/
|
||||||
public WizardPane getNextPane() {
|
public WizardPane getNextPane() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Dispose of resources.
|
* Dispose of resources.
|
||||||
* @see com.webcodepro.applecommander.gui.WizardPane#dispose()
|
* @see com.webcodepro.applecommander.ui.swt.wizard.WizardPane#dispose()
|
||||||
*/
|
*/
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
control.dispose();
|
control.dispose();
|
||||||
control = null;
|
control = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Composite getControl() {
|
||||||
|
return control;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Text getDirectoryText() {
|
||||||
|
return directoryText;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CompileWizard getWizard() {
|
||||||
|
return wizard;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ package com.webcodepro.applecommander.ui.swt.wizard.compilefile;
|
|||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
import com.webcodepro.applecommander.storage.FormattedDisk;
|
import com.webcodepro.applecommander.storage.FormattedDisk;
|
||||||
|
import com.webcodepro.applecommander.ui.TextBundle;
|
||||||
import com.webcodepro.applecommander.ui.swt.util.ImageManager;
|
import com.webcodepro.applecommander.ui.swt.util.ImageManager;
|
||||||
import com.webcodepro.applecommander.ui.swt.wizard.Wizard;
|
import com.webcodepro.applecommander.ui.swt.wizard.Wizard;
|
||||||
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
|
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
|
||||||
@ -39,7 +40,8 @@ public class CompileWizard extends Wizard {
|
|||||||
* Constructor for ExportWizard.
|
* Constructor for ExportWizard.
|
||||||
*/
|
*/
|
||||||
public CompileWizard(Shell parent, ImageManager imageManager, FormattedDisk disk) {
|
public CompileWizard(Shell parent, ImageManager imageManager, FormattedDisk disk) {
|
||||||
super(parent, imageManager.get(ImageManager.LOGO_COMPILE_WIZARD), "Compile Wizard");
|
super(parent, imageManager.get(ImageManager.LOGO_COMPILE_WIZARD),
|
||||||
|
TextBundle.getInstance().get("CompileWizardTitle")); //$NON-NLS-1$
|
||||||
this.disk = disk;
|
this.disk = disk;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -50,7 +52,7 @@ public class CompileWizard extends Wizard {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Create the initial display used in the wizard.
|
* Create the initial display used in the wizard.
|
||||||
* @see com.webcodepro.applecommander.ui.swt.Wizard#createInitialWizardPane()
|
* @see com.webcodepro.applecommander.ui.swt.wizard.Wizard#createInitialWizardPane()
|
||||||
*/
|
*/
|
||||||
public WizardPane createInitialWizardPane() {
|
public WizardPane createInitialWizardPane() {
|
||||||
return new CompileFileStartPane(getContentPane(), this, null);
|
return new CompileFileStartPane(getContentPane(), this, null);
|
||||||
|
Loading…
Reference in New Issue
Block a user