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);
}
}
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);
}
}
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;
}
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();
}
}
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();
}
}
Aggregations