Search in sources :

Example 51 with ProgressMonitorDialog

use of org.eclipse.jface.dialogs.ProgressMonitorDialog in project generator by mybatis.

the class RunGeneratorAction method run.

public void run(IAction action) {
    Shell shell = new Shell();
    if (!MessageDialog.openConfirm(shell, "Deprecated Funtionality", DEPRECATION_MESSAGE)) {
        return;
    }
    try {
        List<String> warnings = new ArrayList<String>();
        ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
        IRunnableWithProgress thread = new GeneratorRunner(warnings);
        dialog.run(true, true, thread);
        if (warnings.size() > 0) {
            MultiStatus ms = new MultiStatus(Activator.PLUGIN_ID, Status.WARNING, "Generation Warnings Occured", null);
            Iterator<String> iter = warnings.iterator();
            while (iter.hasNext()) {
                Status status = new Status(Status.WARNING, Activator.PLUGIN_ID, Status.WARNING, iter.next(), null);
                ms.add(status);
            }
            ErrorDialog.openError(shell, "MyBatis Generator", "Run Complete With Warnings", ms, Status.WARNING);
        }
    } catch (Exception e) {
        handleException(e, shell);
    }
}
Also used : MultiStatus(org.eclipse.core.runtime.MultiStatus) Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) Shell(org.eclipse.swt.widgets.Shell) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) ArrayList(java.util.ArrayList) MultiStatus(org.eclipse.core.runtime.MultiStatus) CoreException(org.eclipse.core.runtime.CoreException) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Example 52 with ProgressMonitorDialog

use of org.eclipse.jface.dialogs.ProgressMonitorDialog in project cubrid-manager by CUBRID.

the class TableSchemaCompareInfoPart method fetchCountOfRecords.

private void fetchCountOfRecords() {
    // FIXME logic code move to core module
    final Set<String> selectedItemKeys = new HashSet<String>();
    TableItem[] items = tablesSchemaCompareTable.getTable().getSelection();
    for (TableItem item : items) {
        if (item == null) {
            continue;
        }
        String src = item.getText(1).equals(Messages.statusMissing) ? "" : item.getText(1);
        String dst = item.getText(2).equals(Messages.statusMissing) ? "" : item.getText(2);
        String key = src + "$" + dst;
        selectedItemKeys.add(key);
    }
    if (selectedItemKeys.size() == 0) {
        CommonUITool.openWarningBox(Messages.warnNotSelectedTables);
        return;
    }
    String msg = Messages.tablesDetailCompareBtnEsitmateRecordAlert;
    if (!CommonUITool.openConfirmBox(msg)) {
        return;
    }
    try {
        new ProgressMonitorDialog(this.getSite().getShell()).run(true, true, new IRunnableWithProgress() {

            public void run(IProgressMonitor monitor) {
                fetchRecordCountProcess(monitor, selectedItemKeys);
            }
        });
    } catch (Exception e) {
        LOGGER.debug("", e);
    }
    tablesSchemaCompareTable.refresh();
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) TableItem(org.eclipse.swt.widgets.TableItem) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) CoreException(org.eclipse.core.runtime.CoreException) PartInitException(org.eclipse.ui.PartInitException) InvocationTargetException(java.lang.reflect.InvocationTargetException) HashSet(java.util.HashSet) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Example 53 with ProgressMonitorDialog

use of org.eclipse.jface.dialogs.ProgressMonitorDialog in project cubrid-manager by CUBRID.

the class BrokerLogTopMergeProgress method merge.

/**
	 * createDatabaseWithProgress return database name
	 *
	 * @return Catalog
	 */
public boolean merge() {
    Display display = Display.getDefault();
    display.syncExec(new Runnable() {

        public void run() {
            try {
                new ProgressMonitorDialog(null).run(true, false, BrokerLogTopMergeProgress.this);
            } catch (Exception e) {
                LOGGER.error(e.getMessage(), e);
            }
        }
    });
    return success;
}
Also used : ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) WriteException(jxl.write.WriteException) IOException(java.io.IOException) InvocationTargetException(java.lang.reflect.InvocationTargetException) Display(org.eclipse.swt.widgets.Display)

Example 54 with ProgressMonitorDialog

use of org.eclipse.jface.dialogs.ProgressMonitorDialog in project cubrid-manager by CUBRID.

the class OpenSerialDetailInfoPartProgress method loadSerialInfoList.

/**
	 * load serialinfo list
	 * 
	 * @return Catalog
	 */
public void loadSerialInfoList() {
    Display display = Display.getDefault();
    display.syncExec(new Runnable() {

        public void run() {
            try {
                new ProgressMonitorDialog(null).run(true, false, OpenSerialDetailInfoPartProgress.this);
            } catch (Exception e) {
                LOGGER.error(e.getMessage(), e);
            }
        }
    });
}
Also used : ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) InvocationTargetException(java.lang.reflect.InvocationTargetException) Display(org.eclipse.swt.widgets.Display)

Example 55 with ProgressMonitorDialog

use of org.eclipse.jface.dialogs.ProgressMonitorDialog in project cubrid-manager by CUBRID.

the class OpenTablesDetailInfoPartProgress method loadTablesInfo.

/**
	 * loadTablesInfo
	 *
	 * @return Catalog
	 */
public void loadTablesInfo() {
    Display display = Display.getDefault();
    display.syncExec(new Runnable() {

        public void run() {
            try {
                new ProgressMonitorDialog(null).run(true, false, OpenTablesDetailInfoPartProgress.this);
            } catch (Exception e) {
                LOGGER.error(e.getMessage(), e);
            }
        }
    });
}
Also used : ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) SQLException(java.sql.SQLException) InvocationTargetException(java.lang.reflect.InvocationTargetException) Display(org.eclipse.swt.widgets.Display)

Aggregations

ProgressMonitorDialog (org.eclipse.jface.dialogs.ProgressMonitorDialog)88 InvocationTargetException (java.lang.reflect.InvocationTargetException)81 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)74 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)74 ArrayList (java.util.ArrayList)27 Display (org.eclipse.swt.widgets.Display)22 CoreException (org.eclipse.core.runtime.CoreException)17 PersistenceException (org.talend.commons.exception.PersistenceException)17 List (java.util.List)15 Shell (org.eclipse.swt.widgets.Shell)12 PartInitException (org.eclipse.ui.PartInitException)12 IFile (org.eclipse.core.resources.IFile)11 SQLException (java.sql.SQLException)10 IOException (java.io.IOException)9 HashMap (java.util.HashMap)9 SocketTask (com.cubrid.cubridmanager.core.common.socket.SocketTask)8 File (java.io.File)8 Item (org.talend.core.model.properties.Item)8 IProject (org.eclipse.core.resources.IProject)7 TableItem (org.eclipse.swt.widgets.TableItem)7