Search in sources :

Example 1 with ItemsVersionConfirmDialog

use of org.talend.repository.ui.dialog.ItemsVersionConfirmDialog in project tdi-studio-se by Talend.

the class AbstractVersionManagementProjectSettingPage method okPressed.

protected void okPressed() {
    if (fixedVersionText == null) {
        return;
    }
    boolean modified = false;
    String newVersion = null;
    for (ItemVersionObject object : checkedObjects) {
        newVersion = getNewVersionWithOption(object);
        if (!newVersion.equals(object.getOldVersion())) {
            isApplied = false;
            modified = true;
            break;
        }
    }
    if (modified) {
        boolean confirm = false;
        if (fixedVersionButton.getSelection()) {
            confirm = //$NON-NLS-1$
            MessageDialog.openConfirm(//$NON-NLS-1$
            getShell(), //$NON-NLS-1$
            Messages.getString("VersionManagementDialog.ConfirmTitle"), //$NON-NLS-1$
            Messages.getString("VersionManagementDialog.ConfirmMessage", newVersion));
            if (confirm && newVersion != null) {
                // set all items for new version
                for (ItemVersionObject object : checkedObjects) {
                    object.setNewVersion(newVersion);
                }
            }
        } else {
            ItemsVersionConfirmDialog chanedDialog = new ItemsVersionConfirmDialog(getShell(), checkedObjects);
            confirm = (chanedDialog.open() == Window.OK);
        }
        if (confirm) {
            updateItemsVersion();
        }
    } else {
        if (!checkedObjects.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"));
        }
    }
}
Also used : ItemsVersionConfirmDialog(org.talend.repository.ui.dialog.ItemsVersionConfirmDialog) ItemVersionObject(org.talend.repository.model.ItemVersionObject)

Aggregations

ItemVersionObject (org.talend.repository.model.ItemVersionObject)1 ItemsVersionConfirmDialog (org.talend.repository.ui.dialog.ItemsVersionConfirmDialog)1