Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2013-02-05 14:53:07 +0000
committervlorenzo2013-02-05 14:53:07 +0000
commite4b7e0851276c0c53d475434aabeb462de976119 (patch)
tree850601f3759968f6060900b32ec9a4d4b6790904
parent84baf24596d65b2dadb575aff03913a737d1ed29 (diff)
downloadorg.eclipse.papyrus-e4b7e0851276c0c53d475434aabeb462de976119.tar.gz
org.eclipse.papyrus-e4b7e0851276c0c53d475434aabeb462de976119.tar.xz
org.eclipse.papyrus-e4b7e0851276c0c53d475434aabeb462de976119.zip
399839: [Table 2][ModelExplorer][Enhancement] The ModelExplorer must support the new Papyrus Table
https://bugs.eclipse.org/bugs/show_bug.cgi?id=399839
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/META-INF/MANIFEST.MF3
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/build.properties4
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/plugin.xml8
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/messages/Messages.java17
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/messages/messages.properties1
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/provider/TableLabelProvider.java76
6 files changed, 106 insertions, 3 deletions
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/META-INF/MANIFEST.MF b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/META-INF/MANIFEST.MF
index f748c393e91..17fcb685821 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/META-INF/MANIFEST.MF
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/META-INF/MANIFEST.MF
@@ -21,7 +21,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.nebula.widgets.nattable.core;bundle-version="0.9.0",
org.eclipse.core.expressions,
org.eclipse.papyrus.infra.widgets,
- org.eclipse.papyrus.infra.tools
+ org.eclipse.papyrus.infra.tools,
+ org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.1"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Bundle-Vendor: Eclipse Modeling Project
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/build.properties b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/build.properties
index 6f20375d6c7..265f3222255 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/build.properties
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/build.properties
@@ -2,4 +2,6 @@ source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
- plugin.xml
+ plugin.xml,\
+ schema/,\
+ icons/
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/plugin.xml b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/plugin.xml
index 659cdffc7a4..193cfbcf4e1 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/plugin.xml
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/plugin.xml
@@ -136,9 +136,15 @@
point="org.eclipse.papyrus.infra.nattable.common.crossvaluesolver">
<crossvalueSolver
id="org.eclipse.papyrus.infra.nattable.common.emf.feature.solver"
- manager="org.eclipse.papyrus.infra.nattable.common.CrossValueSolver1"
solver="org.eclipse.papyrus.infra.nattable.common.solver.FeatureValueResolver">
</crossvalueSolver>
</extension>
+ <extension
+ point="org.eclipse.papyrus.infra.services.labelprovider.labelProvider">
+ <labelProvider
+ priority="10"
+ provider="org.eclipse.papyrus.infra.nattable.common.provider.TableLabelProvider">
+ </labelProvider>
+ </extension>
</plugin>
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/messages/Messages.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/messages/Messages.java
new file mode 100644
index 00000000000..b74f8b8614d
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/messages/Messages.java
@@ -0,0 +1,17 @@
+package org.eclipse.papyrus.infra.nattable.common.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.nattable.common.messages.messages"; //$NON-NLS-1$
+
+ public static String TableLabelProvider_ErrorGettingIconForTable;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/messages/messages.properties b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/messages/messages.properties
new file mode 100644
index 00000000000..c70a5088cfc
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/messages/messages.properties
@@ -0,0 +1 @@
+TableLabelProvider_ErrorGettingIconForTable=Error getting icon image for tables:
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/provider/TableLabelProvider.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/provider/TableLabelProvider.java
new file mode 100644
index 00000000000..1d1e0b0e3a4
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/provider/TableLabelProvider.java
@@ -0,0 +1,76 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ * 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:
+ * Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.common.provider;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.infra.core.Activator;
+import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry;
+import org.eclipse.papyrus.infra.core.editorsfactory.PageIconsRegistry;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.providers.EMFLabelProvider;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.nattable.common.messages.Messages;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+public class TableLabelProvider extends EMFLabelProvider implements IFilteredLabelProvider {
+
+ @Override
+ public String getText(Object table) {
+ Object el = table;
+ if (table instanceof IAdaptable) {
+ el = ((IAdaptable) table).getAdapter(EObject.class);
+ }
+ if (el != null && el instanceof Table) {
+ return ((Table) el).getName();
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ @Override
+ public Image getImage(Object table) {
+ if (table instanceof IAdaptable) {
+ table = ((IAdaptable) table).getAdapter(EObject.class);
+ }
+ if (table instanceof Table) {
+ IPageIconsRegistry registry = null;
+ try {
+ registry = ServiceUtilsForEObject.getInstance().getService(
+ IPageIconsRegistry.class, (Table)table);
+ } catch (ServiceException e) {
+ Activator.log.error(Messages.TableLabelProvider_ErrorGettingIconForTable, e);
+ }
+ if (registry == null) {
+ registry = new PageIconsRegistry();
+ }
+ return registry.getEditorIcon(table);
+ }
+
+ return null;
+ }
+
+ public boolean accept(Object table) {
+ Object el = table;
+ if (table instanceof IAdaptable) {
+ el = EMFHelper.getEObject(table);
+ }
+ if (el != null) {
+ return el instanceof Table;
+ }
+
+ return false;
+ }
+
+}

Back to the top