Project

General

Profile

« Previous | Next » 

Revision d4066259

Added by Andreas Müller about 3 years ago

cleanup and subtasks for referencing objects progress monitor

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/TextHelper.java
1 1
/**
2 2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
3
* European Distributed Institute of Taxonomy
4 4
* http://www.e-taxonomy.eu
5
* 
5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
9

  
10 9
package eu.etaxonomy.taxeditor.model;
11 10

  
12 11
import org.eclipse.swt.graphics.GC;
13 12
import org.eclipse.swt.widgets.Control;
14 13

  
15 14
/**
16
 * <p>TextHelper class.</p>
17
 *
18 15
 * @author n.hoffmann
19 16
 * @created Mar 30, 2010
20
 * @version 1.0
21 17
 */
22 18
public class TextHelper {
23
	
19

  
24 20
	/** Constant <code>ELLIPSIS="..."</code> */
25 21
	public static final String ELLIPSIS = "...";
26
		
22

  
27 23
	/**
28 24
	 * <p>shortenText</p>
29 25
	 *
......
45 41
		}
46 42
		int length = textValue.length();
47 43
		int charsToClip = Math.round(0.95f*length * (1 - ((float)maxWidth/maxExtent)));
48
		
44

  
49 45
		int end = length - charsToClip;
50 46
		while (end > 0) {
51 47
			String s1 = textValue.substring(0, end);
......
59 55
		}
60 56
		gc.dispose();
61 57
		return textValue;
62
		
58

  
63 59
	}
64
	
60

  
65 61
	public static String deproxyClassName(Class clazz){
66 62
		String name = clazz.getSimpleName();
67 63
		if (name.indexOf("_$$")>-1){

Also available in: Unified diff