2022-01-19 03:55:20 +00:00
|
|
|
/*
|
|
|
|
* AppleCommander - An Apple ][ image utility.
|
|
|
|
* Copyright (C) 2003-2022 by Robert Greene and others
|
|
|
|
* robgreene at users.sourceforge.net
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
|
|
* option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
2004-06-09 03:58:00 +00:00
|
|
|
package com.webcodepro.applecommander.ui.swt.wizard.importfile;
|
2003-02-05 03:55:00 +00:00
|
|
|
|
2018-06-09 03:18:41 +00:00
|
|
|
import com.webcodepro.applecommander.storage.os.prodos.ProdosFormatDisk;
|
2004-06-09 03:58:00 +00:00
|
|
|
import com.webcodepro.applecommander.ui.ImportSpecification;
|
2004-07-11 15:07:56 +00:00
|
|
|
import com.webcodepro.applecommander.ui.UiBundle;
|
2004-06-09 03:58:00 +00:00
|
|
|
import com.webcodepro.applecommander.ui.UserPreferences;
|
|
|
|
import com.webcodepro.applecommander.ui.swt.util.SwtUtil;
|
|
|
|
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
|
|
|
|
import com.webcodepro.applecommander.util.AppleUtil;
|
2004-07-11 15:07:56 +00:00
|
|
|
import com.webcodepro.applecommander.util.TextBundle;
|
2018-06-09 03:18:41 +00:00
|
|
|
import io.github.applecommander.applesingle.AppleSingle;
|
|
|
|
import io.github.applecommander.applesingle.AppleSingleReader;
|
|
|
|
import io.github.applecommander.applesingle.ProdosFileInfo;
|
|
|
|
import io.github.applecommander.applesingle.Utilities;
|
2023-10-21 21:59:15 +00:00
|
|
|
import org.eclipse.swt.SWT;
|
|
|
|
import org.eclipse.swt.events.SelectionAdapter;
|
|
|
|
import org.eclipse.swt.events.SelectionEvent;
|
|
|
|
import org.eclipse.swt.layout.*;
|
|
|
|
import org.eclipse.swt.widgets.*;
|
|
|
|
|
|
|
|
import java.io.*;
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.Optional;
|
2018-06-09 03:18:41 +00:00
|
|
|
|
2003-02-05 03:55:00 +00:00
|
|
|
/**
|
|
|
|
* Allow the used to choose the files to import into the disk image.
|
|
|
|
* <br>
|
|
|
|
* Created on Jan 17, 2003.
|
|
|
|
* @author Rob Greene
|
|
|
|
*/
|
|
|
|
public class ImportSelectFilesWizardPane extends WizardPane {
|
2004-07-11 15:07:56 +00:00
|
|
|
private TextBundle textBundle = UiBundle.getInstance();
|
2003-02-05 03:55:00 +00:00
|
|
|
private ImportWizard wizard;
|
|
|
|
private Composite control;
|
|
|
|
private Composite parent;
|
|
|
|
private Button removeButton;
|
|
|
|
private Button editButton;
|
|
|
|
private Table fileTable;
|
2003-02-11 04:42:45 +00:00
|
|
|
private Text addressText;
|
2004-06-23 03:46:10 +00:00
|
|
|
private Button rawCheckbox;
|
2003-02-05 03:55:00 +00:00
|
|
|
/**
|
|
|
|
* Constructor for ImportSelectFilesWizardPane.
|
|
|
|
*/
|
|
|
|
public ImportSelectFilesWizardPane(Composite parent, ImportWizard wizard) {
|
|
|
|
super();
|
|
|
|
this.parent = parent;
|
|
|
|
this.wizard = wizard;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Get the next visible pane.
|
2004-07-04 03:34:35 +00:00
|
|
|
* @see com.webcodepro.applecommander.ui.swt.wizard.WizardPane#getNextPane()
|
2003-02-05 03:55:00 +00:00
|
|
|
*/
|
|
|
|
public WizardPane getNextPane() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Create the wizard pane.
|
2004-07-04 03:34:35 +00:00
|
|
|
* @see com.webcodepro.applecommander.ui.swt.wizard.WizardPane#open()
|
2003-02-05 03:55:00 +00:00
|
|
|
*/
|
|
|
|
public void open() {
|
|
|
|
control = new Composite(parent, SWT.NULL);
|
|
|
|
wizard.enableNextButton(false);
|
|
|
|
wizard.enableFinishButton(false);
|
|
|
|
RowLayout layout = new RowLayout(SWT.VERTICAL);
|
|
|
|
layout.justify = true;
|
|
|
|
layout.marginBottom = 5;
|
|
|
|
layout.marginLeft = 5;
|
|
|
|
layout.marginRight = 5;
|
|
|
|
layout.marginTop = 5;
|
|
|
|
layout.spacing = 3;
|
|
|
|
control.setLayout(layout);
|
|
|
|
Label label = new Label(control, SWT.WRAP);
|
2004-07-04 03:34:35 +00:00
|
|
|
label.setText(textBundle.get("ImportWizardPrompt")); //$NON-NLS-1$
|
2003-02-05 03:55:00 +00:00
|
|
|
|
|
|
|
fileTable = new Table(control, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION
|
|
|
|
| SWT.V_SCROLL | SWT.H_SCROLL);
|
|
|
|
fileTable.setLayoutData(new RowData(330, 100));
|
|
|
|
fileTable.setHeaderVisible(true);
|
|
|
|
fileTable.addSelectionListener(new SelectionAdapter() {
|
|
|
|
/**
|
|
|
|
* Single click.
|
|
|
|
*/
|
|
|
|
public void widgetSelected(SelectionEvent event) {
|
2004-07-04 03:34:35 +00:00
|
|
|
getRemoveButton().setEnabled(true);
|
|
|
|
getEditButton().setEnabled(true);
|
2003-02-05 03:55:00 +00:00
|
|
|
}
|
2003-02-11 04:42:45 +00:00
|
|
|
/**
|
|
|
|
* Double-click.
|
|
|
|
*/
|
|
|
|
public void widgetDefaultSelected(SelectionEvent event) {
|
|
|
|
editSelection();
|
|
|
|
}
|
2003-02-05 03:55:00 +00:00
|
|
|
});
|
2023-10-25 00:11:46 +00:00
|
|
|
|
2003-02-05 03:55:00 +00:00
|
|
|
TableColumn column = new TableColumn(fileTable, SWT.LEFT);
|
2004-07-04 03:34:35 +00:00
|
|
|
column.setText(textBundle.get("SourceColumnHeader")); //$NON-NLS-1$
|
2003-02-05 03:55:00 +00:00
|
|
|
column.setWidth(130);
|
|
|
|
column = new TableColumn(fileTable, SWT.LEFT);
|
2004-07-04 03:34:35 +00:00
|
|
|
column.setText(textBundle.get("TargetColumnHeader")); //$NON-NLS-1$
|
2003-02-05 03:55:00 +00:00
|
|
|
column.setWidth(130);
|
|
|
|
column = new TableColumn(fileTable, SWT.LEFT);
|
2004-07-04 03:34:35 +00:00
|
|
|
column.setText(textBundle.get("TypeColumnHeader")); //$NON-NLS-1$
|
2003-02-05 03:55:00 +00:00
|
|
|
column.setWidth(70);
|
|
|
|
|
|
|
|
Composite buttonPanel = new Composite(control, SWT.NULL);
|
|
|
|
buttonPanel.setLayout(new FillLayout());
|
|
|
|
|
|
|
|
Button chooseButton = new Button(buttonPanel, SWT.PUSH);
|
2004-07-04 03:34:35 +00:00
|
|
|
chooseButton.setText(textBundle.get("ChooseButton")); //$NON-NLS-1$
|
2003-02-05 03:55:00 +00:00
|
|
|
chooseButton.setFocus();
|
2003-02-11 04:42:45 +00:00
|
|
|
chooseButton.addSelectionListener(new SelectionAdapter() {
|
2003-02-05 03:55:00 +00:00
|
|
|
/**
|
|
|
|
* Single click.
|
|
|
|
*/
|
|
|
|
public void widgetSelected(SelectionEvent event) {
|
2018-06-09 03:18:41 +00:00
|
|
|
try {
|
|
|
|
FileDialog dialog = new FileDialog(getParent().getShell(),
|
|
|
|
SWT.OPEN | SWT.MULTI);
|
|
|
|
dialog.setFilterPath(
|
|
|
|
UserPreferences.getInstance().getImportDirectory());
|
|
|
|
String filename = dialog.open();
|
|
|
|
if (filename != null) {
|
|
|
|
setFilenames(dialog.getFilterPath(), dialog.getFileNames());
|
|
|
|
UserPreferences.getInstance().setImportDirectory(
|
|
|
|
dialog.getFilterPath());
|
|
|
|
}
|
|
|
|
} catch (Throwable t) {
|
|
|
|
MessageBox mb = new MessageBox(getParent().getShell(),
|
|
|
|
SWT.OK | SWT.ICON_ERROR | SWT.APPLICATION_MODAL);
|
|
|
|
mb.setText("Error!");
|
|
|
|
StringBuilder message = new StringBuilder();
|
|
|
|
while (t != null) {
|
|
|
|
if (t.getMessage() != null && t.getMessage().length() > 0) {
|
|
|
|
message.append(t.getMessage());
|
|
|
|
message.append("\n");
|
|
|
|
}
|
|
|
|
t = t.getCause();
|
|
|
|
}
|
|
|
|
mb.setMessage(message.toString());
|
|
|
|
mb.open();
|
2003-02-05 03:55:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
removeButton = new Button(buttonPanel, SWT.PUSH);
|
2004-07-04 03:34:35 +00:00
|
|
|
removeButton.setText(textBundle.get("RemoveButton")); //$NON-NLS-1$
|
2003-02-05 03:55:00 +00:00
|
|
|
removeButton.setEnabled(false);
|
|
|
|
removeButton.addSelectionListener(new SelectionAdapter() {
|
|
|
|
/**
|
|
|
|
* Single click.
|
|
|
|
*/
|
|
|
|
public void widgetSelected(SelectionEvent event) {
|
2004-07-04 03:34:35 +00:00
|
|
|
TableItem[] items = getFileTable().getSelection();
|
2003-02-05 03:55:00 +00:00
|
|
|
for (int i=0; i<items.length; i++) {
|
|
|
|
ImportSpecification spec = (ImportSpecification)
|
|
|
|
items[i].getData();
|
2004-07-04 03:34:35 +00:00
|
|
|
getWizard().removeImportSpecification(spec);
|
2003-02-05 03:55:00 +00:00
|
|
|
}
|
2004-07-04 03:34:35 +00:00
|
|
|
getRemoveButton().setEnabled(false);
|
2023-10-23 00:52:27 +00:00
|
|
|
getEditButton().setEnabled(false);
|
2003-02-05 03:55:00 +00:00
|
|
|
refreshTable();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
editButton = new Button(buttonPanel, SWT.PUSH);
|
2004-07-04 03:34:35 +00:00
|
|
|
editButton.setText(textBundle.get("EditButton")); //$NON-NLS-1$
|
2003-02-05 03:55:00 +00:00
|
|
|
editButton.setEnabled(false);
|
2003-02-11 04:42:45 +00:00
|
|
|
editButton.addSelectionListener(new SelectionAdapter() {
|
2003-02-05 03:55:00 +00:00
|
|
|
/**
|
|
|
|
* Single click.
|
|
|
|
*/
|
|
|
|
public void widgetSelected(SelectionEvent event) {
|
|
|
|
editSelection();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Set all filenames to be imported.
|
|
|
|
*/
|
2018-06-09 03:18:41 +00:00
|
|
|
protected void setFilenames(String path, String[] filenames) throws FileNotFoundException, IOException {
|
2003-02-05 03:55:00 +00:00
|
|
|
for (int i=0; i<filenames.length; i++) {
|
2018-06-09 03:18:41 +00:00
|
|
|
String filename = path + File.separatorChar + filenames[i];
|
|
|
|
|
|
|
|
String suggestedFiletype = wizard.getDisk().getSuggestedFiletype(filenames[i]);
|
|
|
|
String suggestedFilename = wizard.getDisk().getSuggestedFilename(filenames[i]);
|
|
|
|
int suggestedAddress = 0;
|
|
|
|
|
|
|
|
try (InputStream inputStream = new FileInputStream(filename)) {
|
|
|
|
byte[] data = Utilities.toByteArray(inputStream);
|
|
|
|
AppleSingleReader reader = AppleSingleReader.builder(data).build();
|
|
|
|
if (AppleSingle.test(reader)) {
|
|
|
|
AppleSingle as = AppleSingle.read(data);
|
|
|
|
suggestedFilename = Optional.ofNullable(as.getRealName())
|
|
|
|
.orElse(suggestedFilename);
|
2023-10-27 19:27:29 +00:00
|
|
|
suggestedFiletype = wizard.getDisk().fromProdosFiletype(
|
|
|
|
ProdosFormatDisk.getFiletype(as.getProdosFileInfo().getFileType()));
|
2018-06-09 03:18:41 +00:00
|
|
|
suggestedAddress = Optional.ofNullable(as.getProdosFileInfo())
|
|
|
|
.map(ProdosFileInfo::getAuxType)
|
|
|
|
.orElse(suggestedAddress);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ImportSpecification spec = new ImportSpecification(filename, suggestedFilename, suggestedFiletype);
|
|
|
|
spec.setAddress(suggestedAddress);
|
2003-02-05 03:55:00 +00:00
|
|
|
wizard.addImportSpecification(spec);
|
|
|
|
}
|
|
|
|
refreshTable();
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Refresh the table of information.
|
|
|
|
*/
|
|
|
|
protected void refreshTable() {
|
|
|
|
fileTable.removeAll();
|
2018-06-09 03:18:41 +00:00
|
|
|
Iterator<ImportSpecification> specs = wizard.getImportSpecifications().iterator();
|
2003-02-05 03:55:00 +00:00
|
|
|
boolean canFinish = specs.hasNext();
|
|
|
|
while (specs.hasNext()) {
|
|
|
|
ImportSpecification spec = (ImportSpecification) specs.next();
|
2003-02-11 04:42:45 +00:00
|
|
|
File file = new File(spec.getSourceFilename());
|
2003-02-05 03:55:00 +00:00
|
|
|
TableItem item = new TableItem(fileTable, SWT.NULL);
|
|
|
|
item.setText(new String[] {
|
2003-02-11 04:42:45 +00:00
|
|
|
file.getName(),
|
2003-02-05 03:55:00 +00:00
|
|
|
spec.getTargetFilename(),
|
|
|
|
spec.getFiletype() });
|
|
|
|
item.setData(spec);
|
2003-02-11 04:42:45 +00:00
|
|
|
canFinish &= spec.hasFiletype();
|
2003-02-05 03:55:00 +00:00
|
|
|
}
|
|
|
|
fileTable.redraw();
|
|
|
|
wizard.enableFinishButton(canFinish);
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Dispose of all resources.
|
2004-07-04 03:34:35 +00:00
|
|
|
* @see com.webcodepro.applecommander.ui.swt.wizard.WizardPane#dispose()
|
2003-02-05 03:55:00 +00:00
|
|
|
*/
|
|
|
|
public void dispose() {
|
|
|
|
fileTable.dispose();
|
|
|
|
control.dispose();
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Edit the current selection.
|
|
|
|
*/
|
|
|
|
public void editSelection() {
|
2003-02-11 04:42:45 +00:00
|
|
|
final ImportSpecification spec = (ImportSpecification)
|
|
|
|
fileTable.getSelection()[0].getData();
|
|
|
|
|
|
|
|
final Shell dialog = new Shell(wizard.getDialog(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
|
2004-07-04 03:34:35 +00:00
|
|
|
dialog.setText(textBundle.get("FileImportSettingsTitle")); //$NON-NLS-1$
|
2003-02-11 04:42:45 +00:00
|
|
|
GridLayout layout = new GridLayout();
|
|
|
|
layout.horizontalSpacing = 5;
|
|
|
|
layout.makeColumnsEqualWidth = false;
|
|
|
|
layout.marginHeight = 5;
|
|
|
|
layout.marginWidth = 5;
|
|
|
|
layout.numColumns = 2;
|
|
|
|
layout.verticalSpacing = 5;
|
|
|
|
dialog.setLayout(layout);
|
|
|
|
|
|
|
|
// Filename prompt:
|
|
|
|
Label label = new Label(dialog, SWT.NONE);
|
2004-07-04 03:34:35 +00:00
|
|
|
label.setText(textBundle.get("FilenameLabel")); //$NON-NLS-1$
|
2003-02-11 04:42:45 +00:00
|
|
|
final Text filenameText = new Text(dialog, SWT.BORDER);
|
|
|
|
filenameText.setText(spec.getTargetFilename());
|
|
|
|
filenameText.setTextLimit(30);
|
|
|
|
GridData layoutData = new GridData();
|
|
|
|
layoutData.widthHint = 150;
|
|
|
|
filenameText.setLayoutData(layoutData);
|
|
|
|
|
|
|
|
// Filetype prompt:
|
|
|
|
label = new Label(dialog, SWT.NONE);
|
2004-07-04 03:34:35 +00:00
|
|
|
label.setText(textBundle.get("FiletypeLabel")); //$NON-NLS-1$
|
2003-02-11 04:42:45 +00:00
|
|
|
final Combo filetypes = new Combo(dialog, SWT.BORDER | SWT.READ_ONLY);
|
|
|
|
filetypes.setItems(wizard.getDisk().getFiletypes());
|
2023-10-27 19:27:29 +00:00
|
|
|
if (spec.hasFiletype() && filetypes.indexOf(spec.getFiletype()) != -1) {
|
2003-02-11 04:42:45 +00:00
|
|
|
filetypes.select(filetypes.indexOf(spec.getFiletype()));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Address component: (only used for some filetypes)
|
|
|
|
label = new Label(dialog, SWT.NONE);
|
2004-07-04 03:34:35 +00:00
|
|
|
label.setText(textBundle.get("AddressLabel")); //$NON-NLS-1$
|
2003-02-11 04:42:45 +00:00
|
|
|
addressText = new Text(dialog, SWT.BORDER);
|
|
|
|
addressText.setTextLimit(5);
|
|
|
|
addressText.setText(AppleUtil.getFormattedWord(spec.getAddress()));
|
|
|
|
layoutData = new GridData();
|
|
|
|
layoutData.widthHint = 75;
|
|
|
|
addressText.setLayoutData(layoutData);
|
2003-03-02 23:11:23 +00:00
|
|
|
if (spec.hasFiletype()) {
|
|
|
|
addressText.setEnabled(
|
|
|
|
wizard.getDisk().needsAddress(spec.getFiletype()));
|
|
|
|
}
|
2004-06-23 03:46:10 +00:00
|
|
|
|
|
|
|
// RAW file image: (probably only used for DOS 3.3)
|
|
|
|
label = new Label(dialog, SWT.NONE);
|
2004-07-04 03:34:35 +00:00
|
|
|
label.setText(textBundle.get("RawBinaryCheckbox")); //$NON-NLS-1$
|
2004-06-23 03:46:10 +00:00
|
|
|
rawCheckbox = new Button(dialog, SWT.CHECK);
|
|
|
|
rawCheckbox.setSelection(spec.isRawFileImport());
|
2003-03-02 23:11:23 +00:00
|
|
|
|
|
|
|
// Enable/disable the address component:
|
|
|
|
filetypes.addSelectionListener(new SelectionAdapter() {
|
|
|
|
public void widgetSelected(SelectionEvent event) {
|
|
|
|
String filetype = filetypes.getItem(
|
|
|
|
filetypes.getSelectionIndex());
|
2004-07-04 03:34:35 +00:00
|
|
|
getAddressText().setEnabled(
|
|
|
|
getWizard().getDisk().needsAddress(filetype));
|
2003-03-02 23:11:23 +00:00
|
|
|
}
|
|
|
|
});
|
2003-02-11 04:42:45 +00:00
|
|
|
|
|
|
|
// Bottom row of buttons
|
|
|
|
layoutData = new GridData();
|
|
|
|
layoutData.horizontalSpan = 2;
|
|
|
|
layoutData.grabExcessHorizontalSpace = true;
|
|
|
|
layoutData.horizontalAlignment = GridData.CENTER;
|
|
|
|
Composite composite = new Composite(dialog, SWT.NONE);
|
|
|
|
composite.setLayoutData(layoutData);
|
|
|
|
composite.setLayout(new FillLayout(SWT.HORIZONTAL));
|
|
|
|
Button button = new Button(composite, SWT.PUSH);
|
2004-07-04 03:34:35 +00:00
|
|
|
button.setText(textBundle.get("CancelButton")); //$NON-NLS-1$
|
2003-02-11 04:42:45 +00:00
|
|
|
button.addSelectionListener(new SelectionAdapter() {
|
|
|
|
public void widgetSelected(SelectionEvent e) {
|
|
|
|
filenameText.dispose();
|
|
|
|
filetypes.dispose();
|
2004-07-04 03:34:35 +00:00
|
|
|
getAddressText().dispose();
|
|
|
|
getRawCheckBox().dispose();
|
2003-02-11 04:42:45 +00:00
|
|
|
dialog.close();
|
2023-10-25 00:11:46 +00:00
|
|
|
getRemoveButton().setEnabled(false);
|
|
|
|
getEditButton().setEnabled(false);
|
|
|
|
getFileTable().deselectAll();
|
2003-02-11 04:42:45 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
button = new Button(composite, SWT.PUSH);
|
2004-07-04 03:34:35 +00:00
|
|
|
button.setText(textBundle.get("OkButton")); //$NON-NLS-1$
|
2003-02-11 04:42:45 +00:00
|
|
|
dialog.setDefaultButton(button);
|
|
|
|
button.addSelectionListener(new SelectionAdapter() {
|
|
|
|
public void widgetSelected(SelectionEvent e) {
|
2023-10-25 00:11:46 +00:00
|
|
|
getRemoveButton().setEnabled(false);
|
|
|
|
getEditButton().setEnabled(false);
|
|
|
|
getFileTable().deselectAll();
|
2023-10-21 21:59:15 +00:00
|
|
|
try {
|
|
|
|
// Make an attempt at validating before accepting the change
|
|
|
|
ImportSpecification temp = new ImportSpecification(spec);
|
|
|
|
temp.setTargetFilename(getWizard().getDisk().
|
|
|
|
getSuggestedFilename(filenameText.getText()));
|
|
|
|
temp.setFiletype(filetypes.getItem(
|
|
|
|
filetypes.getSelectionIndex()));
|
|
|
|
temp.setAddress(AppleUtil.convertFormattedWord(
|
|
|
|
getAddressText().getText()));
|
|
|
|
temp.setRawFileImport(getRawCheckBox().getSelection());
|
|
|
|
wizard.validate(temp);
|
|
|
|
} catch (Throwable t) {
|
|
|
|
SwtUtil.showErrorDialog(wizard.getDialog(), "Error", t.getMessage());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-07-04 03:34:35 +00:00
|
|
|
spec.setTargetFilename(getWizard().getDisk().
|
2003-02-11 04:42:45 +00:00
|
|
|
getSuggestedFilename(filenameText.getText()));
|
|
|
|
spec.setFiletype(filetypes.getItem(
|
|
|
|
filetypes.getSelectionIndex()));
|
|
|
|
spec.setAddress(AppleUtil.convertFormattedWord(
|
2004-07-04 03:34:35 +00:00
|
|
|
getAddressText().getText()));
|
|
|
|
spec.setRawFileImport(getRawCheckBox().getSelection());
|
2003-02-11 04:42:45 +00:00
|
|
|
filenameText.dispose();
|
|
|
|
filetypes.dispose();
|
2004-07-04 03:34:35 +00:00
|
|
|
getAddressText().dispose();
|
|
|
|
getRawCheckBox().dispose();
|
2003-02-11 04:42:45 +00:00
|
|
|
dialog.close();
|
|
|
|
refreshTable();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
dialog.pack();
|
2003-03-16 05:27:38 +00:00
|
|
|
SwtUtil.center(wizard.getDialog(), dialog);
|
2003-02-11 04:42:45 +00:00
|
|
|
dialog.open();
|
2003-02-05 03:55:00 +00:00
|
|
|
}
|
2004-07-04 03:34:35 +00:00
|
|
|
|
|
|
|
protected Button getRemoveButton() {
|
|
|
|
return removeButton;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected Button getEditButton() {
|
|
|
|
return editButton;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected Composite getParent() {
|
|
|
|
return parent;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected Table getFileTable() {
|
|
|
|
return fileTable;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected ImportWizard getWizard() {
|
|
|
|
return wizard;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected Text getAddressText() {
|
|
|
|
return addressText;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected Button getRawCheckBox() {
|
|
|
|
return rawCheckbox;
|
|
|
|
}
|
2003-02-05 03:55:00 +00:00
|
|
|
}
|