From d4b5b03512b64ada6b7e465a4b1f6c52af537f9a Mon Sep 17 00:00:00 2001
From: Daniel Ratiu <ratiu@fortiss.org>
Date: Sat, 7 Jan 2012 09:50:11 +0000
Subject: [PATCH] cleaning the code by factoring out the TableViewerUtils
 utility methods

---
 .../TableContentProviderBase.java             | 24 -------------
 .../base/ui/utils/TableViewerUtils.java       | 34 +++++++++++++++++--
 2 files changed, 31 insertions(+), 27 deletions(-)

diff --git a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/contentprovider/TableContentProviderBase.java b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/contentprovider/TableContentProviderBase.java
index 866b95dfa..80dff926b 100644
--- a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/contentprovider/TableContentProviderBase.java
+++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/contentprovider/TableContentProviderBase.java
@@ -18,11 +18,8 @@ $Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $
 package org.fortiss.tooling.base.ui.contentprovider;
 
 import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.viewers.ColumnLabelProvider;
-import org.eclipse.jface.viewers.EditingSupport;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TableViewerColumn;
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.jface.viewers.ViewerSorter;
 import org.eclipse.swt.SWT;
@@ -74,27 +71,6 @@ public abstract class TableContentProviderBase implements
 		return viewer;
 	}
 
-	/** Creates a simple column. */
-	public TableViewerColumn makeColumn(TableViewer viewer, int width,
-			String title, String tooltip, ColumnLabelProvider labelProvider) {
-		TableViewerColumn column = new TableViewerColumn(viewer, SWT.LEFT);
-		column.getColumn().setWidth(width);
-		column.getColumn().setText(title);
-		column.getColumn().setToolTipText(tooltip);
-		column.setLabelProvider(labelProvider);
-		return column;
-	}
-
-	/** Creates a simple column with editing support. */
-	public TableViewerColumn makeColumn(TableViewer viewer, int width,
-			String title, String tooltip, ColumnLabelProvider labelProvider,
-			EditingSupport editingSupport) {
-		TableViewerColumn column = makeColumn(viewer, width, title, tooltip,
-				labelProvider);
-		column.setEditingSupport(editingSupport);
-		return column;
-	}
-
 	/** {@inheritDoc} */
 	@Override
 	public void dispose() {
diff --git a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/utils/TableViewerUtils.java b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/utils/TableViewerUtils.java
index 6bc80a895..fb956cc97 100644
--- a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/utils/TableViewerUtils.java
+++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/utils/TableViewerUtils.java
@@ -18,6 +18,7 @@ $Id$
 package org.fortiss.tooling.base.ui.utils;
 
 import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.EditingSupport;
 import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.jface.viewers.TableViewerColumn;
 import org.eclipse.swt.SWT;
@@ -28,7 +29,7 @@ import org.eclipse.swt.SWT;
  * @author hoelzl
  * @author $Author$
  * @version $Rev$
- * @ConQAT.Rating YELLOW Hash: C0D33568CD83347695F9B10BB6883E7C
+ * @ConQAT.Rating YELLOW Hash: 0F5344CC790350F28E412502C6A79557
  */
 public class TableViewerUtils {
 
@@ -47,13 +48,40 @@ public class TableViewerUtils {
 	 *            the column's label provider
 	 * @return the configured viewer column
 	 */
-	public static TableViewerColumn makeColumn(TableViewer viewer, int width,
+	public static TableViewerColumn createColumn(TableViewer viewer, int width,
 			String title, String tooltip, ColumnLabelProvider labelProvider) {
-		final TableViewerColumn column = new TableViewerColumn(viewer, SWT.LEFT);
+		TableViewerColumn column = new TableViewerColumn(viewer, SWT.LEFT);
 		column.getColumn().setWidth(width);
 		column.getColumn().setText(title);
 		column.getColumn().setToolTipText(tooltip);
 		column.setLabelProvider(labelProvider);
 		return column;
 	}
+
+	/**
+	 * Creates a simple column in the table viewer with editing support.
+	 * 
+	 * @param viewer
+	 *            the table viewer
+	 * @param width
+	 *            the column width
+	 * @param title
+	 *            the column title
+	 * @param tooltip
+	 *            the column tool tip
+	 * @param labelProvider
+	 *            the column's label provider
+	 * @param editingSupport
+	 *            the column's editing support
+	 * 
+	 * @return the configured viewer column
+	 */
+	public static TableViewerColumn createColumn(TableViewer viewer, int width,
+			String title, String tooltip, ColumnLabelProvider labelProvider,
+			EditingSupport editingSupport) {
+		TableViewerColumn column = createColumn(viewer, width, title, tooltip,
+				labelProvider);
+		column.setEditingSupport(editingSupport);
+		return column;
+	}
 }
-- 
GitLab