use of org.eclipse.ui.ide.undo.UpdateMarkersOperation in project tdq-studio-se by Talend.
the class TdDialogMarkerProperties method saveChanges.
/**
* Saves the changes made in the dialog if needed. Creates a new marker if needed. Updates the existing marker only
* if there have been changes.
*/
@SuppressWarnings("unchecked")
private void saveChanges() {
Map attrs = getMarkerAttributes();
IUndoableOperation op = null;
if (marker == null) {
if (resource == null)
return;
op = new CreateMarkersOperation(type, attrs, resource, getCreateOperationTitle());
} else {
if (isDirty()) {
op = new UpdateMarkersOperation(marker, attrs, getModifyOperationTitle(), true);
}
}
if (op != null) {
try {
PlatformUI.getWorkbench().getOperationSupport().getOperationHistory().execute(op, null, WorkspaceUndoUtil.getUIInfoAdapter(getShell()));
} catch (ExecutionException e) {
if (e.getCause() instanceof CoreException) {
ErrorDialog.openError(getShell(), MarkerMessages.Error, null, ((CoreException) e.getCause()).getStatus());
} else {
IDEWorkbenchPlugin.log(e.getMessage(), e);
}
}
}
}
Aggregations