Example #1
0
 private static MethodElement getMethodElement(Object obj) {
   Object object = TngUtil.unwrap(obj);
   if (object instanceof ProcessComponent) object = ((ProcessComponent) object).getProcess();
   object = TngUtil.unwrap(object);
   if (object instanceof MethodElement) {
     return (MethodElement) object;
   }
   return null;
 }
Example #2
0
 public int compare(Object o1, Object o2) {
   o1 = TngUtil.unwrap(o1);
   o2 = TngUtil.unwrap(o2);
   if (o1 == o2) return 0;
   int ret = 0;
   ret = getOrderId((EObject) o1) - getOrderId((EObject) o2);
   if (ret == 0) {
     return getDefaultComparator().compare(o1, o2);
   }
   return ret;
 }
Example #3
0
 public int compare(Object o1, Object o2) {
   if (o1 == o2) return 0;
   Collator collator = Collator.getInstance();
   if (o1 instanceof MethodElement && o2 instanceof MethodElement) {
     return collator.compare(((MethodElement) o1).getName(), ((MethodElement) o2).getName());
   }
   Object o1unwrap = TngUtil.unwrap(o1);
   Object o2unwrap = TngUtil.unwrap(o2);
   if (o1unwrap instanceof MethodElement && o2unwrap instanceof MethodElement) {
     return collator.compare(
         ((MethodElement) o1unwrap).getName(), ((MethodElement) o2unwrap).getName());
   }
   return 0;
 }
Example #4
0
 public int compare(Object o1, Object o2) {
   if (o1 == o2) return 0;
   if (!(o1 instanceof DescribableElement)) {
     o1 = TngUtil.unwrap(o1);
     if (!(o1 instanceof DescribableElement)) {
       return 0;
     }
   }
   if (!(o2 instanceof DescribableElement)) {
     o2 = TngUtil.unwrap(o2);
     if (!(o2 instanceof DescribableElement)) {
       return 0;
     }
   }
   return oppositeValue(
       comparePresentationName((DescribableElement) o1, (DescribableElement) o2));
 }
Example #5
0
        public int compare(Object o1, Object o2) {
          if (o1 == o2) return 0;
          o1 = TngUtil.unwrap(o1);
          o2 = TngUtil.unwrap(o2);

          if (o1 instanceof PluginUIPackagesItemProvider && o2 instanceof MethodPlugin) {
            return -1;
          }
          if (o1 instanceof MethodPlugin && o2 instanceof PluginUIPackagesItemProvider) {
            return 1;
          }

          boolean usePresName = PresentationContext.INSTANCE.isShowPresentationNames();
          String s1 = null;
          String s2 = null;
          if (usePresName && o1 instanceof DescribableElement) {
            s1 = ((DescribableElement) o1).getPresentationName();
          } else if (o1 instanceof MethodElement) {
            s1 = ((MethodElement) o1).getName();
          } else if (o1 instanceof PluginUIPackagesItemProvider) {
            s1 = ((PluginUIPackagesItemProvider) o1).getFullName();
          } else if (o1 instanceof String) {
            s1 = (String) o1;
          }

          if (usePresName && o2 instanceof DescribableElement) {
            s2 = ((DescribableElement) o2).getPresentationName();
          } else if (o2 instanceof MethodElement) {
            s2 = ((MethodElement) o2).getName();
          } else if (o2 instanceof PluginUIPackagesItemProvider) {
            s2 = ((PluginUIPackagesItemProvider) o2).getFullName();
          } else if (o2 instanceof String) {
            s2 = (String) o2;
          }

          if (s1 == null || s2 == null) {
            return 0;
          }

          return s1.compareToIgnoreCase(s2);
        }