1 11 package org.eclipse.ui.commands; 12 13 import org.eclipse.swt.widgets.Shell; 14 import org.eclipse.ui.IWorkbenchPartSite; 15 import org.eclipse.ui.internal.util.Util; 16 17 43 public final class HandlerSubmission implements Comparable { 44 45 50 private final String activePartId; 51 52 57 private final Shell activeShell; 58 59 64 private final IWorkbenchPartSite activeWorkbenchPartSite; 65 66 70 private final String commandId; 71 72 75 private final IHandler handler; 76 77 82 private final Priority priority; 83 84 89 private transient String string; 90 91 111 public HandlerSubmission(String activePartId, Shell activeShell, 112 IWorkbenchPartSite activeWorkbenchPartSite, String commandId, 113 IHandler handler, Priority priority) { 114 if (commandId == null || handler == null || priority == null) { 115 throw new NullPointerException (); 116 } 117 118 this.activePartId = activePartId; 119 this.activeShell = activeShell; 120 this.activeWorkbenchPartSite = activeWorkbenchPartSite; 121 this.commandId = commandId; 122 this.handler = handler; 123 this.priority = priority; 124 } 125 126 129 public int compareTo(Object object) { 130 HandlerSubmission castedObject = (HandlerSubmission) object; 131 int compareTo = Util.compare(activeWorkbenchPartSite, 132 castedObject.activeWorkbenchPartSite); 133 134 if (compareTo == 0) { 135 compareTo = Util.compare(activePartId, castedObject.activePartId); 136 137 if (compareTo == 0) { 138 compareTo = Util.compare(activeShell, castedObject.activeShell); 139 140 if (compareTo == 0) { 141 compareTo = Util.compare(priority, castedObject.priority); 142 143 if (compareTo == 0) { 144 compareTo = Util.compare(commandId, 145 castedObject.commandId); 146 147 if (compareTo == 0) { 148 compareTo = Util.compare(handler, 149 castedObject.handler); 150 } 151 } 152 } 153 } 154 } 155 156 return compareTo; 157 } 158 159 166 public String getActivePartId() { 167 return activePartId; 168 } 169 170 176 public Shell getActiveShell() { 177 return activeShell; 178 } 179 180 187 public IWorkbenchPartSite getActiveWorkbenchPartSite() { 188 return activeWorkbenchPartSite; 189 } 190 191 197 public String getCommandId() { 198 return commandId; 199 } 200 201 206 public IHandler getHandler() { 207 return handler; 208 } 209 210 215 public Priority getPriority() { 216 return priority; 217 } 218 219 222 public String toString() { 223 if (string == null) { 224 final StringBuffer stringBuffer = new StringBuffer (); 225 stringBuffer.append("[activePartId="); stringBuffer.append(activePartId); 227 stringBuffer.append(",activeShell="); stringBuffer.append(activeShell); 229 stringBuffer.append(",activeWorkbenchSite="); stringBuffer.append(activeWorkbenchPartSite); 231 stringBuffer.append(",commandId="); stringBuffer.append(commandId); 233 stringBuffer.append(",handler="); stringBuffer.append(handler); 235 stringBuffer.append(",priority="); stringBuffer.append(priority); 237 stringBuffer.append(']'); 238 string = stringBuffer.toString(); 239 } 240 241 return string; 242 } 243 } 244 | Popular Tags |