monitor.beginTask("Calculating referencing objects", 100);
actualUuid = entityUUID;
- monitor.worked(5);
+ monitor.worked(2);
referencingObjects = new ArrayList<>();
if(monitor.isCanceled()) {
actualUuid = null;
}
actualMonitor = monitor;
if (entityUUID != null){
+ monitor.subTask("Load data from server");
referencingObjectsSet = getReferencingObjects(entityUUID, objectClass);
if(monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
- monitor.worked(30);
+ monitor.worked(33);
+ monitor.subTask("Sort");
referencingObjects = sortReferencing();
if (referencingObjects == null){
if (monitor.isCanceled()){
if(monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
- monitor.worked(80);
+ monitor.worked(35);
+ monitor.subTask("Update View");
updateView();
+ monitor.worked(30);
}
monitor.done();
actualMonitor = null;
return Status.OK_STATUS;
-
-
}
};
currentJob.setUser(true);
private List<CdmBase> sortReferencing(){
if (referencingObjectsSet != null){
- List<CdmBase> referencingObjects = new ArrayList<CdmBase>(referencingObjectsSet);
+ List<CdmBase> referencingObjects = new ArrayList<>(referencingObjectsSet);
try{
Collections.sort(referencingObjects, new ReferencingClassComparator());
}catch (RemoteAccessException e){
return o1.getUuid().compareTo(o2.getUuid());
}
}
- return result;
+ return result;
}
}
contentDescription.setText(description.replace("&", "&&"));
}
}
-
});
}
if (referencedCdmObject.getUuid() == actualUuid){
return;
}
- if (referencedCdmObject != null){
- if(referencedCdmObject.isInstanceOf(IdentifiableEntity.class)){
- referencedObjectTitleCache = (HibernateProxyHelper.deproxy(referencedCdmObject, IdentifiableEntity.class)).getTitleCache();
- }
- else if(referencedCdmObject.isInstanceOf(DescriptionElementBase.class)){
- referencedObjectTitleCache = DescriptionHelper.getLabel(referencedCdmObject);
- }
- else if (referencedCdmObject.isInstanceOf(User.class)){
- referencedObjectTitleCache = ((User)referencedCdmObject).getUsername();
- }else if (referencedCdmObject.isInstanceOf(TaxonNode.class)){
- referencedObjectTitleCache = "TaxonNode of "+(HibernateProxyHelper.deproxy(referencedCdmObject, TaxonNode.class)).getTaxon().getTitleCache();
- }
- }
+ if(referencedCdmObject.isInstanceOf(IdentifiableEntity.class)){
+ referencedObjectTitleCache = (HibernateProxyHelper.deproxy(referencedCdmObject, IdentifiableEntity.class)).getTitleCache();
+ }
+ else if(referencedCdmObject.isInstanceOf(DescriptionElementBase.class)){
+ referencedObjectTitleCache = DescriptionHelper.getLabel(referencedCdmObject);
+ }
+ else if (referencedCdmObject.isInstanceOf(User.class)){
+ referencedObjectTitleCache = ((User)referencedCdmObject).getUsername();
+ }else if (referencedCdmObject.isInstanceOf(TaxonNode.class)){
+ referencedObjectTitleCache = "TaxonNode of "+(HibernateProxyHelper.deproxy(referencedCdmObject, TaxonNode.class)).getTaxon().getTitleCache();
+ }
if (referencedObjectTitleCache != null){
updateDescription(referencedCdmObject.getUserFriendlyTypeName() + " '" + referencedObjectTitleCache + "' is referenced by:");
} else{
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
-
package eu.etaxonomy.taxeditor.model;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.widgets.Control;
/**
- * <p>TextHelper class.</p>
- *
* @author n.hoffmann
* @created Mar 30, 2010
- * @version 1.0
*/
public class TextHelper {
-
+
/** Constant <code>ELLIPSIS="..."</code> */
public static final String ELLIPSIS = "...";
-
+
/**
* <p>shortenText</p>
*
}
int length = textValue.length();
int charsToClip = Math.round(0.95f*length * (1 - ((float)maxWidth/maxExtent)));
-
+
int end = length - charsToClip;
while (end > 0) {
String s1 = textValue.substring(0, end);
}
gc.dispose();
return textValue;
-
+
}
-
+
public static String deproxyClassName(Class clazz){
String name = clazz.getSimpleName();
if (name.indexOf("_$$")>-1){