Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/TableEditorMetaclass.java')
-rw-r--r--plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/TableEditorMetaclass.java46
1 files changed, 46 insertions, 0 deletions
diff --git a/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/TableEditorMetaclass.java b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/TableEditorMetaclass.java
new file mode 100644
index 00000000000..7ba87f8ab48
--- /dev/null
+++ b/plugins/xwt/org.eclipse.papyrus.xwt/src/org/eclipse/papyrus/xwt/javabean/metadata/TableEditorMetaclass.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2010 Soyatec (http://www.soyatec.com) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Soyatec - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.xwt.javabean.metadata;
+
+import org.eclipse.papyrus.xwt.IXWTLoader;
+import org.eclipse.papyrus.xwt.internal.utils.UserData;
+import org.eclipse.papyrus.xwt.metadata.IMetaclass;
+import org.eclipse.swt.custom.TableEditor;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Widget;
+
+public class TableEditorMetaclass extends Metaclass {
+
+ public TableEditorMetaclass(IMetaclass superClass, IXWTLoader xwtLoader) {
+ super(TableEditor.class, superClass, xwtLoader);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.xwt.javabean.metadata.Metaclass#newInstance(java.lang. Object[])
+ */
+ @Override
+ public Object newInstance(Object[] parameters) {
+ Object widget = parameters[0];
+ if(parameters.length == 0 || !(widget instanceof Widget)) {
+ throw new IllegalStateException("Table parent is missing.");
+ }
+ Table table = null;
+ if(widget instanceof Table) {
+ table = (Table)widget;
+ } else {
+ table = (Table)UserData.findParent((Widget)widget, Table.class);
+ }
+ if(table == null) {
+ throw new IllegalStateException("Table parent is missing.");
+ }
+ return super.newInstance(new Object[]{ table });
+ }
+}

Back to the top