Search in sources :

Example 1 with IComparisonLevel

use of org.talend.cwm.compare.factory.IComparisonLevel in project tdq-studio-se by Talend.

the class SelectedComparisonAction method run.

@Override
public void run() {
    IRunnableWithProgress op = new IRunnableWithProgress() {

        public void run(IProgressMonitor monitor) throws InvocationTargetException {
            final IComparisonLevel creatComparisonLevel = ComparisonLevelFactory.creatComparisonLevel(selectedObj1, selectedObj2);
            Display.getDefault().asyncExec(new Runnable() {

                public void run() {
                    try {
                        creatComparisonLevel.popComparisonUI(new UiHandler());
                    } catch (ReloadCompareException e) {
                        log.error(e, e);
                    }
                }
            });
        }
    };
    try {
        ProgressUI.popProgressDialog(op);
        if (selectedObj1 instanceof Connection && selectedObj2 instanceof Connection) {
            DQRespositoryView repositoryView = CorePlugin.getDefault().getRepositoryView();
            if (repositoryView != null) {
                repositoryView.refresh();
            }
        }
    } catch (InvocationTargetException e) {
        // $NON-NLS-1$
        MessageUI.openError(Messages.getString("PopComparisonUIAction.checkConnectionFailure", e.getCause().getMessage()));
        log.error(e, e);
    } catch (InterruptedException e) {
        log.error(e, e);
    }
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ReloadCompareException(org.talend.cwm.compare.exception.ReloadCompareException) Connection(org.talend.core.model.metadata.builder.connection.Connection) DQRespositoryView(org.talend.dataprofiler.core.ui.views.DQRespositoryView) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) IComparisonLevel(org.talend.cwm.compare.factory.IComparisonLevel)

Example 2 with IComparisonLevel

use of org.talend.cwm.compare.factory.IComparisonLevel in project tdq-studio-se by Talend.

