Bug 574833: Fix not disposed GC in ShortedLabel

Change-Id: I9d9a97404238b3e239adb3d1a4a23c04cb0daa52
diff --git a/ecommons/org.eclipse.statet.ecommons.uimisc/src/org/eclipse/statet/ecommons/ui/components/ShortedLabel.java b/ecommons/org.eclipse.statet.ecommons.uimisc/src/org/eclipse/statet/ecommons/ui/components/ShortedLabel.java
index 5d79876..92f36aa 100644
--- a/ecommons/org.eclipse.statet.ecommons.uimisc/src/org/eclipse/statet/ecommons/ui/components/ShortedLabel.java
+++ b/ecommons/org.eclipse.statet.ecommons.uimisc/src/org/eclipse/statet/ecommons/ui/components/ShortedLabel.java
@@ -85,9 +85,15 @@
 	}
 	
 	private void updateShortening() {
-		final String text = new Shorter(fLabel).shorten(fCheckedText);
-		fLabel.setText(text);
-		fLabel.setToolTipText((text == fCheckedText) ? null : fText);
+		final Shorter shorter= new Shorter(fLabel);
+		try {
+			final String text= shorter.shorten(fCheckedText);
+			fLabel.setText(text);
+			fLabel.setToolTipText((text == fCheckedText) ? null : fText);
+		}
+		finally {
+			shorter.dispose();
+		}
 	}
 	
 	
@@ -107,6 +113,15 @@
 			fControl = control;
 		}
 		
+		public void dispose() {
+			final var gc= this.fGC;
+			if (gc != null) {
+				this.fGC= null;
+				gc.dispose();
+			}
+		}
+		
+		
 		public String shorten(final String text) {
 			if (text == null || text.isEmpty()) {
 				return text;