Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2013-07-12 13:54:32 +0000
committerVincent Lorenzo2013-07-12 13:54:32 +0000
commit83bbe087fa5356782da031cc738e85eecd6708d0 (patch)
tree6446ad2c80dde247a2ebef15feb76b0556ec2aa3 /sandbox
parent9de999e05f2d40ae97789d5238a7d2376146c081 (diff)
downloadorg.eclipse.papyrus-83bbe087fa5356782da031cc738e85eecd6708d0.tar.gz
org.eclipse.papyrus-83bbe087fa5356782da031cc738e85eecd6708d0.tar.xz
org.eclipse.papyrus-83bbe087fa5356782da031cc738e85eecd6708d0.zip
Share the new plugin oep.uml.nattable.ws.preferences.
This plugin has been created to test a table with 2 dynamic axis and any axis information stored in the model.
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/.classpath7
-rw-r--r--sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/.project28
-rw-r--r--sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/META-INF/MANIFEST.MF22
-rw-r--r--sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/about.html28
-rw-r--r--sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/build.properties9
-rw-r--r--sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/icons/file.pngbin0 -> 319 bytes
-rw-r--r--sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/icons/preferences_16x16.gifbin0 -> 224 bytes
-rw-r--r--sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/icons/property.gifbin0 -> 171 bytes
-rw-r--r--sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/plugin.pdoc4
-rw-r--r--sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/plugin.xml61
-rw-r--r--sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/resources/nattablepreferences.nattableconfiguration17
-rw-r--r--sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/Activator.java66
-rw-r--r--sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/celleditor/config/FilePropertyCellEditorConfiguration.java84
-rw-r--r--sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/manager/axis/PropertyFileAxisManager.java304
-rw-r--r--sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/manager/axis/PropertyFilePropertyAxisManager.java267
-rw-r--r--sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/manager/cell/PreferencesCellManager.java161
-rw-r--r--sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/provider/FileLabelProvider.java102
-rw-r--r--sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/provider/PropertyLabelProvider.java100
-rw-r--r--sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/tester/PreferencesTableCreationTester.java34
-rw-r--r--sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/utils/Constants.java29
21 files changed, 1330 insertions, 0 deletions
diff --git a/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/.classpath b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/.classpath
new file mode 100644
index 00000000000..8a8f1668cdc
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/.project b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/.project
new file mode 100644
index 00000000000..eeda059fd72
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.uml.nattable.ws.preferences</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/.settings/org.eclipse.jdt.core.prefs b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..f287d53cf45
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/META-INF/MANIFEST.MF b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..388cd970ad1
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/META-INF/MANIFEST.MF
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Papyrus table for Workspace Preferences (Incubation)
+Bundle-SymbolicName: org.eclipse.papyrus.uml.nattable.ws.preferences;singleton:=true
+Bundle-Version: 0.10.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.uml.nattable.ws.preferences.Activator
+Bundle-Vendor: Eclipse Modeling Project
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.nattable;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.nattable.common;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.nattable.model;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.1",
+ org.eclipse.uml2.uml;bundle-version="4.1.0",
+ org.eclipse.nebula.widgets.nattable.core;bundle-version="1.0.0",
+ org.eclipse.emf.transaction;bundle-version="1.4.0",
+ org.eclipse.papyrus.infra.widgets;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.1",
+ org.eclipse.papyrus.infra.emf.nattable
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
diff --git a/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/about.html b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/about.html
new file mode 100644
index 00000000000..598b3684879
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>May 12, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/build.properties b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/build.properties
new file mode 100644
index 00000000000..2b8285975bd
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/build.properties
@@ -0,0 +1,9 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/,\
+ plugin.pdoc,\
+ about.html
+src.includes = about.html
diff --git a/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/icons/file.png b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/icons/file.png
new file mode 100644
index 00000000000..2bae43270eb
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/icons/file.png
Binary files differ
diff --git a/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/icons/preferences_16x16.gif b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/icons/preferences_16x16.gif
new file mode 100644
index 00000000000..4c07fea1449
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/icons/preferences_16x16.gif
Binary files differ
diff --git a/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/icons/property.gif b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/icons/property.gif
new file mode 100644
index 00000000000..867e05283d4
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/icons/property.gif
Binary files differ
diff --git a/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/plugin.pdoc b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/plugin.pdoc
new file mode 100644
index 00000000000..1e722b25b18
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/plugin.pdoc
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<doc:Documentation xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:doc="http://www.eclipse.org/papyrus/documentation/plugin/documentation" description="This plugin provides a table to edit preferences from the worskpace.">
+ <referent firstName="Juan" lastName="Cadavid" eMail="juan.cadavid@cea.fr" currentCompany="CEA-LIST"/>
+</doc:Documentation>
diff --git a/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/plugin.xml b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/plugin.xml
new file mode 100644
index 00000000000..e7c48221adc
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/plugin.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.papyrus.infra.nattable.tester">
+ <tester
+ class="org.eclipse.papyrus.uml.nattable.ws.preferences.tester.PreferencesTableCreationTester"
+ id="org.eclipse.papyrus.uml.nattable.ws.preferences.creationtester">
+ </tester>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.infra.nattable.axismanager">
+ <axisManager
+ id="org.eclipse.papyrus.infra.nattable.propertyfile.property.axis.manager"
+ manager="org.eclipse.papyrus.uml.nattable.ws.preferences.manager.axis.PropertyFilePropertyAxisManager">
+ </axisManager>
+ <axisManager
+ id="org.eclipse.papyrus.infra.nattable.propertyfile.file.axis.manager"
+ manager="org.eclipse.papyrus.uml.nattable.ws.preferences.manager.axis.PropertyFileAxisManager">
+ </axisManager>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.infra.nattable.configuration">
+ <configuration
+ file="resources/nattablepreferences.nattableconfiguration">
+ </configuration>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.infra.nattable.cellmanager">
+ <cellManager
+ id="org.eclipse.papyrus.uml.nattable.ws.preferences.cellManager"
+ manager="org.eclipse.papyrus.uml.nattable.ws.preferences.manager.cell.PreferencesCellManager"
+ order="2">
+ </cellManager>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.infra.services.labelprovider.labelProvider">
+ <labelProvider
+ priority="10"
+ provider="org.eclipse.papyrus.uml.nattable.ws.preferences.provider.FileLabelProvider">
+ <labelProviderContext
+ context="org.eclipse.papyrus.infra.nattable.header.labelprovider">
+ </labelProviderContext>
+ </labelProvider>
+ <labelProvider
+ priority="10"
+ provider="org.eclipse.papyrus.uml.nattable.ws.preferences.provider.PropertyLabelProvider">
+ <labelProviderContext
+ context="org.eclipse.papyrus.infra.nattable.header.labelprovider">
+ </labelProviderContext>
+ </labelProvider>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.infra.nattable.celleditor.configuration">
+ <configuration
+ class="org.eclipse.papyrus.uml.nattable.ws.preferences.celleditor.config.FilePropertyCellEditorConfiguration"
+ order="20">
+ </configuration>
+ </extension>
+
+</plugin>
diff --git a/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/resources/nattablepreferences.nattableconfiguration b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/resources/nattablepreferences.nattableconfiguration
new file mode 100644
index 00000000000..b76417b9e87
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/resources/nattablepreferences.nattableconfiguration
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nattableconfiguration:TableConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:nattableaxisconfiguration="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisconfiguration" xmlns:nattableaxisprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisprovider" xmlns:nattableconfiguration="http://www.eclipse.org/papyrus/nattable/model/nattableconfiguration" xmlns:nattablelabelprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattablecontentprovider" xmlns:nattabletester="http://www.eclipse.org/papyrus/nattable/model/table/nattabletester" description="This table allows to edit preferences" name="PreferencesTable" type="PapyrusPreferencesTable" iconPath="platform:/plugin/org.eclipse.papyrus.uml.nattable.ws.preferences/icons/preferences_16x16.gif" defaultRowAxisProvider="//@rowAxisProviders.0" defaultColumnAxisProvider="//@columnAxisProviders.0">
+ <creationTester xsi:type="nattabletester:JavaTableTester" tester="org.eclipse.papyrus.uml.nattable.ws.preferences.creationtester"/>
+ <rowHeaderAxisConfiguration xsi:type="nattableaxisconfiguration:TableHeaderAxisConfiguration" indexStyle="NUMERIC">
+ <ownedLabelConfigurations xsi:type="nattablelabelprovider:ObjectLabelProviderConfiguration"/>
+ <ownedAxisConfigurations xsi:type="nattableaxisconfiguration:EStructuralFeatureValueFillingConfiguration">
+ <listenFeature xsi:type="ecore:EReference" href="http://www.eclipse.org/uml2/4.0.0/UML#//Element/ownedComment"/>
+ </ownedAxisConfigurations>
+ <axisManagers xsi:type="nattableaxisconfiguration:AxisManagerRepresentation" axisManagerId="org.eclipse.papyrus.infra.nattable.propertyfile.file.axis.manager" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.labelprovider" headerLabelConfiguration="//@rowHeaderAxisConfiguration/@ownedLabelConfigurations.0" specificAxisConfigurations="//@rowHeaderAxisConfiguration/@ownedAxisConfigurations.0"/>
+ </rowHeaderAxisConfiguration>
+ <columnHeaderAxisConfiguration xsi:type="nattableaxisconfiguration:TableHeaderAxisConfiguration">
+ <ownedLabelConfigurations xsi:type="nattablelabelprovider:ObjectLabelProviderConfiguration"/>
+ <axisManagers xsi:type="nattableaxisconfiguration:AxisManagerRepresentation" axisManagerId="org.eclipse.papyrus.infra.nattable.propertyfile.property.axis.manager" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.labelprovider" headerLabelConfiguration="//@rowHeaderAxisConfiguration/@ownedLabelConfigurations.0"/>
+ </columnHeaderAxisConfiguration>
+ <columnAxisProviders xsi:type="nattableaxisprovider:SlaveObjectAxisProvider" description="Provides the property of the files" name="Preferences Property Axis Manager"/>
+ <rowAxisProviders xsi:type="nattableaxisprovider:MasterObjectAxisProvider" description="Provides the files properties" name="Provides the files properties"/>
+</nattableconfiguration:TableConfiguration>
diff --git a/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/Activator.java b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/Activator.java
new file mode 100644
index 00000000000..2e8c5cae75e
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/Activator.java
@@ -0,0 +1,66 @@
+/*****************************************************************************
+ * 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.nattable.ws.preferences;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.uml.nattable.ws.preferences"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ public static LogHelper log;
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/celleditor/config/FilePropertyCellEditorConfiguration.java b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/celleditor/config/FilePropertyCellEditorConfiguration.java
new file mode 100644
index 00000000000..ba171944ca3
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/celleditor/config/FilePropertyCellEditorConfiguration.java
@@ -0,0 +1,84 @@
+/*****************************************************************************
+ * 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.nattable.ws.preferences.celleditor.config;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.data.validate.IDataValidator;
+import org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor;
+import org.eclipse.nebula.widgets.nattable.edit.editor.IComboBoxDataProvider;
+import org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter;
+import org.eclipse.papyrus.infra.emf.nattable.celleditor.config.EStructuralFeatureEditorConfig;
+import org.eclipse.papyrus.infra.nattable.manager.table.ITableAxisElementProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.uml.nattable.ws.preferences.utils.Constants;
+
+
+
+public class FilePropertyCellEditorConfiguration extends EStructuralFeatureEditorConfig {
+
+ @Override
+ public ICellEditor getICellEditor(Table table, Object axisElement, ITableAxisElementProvider elementProvider) {
+ return super.getICellEditor(table, axisElement, elementProvider);
+ }
+
+ @Override
+ public String getEditorId() {
+ return super.getEditorId();
+ }
+
+ @Override
+ protected IComboBoxDataProvider getComboDataProvider(Table table, Object axisElement, ITableAxisElementProvider elementProvider) {
+ return super.getComboDataProvider(table, axisElement, elementProvider);
+ }
+
+ @Override
+ public IDisplayConverter getDisplayConvert(Object axisElement, Table table, ILabelProvider provider) {
+ return super.getDisplayConvert(axisElement, table, provider);
+ }
+
+ @Override
+ public ICellPainter getCellPainter(Table table, Object axisElement) {
+ return super.getCellPainter(table, axisElement);
+ }
+
+ @Override
+ public String getDisplayMode(Table table, Object axisElement) {
+ return super.getDisplayMode(table, axisElement);
+ }
+
+ @Override
+ public IDataValidator getDataValidator(Table table, Object axisElement) {
+ return super.getDataValidator(table, axisElement);
+ }
+
+ @Override
+ public boolean handles(Table table, Object axisElement) {
+ return axisElement instanceof String && ((String)axisElement).startsWith(Constants.PROPERTY_PREFIX);
+ }
+
+ @Override
+ protected int getFeatureIdentifier(Table table, Object axisElement) {
+ return SINGLE_STRING;
+ // return super.getFeatureIdentifier(table, axisElement);
+ }
+
+ @Override
+ public String getEditorDescription() {
+ return super.getEditorDescription();
+ }
+
+
+
+}
diff --git a/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/manager/axis/PropertyFileAxisManager.java b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/manager/axis/PropertyFileAxisManager.java
new file mode 100644
index 00000000000..48a852e4e98
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/manager/axis/PropertyFileAxisManager.java
@@ -0,0 +1,304 @@
+/*****************************************************************************
+ * 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.nattable.ws.preferences.manager.axis;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.nebula.widgets.nattable.ui.NatEventData;
+import org.eclipse.papyrus.infra.nattable.manager.axis.AbstractSynchronizedOnFeatureAxisManager;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerRepresentation;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
+import org.eclipse.papyrus.infra.widgets.providers.IRestrictedContentProvider;
+import org.eclipse.papyrus.uml.nattable.ws.preferences.utils.Constants;
+import org.eclipse.uml2.uml.Comment;
+import org.eclipse.uml2.uml.Element;
+
+//FIXME : all input and output steam must be closed in this plugin!!! VERIFY THEM
+public class PropertyFileAxisManager extends AbstractSynchronizedOnFeatureAxisManager {
+
+ @Override
+ public void init(INattableModelManager manager, AxisManagerRepresentation rep, AbstractAxisProvider provider) {
+ super.init(manager, rep, provider);
+ }
+
+ /**
+ * add a listener on the table context to listen the required feature
+ */
+ protected void addContextFeatureValueListener() {
+ this.featureListener = new AdapterImpl() {
+
+ @Override
+ public void notifyChanged(Notification msg) {
+ if(getListenFeatures().contains(msg.getFeature())) {//FIXME : create our own adapter for derived/subset feature
+ getTableManager().updateAxisContents(getRepresentedContentProvider());
+ if(getRepresentedContentProvider() == getTableManager().getHorizontalAxisProvider()) {
+ getTableManager().updateAxisContents(getTableManager().getVerticalAxisProvider());
+ } else {
+ getTableManager().updateAxisContents(getTableManager().getHorizontalAxisProvider());
+ }
+
+ }
+ };
+ };
+
+ getTableContext().eAdapters().add(this.featureListener);
+ }
+
+ @Override
+ public NattableModelManager getTableManager() {
+ return super.getTableManager();
+ }
+
+ @Override
+ public boolean canInsertAxis(Collection<Object> objectsToAdd, int index) {
+ return super.canInsertAxis(objectsToAdd, index);
+ }
+
+ @Override
+ public boolean canCreateAxisElement(String elementId) {
+ return super.canCreateAxisElement(elementId);
+ }
+
+ @Override
+ public boolean canDropAxisElement(Collection<Object> objectsToAdd) {
+ return super.canDropAxisElement(objectsToAdd);
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ }
+
+ @Override
+ public boolean canBeUsedAsRowManager() {
+ return super.canBeUsedAsRowManager();
+ }
+
+ @Override
+ public boolean canBeUsedAsColumnManager() {
+ return super.canBeUsedAsColumnManager();
+ }
+
+ @Override
+ public Command getAddAxisCommand(EditingDomain domain, Collection<Object> objectToAdd) {
+ return super.getAddAxisCommand(domain, objectToAdd);
+ }
+
+ @Override
+ public Command getInsertAxisCommand(Collection<Object> objectsToAdd, int index) {
+ return super.getInsertAxisCommand(objectsToAdd, index);
+ }
+
+ @Override
+ public Command getComplementaryAddAxisCommand(EditingDomain domain, Collection<Object> objectToAdd) {
+ return super.getComplementaryAddAxisCommand(domain, objectToAdd);
+ }
+
+ @Override
+ public AbstractAxisProvider getRepresentedContentProvider() {
+ return super.getRepresentedContentProvider();
+ }
+
+ @Override
+ public void setHeaderDataValue(int columnIndex, int rowIndex, Object newValue) {
+ super.setHeaderDataValue(columnIndex, rowIndex, newValue);
+ }
+
+ @Override
+ public boolean isAllowedContents(Object object) {
+ return super.isAllowedContents(object);
+ }
+
+ @Override
+ public boolean canMoveAxis() {
+ return true;
+ }
+
+ @Override
+ public IRestrictedContentProvider createPossibleAxisContentProvider(boolean isRestricted) {
+ return super.createPossibleAxisContentProvider(isRestricted);
+ }
+
+ @Override
+ public Command getDestroyAxisCommand(EditingDomain domain, Collection<Object> objectToDestroy) {
+ return super.getDestroyAxisCommand(domain, objectToDestroy);
+ }
+
+ @Override
+ public Collection<Object> getAllManagedAxis() {
+ final Element el = (Element)getTableContext();
+ List<Object> comments = new ArrayList<Object>();
+ Collection<Object> prop = new HashSet<Object>();
+ Properties properties = new Properties();
+ for(final Comment current : el.getOwnedComments()) {
+ String body = current.getBody();
+ if(body.startsWith(Constants.WORKSPACE_PREFIX)) {
+
+ // Properties currentProp = new Properties();
+ // try {
+ // currentProp.load(new FileInputStream(filePath));
+ // } catch (FileNotFoundException e) {
+ // e.printStackTrace();
+ // } catch (IOException e) {
+ // e.printStackTrace();
+ // }
+ // // comments.add(current);
+ // prop.add(currentProp);
+ FileInputStream fis = null;
+ try {
+ fis = new FileInputStream(body.replace(Constants.WORKSPACE_PREFIX, ""));
+ properties.load(fis);
+ prop.add(body);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ if(fis != null) {
+ try {
+ fis.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ prop.clear();
+ }
+
+ } else if(body.startsWith(Constants.FOLDER)) {
+ // String path = body.replace(Constants.FOLDER, newChar)
+ File folder = new File(body.replace(Constants.FOLDER, ""));
+ File[] listOfFiles = folder.listFiles();
+
+ for(int i = 0; i < listOfFiles.length; i++) {
+ if(listOfFiles[i].isFile()) {
+ prop.add(Constants.WORKSPACE_PREFIX + listOfFiles[i].getAbsolutePath());
+ // System.out.println("File " + listOfFiles[i].getAbsolutePath());
+ // prop.add(e)
+ } else if(listOfFiles[i].isDirectory()) {
+ System.out.println("Directory " + listOfFiles[i].getName());
+ }
+ }
+ }
+ }
+
+ properties.clear();
+ return prop;
+ }
+
+ @Override
+ protected EditingDomain getTableEditingDomain() {
+ return super.getTableEditingDomain();
+ }
+
+ @Override
+ protected EditingDomain getContextEditingDomain() {
+ return super.getContextEditingDomain();
+ }
+
+ @Override
+ public void moveAxis(Object elementToMove, int newIndex) {
+ super.moveAxis(elementToMove, newIndex);
+ }
+
+ @Override
+ public void openEditAxisAliasDialog(NatEventData event, int axisPosition) {
+ super.openEditAxisAliasDialog(event, axisPosition);
+ }
+
+ @Override
+ public String getElementAxisName(IAxis axis) {
+ return super.getElementAxisName(axis);
+ }
+
+ @Override
+ public AxisManagerRepresentation getAxisManagerRepresentation() {
+ return super.getAxisManagerRepresentation();
+ }
+
+ @Override
+ public boolean canDestroyAxis(List<Integer> axisPositions) {
+ return super.canDestroyAxis(axisPositions);
+ }
+
+ @Override
+ public boolean canDestroyAxisElement(List<Integer> axisPositions) {
+ return super.canDestroyAxisElement(axisPositions);
+ }
+
+ @Override
+ public void destroyAxis(List<Integer> axisPositions) {
+ super.destroyAxis(axisPositions);
+ }
+
+ @Override
+ public boolean canDestroyAxis(Integer axisPosition) {
+ return super.canDestroyAxis(axisPosition);
+ }
+
+ @Override
+ protected List<Object> getElements(List<Integer> axisPositions) {
+ return super.getElements(axisPositions);
+ }
+
+ @Override
+ public void destroyAxisElement(List<Integer> axisPosition) {
+ super.destroyAxisElement(axisPosition);
+ }
+
+ @Override
+ protected List<Object> getElements() {
+ return super.getElements();
+ }
+
+ @Override
+ public boolean isSlave() {
+ return false;
+ }
+
+ // @Override
+ // public boolean isDynamic() {
+ // return true;
+ // }
+
+ @Override
+ public boolean canEditAxisHeader() {
+ return false;
+ }
+
+ @Override
+ public boolean canDestroyAxisElement(Integer axisIndex) {
+ return false;
+ }
+
+ @Override
+ public Command getDestroyAxisElementCommand(EditingDomain domain, Integer axisPosition) {
+ return null;
+ }
+
+}
diff --git a/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/manager/axis/PropertyFilePropertyAxisManager.java b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/manager/axis/PropertyFilePropertyAxisManager.java
new file mode 100644
index 00000000000..1658fad64ed
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/manager/axis/PropertyFilePropertyAxisManager.java
@@ -0,0 +1,267 @@
+/*****************************************************************************
+ * 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.nattable.ws.preferences.manager.axis;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.Set;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.nebula.widgets.nattable.ui.NatEventData;
+import org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerRepresentation;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
+import org.eclipse.papyrus.infra.widgets.providers.IRestrictedContentProvider;
+import org.eclipse.papyrus.uml.nattable.ws.preferences.utils.Constants;
+
+
+public class PropertyFilePropertyAxisManager extends AbstractAxisManager {
+
+ @Override
+ public void init(INattableModelManager manager, AxisManagerRepresentation rep, AbstractAxisProvider provider) {
+ super.init(manager, rep, provider);
+ }
+
+ @Override
+ public NattableModelManager getTableManager() {
+ return super.getTableManager();
+ }
+
+ @Override
+ public boolean canInsertAxis(Collection<Object> objectsToAdd, int index) {
+ return super.canInsertAxis(objectsToAdd, index);
+ }
+
+ @Override
+ public boolean canCreateAxisElement(String elementId) {
+ return super.canCreateAxisElement(elementId);
+ }
+
+ @Override
+ public boolean canDropAxisElement(Collection<Object> objectsToAdd) {
+ return super.canDropAxisElement(objectsToAdd);
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ }
+
+ @Override
+ public boolean canBeUsedAsRowManager() {
+ return super.canBeUsedAsRowManager();
+ }
+
+ @Override
+ public boolean canBeUsedAsColumnManager() {
+ return super.canBeUsedAsColumnManager();
+ }
+
+ @Override
+ public Command getAddAxisCommand(EditingDomain domain, Collection<Object> objectToAdd) {
+ return super.getAddAxisCommand(domain, objectToAdd);
+ }
+
+ @Override
+ public Command getInsertAxisCommand(Collection<Object> objectsToAdd, int index) {
+ return super.getInsertAxisCommand(objectsToAdd, index);
+ }
+
+ @Override
+ public Command getComplementaryAddAxisCommand(EditingDomain domain, Collection<Object> objectToAdd) {
+ return super.getComplementaryAddAxisCommand(domain, objectToAdd);
+ }
+
+ @Override
+ public AbstractAxisProvider getRepresentedContentProvider() {
+ return super.getRepresentedContentProvider();
+ }
+
+ @Override
+ public void setHeaderDataValue(int columnIndex, int rowIndex, Object newValue) {
+ super.setHeaderDataValue(columnIndex, rowIndex, newValue);
+ }
+
+ @Override
+ public boolean isAllowedContents(Object object) {
+ return super.isAllowedContents(object);
+ }
+
+ @Override
+ public boolean canMoveAxis() {
+ return super.canMoveAxis();
+ }
+
+ @Override
+ public IRestrictedContentProvider createPossibleAxisContentProvider(boolean isRestricted) {
+ return super.createPossibleAxisContentProvider(isRestricted);
+ }
+
+ @Override
+ public Command getDestroyAxisCommand(EditingDomain domain, Collection<Object> objectToDestroy) {
+ return super.getDestroyAxisCommand(domain, objectToDestroy);
+ }
+
+ @Override
+ public Collection<Object> getAllManagedAxis() {
+ List<Object> rowElements = getTableManager().getRowElementsList();//FIXME use the best way for that!
+ Collection<Object> values = new ArrayList<Object>();
+ for(final Object current : rowElements) {
+ if(current instanceof String) {
+ // String filePath = body.replace("wsPref:/", "");
+ Properties currentProp = new Properties();
+ try {
+ currentProp.load(new FileInputStream(((String)current).replace(Constants.WORKSPACE_PREFIX, "")));
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ Set<Entry<Object, Object>> entrySet = ((Properties)currentProp).entrySet();
+ for(Entry<Object, Object> entry : entrySet) {
+ values.add(Constants.PROPERTY_PREFIX + entry.getKey());
+ }
+ currentProp.clear();
+ // Enumeration<Object> elements = currentProp.elements();
+ // while(elements.hasMoreElements()) {
+ // values.add(elements.nextElement());
+ // }
+ // int i = 0;
+ // i++;
+ // // comments.add(current);
+ // prop.add(currentProp);
+ }
+ // if(current instanceof Properties) {
+ // values.addAll(((Properties)current).entrySet());
+ // Enumeration<Object> el = ((Properties)current).elements();
+ // while(el.hasMoreElements()) {
+ // System.out.println(((Properties)current).get(el.nextElement()));
+ //
+ // // System.out.println(((Properties)current).getProperty(el.nextElement()));
+ // // System.out.println(el.nextElement());
+ // }
+ // // Object next = el.nextElement();
+ // // int i = 0;
+ // // i++;
+ // }
+ }
+ return values;
+ }
+
+ @Override
+ protected EditingDomain getTableEditingDomain() {
+ return super.getTableEditingDomain();
+ }
+
+ @Override
+ protected EditingDomain getContextEditingDomain() {
+ return super.getContextEditingDomain();
+ }
+
+ @Override
+ public void moveAxis(Object elementToMove, int newIndex) {
+ super.moveAxis(elementToMove, newIndex);
+ }
+
+ @Override
+ public void openEditAxisAliasDialog(NatEventData event, int axisPosition) {
+ super.openEditAxisAliasDialog(event, axisPosition);
+ }
+
+ @Override
+ public String getElementAxisName(IAxis axis) {
+ return super.getElementAxisName(axis);
+ }
+
+ @Override
+ public AxisManagerRepresentation getAxisManagerRepresentation() {
+ return super.getAxisManagerRepresentation();
+ }
+
+ @Override
+ public boolean canDestroyAxis(List<Integer> axisPositions) {
+ return super.canDestroyAxis(axisPositions);
+ }
+
+ @Override
+ public boolean canDestroyAxisElement(List<Integer> axisPositions) {
+ return super.canDestroyAxisElement(axisPositions);
+ }
+
+ @Override
+ public void destroyAxis(List<Integer> axisPositions) {
+ super.destroyAxis(axisPositions);
+ }
+
+ @Override
+ public boolean canDestroyAxis(Integer axisPosition) {
+ return super.canDestroyAxis(axisPosition);
+ }
+
+ @Override
+ protected List<Object> getElements(List<Integer> axisPositions) {
+ return super.getElements(axisPositions);
+ }
+
+ @Override
+ public void destroyAxisElement(List<Integer> axisPosition) {
+ super.destroyAxisElement(axisPosition);
+ }
+
+ @Override
+ protected List<Object> getElements() {
+ return super.getElements();
+ }
+
+ @Override
+ public boolean isSlave() {
+ return false;
+ }
+
+ // @Override
+ // public boolean isDynamic() {
+ // return true;
+ // }
+
+ @Override
+ public boolean canEditAxisHeader() {
+ return false;
+ }
+
+ @Override
+ public boolean canDestroyAxisElement(Integer axisIndex) {
+ return false;
+ }
+
+ @Override
+ public Command getDestroyAxisElementCommand(EditingDomain domain, Integer axisPosition) {
+ return null;
+ }
+
+ @Override
+ public boolean isDynamic() {
+ return true;
+ }
+
+}
diff --git a/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/manager/cell/PreferencesCellManager.java b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/manager/cell/PreferencesCellManager.java
new file mode 100644
index 00000000000..aac44eda215
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/manager/cell/PreferencesCellManager.java
@@ -0,0 +1,161 @@
+/*****************************************************************************
+ * 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.nattable.ws.preferences.manager.cell;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.nattable.manager.cell.AbstractCellManager;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.uml.nattable.ws.preferences.Activator;
+import org.eclipse.papyrus.uml.nattable.ws.preferences.utils.Constants;
+
+
+public class PreferencesCellManager extends AbstractCellManager {
+
+ @Override
+ public boolean handles(Object columnElement, Object rowElement) {
+ return organizedAndResolvedValue(columnElement, rowElement) != null;
+ }
+
+ @Override
+ public Object getValue(Object columnElement, Object rowElement, INattableModelManager tableManager) {
+ final List<Object> elements = organizedAndResolvedValue(columnElement, rowElement);
+ Properties prop = new Properties();
+ FileInputStream fis = null;
+
+ try {
+ fis = new FileInputStream(new File((String)elements.get(0)));
+
+ } catch (FileNotFoundException e) {
+ Activator.log.error(e);
+ }
+ try {
+ prop.load(fis);
+ } catch (FileNotFoundException e) {
+ Activator.log.error(e);
+ } catch (IOException e) {
+ Activator.log.error(e);
+ }
+
+ String propName = (String)elements.get(1);
+ try {
+ fis.close();
+ } catch (IOException e) {
+ Activator.log.error(e);
+ }
+ if(prop.containsKey(propName)) {
+ return prop.getProperty(propName);
+ }
+ return NOT_AVALAIBLE;
+ }
+
+ @Override
+ public void setValue(TransactionalEditingDomain domain, Object columnElement, Object rowElement, Object newValue, INattableModelManager tableManager) {
+ final List<Object> elements = organizedAndResolvedValue(columnElement, rowElement);
+ Properties prop = new Properties();
+ FileInputStream fis = null;
+ FileOutputStream fos = null;
+ try {
+ fis = new FileInputStream(new File((String)elements.get(0)));
+ fos = new FileOutputStream(new File((String)elements.get(0)));
+ } catch (FileNotFoundException e) {
+ Activator.log.error(e);
+ }
+ if(fis != null) {
+ // try {
+ try {
+ prop.load(fis);
+ String propName = (String)elements.get(1);
+ prop.put(propName, newValue);
+
+ prop.store(fos, "");
+ } catch (IOException e) {
+ Activator.log.error(e);
+ }
+ }
+ if(fis != null) {
+ try {
+ fis.close();
+ } catch (IOException e) {
+ Activator.log.error(e);
+ }
+ }
+ if(fos != null) {
+ try {
+ fos.close();
+ } catch (IOException e) {
+ Activator.log.error(e);
+ }
+ }
+ prop.clear();
+ }
+
+ @Override
+ public boolean isCellEditable(Object obj1, Object obj2) {
+ final List<Object> elements = organizedAndResolvedValue(obj1, obj2);
+ Properties prop = new Properties();
+ FileInputStream fis = null;
+ try {
+ fis = new FileInputStream(new File((String)elements.get(0)));
+ } catch (FileNotFoundException e) {
+ Activator.log.error(e);
+ }
+ try {
+ prop.load(fis);
+ } catch (FileNotFoundException e) {
+ Activator.log.error(e);
+ } catch (IOException e) {
+ Activator.log.error(e);
+ }
+ try {
+ fis.close();
+ } catch (IOException e) {
+ Activator.log.error(e);
+ }
+ String propName = (String)elements.get(1);
+
+ return prop.containsKey(propName);
+ }
+
+ @Override
+ public Command getSetValueCommand(TransactionalEditingDomain domain, Object columnElement, Object rowElement, Object newValue, INattableModelManager tableManager) {
+ return super.getSetValueCommand(domain, columnElement, rowElement, newValue, tableManager);
+ }
+
+ protected List<Object> organizedAndResolvedValue(final Object columnlement, final Object rowElement) {
+ List<Object> elements = null;
+ if(columnlement instanceof String && ((String)columnlement).startsWith(Constants.PROPERTY_PREFIX) && rowElement instanceof String && ((String)rowElement).startsWith(Constants.WORKSPACE_PREFIX)) {
+ elements = new ArrayList<Object>();
+ elements.add(((String)rowElement).replace(Constants.WORKSPACE_PREFIX, ""));
+ elements.add(((String)columnlement).replace(Constants.PROPERTY_PREFIX, ""));
+ } else if(rowElement instanceof String && ((String)rowElement).startsWith(Constants.PROPERTY_PREFIX) && columnlement instanceof String && ((String)columnlement).startsWith(Constants.WORKSPACE_PREFIX)) {
+ elements = new ArrayList<Object>();
+ elements.add(((String)columnlement).replace(Constants.WORKSPACE_PREFIX, ""));
+ elements.add(((String)rowElement).replace(Constants.PROPERTY_PREFIX, ""));
+
+ }
+
+ return elements;
+
+ }
+}
diff --git a/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/provider/FileLabelProvider.java b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/provider/FileLabelProvider.java
new file mode 100644
index 00000000000..cf4cbb05c45
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/provider/FileLabelProvider.java
@@ -0,0 +1,102 @@
+/*****************************************************************************
+ * 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.nattable.ws.preferences.provider;
+
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
+import org.eclipse.papyrus.infra.nattable.manager.table.ITableAxisElementProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.ILabelProviderConfiguration;
+import org.eclipse.papyrus.infra.nattable.provider.AbstractNattableCellLabelProvider;
+import org.eclipse.papyrus.infra.nattable.utils.LabelProviderCellContextElementWrapper;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+import org.eclipse.papyrus.infra.widgets.Activator;
+import org.eclipse.papyrus.uml.nattable.ws.preferences.utils.Constants;
+import org.eclipse.swt.graphics.Image;
+
+
+public class FileLabelProvider extends AbstractNattableCellLabelProvider {
+
+ @Override
+ public boolean accept(Object element) {
+ if(element instanceof LabelProviderCellContextElementWrapper) {
+ element = ((LabelProviderCellContextElementWrapper)element).getObject();
+ return element instanceof String && ((String)element).startsWith(Constants.WORKSPACE_PREFIX);
+ }
+ return false;
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ return Activator.getDefault().getImage(org.eclipse.papyrus.uml.nattable.ws.preferences.Activator.PLUGIN_ID, "icons/file.png");
+ }
+
+ @Override
+ public String getText(Object element) {
+ if(element instanceof LabelProviderCellContextElementWrapper) {
+ element = ((LabelProviderCellContextElementWrapper)element).getObject();
+ String path = (String)element;
+ int lastIndex = path.lastIndexOf("\\") + 1;
+ return path.substring(lastIndex, path.length());
+
+ }
+ return null;
+ }
+
+ @Override
+ public void addListener(ILabelProviderListener listener) {
+ super.addListener(listener);
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ }
+
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ return super.isLabelProperty(element, property);
+ }
+
+ @Override
+ public void removeListener(ILabelProviderListener listener) {
+ super.removeListener(listener);
+ }
+
+ @Override
+ protected Object getRowObject(ILayerCell cell, IConfigRegistry registry) {
+ return super.getRowObject(cell, registry);
+ }
+
+ @Override
+ protected Object getColumnObject(ILayerCell cell, IConfigRegistry registry) {
+ return super.getColumnObject(cell, registry);
+ }
+
+ @Override
+ protected ITableAxisElementProvider getAxisContentProvider(IConfigRegistry registry) {
+ return super.getAxisContentProvider(registry);
+ }
+
+ @Override
+ protected LabelProviderService getLabelProviderService(IConfigRegistry registry) {
+ return super.getLabelProviderService(registry);
+ }
+
+ @Override
+ protected ILabelProviderConfiguration getLabelConfiguration(LabelProviderCellContextElementWrapper element) {
+ return super.getLabelConfiguration(element);
+ }
+
+}
diff --git a/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/provider/PropertyLabelProvider.java b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/provider/PropertyLabelProvider.java
new file mode 100644
index 00000000000..5842685f279
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/provider/PropertyLabelProvider.java
@@ -0,0 +1,100 @@
+/*****************************************************************************
+ * 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.nattable.ws.preferences.provider;
+
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
+import org.eclipse.papyrus.infra.nattable.manager.table.ITableAxisElementProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.ILabelProviderConfiguration;
+import org.eclipse.papyrus.infra.nattable.provider.AbstractNattableCellLabelProvider;
+import org.eclipse.papyrus.infra.nattable.utils.LabelProviderCellContextElementWrapper;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+import org.eclipse.papyrus.infra.widgets.Activator;
+import org.eclipse.papyrus.uml.nattable.ws.preferences.utils.Constants;
+import org.eclipse.swt.graphics.Image;
+
+
+public class PropertyLabelProvider extends AbstractNattableCellLabelProvider {
+
+ @Override
+ public boolean accept(Object element) {
+ if(element instanceof LabelProviderCellContextElementWrapper) {
+ element = ((LabelProviderCellContextElementWrapper)element).getObject();
+ return element instanceof String && ((String)element).startsWith(Constants.PROPERTY_PREFIX);
+ }
+ return false;
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ return Activator.getDefault().getImage(org.eclipse.papyrus.uml.nattable.ws.preferences.Activator.PLUGIN_ID, "icons/property.gif");
+ }
+
+ @Override
+ public String getText(Object element) {
+ if(element instanceof LabelProviderCellContextElementWrapper) {
+ element = ((LabelProviderCellContextElementWrapper)element).getObject();
+ return ((String)element).replace(Constants.PROPERTY_PREFIX, "");
+ }
+ return null;
+
+ }
+
+ @Override
+ public void addListener(ILabelProviderListener listener) {
+ super.addListener(listener);
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ }
+
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ return super.isLabelProperty(element, property);
+ }
+
+ @Override
+ public void removeListener(ILabelProviderListener listener) {
+ super.removeListener(listener);
+ }
+
+ @Override
+ protected Object getRowObject(ILayerCell cell, IConfigRegistry registry) {
+ return super.getRowObject(cell, registry);
+ }
+
+ @Override
+ protected Object getColumnObject(ILayerCell cell, IConfigRegistry registry) {
+ return super.getColumnObject(cell, registry);
+ }
+
+ @Override
+ protected ITableAxisElementProvider getAxisContentProvider(IConfigRegistry registry) {
+ return super.getAxisContentProvider(registry);
+ }
+
+ @Override
+ protected LabelProviderService getLabelProviderService(IConfigRegistry registry) {
+ return super.getLabelProviderService(registry);
+ }
+
+ @Override
+ protected ILabelProviderConfiguration getLabelConfiguration(LabelProviderCellContextElementWrapper element) {
+ return super.getLabelConfiguration(element);
+ }
+
+}
diff --git a/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/tester/PreferencesTableCreationTester.java b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/tester/PreferencesTableCreationTester.java
new file mode 100644
index 00000000000..3c18b877b0c
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/tester/PreferencesTableCreationTester.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.nattable.ws.preferences.tester;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.papyrus.infra.nattable.Activator;
+import org.eclipse.papyrus.infra.nattable.tester.ITableTester;
+import org.eclipse.uml2.uml.Element;
+
+
+public class PreferencesTableCreationTester implements ITableTester {
+
+
+ @Override
+ public IStatus isAllowed(Object context) {
+ if(context instanceof Element) {
+ return Status.OK_STATUS;
+ }
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "The selection is not an Uml Element");
+ }
+
+}
diff --git a/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/utils/Constants.java b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/utils/Constants.java
new file mode 100644
index 00000000000..adaf05a9078
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.uml.nattable.ws.preferences/src/org/eclipse/papyrus/uml/nattable/ws/preferences/utils/Constants.java
@@ -0,0 +1,29 @@
+/*****************************************************************************
+ * 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.nattable.ws.preferences.utils;
+
+
+public class Constants {
+
+
+ private Constants() {
+ //to prevent instanciation
+ }
+
+ public static final String WORKSPACE_PREFIX = "wsPref:/";
+
+ public static final String PROPERTY_PREFIX = "property:/";
+
+ public static final String FOLDER = "folder:/";
+}

Back to the top