the class PopComparisonUIAction method run.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
public void run() {
    final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    IRunnableWithProgress op = new IRunnableWithProgress() {

        public void run(IProgressMonitor monitor) throws InvocationTargetException {
            final IComparisonLevel creatComparisonLevel = ComparisonLevelFactory.creatComparisonLevel(selectedObject);
            try {
                if (creatComparisonLevel != null) {
                    creatComparisonLevel.popComparisonUI(new UiHandler());
                } else {
                    // $NON-NLS-1$
                    String errMsg = Messages.getString("PopComparisonUIAction.dontSupport");
                    log.error(errMsg, new Exception(errMsg));
                }
            } catch (ReloadCompareException e) {
                MessageDialog.openError(shell, // $NON-NLS-1$
                Messages.getString("PopComparisonUIAction.ErrorDuringComparison"), // $NON-NLS-1$
                e.getMessage());
                log.error(e, e);
            }
        }
    };
    try {
        ProgressUI.popProgressDialog(op, false, false);
    } catch (InvocationTargetException e) {
        MessageDialog.openInformation(shell, Messages.getString("PopComparisonUIAction.connectionFailure"), // $NON-NLS-1$ //$NON-NLS-2$
        Messages.getString("PopComparisonUIAction.checkConnectionFailure"));
        log.error(e, e);
    } catch (InterruptedException e) {
        log.error(e, e);
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ReloadCompareException(org.talend.cwm.compare.exception.ReloadCompareException) ReloadCompareException(org.talend.cwm.compare.exception.ReloadCompareException) InvocationTargetException(java.lang.reflect.InvocationTargetException) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) IComparisonLevel(org.talend.cwm.compare.factory.IComparisonLevel)

Example 3 with IComparisonLevel

use of org.talend.cwm.compare.factory.IComparisonLevel in project tdq-studio-se by Talend.

the class TOPRepositoryService method reloadDatabase.

/**
 * Comment method "reloadDatabase".
 *
 * @param connectionItem
 * @deprecated instead of it by TDQCompareService.reloadDatabase
 */
@Deprecated
public ReturnCode reloadDatabase(ConnectionItem connectionItem) {
    ReturnCode retCode = new ReturnCode(Boolean.TRUE);
    Connection conn = connectionItem.getConnection();
    try {
        if (conn instanceof DatabaseConnection) {
            List<ModelElement> dependencyClients = EObjectHelper.getDependencyClients(conn);
            if (!(dependencyClients == null || dependencyClients.isEmpty())) {
                int isOk = DeleteModelElementConfirmDialog.showElementImpactConfirmDialog(null, new ModelElement[] { conn }, // $NON-NLS-1$
                DefaultMessagesImpl.getString("TOPRepositoryService.dependcyTile"), DefaultMessagesImpl.getString("TOPRepositoryService.dependcyMessage", // $NON-NLS-1$
                conn.getLabel()));
                if (isOk != Dialog.OK) {
                    retCode.setOk(Boolean.FALSE);
                    // $NON-NLS-1$
                    retCode.setMessage("The user canceled the operation!");
                    return retCode;
                }
            }
            final IComparisonLevel creatComparisonLevel = ComparisonLevelFactory.creatComparisonLevel(conn);
            Connection newConnection = creatComparisonLevel.reloadCurrentLevelElement();
            // update the sql explore.
            Property property = PropertyHelper.getProperty(newConnection);
            if (property != null) {
                Item newItem = property.getItem();
                if (newItem != null) {
                    CWMPlugin.getDefault().updateConnetionAliasByName(newConnection, newConnection.getLabel());
                // notifySQLExplorer(newItem);
                }
            }
            // update the related analyses.
            WorkbenchUtils.impactExistingAnalyses(newConnection);
        }
    } catch (ReloadCompareException e) {
        log.error(e, e);
        retCode.setOk(Boolean.FALSE);
        retCode.setMessage(e.getMessage());
    } catch (PartInitException e) {
        log.error(e, e);
        retCode.setOk(Boolean.FALSE);
        retCode.setMessage(e.getMessage());
    }
    return retCode;
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) ConnectionItem(org.talend.core.model.properties.ConnectionItem) Item(org.talend.core.model.properties.Item) DatabaseConnectionItem(org.talend.core.model.properties.DatabaseConnectionItem) TypedReturnCode(org.talend.utils.sugars.TypedReturnCode) ReturnCode(org.talend.utils.sugars.ReturnCode) IMetadataConnection(org.talend.core.model.metadata.IMetadataConnection) DelimitedFileConnection(org.talend.core.model.metadata.builder.connection.DelimitedFileConnection) MDMConnection(org.talend.core.model.metadata.builder.connection.MDMConnection) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) Connection(org.talend.core.model.metadata.builder.connection.Connection) ReloadCompareException(org.talend.cwm.compare.exception.ReloadCompareException) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) PartInitException(org.eclipse.ui.PartInitException) Property(org.talend.core.model.properties.Property) IComparisonLevel(org.talend.cwm.compare.factory.IComparisonLevel)

Example 4 with IComparisonLevel

use of org.talend.cwm.compare.factory.IComparisonLevel in project tdq-studio-se by Talend.

the class ChangeConnectionAction method reloadByColumnSetFolderLevel.

