Skip to content

Commit

Permalink
[PDI-12920] Comment couldn't be updated after restore previously vers…
Browse files Browse the repository at this point in the history
…ion of transformation (job). (pentaho#4471)
  • Loading branch information
stanislau-strelchanka authored and Ben Morrise committed Oct 12, 2017
1 parent 8e70690 commit 15f8c43
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@
import org.pentaho.ui.xul.binding.BindingFactory;
import org.pentaho.ui.xul.binding.DefaultBindingFactory;
import org.pentaho.ui.xul.components.XulMessageBox;
import org.pentaho.ui.xul.components.XulPromptBox;
import org.pentaho.ui.xul.components.XulTab;
import org.pentaho.ui.xul.containers.XulTabbox;
import org.pentaho.ui.xul.containers.XulTree;
import org.pentaho.ui.xul.impl.AbstractXulEventHandler;
import org.pentaho.ui.xul.swt.custom.DialogConstant;
import org.pentaho.ui.xul.swt.tags.SwtConfirmBox;
import org.pentaho.ui.xul.util.XulDialogCallback;

public class RevisionController extends AbstractXulEventHandler implements IUISupportController, java.io.Serializable {
Expand Down Expand Up @@ -255,9 +255,8 @@ public void openRevision() {
UIRepositoryObjectRevision revisionToOpen = revision.iterator().next();
if ( mainController != null && mainController.getCallback() != null ) {
try {
if ( mainController.getCallback().open( contentToOpen, revisionToOpen.getName() ) ) {
// TODO: fire request to close dialog
}
// TODO: fire request to close dialog
mainController.getCallback().open( contentToOpen, revisionToOpen.getName() );
} catch ( Exception e ) {
if ( mainController != null ) {
mainController.handleLostRepository( e );
Expand All @@ -275,7 +274,7 @@ public void restoreRevision() {
Collection<UIRepositoryObjectRevision> versions = revisionTable.getSelectedItems();
final UIRepositoryObjectRevision versionToRestore = versions.iterator().next();

XulPromptBox commitPrompt = promptCommitComment( document, messages, null );
SwtConfirmBox confirmbox = promptCommitComment( document );

if ( contentToRestore instanceof ILockObject && ( (ILockObject) contentToRestore ).isLocked() ) {
// Cannot restore revision of locked content
Expand All @@ -286,7 +285,7 @@ public void restoreRevision() {
return;
}

commitPrompt.addDialogCallback( new XulDialogCallback<String>() {
confirmbox.addDialogCallback( new XulDialogCallback<String>() {
public void onClose( XulComponent component, Status status, String value ) {

if ( !status.equals( Status.CANCEL ) ) {
Expand Down Expand Up @@ -316,25 +315,21 @@ public void onError( XulComponent component, Throwable err ) {
}
} );

commitPrompt.open();
confirmbox.open();
} catch ( Exception e ) {
if ( mainController == null || !mainController.handleLostRepository( e ) ) {
throw new RuntimeException( new KettleException( e ) );
}
}
}

private XulPromptBox promptCommitComment( org.pentaho.ui.xul.dom.Document document, ResourceBundle messages,
String defaultMessage ) throws XulException {
XulPromptBox prompt = (XulPromptBox) document.createElement( "promptbox" ); //$NON-NLS-1$

prompt.setTitle( BaseMessages.getString( PKG, "RepositoryExplorer.CommitTitle" ) ); //$NON-NLS-1$
prompt.setButtons( new DialogConstant[] { DialogConstant.OK, DialogConstant.CANCEL } );
private SwtConfirmBox promptCommitComment( org.pentaho.ui.xul.dom.Document document ) throws XulException {
SwtConfirmBox confirmbox = (SwtConfirmBox) document.createElement( "confirmbox" );
confirmbox.setTitle( BaseMessages.getString( PKG, "RepositoryExplorer.CommitTitle" ) ); //$NON-NLS-1$
confirmbox.setButtons( new DialogConstant[] { DialogConstant.OK, DialogConstant.CANCEL } );

prompt.setMessage( BaseMessages.getString( PKG, "RepositoryExplorer.CommitLabel" ) ); //$NON-NLS-1$
prompt.setValue( defaultMessage == null
? BaseMessages.getString( PKG, "RepositoryExplorer.DefaultCommitMessage" ) : defaultMessage ); //$NON-NLS-1$
return prompt;
confirmbox.setMessage( BaseMessages.getString( PKG, "RepositoryExplorer.CommitLabel" ) ); //$NON-NLS-1$//$NON-NLS-1$
return confirmbox;
}

private void setRevisionTableColumns( Boolean versionCommentEnabled ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,8 @@ RepositoryExplorerDialog.ContextMenu.LockNotes=Lock Notes...
RepositoryExplorer.LockMessage.Title=Lock Notes
RepositoryExplorer.LockMessage.Label=Note:
RepositoryExplorer.DefaultLockMessage=Locked by user
RepositoryExplorer.DefaultCommitMessage=Modification by user
RepositoryExplorer.CommitTitle=Commit Comment
RepositoryExplorer.CommitLabel=Enter a comment
RepositoryExplorer.CommitTitle=Restore commit
RepositoryExplorer.CommitLabel=Are you sure you want to restore specified commit ?

BrowseController.MoveNotAllowed=Locked file(s) cannot be moved
BrowseController.FolderMoveNotAllowed=Folder contains file(s) that are locked by another user for editing and cannot be moved.
Expand Down

0 comments on commit 15f8c43

Please sign in to comment.