1 17 package org.eclipse.emf.common.command; 18 19 20 import java.util.Collection ; 21 import java.util.Collections ; 22 23 import org.eclipse.emf.common.CommonPlugin; 24 25 26 29 public class IdentityCommand extends AbstractCommand 30 { 31 34 public static final IdentityCommand INSTANCE = new IdentityCommand(); 35 36 39 protected Collection result; 40 41 { 42 isPrepared = true; 45 isExecutable = true; 46 } 47 48 51 public IdentityCommand() 52 { 53 super(); 54 this.result = Collections.EMPTY_LIST; 55 } 56 57 61 public IdentityCommand(Object result) 62 { 63 super(); 64 this.result = Collections.singleton(result); 65 } 66 67 71 public IdentityCommand(Collection result) 72 { 73 super(); 74 this.result = result; 75 } 76 77 81 public IdentityCommand(String label) 82 { 83 this.label = label; 84 this.result = Collections.EMPTY_LIST; 85 } 86 87 92 public IdentityCommand(String label, Object result) 93 { 94 this.label = label; 95 this.result = Collections.singleton(result); 96 } 97 98 103 public IdentityCommand(String label, Collection result) 104 { 105 this.label = label; 106 this.result = result; 107 } 108 109 114 public IdentityCommand(String label, String description) 115 { 116 this.label = label; 117 this.description = description; 118 this.result = Collections.EMPTY_LIST; 119 } 120 121 127 public IdentityCommand(String label, String description, Object result) 128 { 129 this.label = label; 130 this.description = description; 131 this.result = Collections.singleton(result); 132 } 133 134 140 public IdentityCommand(String label, String description, Collection result) 141 { 142 this.label = label; 143 this.description = description; 144 this.result = result; 145 } 146 147 151 public boolean canExecute() 152 { 153 return true; 154 } 155 156 159 public void execute() 160 { 161 } 162 163 166 public void undo() 167 { 168 } 169 170 173 public void redo() 174 { 175 } 176 177 180 public String getLabel() 181 { 182 return label == null ? CommonPlugin.INSTANCE.getString("_UI_IdentityCommand_label") : label; 183 } 184 185 188 public String getDescription() 189 { 190 return description == null ? CommonPlugin.INSTANCE.getString("_UI_IdentityCommand_description") : description; 191 } 192 193 197 public Collection getResult() 198 { 199 return result; 200 } 201 } 202 | Popular Tags |