private void reloadByColumnSetFolderLevel(List<SynTreeModel> treeModelLs, AnalyzedElementSynDialog anaEleSynDialog, Connection newDataProv) throws ReloadCompareException {
    ModelElement oldDataProviderModel = treeModelLs.get(0).getOldDataProvElement();
    // Reload columnSet folder
    ColumnSet columnset = null;
    if (oldDataProviderModel instanceof ColumnSet) {
        columnset = (ColumnSet) oldDataProviderModel;
    } else if (oldDataProviderModel instanceof TdColumn) {
        columnset = ColumnHelper.getColumnOwnerAsColumnSet(oldDataProviderModel);
    } else {
        return;
    }
    // MOD mzhao bug 8567 2010-03-29
    IFolderNode reloadFolder = FolderNodeHelper.getFolderNode((Package) treeModelLs.get(0).getNewDataProvElement(), columnset);
    if (reloadFolder != null) {
        IComparisonLevel creatComparisonLevel = ComparisonLevelFactory.creatComparisonLevel(reloadFolder);
        if (creatComparisonLevel != null) {
            // FIXME newDataProv is never used in the following codes.
            newDataProv = creatComparisonLevel.reloadCurrentLevelElement();
        }
        // Recompute after reload
        // FIXME treeModelLs is never used in the following codes.
        treeModelLs = anaEleSynDialog.getSynInputModel();
    }
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) IFolderNode(org.talend.dq.nodes.foldernode.IFolderNode) TdColumn(org.talend.cwm.relational.TdColumn) ColumnSet(orgomg.cwm.resource.relational.ColumnSet) IComparisonLevel(org.talend.cwm.compare.factory.IComparisonLevel)

Example 5 with IComparisonLevel

use of org.talend.cwm.compare.factory.IComparisonLevel in project tdq-studio-se by Talend.

the class ChangeConnectionAction method reloadByColumnFolderLevel.

private void reloadByColumnFolderLevel(List<SynTreeModel> treeModelLs, AnalyzedElementSynDialog anaEleSynDialog, Connection newDataProv) throws ReloadCompareException {
    ModelElement newDataProviderModel = treeModelLs.get(0).getNewDataProvElement();
    // If schema or catalog changed, we did not load anymore.
    // Reload column folder
    ColumnSet columnset = null;
    if (newDataProviderModel instanceof ColumnSet) {
        columnset = (ColumnSet) newDataProviderModel;
    } else if (newDataProviderModel instanceof TdColumn) {
        columnset = ColumnHelper.getColumnOwnerAsColumnSet(newDataProviderModel);
    } else {
        return;
    }
    // MOD mzhao bug 8567 2010-03-29
    IFolderNode reloadFolder = FolderNodeHelper.getFolderNodes(columnset)[0];
    if (reloadFolder != null) {
        IComparisonLevel creatComparisonLevel = ComparisonLevelFactory.creatComparisonLevel(reloadFolder);
        if (creatComparisonLevel != null) {
            // FIXME newDataProv is never used in the following codes.
            newDataProv = creatComparisonLevel.reloadCurrentLevelElement();
        }
        // Recompute after reload
        // FIXME treeModelLs is never used in the following codes.
        treeModelLs = anaEleSynDialog.getSynInputModel();
    }
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) IFolderNode(org.talend.dq.nodes.foldernode.IFolderNode) TdColumn(org.talend.cwm.relational.TdColumn) ColumnSet(orgomg.cwm.resource.relational.ColumnSet) IComparisonLevel(org.talend.cwm.compare.factory.IComparisonLevel)

Aggregations

IComparisonLevel (org.talend.cwm.compare.factory.IComparisonLevel)7 ReloadCompareException (org.talend.cwm.compare.exception.ReloadCompareException)5 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)4 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)4 InvocationTargetException (java.lang.reflect.InvocationTargetException)3 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)3 Connection (org.talend.core.model.metadata.builder.connection.Connection)3 PartInitException (org.eclipse.ui.PartInitException)2 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)2 ConnectionItem (org.talend.core.model.properties.ConnectionItem)2 Item (org.talend.core.model.properties.Item)2 Property (org.talend.core.model.properties.Property)2 TdColumn (org.talend.cwm.relational.TdColumn)2 IFolderNode (org.talend.dq.nodes.foldernode.IFolderNode)2 ReturnCode (org.talend.utils.sugars.ReturnCode)2 ColumnSet (orgomg.cwm.resource.relational.ColumnSet)2 IWorkspace (org.eclipse.core.resources.IWorkspace)1 IWorkspaceRunnable (org.eclipse.core.resources.IWorkspaceRunnable)1 CoreException (org.eclipse.core.runtime.CoreException)1 MessageDialog (org.eclipse.jface.dialogs.MessageDialog)1