use of org.talend.repository.ui.dialog.StatusConfirmSettingDialog in project tdi-studio-se by Talend.
the class StatusManagerSettingPage method okPressed.
protected void okPressed() {
if (statusCombo == null) {
return;
}
boolean modified = false;
String newStatus = null;
if (getModifiedVersionItems().size() > 0) {
newStatus = statusHelper.getStatusCode(statusCombo.getText());
}
for (RepositoryObject object : getModifiedVersionItems()) {
if (!isFixedstatus()) {
newStatus = object.getStatusCode();
}
if (object != null && object.getProperty() != null) {
if (!newStatus.equals(object.getProperty().getOldStatusCode())) {
isApplied = false;
modified = true;
break;
}
}
}
if (modified) {
boolean confirm = false;
if (isFixedstatus()) {
confirm = //$NON-NLS-1$
MessageDialog.openConfirm(//$NON-NLS-1$
getShell(), //$NON-NLS-1$
Messages.getString("VersionManagementDialog.ConfirmTitle"), //$NON-NLS-1$
Messages.getString("VersionManagementDialog.ConfirmMessage", newStatus));
if (confirm) {
// set all items for new version
for (RepositoryObject object : getModifiedVersionItems()) {
if (techinalButton.getSelection()) {
ERepositoryObjectType type = object.getRepositoryNode().getContentType();
if (!type.equals(ERepositoryObjectType.DOCUMENTATION) && !type.equals(ERepositoryObjectType.BUSINESS_PROCESS)) {
object.setStatusCode(newStatus);
}
} else {
ERepositoryObjectType type = object.getRepositoryNode().getContentType();
if (type.equals(ERepositoryObjectType.DOCUMENTATION) || type.equals(ERepositoryObjectType.BUSINESS_PROCESS)) {
object.setStatusCode(newStatus);
}
}
}
}
} else {
StatusConfirmSettingDialog chanedDialog = new StatusConfirmSettingDialog(getShell(), getModifiedVersionItems(), statusHelper);
confirm = (chanedDialog.open() == Window.OK);
}
if (confirm) {
updateItemsVersion();
}
} else {
if (!getModifiedVersionItems().isEmpty() && !isApplied) {
//$NON-NLS-1$
MessageDialog.openWarning(//$NON-NLS-1$
getShell(), //$NON-NLS-1$
Messages.getString("VersionManagementDialog.WarningTitle"), //$NON-NLS-1$
Messages.getString("VersionManagementDialog.WarningMessages"));
}
}
}
Aggregations