protected Control createDialogArea( Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
mtabFolder = new TabFolder(container, SWT.NONE);
mtabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
mtabMBox = new TabItem(mtabFolder, SWT.NONE);
mtabMBox.setText("Mbox");
mCurTab = mtabMBox;
mcompMbox = new Composite(mtabFolder, SWT.NONE);
mtabMBox.setControl(mcompMbox);
mcompMbox.setLayout(new GridLayout(3, false));
Label lblMboxPath = new Label(mcompMbox, SWT.NONE);
lblMboxPath.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblMboxPath.setSize(60, 15);
lblMboxPath.setText("mbox Path:");
mtxtPath = new Text(mcompMbox, SWT.BORDER);
mtxtPath.addFocusListener(new FocusAdapter() {
@Override
public void focusLost( FocusEvent e) {
checkButtonState();
return;
}
});
mtxtPath.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
mtxtPath.setSize(277, 21);
Button btnBrowse = new Button(mcompMbox, SWT.NONE);
btnBrowse.setSize(50, 25);
btnBrowse.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected( SelectionEvent e) {
Shell shell = new Shell(Display.getDefault(), SWT.APPLICATION_MODAL);
FileDialog dialog = new FileDialog(shell);
dialog.setText("Select mbox file");
dialog.setFileName(mtxtPath.getText());
String file = dialog.open();
if (file != null) {
mtxtPath.setText(file);
}
checkButtonState();
return;
}
});
btnBrowse.setText("Browse");
Label lblTargetFolder = new Label(mcompMbox, SWT.NONE);
lblTargetFolder.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblTargetFolder.setSize(73, 15);
lblTargetFolder.setText("Target Folder:");
mbuttonSelFolder = new Button(mcompMbox, SWT.NONE);
mbuttonSelFolder.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected( SelectionEvent e) {
try {
FolderSelectDialog dialog = new FolderSelectDialog(getShell());
dialog.open();
mFolderID = dialog.getSelectedFolder();
mbuttonSelFolder.setText((mFolderID == 0) ? "<select folder>" : getFolder(mFolderID).getName());
} catch (RemoteException ex) {
logger.error("Remote Exception", ex);
} catch (FolderNotFoundException ex) {
logger.error("Folder Not Found Exception", ex);
}
checkButtonState();
return;
}
});
mbuttonSelFolder.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
mbuttonSelFolder.setText("<select folder>");
new Label(mcompMbox, SWT.NONE);
Label lblAccountIfNo = new Label(mcompMbox, SWT.NONE);
lblAccountIfNo.setToolTipText("Accoun to use if Import is unable to guess an Account for a message.");
lblAccountIfNo.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblAccountIfNo.setSize(147, 15);
lblAccountIfNo.setText("Default Account:");
mcmbAccounts = new Combo(mcompMbox, SWT.READ_ONLY);
mcmbAccounts.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
mcmbAccounts.setSize(277, 23);
mcmbAccounts.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected( SelectionEvent e) {
int selid = mcmbAccounts.getSelectionIndex();
if (selid != -1) {
mAccountID = ((IAccount) mcmbAccounts.getData(mcmbAccounts.getItem(selid))).getID();
} else {
mAccountID = 0;
}
checkButtonState();
return;
}
});
new Label(mcompMbox, SWT.NONE);
new Label(mcompMbox, SWT.NONE);
mbtnMarkUnread = new Button(mcompMbox, SWT.CHECK);
mbtnMarkUnread.setSize(157, 16);
mbtnMarkUnread.setText("Mark messages as Unread");
new Label(mcompMbox, SWT.NONE);
mtabTB = new TabItem(mtabFolder, SWT.NONE);
mtabTB.setText("Thunderbird");
mcompTBird = new Composite(mtabFolder, SWT.NONE);
mtabTB.setControl(mcompTBird);
mcompTBird.setLayout(new GridLayout(3, false));
mlabel_3 = new Label(mcompTBird, SWT.NONE);
mlabel_3.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
mlabel_3.setText("Profile Directory:");
mtextProfileDir = new Text(mcompTBird, SWT.BORDER);
mtextProfileDir.addFocusListener(new FocusAdapter() {
@Override
public void focusLost( FocusEvent e) {
checkButtonState();
return;
}
});
mtextProfileDir.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
mbuttonProfileBrowse = new Button(mcompTBird, SWT.NONE);
mbuttonProfileBrowse.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected( SelectionEvent e) {
Shell shell = new Shell(Display.getDefault(), SWT.APPLICATION_MODAL);
DirectoryDialog dialog = new DirectoryDialog(shell);
dialog.setText("Select Thunderbird Profile Directory");
String file = dialog.open();
if (file != null) {
mtextProfileDir.setText(file);
}
checkButtonState();
return;
}
});
mbuttonProfileBrowse.setText("Browse");
new Label(mcompTBird, SWT.NONE);
mbuttonTBFindAccts = new Button(mcompTBird, SWT.NONE);
mbuttonTBFindAccts.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected( SelectionEvent e) {
tbirdScan();
checkButtonState();
return;
}
});
mbuttonTBFindAccts.setText("Find Accounts");
new Label(mcompTBird, SWT.NONE);
mlabel_4 = new Label(mcompTBird, SWT.NONE);
mlabel_4.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
mlabel_4.setText("Accounts:");
mcomposite_4 = new Composite(mcompTBird, SWT.NONE);
mcomposite_4.setLayout(new FillLayout(SWT.VERTICAL));
mcomposite_4.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 2));
mtvTBAccounts = CheckboxTableViewer.newCheckList(mcomposite_4, SWT.BORDER | SWT.FULL_SELECTION);
mtableTBAccounts = mtvTBAccounts.getTable();
mtvTBFolders = CheckboxTableViewer.newCheckList(mcomposite_4, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
mtableTBFolders = mtvTBFolders.getTable();
mtvTBFolders.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged( CheckStateChangedEvent event) {
IStructuredSelection sel = (IStructuredSelection) mtvTBFolders.getSelection();
Object[] elements = sel.toArray();
for (int idx = 0; (idx < elements.length); idx++) {
mtvTBFolders.setChecked(elements[idx], event.getChecked());
}
return;
}
});
mlabel_5 = new Label(mcompTBird, SWT.NONE);
mlabel_5.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
mlabel_5.setText("Folders:");
new Label(mcompTBird, SWT.NONE);
mcheckNoTrash = new Button(mcompTBird, SWT.CHECK);
mcheckNoTrash.setSelection(true);
mcheckNoTrash.setText("Don't Import TRASH folders");
new Label(mcompTBird, SWT.NONE);
mlabel_6 = new Label(mcompTBird, SWT.NONE);
mlabel_6.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
mlabel_6.setText("Default Account:");
mcomboTBDefAcct = new Combo(mcompTBird, SWT.READ_ONLY);
mcomboTBDefAcct.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected( SelectionEvent e) {
int selid = mcomboTBDefAcct.getSelectionIndex();
if (selid != -1) {
mAccountID = ((IAccount) mcomboTBDefAcct.getData(mcomboTBDefAcct.getItem(selid))).getID();
} else {
mAccountID = 0;
}
checkButtonState();
return;
}
});
mcomboTBDefAcct.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
new Label(mcompTBird, SWT.NONE);
mcompImportStatus = new Composite(container, SWT.NONE);
mcompImportStatus.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
mcompImportStatus.setLayout(new GridLayout(3, false));
Label lblStatus = new Label(mcompImportStatus, SWT.NONE);
lblStatus.setSize(35, 15);
lblStatus.setText("Status:");
mcomposite_1 = new Composite(mcompImportStatus, SWT.NONE);
mcomposite_1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
mcomposite_1.setSize(144, 55);
mcomposite_1.setLayout(new GridLayout(3, false));
mcomposite_2 = new Composite(mcomposite_1, SWT.NONE);
mcomposite_2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
mcomposite_2.setLayout(new GridLayout(1, false));
mlabel = new Label(mcomposite_2, SWT.CENTER);
mlabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
mlabel.setSize(36, 15);
mlabel.setText("Count");
mlblCount = new Label(mcomposite_2, SWT.RIGHT);
mlblCount.setAlignment(SWT.CENTER);
mlblCount.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
mlblCount.setSize(36, 15);
mlblCount.setText("0");
mcomposite_3 = new Composite(mcomposite_1, SWT.NONE);
mcomposite_3.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
mcomposite_3.setLayout(new GridLayout(1, false));
mlabel_1 = new Label(mcomposite_3, SWT.CENTER);
mlabel_1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
mlabel_1.setText("Size");
lblSize = new Label(mcomposite_3, SWT.RIGHT);
lblSize.setAlignment(SWT.CENTER);
lblSize.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
mcomposite = new Composite(mcomposite_1, SWT.NONE);
mcomposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
mcomposite.setLayout(new GridLayout(1, false));
mlabel_2 = new Label(mcomposite, SWT.CENTER);
mlabel_2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
mlabel_2.setText("% Done");
mlblPctDon = new Label(mcomposite, SWT.RIGHT);
mlblPctDon.setAlignment(SWT.CENTER);
mlblPctDon.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
mlblPctDon.setText("0");
mcomposite_5 = new Composite(mcompImportStatus, SWT.NONE);
mcomposite_5.setLayout(new FillLayout(SWT.VERTICAL));
mcomposite_5.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
mcomposite_5.setSize(43, 55);
mbtnStop = new Button(mcomposite_5, SWT.NONE);
mbtnStop.setEnabled(false);
//mbtnStop.setSize(43,25);
mbtnStop.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected( SelectionEvent e) {
if (mImporter != null) {
mImporter.stop();
} else if (mFolderCreator != null) {
mFolderCreator.stopCreating();
}
return;
}
});
mbtnStop.setText("Stop Import");
mbtnPause = new Button(mcomposite_5, SWT.NONE);
mbtnPause.setEnabled(false);
//mbtnPause.setSize(43, 25);
mbtnPause.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected( SelectionEvent e) {
if (mImporter != null) {
mImporter.pause(!mImporter.isPaused());
mbtnPause.setText(mImporter.isPaused() ? "Resume" : "Pause");
}
return;
}
});
mbtnPause.setText("Pause");
mlblMsg = new Label(mcompImportStatus, SWT.NONE);
mlblMsg.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
mlblMsg.setSize(18, 15);
mtabFolder.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected( SelectionEvent e) {
logger.debug("Changed Tab");
TabItem[] items = mtabFolder.getSelection();
if ((items.length > 0) && (items[0] == mtabMBox)) {
mCurTab = mtabMBox;
} else {
mCurTab = mtabTB;
}
checkButtonState();
return;
}
});
fillLists();
return container;