use of org.talend.dataprofiler.core.ui.events.EventReceiver in project tdq-studio-se by Talend.
the class ColumnAnalysisResultPage method registerOtherDynamicEvent.
/**
* refresh the composite of the chart, to show the changes on the chart.
*/
private void registerOtherDynamicEvent() {
registerDynamicRefreshEvent = new EventReceiver() {
@Override
public boolean handle(Object data) {
reLayoutChartComposite();
return true;
}
};
EventManager.getInstance().register(chartComposite, EventEnum.DQ_DYNAMIC_REFRESH_DYNAMIC_CHART, registerDynamicRefreshEvent);
// register a event to handle switch between master and result page
switchBetweenPageEvent = new EventReceiver() {
int times = 0;
@Override
public boolean handle(Object data) {
if (times == 0) {
times++;
masterPage.refreshGraphicsInSettingsPage();
}
return true;
}
};
EventManager.getInstance().register(masterPage.getCurrentModelElement(), EventEnum.DQ_DYNAMIC_SWITCH_MASTER_RESULT_PAGE, switchBetweenPageEvent);
}
use of org.talend.dataprofiler.core.ui.events.EventReceiver in project tdq-studio-se by Talend.
the class DynamicAnalysisMasterPage method registerOtherDynamicEvent.
/**
* refresh the composite of the chart, to show the changes on the chart.
*/
private void registerOtherDynamicEvent() {
registerDynamicRefreshEvent = new EventReceiver() {
@Override
public boolean handle(Object data) {
reLayoutChartComposite();
return true;
}
};
EventManager.getInstance().register(chartComposite, EventEnum.DQ_DYNAMIC_REFRESH_DYNAMIC_CHART, registerDynamicRefreshEvent);
// register a event to handle switch between master and result page
switchBetweenPageEvent = new EventReceiver() {
int times = 0;
@Override
public boolean handle(Object data) {
// only need to refresh for the first time switch, and must be during a running.
if (times == 0) {
times++;
((AnalysisEditor) currentEditor).getResultPage().refresh(((AnalysisEditor) currentEditor).getMasterPage());
}
return true;
}
};
EventManager.getInstance().register(getCurrentModelElement(), EventEnum.DQ_DYNAMIC_SWITCH_MASTER_RESULT_PAGE, switchBetweenPageEvent);
}
use of org.talend.dataprofiler.core.ui.events.EventReceiver in project tdq-studio-se by Talend.
the class AbstractAnalysisMetadataPage method registerEvents.
/**
* DOC msjian Comment method "registerEvents".
*/
protected void registerEvents() {
// register: refresh the result page after running it from menu
afterCreateConnectionReceiver = new EventReceiver() {
@Override
public boolean handle(Object data) {
// check if the connection is unavailable, give a warning dialog to user without opening the columns
// select dialog
Connection conn = (Connection) data;
if (ConnectionUtils.checkConnection(conn, getAnalysisHandler().getAnalysis().getName())) {
// need to give the new connection to the dialog to show only this new one in the dialog.
openColumnsSelectionDialog(conn);
}
return true;
}
};
EventManager.getInstance().register(dataPreviewSection, EventEnum.DQ_SELECT_ELEMENT_AFTER_CREATE_CONNECTION, afterCreateConnectionReceiver);
}
use of org.talend.dataprofiler.core.ui.events.EventReceiver in project tdq-studio-se by Talend.
the class AnalysisEditor method registerUpdateExecutionEvent.
/**
* currently will not open the editor of the analysis when running from menu, so, if the editor is opened and not
* the current active one, the page will not know that the result is changed. so we need to add the event/listener
* to them to handle this. Added 20130725 TDQ-7639
*
* @param analysis
*/
private void registerUpdateExecutionEvent() {
// register: check if the analysis need to be saved or if it can run before running it(from menu's RUN)
checkBeforeRunReceiver = new EventReceiver() {
@Override
public boolean handle(Object data) {
if (isDirty()) {
ReturnCode canSave = masterPage.canSave();
if (canSave.isOk()) {
// save the analysis before running
// MOD msjian TDQ-8225 : This save action won't invoke any remote repository action such as svn
// commit. TDQ-7508
IRepositoryFactory localRepository = RepositoryFactoryProvider.getRepositoriyById(RepositoryConstants.REPOSITORY_LOCAL_ID);
IRepositoryFactory oldRepository = ProxyRepositoryFactory.getInstance().getRepositoryFactoryFromProvider();
ProxyRepositoryFactory.getInstance().setRepositoryFactoryFromProvider(localRepository);
try {
doSave(null);
} catch (Exception e) {
log.error(e, e);
} finally {
ProxyRepositoryFactory.getInstance().setRepositoryFactoryFromProvider(oldRepository);
}
// TDQ-8225~
setDirty(false);
} else {
if (canSave.getMessage() != null && !canSave.getMessage().equals(StringUtils.EMPTY)) {
MessageDialogWithToggle.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), DefaultMessagesImpl.getString("AbstractAnalysisMetadataPage.SaveAnalysis"), // $NON-NLS-1$
canSave.getMessage());
}
return false;
}
}
ReturnCode canRun = canRun();
if (!canRun.isOk()) {
MessageDialogWithToggle.openError(null, DefaultMessagesImpl.getString("RunAnalysisAction.runAnalysis"), // $NON-NLS-1$
canRun.getMessage());
return false;
}
// TDQ-8220 change the listener every time( master page or result page)
changeListener();
return true;
}
};
EventManager.getInstance().register(getMasterPage().getCurrentModelElement(), EventEnum.DQ_ANALYSIS_CHECK_BEFORERUN, checkBeforeRunReceiver);
// register: refresh the result page after running it from menu
refreshReceiver = new EventReceiver() {
@Override
public boolean handle(Object data) {
// enough;TDQ-8270 resultpage is null for overview type
if (resultPage != null && resultPage.getManagedForm() != null) {
resultPage.refresh(getMasterPage());
} else {
getMasterPage().refreshGraphicsInSettingsPage();
}
return true;
}
};
EventManager.getInstance().register(getMasterPage().getCurrentModelElement(), EventEnum.DQ_ANALYSIS_RUN_FROM_MENU, refreshReceiver);
// register: reopen this editor after reload its depended connection
reopenEditor = new EventReceiver() {
@Override
public boolean handle(Object data) {
// TDQ-13275 remove 'Display.getDefault().asyncExec' to avoid error with Multi-thread open editors.
WorkbenchUtils.refreshCurrentAnalysisEditor(getMasterPage().getCurrentModelElement().getName());
return true;
}
};
EventManager.getInstance().register(getMasterPage().getCurrentModelElement().getName(), EventEnum.DQ_ANALYSIS_REOPEN_EDITOR, reopenEditor);
// all match indicator in the Indicators section.
if (analysisType.equals(AnalysisType.COLUMN_SET)) {
// register: refresh the dataprovider combobox when the name of the data provider is changed.
refresh2ShowMatchIndicator = new EventReceiver() {
@Override
public boolean handle(Object data) {
((ColumnSetAnalysisDetailsPage) getMasterPage()).refreshIndicatorsSection();
return true;
}
};
EventManager.getInstance().register(getMasterPage().getCurrentModelElement(), EventEnum.DQ_COLUMNSET_SHOW_MATCH_INDICATORS, refresh2ShowMatchIndicator);
}
// Added TDQ8787 2014-06-16 yyin: for dynamic chart, create all charts before execute the analysis
if (masterPage instanceof DynamicAnalysisMasterPage) {
registerDynamicEvent = new EventReceiver() {
@Override
public boolean handle(Object data) {
if (masterPage.equals(activePageInstance)) {
((DynamicAnalysisMasterPage) masterPage).registerDynamicEvent();
} else {
// register result page
if (resultPage != null) {
if (resultPage instanceof ColumnAnalysisResultPage) {
((ColumnAnalysisResultPage) resultPage).registerDynamicEvent();
} else if (resultPage instanceof BusinessRuleAnalysisResultPage) {
((BusinessRuleAnalysisResultPage) resultPage).registerDynamicEvent();
}
}
}
return true;
}
};
EventManager.getInstance().register(getMasterPage().getCurrentModelElement(), EventEnum.DQ_DYNAMIC_REGISTER_DYNAMIC_CHART, registerDynamicEvent);
unRegisterDynamicEvent = new EventReceiver() {
@Override
public boolean handle(Object data) {
if (masterPage.equals(activePageInstance)) {
((DynamicAnalysisMasterPage) masterPage).unRegisterDynamicEvent();
} else {
// register result page
if (resultPage != null) {
if (resultPage instanceof ColumnAnalysisResultPage) {
((ColumnAnalysisResultPage) resultPage).unRegisterDynamicEvent();
} else if (resultPage instanceof BusinessRuleAnalysisResultPage) {
((BusinessRuleAnalysisResultPage) resultPage).unRegisterDynamicEvent();
}
}
}
return true;
}
};
EventManager.getInstance().register(getMasterPage().getCurrentModelElement(), EventEnum.DQ_DYNAMIC_UNREGISTER_DYNAMIC_CHART, unRegisterDynamicEvent);
}
}
Aggregations