1 19 package org.openharmonise.him.actions.sync; 20 21 import java.awt.event.ActionEvent ; 22 23 import javax.swing.Icon ; 24 25 import org.openharmonise.him.actions.*; 26 import org.openharmonise.him.context.StateHandler; 27 import org.openharmonise.him.window.session.*; 28 import org.openharmonise.vfs.*; 29 import org.openharmonise.vfs.context.*; 30 import org.openharmonise.vfs.gui.*; 31 32 33 41 public class ActionDiscard extends AbstractHIMAction implements HIMAction { 42 43 46 private SessionWindow m_session = null; 47 48 51 public ActionDiscard(SessionWindow session) { 52 super(); 53 this.m_session = session; 54 } 55 56 59 private ActionDiscard(VirtualFile vfFile) { 60 super(vfFile); 61 } 62 63 66 public void actionPerformed(ActionEvent arg0) { 67 StateHandler.getInstance().addWait("DISCARD-ACTION"); 68 try { 69 this.m_session.getSelectedEntry().getVFS().discardFileChanges(this.m_session.getSelectedEntry().getPath()); 70 this.m_session.removeEntry(this.m_session.getSelectedEntry()); 71 } catch (Exception e) { 72 e.printStackTrace(System.err); 73 } finally { 74 StateHandler.getInstance().removeWait("DISCARD-ACTION"); 75 } 76 } 77 78 81 public String getText() { 82 return "Reject changes"; 83 } 84 85 88 public String getToolTip() { 89 return this.getDescription(); 90 } 91 92 95 public Icon getIcon() { 96 return IconManager.getInstance().getIcon("16-command-exit.gif"); 97 } 98 99 102 public String getMnemonic() { 103 return "R"; 104 } 105 106 109 public String getDescription() { 110 return "Rejects the changes to the currently selected resource"; 111 } 112 113 116 public int getAcceleratorKeycode() { 117 return 0; 118 } 119 120 123 public int getAcceleratorMask() { 124 return 0; 125 } 126 127 } 128 | Popular Tags |