use of org.talend.utils.sugars.ReturnCode in project tdq-studio-se by Talend.
the class Application method start.
/*
* (non-Javadoc)
*
* @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
*/
@Override
public Object start(IApplicationContext context) {
Display display = PlatformUI.createDisplay();
Shell shell = new Shell(display, SWT.ON_TOP);
// TDQ-12221: do check before use to make sure can popup the "Connect to TalendForge"
checkBrowserSupport();
try {
boolean accept = openLicenseAndRegister(shell);
if (!accept) {
return IApplication.EXIT_OK;
}
} catch (BusinessException e) {
log.error(e.getMessage());
}
try {
if (!CorePlugin.getDefault().isRepositoryInitialized()) {
ReturnCode rc = CorePlugin.getDefault().initProxyRepository();
if (!rc.isOk()) {
// $NON-NLS-1$
MessageDialog.openError(shell, DefaultMessagesImpl.getString("Application.warring"), rc.getMessage());
return IApplication.EXIT_OK;
}
}
// Tweaklets.setDefault(WorkbenchImplementation.KEY, new Workbench3xImplementation4CoolBar());
int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
if (returnCode == PlatformUI.RETURN_RESTART) {
return IApplication.EXIT_RESTART;
}
return IApplication.EXIT_OK;
} finally {
display.dispose();
}
}
use of org.talend.utils.sugars.ReturnCode in project tdq-studio-se by Talend.
the class DataThresholdsForm method checkDateFilds.
protected ReturnCode checkDateFilds(String min, String max) {
ReturnCode rc = new ReturnCode(true);
String statusLabelText = PluginConstant.EMPTY_STRING;
if ((!CheckValueUtils.isDateValue(min) && !CheckValueUtils.isEmpty(min)) || (!CheckValueUtils.isDateValue(max) && !CheckValueUtils.isEmpty(max))) {
rc.setOk(false);
// $NON-NLS-1$
statusLabelText += MSG_ONLY_DATE + System.getProperty("line.separator");
}
if (CheckValueUtils.isAoverB(min, max)) {
rc.setOk(false);
// $NON-NLS-1$
statusLabelText += UIMessages.MSG_LOWER_LESS_HIGHER + System.getProperty("line.separator");
}
rc.setMessage(statusLabelText);
return rc;
}
use of org.talend.utils.sugars.ReturnCode in project tdq-studio-se by Talend.
the class IndicatorThresholdsForm method checkFields.
/**
* yyi 2009-10-29 validate lowerText higherText pLowerText pHigherText. feature:9340: Set indicator thresholds.
*/
protected boolean checkFields() {
ReturnCode rc0 = checkIndicatorFields();
ReturnCode rc1 = checkIndicatorInPrecentFields();
if (rc0.isOk() && rc1.isOk()) {
updateStatus(IStatus.OK, MSG_OK);
return true;
} else {
updateStatus(IStatus.ERROR, rc0.getMessage() + rc1.getMessage());
return false;
}
}
use of org.talend.utils.sugars.ReturnCode in project tdq-studio-se by Talend.
the class IndicatorThresholdsForm method checkIndicatorInPrecentFields.
/**
* DOC yyi Comment method "checkIndicatorInPrecentFields".
*
* @return
*/
protected ReturnCode checkIndicatorInPrecentFields() {
// $NON-NLS-1$
String pmin = null != pLowerText ? pLowerText.getText().trim() : "";
// $NON-NLS-1$
String pmax = null != pHigherText ? pHigherText.getText().trim() : "";
ReturnCode rc = new ReturnCode(true);
// $NON-NLS-1$
String statusLabelText = "";
if ((!CheckValueUtils.isEmpty(pmin) && !CheckValueUtils.isRealNumberValue(pmin)) || (!CheckValueUtils.isEmpty(pmax) && !CheckValueUtils.isRealNumberValue(pmax))) {
rc.setOk(false);
// $NON-NLS-1$
statusLabelText += MSG_ONLY_REAL_NUMBER + System.getProperty("line.separator");
}
if (CheckValueUtils.isOutRange(MIN, MAX, pmin) || CheckValueUtils.isOutRange(MIN, MAX, pmax)) {
rc.setOk(false);
// $NON-NLS-1$
statusLabelText += UIMessages.MSG_INDICATOR_VALUE_OUT_OF_RANGE + System.getProperty("line.separator");
}
if (CheckValueUtils.isAoverB(pmin, pmax)) {
rc.setOk(false);
// $NON-NLS-1$
statusLabelText += UIMessages.MSG_LOWER_LESS_HIGHER + System.getProperty("line.separator");
}
rc.setMessage(statusLabelText);
return rc;
}
use of org.talend.utils.sugars.ReturnCode 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;
}
Aggregations