From dc839b0f875aecdd71e1a24f0cdd38b949f1f180 Mon Sep 17 00:00:00 2001
From: Florian Hoelzl <hoelzl@fortiss.org>
Date: Mon, 31 Oct 2011 11:54:53 +0000
Subject: [PATCH] Cleanup => YELLOW refs 238

---
 .../tooling/base/ui/utils/ActionUtils.java    | 42 +++++++++++++++++
 .../base/ui/utils/TableViewerUtils.java       | 45 +++++++++++++++++++
 2 files changed, 87 insertions(+)
 create mode 100644 org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/utils/ActionUtils.java
 create mode 100644 org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/utils/TableViewerUtils.java

diff --git a/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/utils/ActionUtils.java b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/utils/ActionUtils.java
new file mode 100644
index 000000000..6c0b6969e
--- /dev/null
+++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/utils/ActionUtils.java
@@ -0,0 +1,42 @@
+/*--------------------------------------------------------------------------+
+$Id$
+|                                                                          |
+| Copyright 2011 ForTISS GmbH                     |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.tooling.base.ui.utils;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+/**
+ * Utility methods for handling JFace {@link Action}s.
+ * 
+ * @author hoelzl
+ * @author $Author$
+ * @version $Rev$
+ * @ConQAT.Rating RED Hash:
+ */
+public class ActionUtils {
+
+	/** Setup an enabled action with name, tool tip, and icons. */
+	public static void setUpAction(Action action, String name, String toolTip,
+			ImageDescriptor icon, ImageDescriptor disabledIcon) {
+		action.setText(name);
+		action.setToolTipText(toolTip);
+		action.setEnabled(true);
+		action.setImageDescriptor(icon);
+		action.setDisabledImageDescriptor(disabledIcon);
+	}
+}
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
new file mode 100644
index 000000000..cd81e7b35
--- /dev/null
+++ b/org.fortiss.tooling.base.ui/trunk/src/org/fortiss/tooling/base/ui/utils/TableViewerUtils.java
@@ -0,0 +1,45 @@
+/*--------------------------------------------------------------------------+
+$Id$
+|                                                                          |
+| Copyright 2011 ForTISS GmbH                     |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.tooling.base.ui.utils;
+
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.swt.SWT;
+
+/**
+ * Utility methods for JFace {@link TableViewer}s.
+ * 
+ * @author hoelzl
+ * @author $Author$
+ * @version $Rev$
+ * @ConQAT.Rating RED Hash:
+ */
+public class TableViewerUtils {
+
+	/** Creates a simple column in the table viewer. */
+	public static TableViewerColumn makeColumn(TableViewer viewer, int bound,
+			String title, String tooltip, ColumnLabelProvider labelProvider) {
+		final TableViewerColumn column = new TableViewerColumn(viewer, SWT.LEFT);
+		column.getColumn().setWidth(bound);
+		column.getColumn().setText(title);
+		column.getColumn().setToolTipText(tooltip);
+		column.setLabelProvider(labelProvider);
+		return column;
+	}
+}
-- 
GitLab