1 11 package org.eclipse.ui.contexts; 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 EnabledSubmission implements Comparable { 44 45 50 private final String activePartId; 51 52 56 private final Shell activeShell; 57 58 62 private final IWorkbenchPartSite activeWorkbenchPartSite; 63 64 68 private final String contextId; 69 70 76 private transient String string = null; 77 78 94 public EnabledSubmission(String activePartId, Shell activeShell, 95 IWorkbenchPartSite activeWorkbenchPartSite, String contextId) { 96 if (contextId == null) { 97 throw new NullPointerException (); 98 } 99 100 this.activePartId = activePartId; 101 this.activeShell = activeShell; 102 this.activeWorkbenchPartSite = activeWorkbenchPartSite; 103 this.contextId = contextId; 104 } 105 106 109 public int compareTo(Object object) { 110 EnabledSubmission castedObject = (EnabledSubmission) object; 111 int compareTo = Util.compare(activeWorkbenchPartSite, 112 castedObject.activeWorkbenchPartSite); 113 114 if (compareTo == 0) { 115 compareTo = Util.compare(activePartId, castedObject.activePartId); 116 117 if (compareTo == 0) { 118 compareTo = Util.compare(activeShell, castedObject.activeShell); 119 120 if (compareTo == 0) { 121 compareTo = Util.compare(contextId, castedObject.contextId); 122 } 123 } 124 } 125 126 return compareTo; 127 } 128 129 136 public String getActivePartId() { 137 return activePartId; 138 } 139 140 146 public Shell getActiveShell() { 147 return activeShell; 148 } 149 150 157 public IWorkbenchPartSite getActiveWorkbenchPartSite() { 158 return activeWorkbenchPartSite; 159 } 160 161 167 public String getContextId() { 168 return contextId; 169 } 170 171 174 public String toString() { 175 if (string == null) { 176 final StringBuffer stringBuffer = new StringBuffer (); 177 stringBuffer.append("[activePartId="); stringBuffer.append(activePartId); 179 stringBuffer.append(",activeShell="); stringBuffer.append(activeShell); 181 stringBuffer.append(",activeWorkbenchSite="); stringBuffer.append(activeWorkbenchPartSite); 183 stringBuffer.append(",contextId="); stringBuffer.append(contextId); 185 stringBuffer.append(']'); 186 string = stringBuffer.toString(); 187 } 188 189 return string; 190 } 191 } 192 | Popular Tags |