Search in sources :

Example 1 with MultiStatusDialog

use of org.talend.mdm.repository.ui.dialogs.message.MultiStatusDialog in project tmdm-studio-se by Talend.

the class ImportDataClusterAction method doRun.

@Override
protected void doRun() {
    FileDialog fd = new FileDialog(getShell(), SWT.OPEN);
    // $NON-NLS-1$
    fd.setFilterExtensions(new String[] { "*.zip" });
    String fPath = fd.open();
    if (fPath != null) {
        DataClusterService dataClusterService = DataClusterService.getIntance();
        File tempFolder = IOUtil.getTempFolder();
        String tempFolderPath = tempFolder.getAbsolutePath();
        dataClusterService.unZipFile(fPath, tempFolderPath);
        String dName = dataClusterService.loadIndexFile(tempFolderPath);
        if (dName == null) {
            MessageDialog.openError(getShell(), Messages.Common_Error, Messages.ImportDataClusterAction_errorFormat);
            return;
        }
        tempFolderPath += File.separator + dName;
        // 
        SelectServerDefDialog dialog = new SelectServerDefDialog(getShell());
        if (dialog.open() == IDialogConstants.OK_ID) {
            MDMServerDef serverDef = dialog.getSelectedServerDef();
            try {
                TMDMService service = RepositoryWebServiceAdapter.getMDMService(serverDef);
                service.ping(new WSPing(Messages.ImportDataClusterAction_importTitle));
                if (!dataClusterService.isExistDataCluster(service, dName)) {
                    if (MessageDialog.openQuestion(getShell(), Messages.ImportDataClusterAction_createDataClusterTitle, Messages.bind(Messages.ImportDataClusterAction_createConfirm, dName))) {
                        dataClusterService.createDataCluster(service, dName);
                    } else {
                        return;
                    }
                }
                IDataContentProcess process = dataClusterService.getNewImportContentProcess(serverDef, dName, tempFolderPath);
                try {
                    process.run();
                } catch (InterruptedException e) {
                    // do nothing
                    return;
                }
                MultiStatus multiStatus = process.getResult();
                if (multiStatus != null && multiStatus.getChildren().length > 0) {
                    MultiStatusDialog statusDialog = new MultiStatusDialog(getShell(), multiStatus.getMessage(), multiStatus);
                    statusDialog.open();
                } else {
                    // show success info
                    MessageDialog.openInformation(getShell(), Messages.ImportDataClusterAction_importTitle, Messages.bind(Messages.ImportDataClusterAction_successImport, dName));
                }
            } catch (XtentisException e) {
                log.error(e.getMessage(), e);
            } catch (WebServiceException e) {
                MessageDialog.openError(getShell(), Messages.ImportDataClusterAction_importTitle, Messages.AbstractDataClusterAction_ConnectFailed);
            } finally {
                IOUtil.cleanFolder(tempFolder);
            }
        }
    }
}
Also used : WSPing(com.amalto.workbench.webservices.WSPing) DataClusterService(org.talend.mdm.repository.core.service.DataClusterService) WebServiceException(javax.xml.ws.WebServiceException) IDataContentProcess(org.talend.mdm.repository.core.datacontent.IDataContentProcess) MultiStatusDialog(org.talend.mdm.repository.ui.dialogs.message.MultiStatusDialog) MultiStatus(org.eclipse.core.runtime.MultiStatus) TMDMService(com.amalto.workbench.webservices.TMDMService) SelectServerDefDialog(org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog) FileDialog(org.eclipse.swt.widgets.FileDialog) File(java.io.File) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef) XtentisException(com.amalto.workbench.utils.XtentisException)

Example 2 with MultiStatusDialog

use of org.talend.mdm.repository.ui.dialogs.message.MultiStatusDialog in project tmdm-studio-se by Talend.

the class AbstractDeployAction method showDeployStatus.

protected void showDeployStatus(IStatus status) {
    int count = 0;
    if (status.isMultiStatus()) {
        for (IStatus child : status.getChildren()) {
            if (child.isMultiStatus()) {
                count += child.getChildren().length;
            } else {
                count++;
            }
        }
    }
    MultiStatusDialog dialog = new DeployStatusDialog(getShell(), status);
    dialog.open();
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) DeployStatusDialog(org.talend.mdm.repository.ui.dialogs.deploy.DeployStatusDialog) MultiStatusDialog(org.talend.mdm.repository.ui.dialogs.message.MultiStatusDialog)

Example 3 with MultiStatusDialog

use of org.talend.mdm.repository.ui.dialogs.message.MultiStatusDialog in project tmdm-studio-se by Talend.

the class DeployService method showDeployStatus.

private void showDeployStatus(Shell shell, IStatus status) {
    MultiStatusDialog dialog = new DeployStatusDialog(shell, status);
    dialog.open();
}
Also used : DeployStatusDialog(org.talend.mdm.repository.ui.dialogs.deploy.DeployStatusDialog) MultiStatusDialog(org.talend.mdm.repository.ui.dialogs.message.MultiStatusDialog)

Example 4 with MultiStatusDialog

use of org.talend.mdm.repository.ui.dialogs.message.MultiStatusDialog in project tmdm-studio-se by Talend.

the class AbstractRepositoryAction method showRemoveStatus.

protected void showRemoveStatus(IStatus status) {
    MultiStatusDialog dialog = new MultiStatusDialog(getShell(), status.getChildren().length + Messages.AbstractDeployAction_removeMessage, status);
    dialog.open();
}
Also used : MultiStatusDialog(org.talend.mdm.repository.ui.dialogs.message.MultiStatusDialog)

Aggregations

MultiStatusDialog (org.talend.mdm.repository.ui.dialogs.message.MultiStatusDialog)4 DeployStatusDialog (org.talend.mdm.repository.ui.dialogs.deploy.DeployStatusDialog)2 XtentisException (com.amalto.workbench.utils.XtentisException)1 TMDMService (com.amalto.workbench.webservices.TMDMService)1 WSPing (com.amalto.workbench.webservices.WSPing)1 File (java.io.File)1 WebServiceException (javax.xml.ws.WebServiceException)1 IStatus (org.eclipse.core.runtime.IStatus)1 MultiStatus (org.eclipse.core.runtime.MultiStatus)1 FileDialog (org.eclipse.swt.widgets.FileDialog)1 IDataContentProcess (org.talend.mdm.repository.core.datacontent.IDataContentProcess)1 DataClusterService (org.talend.mdm.repository.core.service.DataClusterService)1 MDMServerDef (org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)1 SelectServerDefDialog (org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog)1