ProgressBar mProgressBar = null;
boolean bCancel = false;
+
+ private static IndeterminateProgressDialog progressDialog = null;
- public IndeterminateProgressDialog(Shell parent, int style) {
+ private IndeterminateProgressDialog(Shell parent, int style) {
super(parent, style);
}
- public IndeterminateProgressDialog(Shell parent, int style, String title) {
+ private IndeterminateProgressDialog(Shell parent, int style, String title) {
super(parent, style);
mDisplay = getParent().getDisplay();
setText(title);
public void open() {
createContents();
setCenterOfMonitor();
-
+
mShell.open();
mShell.layout();
*/
private void createContents() {
mShell = new Shell(getParent(), SWT.None | SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
- mShell.setSize(250, 130);
+ mShell.setSize(300, 130);
mShell.setText("InstallManager");
- mProgressBar = new ProgressBar(mShell, SWT.INDETERMINATE);
- mProgressBar.setBounds(50, 43, 150, 17);
+// mProgressBar = new ProgressBar(mShell, SWT.INDETERMINATE);
+// mProgressBar.setBounds(50, 43, 150, 17);
mNameLabel = new Label(mShell, SWT.NONE | SWT.CENTER);
- mNameLabel.setBounds(45, 17, 160, 17);
+ mNameLabel.setBounds(25, 17, 250, 40);
mNameLabel.setText("file name");
}
* @param fileName is string that wants to show on dialog
*/
public void updateName(final String fileName) {
+// if (!mDisplay.isDisposed()) {
+// mNameLabel.setText(fileName);
+// }
if (!mDisplay.isDisposed()) {
mDisplay.asyncExec(new Runnable() {
public void run() {
if (!mNameLabel.isDisposed()) {
if (fileName.length() > 30) {
- String name = fileName.substring(0, 29);
- name = name + "...";
+ //String name = fileName.substring(0, 29);
+ String name = fileName + "...";
mNameLabel.setText(name);
}
else {
/**
* Finish displaying the indeterminate dialog.
*/
- public void finish() {
- if (mShell.isDisposed()) {
+ public void finish() {
+ if (mShell == null || mShell.isDisposed()) {
return;
}
}
}
- /**
- * Start to display the indeterminate dialog.
- */
- public static void start() {
-
+ public static IndeterminateProgressDialog getInstance() {
+ if (progressDialog == null) {
+ Shell shell = new Shell(Display.getCurrent());
+ progressDialog = new IndeterminateProgressDialog(shell, SWT.NONE, "");
+ }
+
+ return progressDialog;
}
}