Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordsciamma2007-11-07 15:09:20 +0000
committerdsciamma2007-11-07 15:09:20 +0000
commit6746deec4a31dca29f7b3598a78d2f9913ea07d0 (patch)
treec9b9e6a05e93ace532fa0b9f9605abe8b8ac6169
parent21a2d2906573fe5ad0edbc3fa84bbaa40dea0c1d (diff)
downloadorg.eclipse.ecoretools-6746deec4a31dca29f7b3598a78d2f9913ea07d0.tar.gz
org.eclipse.ecoretools-6746deec4a31dca29f7b3598a78d2f9913ea07d0.tar.xz
org.eclipse.ecoretools-6746deec4a31dca29f7b3598a78d2f9913ea07d0.zip
Initial contribution
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/.classpath7
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/.project28
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/META-INF/MANIFEST.MF18
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/about.html29
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/build.properties8
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/plugin.properties28
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/plugin.xml289
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/Activator.java61
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/AffiliationSection.java106
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/BaseTypeSection.java107
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/ContentKindSection.java213
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/FeatureKindSection.java213
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/FractionDigitsSection.java205
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/GroupSection.java105
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/ItemTypeSection.java106
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/LengthSection.java204
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/MaxExclusiveSection.java208
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/MaxInclusiveSection.java208
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/MaxLengthSection.java170
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/MinExclusiveSection.java208
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/MinInclusiveSection.java208
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/MinLengthSection.java170
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/NameSection.java224
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/NamespaceSection.java200
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/ProcessingKindSection.java178
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/QualifiedSection.java80
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/TotalDigitsSection.java170
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/WhitespaceSection.java198
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/DetailEntryKeyPropertySection.java41
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/DetailEntryValuePropertySection.java56
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/EAnnotationSourcePropertySection.java41
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/EEnumLiteralLiteralPropertySection.java41
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/EEnumLiteralValuePropertySection.java50
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/EOperationParameterSection.java295
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/EOppositePropertySection.java99
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/ETypePropertySection.java78
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/InstanceClassNamePropertySection.java41
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/IsAbstractPropertySection.java40
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/IsContainmentPropertySection.java39
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/IsInterfacePropertySection.java40
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/IsSerializablePropertySection.java40
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/LowerBoundPropertySection.java50
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/NamePropertySection.java41
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/NsPrefixPropertySection.java41
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/NsURIPropertySection.java41
-rw-r--r--plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/UpperBoundPropertySection.java87
46 files changed, 5110 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/.classpath b/plugins/org.eclipse.emf.ecoretools.properties/.classpath
new file mode 100644
index 0000000..751c8f2
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/.project b/plugins/org.eclipse.emf.ecoretools.properties/.project
new file mode 100644
index 0000000..449bef3
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.emf.ecoretools.properties</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/plugins/org.eclipse.emf.ecoretools.properties/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.ecoretools.properties/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..d3c76cb
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/META-INF/MANIFEST.MF
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName (Incubation)
+Bundle-SymbolicName: org.eclipse.emf.ecoretools.properties;singleton:=true
+Bundle-Version: 0.8.0.qualifier
+Bundle-Activator: org.eclipse.emf.ecoretools.properties.internal.Activator
+Bundle-Vendor: %providerName
+Bundle-Copyright: %copyright
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.emf.tabbedproperties
+Eclipse-LazyStart: true
+Export-Package: org.eclipse.emf.ecoretools.properties.internal;x-internal:=true,
+ org.eclipse.emf.ecoretools.properties.internal.metadata;x-internal:=true,
+ org.eclipse.emf.ecoretools.properties.internal.sections;x-internal:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ClassPath: .
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/about.html b/plugins/org.eclipse.emf.ecoretools.properties/about.html
new file mode 100644
index 0000000..984e460
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/about.html
@@ -0,0 +1,29 @@
+<!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>November 7, 2007</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/plugins/org.eclipse.emf.ecoretools.properties/build.properties b/plugins/org.eclipse.emf.ecoretools.properties/build.properties
new file mode 100644
index 0000000..67aa01e
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/build.properties
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html
+
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/plugin.properties b/plugins/org.eclipse.emf.ecoretools.properties/plugin.properties
new file mode 100644
index 0000000..ec07992
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/plugin.properties
@@ -0,0 +1,28 @@
+# /**
+# * Copyright (c) 2007 Anyware Technologies.
+# * 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:
+# * Anyware Technologies - Initial API and implementation
+# */
+
+# NLS_MESSAGEFORMAT_VAR
+
+# ==============================================================================
+# Do not change the properties between this line and the last line containing:
+# %%% END OF TRANSLATED PROPERTIES %%%
+# Instead, either redefine an existing property, or create a new property,
+# append it to the end of the file, and change the code to use the new name.
+# ==============================================================================
+
+pluginName=Ecore Properties
+providerName=Eclipse.org
+copyright=Copyright (c) 2007 Anyware Technologies. All rights reserved.
+
+# ==============================================================================
+# %%% END OF TRANSLATED PROPERTIES %%%
+# The above properties have been shipped for translation.
+# ==============================================================================
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/plugin.xml b/plugins/org.eclipse.emf.ecoretools.properties/plugin.xml
new file mode 100644
index 0000000..2a03dae
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/plugin.xml
@@ -0,0 +1,289 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+
+<!--
+ Copyright (c) 2005, 2007 Anyware Technologies. 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:
+ Lucas Bigeardel (Anyware Technologies) - IP'zation
+-->
+
+<plugin>
+ <extension point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
+ <propertyTabs contributorId="org.eclipse.emf.ecoretools.diagram">
+ <propertyTab
+ category="domain"
+ id="org.eclipse.emf.ecoretools.diagram.modelTab"
+ label="Model"/>
+ <propertyTab
+ category="extra"
+ id="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata"
+ label="Extended Metadata"/>
+ <propertyTab
+ afterTab="org.eclipse.emf.ecoretools.diagram.modelTab"
+ category="domain"
+ id="org.eclipse.emf.ecoretools.diagram.modelTab.parameterTab"
+ indented="true"
+ label="Parameter"/>
+ </propertyTabs>
+ </extension>
+
+ <extension point="org.eclipse.ui.views.properties.tabbed.propertySections">
+ <propertySections contributorId="org.eclipse.emf.ecoretools.diagram">
+ <propertySection
+ id="org.eclipse.emf.ecoretools.diagram.ecore.NameSection"
+ class="org.eclipse.emf.ecoretools.properties.internal.sections.NamePropertySection"
+ tab="org.eclipse.emf.ecoretools.diagram.modelTab">
+ <input type="org.eclipse.emf.ecore.ENamedElement"/>
+ </propertySection>
+ <propertySection
+ id="org.eclipse.emf.ecoretools.diagram.ecore.LowerBoundSection"
+ class="org.eclipse.emf.ecoretools.properties.internal.sections.LowerBoundPropertySection"
+ tab="org.eclipse.emf.ecoretools.diagram.modelTab"
+ afterSection="org.eclipse.emf.ecoretools.diagram.ecore.NameSection">
+ <input type="org.eclipse.emf.ecore.ETypedElement"/>
+ </propertySection>
+ <propertySection
+ id="org.eclipse.emf.ecoretools.diagram.ecore.UpperBoundSection"
+ class="org.eclipse.emf.ecoretools.properties.internal.sections.UpperBoundPropertySection"
+ tab="org.eclipse.emf.ecoretools.diagram.modelTab"
+ afterSection="org.eclipse.emf.ecoretools.diagram.ecore.LowerBoundSection">
+ <input type="org.eclipse.emf.ecore.ETypedElement"/>
+ </propertySection>
+ <propertySection
+ id="org.eclipse.emf.ecoretools.diagram.ecore.ETypeSection"
+ class="org.eclipse.emf.ecoretools.properties.internal.sections.ETypePropertySection"
+ tab="org.eclipse.emf.ecoretools.diagram.modelTab"
+ afterSection="org.eclipse.emf.ecoretools.diagram.ecore.UpperBoundSection">
+ <input type="org.eclipse.emf.ecore.EAttribute"/>
+ <input type="org.eclipse.emf.ecore.EOperation"/>
+ <input type="org.eclipse.emf.ecore.EParameter"/>
+ </propertySection>
+ <propertySection
+ id="org.eclipse.emf.ecoretools.diagram.ecore.NsPrefixSection"
+ class="org.eclipse.emf.ecoretools.properties.internal.sections.NsPrefixPropertySection"
+ tab="org.eclipse.emf.ecoretools.diagram.modelTab"
+ afterSection="org.eclipse.emf.ecoretools.diagram.ecore.NameSection">
+ <input type="org.eclipse.emf.ecore.EPackage"/>
+ </propertySection>
+ <propertySection
+ id="org.eclipse.emf.ecoretools.diagram.ecore.NsURISection"
+ class="org.eclipse.emf.ecoretools.properties.internal.sections.NsURIPropertySection"
+ tab="org.eclipse.emf.ecoretools.diagram.modelTab"
+ afterSection="org.eclipse.emf.ecoretools.diagram.ecore.NsPrefixSection">
+ <input type="org.eclipse.emf.ecore.EPackage"/>
+ </propertySection>
+ <propertySection
+ id="org.eclipse.emf.ecoretools.diagram.ecore.IsContainmentSection"
+ class="org.eclipse.emf.ecoretools.properties.internal.sections.IsContainmentPropertySection"
+ tab="org.eclipse.emf.ecoretools.diagram.modelTab"
+ afterSection="org.eclipse.emf.ecoretools.diagram.ecore.UpperBoundSection">
+ <input type="org.eclipse.emf.ecore.EReference"/>
+ </propertySection>
+ <propertySection
+ id="org.eclipse.emf.ecoretools.diagram.ecore.EOppositeSection"
+ class="org.eclipse.emf.ecoretools.properties.internal.sections.EOppositePropertySection"
+ tab="org.eclipse.emf.ecoretools.diagram.modelTab"
+ afterSection="org.eclipse.emf.ecoretools.diagram.ecore.IsContainmentSection">
+ <input type="org.eclipse.emf.ecore.EReference"/>
+ </propertySection>
+ <propertySection
+ id="org.eclipse.emf.ecoretools.diagram.ecore.IsAbstractSection"
+ class="org.eclipse.emf.ecoretools.properties.internal.sections.IsAbstractPropertySection"
+ tab="org.eclipse.emf.ecoretools.diagram.modelTab"
+ afterSection="org.eclipse.emf.ecoretools.diagram.ecore.NameSection">
+ <input type="org.eclipse.emf.ecore.EClass"/>
+ </propertySection>
+ <propertySection
+ id="org.eclipse.emf.ecoretools.diagram.ecore.IsInterfaceSection"
+ class="org.eclipse.emf.ecoretools.properties.internal.sections.IsInterfacePropertySection"
+ tab="org.eclipse.emf.ecoretools.diagram.modelTab"
+ afterSection="org.eclipse.emf.ecoretools.diagram.ecore.IsAbstractSection">
+ <input type="org.eclipse.emf.ecore.EClass"/>
+ </propertySection>
+ <propertySection
+ id="org.eclipse.emf.ecoretools.diagram.ecore.InstanceClassNameSection"
+ class="org.eclipse.emf.ecoretools.properties.internal.sections.InstanceClassNamePropertySection"
+ tab="org.eclipse.emf.ecoretools.diagram.modelTab"
+ afterSection="org.eclipse.emf.ecoretools.diagram.ecore.NameSection">
+ <input type="org.eclipse.emf.ecore.EClassifier"/>
+ </propertySection>
+ <propertySection
+ id="org.eclipse.emf.ecoretools.diagram.ecore.IsSerializableSection"
+ class="org.eclipse.emf.ecoretools.properties.internal.sections.IsSerializablePropertySection"
+ tab="org.eclipse.emf.ecoretools.diagram.modelTab"
+ afterSection="org.eclipse.emf.ecoretools.diagram.ecore.InstanceClassNameSection">
+ <input type="org.eclipse.emf.ecore.EDataType"/>
+ </propertySection>
+ <propertySection
+ id="org.eclipse.emf.ecoretools.diagram.ecore.EAnnotationSourceSection"
+ class="org.eclipse.emf.ecoretools.properties.internal.sections.EAnnotationSourcePropertySection"
+ tab="org.eclipse.emf.ecoretools.diagram.modelTab">
+ <input type="org.eclipse.emf.ecore.EAnnotation"/>
+ </propertySection>
+ <propertySection
+ id="org.eclipse.emf.ecoretools.diagram.ecore.EEnumLiteralLiteralSection"
+ class="org.eclipse.emf.ecoretools.properties.internal.sections.EEnumLiteralLiteralPropertySection"
+ tab="org.eclipse.emf.ecoretools.diagram.modelTab"
+ afterSection="org.eclipse.emf.ecoretools.diagram.ecore.NameSection">
+ <input type="org.eclipse.emf.ecore.EEnumLiteral"/>
+ </propertySection>
+ <propertySection
+ id="org.eclipse.emf.ecoretools.diagram.ecore.EEnumLiteralValueSection"
+ class="org.eclipse.emf.ecoretools.properties.internal.sections.EEnumLiteralValuePropertySection"
+ tab="org.eclipse.emf.ecoretools.diagram.modelTab"
+ afterSection="org.eclipse.emf.ecoretools.diagram.ecore.EEnumLiteralLiteralSection">
+ <input type="org.eclipse.emf.ecore.EEnumLiteral"/>
+ </propertySection>
+ <propertySection
+ id="org.eclipse.emf.ecoretools.diagram.ecore.DetailEntryKeySection"
+ class="org.eclipse.emf.ecoretools.properties.internal.sections.DetailEntryKeyPropertySection"
+ tab="org.eclipse.emf.ecoretools.diagram.modelTab">
+ <input type="org.eclipse.emf.ecore.impl.EStringToStringMapEntryImpl"/>
+ </propertySection>
+ <propertySection
+ id="org.eclipse.emf.ecoretools.diagram.ecore.DetailEntryValueSection"
+ class="org.eclipse.emf.ecoretools.properties.internal.sections.DetailEntryValuePropertySection"
+ tab="org.eclipse.emf.ecoretools.diagram.modelTab"
+ afterSection="org.eclipse.emf.ecoretools.diagram.ecore.DetailEntryValueSection">
+ <input type="org.eclipse.emf.ecore.impl.EStringToStringMapEntryImpl"/>
+ </propertySection>
+ <propertySection
+ class="org.eclipse.emf.ecoretools.properties.internal.sections.EOperationParameterSection"
+ id="org.eclipse.emf.ecoretools.diagram.ecore.parameterSection"
+ tab="org.eclipse.emf.ecoretools.diagram.modelTab.parameterTab">
+ <input type="org.eclipse.emf.ecore.EOperation"/>
+ </propertySection>
+
+ <!-- Extended Metadata Sections -->
+ <propertySection
+ class="org.eclipse.emf.ecoretools.properties.internal.metadata.QualifiedSection"
+ id="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata.Qualified"
+ tab="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata">
+ <input type="org.eclipse.emf.ecore.EPackage"/>
+ </propertySection>
+ <propertySection
+ class="org.eclipse.emf.ecoretools.properties.internal.metadata.AffiliationSection"
+ id="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata.Affiliation"
+ tab="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata">
+ <input type="org.eclipse.emf.ecore.EStructuralFeature"/>
+ </propertySection>
+ <!-- TODO add Wildcards Section : String List -->
+ <!-- TODO add Pattern Facet Section : String List -->
+ <!-- TODO add Enumeration Facet Section : String List -->
+ <!-- TODO add Member Types Section : EDatatype List -->
+ <propertySection
+ class="org.eclipse.emf.ecoretools.properties.internal.metadata.TotalDigitsSection"
+ id="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata.TotalDigits"
+ tab="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata">
+ <input type="org.eclipse.emf.ecore.EDataType"/>
+ </propertySection>
+ <propertySection
+ class="org.eclipse.emf.ecoretools.properties.internal.metadata.FractionDigitsSection"
+ id="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata.FractionDigits"
+ tab="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata">
+ <input type="org.eclipse.emf.ecore.EDataType"/>
+ </propertySection>
+ <propertySection
+ class="org.eclipse.emf.ecoretools.properties.internal.metadata.WhitespaceSection"
+ id="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata.Whitespace"
+ tab="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata">
+ <input type="org.eclipse.emf.ecore.EDataType"/>
+ </propertySection>
+ <propertySection
+ class="org.eclipse.emf.ecoretools.properties.internal.metadata.MinExclusiveSection"
+ id="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata.MinExclusive"
+ tab="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata">
+ <input type="org.eclipse.emf.ecore.EDataType"/>
+ </propertySection>
+ <propertySection
+ class="org.eclipse.emf.ecoretools.properties.internal.metadata.MinInclusiveSection"
+ id="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata.MinInclusive"
+ tab="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata">
+ <input type="org.eclipse.emf.ecore.EDataType"/>
+ </propertySection>
+ <propertySection
+ class="org.eclipse.emf.ecoretools.properties.internal.metadata.MaxInclusiveSection"
+ id="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata.MaxInclusive"
+ tab="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata">
+ <input type="org.eclipse.emf.ecore.EDataType"/>
+ </propertySection>
+ <propertySection
+ class="org.eclipse.emf.ecoretools.properties.internal.metadata.MaxExclusiveSection"
+ id="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata.MaxExclusive"
+ tab="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata">
+ <input type="org.eclipse.emf.ecore.EDataType"/>
+ </propertySection>
+ <propertySection
+ class="org.eclipse.emf.ecoretools.properties.internal.metadata.MaxLengthSection"
+ id="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata.MaxLength"
+ tab="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata">
+ <input type="org.eclipse.emf.ecore.EDataType"/>
+ </propertySection>
+ <propertySection
+ class="org.eclipse.emf.ecoretools.properties.internal.metadata.LengthSection"
+ id="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata.Length"
+ tab="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata">
+ <input type="org.eclipse.emf.ecore.EDataType"/>
+ </propertySection>
+ <propertySection
+ class="org.eclipse.emf.ecoretools.properties.internal.metadata.MinLengthSection"
+ id="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata.MinLength"
+ tab="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata">
+ <input type="org.eclipse.emf.ecore.EDataType"/>
+ </propertySection>
+ <propertySection
+ class="org.eclipse.emf.ecoretools.properties.internal.metadata.ItemTypeSection"
+ id="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata.ItemType"
+ tab="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata">
+ <input type="org.eclipse.emf.ecore.EDataType"/>
+ </propertySection>
+ <propertySection
+ class="org.eclipse.emf.ecoretools.properties.internal.metadata.BaseTypeSection"
+ id="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata.BaseType"
+ tab="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata">
+ <input type="org.eclipse.emf.ecore.EDataType"/>
+ </propertySection>
+ <propertySection
+ class="org.eclipse.emf.ecoretools.properties.internal.metadata.ProcessingKindSection"
+ id="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata.ProcessingKind"
+ tab="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata">
+ <input type="org.eclipse.emf.ecore.EStructuralFeature"/>
+ </propertySection>
+ <propertySection
+ class="org.eclipse.emf.ecoretools.properties.internal.metadata.GroupSection"
+ id="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata.Group"
+ tab="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata">
+ <input type="org.eclipse.emf.ecore.EStructuralFeature"/>
+ </propertySection>
+ <propertySection
+ class="org.eclipse.emf.ecoretools.properties.internal.metadata.FeatureKindSection"
+ id="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata.FeatureKind"
+ tab="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata">
+ <input type="org.eclipse.emf.ecore.EStructuralFeature"/>
+ </propertySection>
+ <propertySection
+ class="org.eclipse.emf.ecoretools.properties.internal.metadata.NamespaceSection"
+ id="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata.Namespace"
+ tab="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata">
+ <input type="org.eclipse.emf.ecore.EStructuralFeature"/>
+ </propertySection>
+ <propertySection
+ class="org.eclipse.emf.ecoretools.properties.internal.metadata.ContentKindSection"
+ id="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata.ContentKind"
+ tab="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata">
+ <input type="org.eclipse.emf.ecore.EClass"/>
+ </propertySection>
+ <propertySection
+ class="org.eclipse.emf.ecoretools.properties.internal.metadata.NameSection"
+ id="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata.Name"
+ tab="org.eclipse.emf.ecoretools.diagram.ecore.properties.extendedMetadata">
+ <input type="org.eclipse.emf.ecore.EStructuralFeature"/>
+ <input type="org.eclipse.emf.ecore.EClassifier"/>
+ </propertySection>
+ </propertySections>
+ </extension>
+</plugin>
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/Activator.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/Activator.java
new file mode 100644
index 0000000..a2a1b85
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/Activator.java
@@ -0,0 +1,61 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal;
+
+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.emf.ecoretools.properties";
+
+ /** The shared instance */
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ // Do nothing
+ }
+
+ /**
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /**
+ * @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/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/AffiliationSection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/AffiliationSection.java
new file mode 100644
index 0000000..15e8217
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/AffiliationSection.java
@@ -0,0 +1,106 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.metadata;
+
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.emf.tabbedproperties.EMFRecordingChangeCommand;
+import org.eclipse.emf.tabbedproperties.sections.AbstractChooserPropertySection;
+import org.eclipse.jface.viewers.ILabelProvider;
+
+/**
+ * Section to edit affiliation extended metadata annotation
+ *
+ * @see ExtendedMetaData#setAffiliation(org.eclipse.emf.ecore.EStructuralFeature,
+ * org.eclipse.emf.ecore.EStructuralFeature)
+ * @author <a href="david.sciamma@anyware-tech.com">David Sciamma</a>
+ */
+public class AffiliationSection extends AbstractChooserPropertySection {
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Affiliation";
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractChooserPropertySection#getComboFeatureValues()
+ */
+ protected Object[] getComboFeatureValues() {
+ return getChoices(getEObject(), EcorePackage.eINSTANCE.getEStructuralFeature());
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractChooserPropertySection#getLabelProvider()
+ */
+ protected ILabelProvider getLabelProvider() {
+ return new AdapterFactoryLabelProvider(new EcoreItemProviderAdapterFactory());
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractChooserPropertySection#getFeatureValue()
+ */
+ protected Object getFeatureValue() {
+ return ExtendedMetaData.INSTANCE.getAffiliation((EStructuralFeature) getEObject());
+ }
+
+ /**
+ * Handle the combo modified event.
+ */
+ protected void handleComboModified() {
+ if (!isRefreshing()) {
+ final Object newAffiliation = getCSingleObjectChooser().getSelection();
+ EditingDomain editingDomain = getEditingDomain();
+ if (getEObjectList().size() == 1) {
+ EStructuralFeature oldAffiliation = ExtendedMetaData.INSTANCE.getAffiliation((EStructuralFeature) getEObject());
+ if (oldAffiliation != newAffiliation) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(getEObject().eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setAffiliation((EStructuralFeature) getEObject(), (EStructuralFeature) newAffiliation);
+ }
+ });
+ }
+ } else {
+ CompoundCommand compoundCommand = new CompoundCommand();
+ /* apply the property change to all selected elements */
+ for (final EObject nextObject : getEObjectList()) {
+ EStructuralFeature oldAffiliation = ExtendedMetaData.INSTANCE.getAffiliation((EStructuralFeature) nextObject);
+ if (oldAffiliation != newAffiliation) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(nextObject.eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setAffiliation((EStructuralFeature) nextObject, (EStructuralFeature) newAffiliation);
+ }
+ });
+ }
+ }
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/BaseTypeSection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/BaseTypeSection.java
new file mode 100644
index 0000000..dd82129
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/BaseTypeSection.java
@@ -0,0 +1,107 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.metadata;
+
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.emf.tabbedproperties.EMFRecordingChangeCommand;
+import org.eclipse.emf.tabbedproperties.sections.AbstractChooserPropertySection;
+import org.eclipse.jface.viewers.ILabelProvider;
+
+/**
+ * Section to edit basetype extended metadata annotation
+ *
+ * @see ExtendedMetaData#setBaseType(org.eclipse.emf.ecore.EDataType,
+ * org.eclipse.emf.ecore.EDataType)
+ * @author <a href="david.sciamma@anyware-tech.com">David Sciamma</a>
+ */
+public class BaseTypeSection extends AbstractChooserPropertySection {
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Base Type";
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractChooserPropertySection#getComboFeatureValues()
+ */
+ protected Object[] getComboFeatureValues() {
+ return getChoices(getEObject(), EcorePackage.eINSTANCE.getEDataType());
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractChooserPropertySection#getLabelProvider()
+ */
+ protected ILabelProvider getLabelProvider() {
+ return new AdapterFactoryLabelProvider(new EcoreItemProviderAdapterFactory());
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractChooserPropertySection#getFeatureValue()
+ */
+ protected Object getFeatureValue() {
+ return ExtendedMetaData.INSTANCE.getBaseType((EDataType) getEObject());
+ }
+
+ /**
+ * Handle the combo modified event.
+ */
+ protected void handleComboModified() {
+ if (!isRefreshing()) {
+ final Object newBaseType = getCSingleObjectChooser().getSelection();
+ EditingDomain editingDomain = getEditingDomain();
+ if (getEObjectList().size() == 1) {
+ EDataType oldBaseType = ExtendedMetaData.INSTANCE.getBaseType((EDataType) getEObject());
+ if (oldBaseType != newBaseType) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(getEObject().eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setBaseType((EDataType) getEObject(), (EDataType) newBaseType);
+ }
+ });
+ }
+ } else {
+ CompoundCommand compoundCommand = new CompoundCommand();
+ /* apply the property change to all selected elements */
+ for (final EObject nextObject : getEObjectList()) {
+ EDataType oldBaseType = ExtendedMetaData.INSTANCE.getBaseType((EDataType) nextObject);
+ if (oldBaseType != newBaseType) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(nextObject.eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setBaseType((EDataType) nextObject, (EDataType) newBaseType);
+ }
+ });
+ }
+ }
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/ContentKindSection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/ContentKindSection.java
new file mode 100644
index 0000000..3ff527e
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/ContentKindSection.java
@@ -0,0 +1,213 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.metadata;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.tabbedproperties.EMFRecordingChangeCommand;
+import org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+/**
+ * Section to edit content kind extended metadata annotation
+ *
+ * @see ExtendedMetaData#setContentKind(EClass, int)
+ * @author <a href="david.sciamma@anyware-tech.com">David Sciamma</a>
+ */
+public class ContentKindSection extends AbstractTabbedPropertySection {
+
+ /**
+ * A boolean that store if refreshing is happening and no model
+ * modifications should be performed
+ */
+ private boolean isRefreshing = false;
+
+ /**
+ * The combo box control for the section.
+ */
+ private CCombo contentKindCb;
+
+ /**
+ * The section label;
+ */
+ private CLabel labelTxt;
+
+ // /**
+ // * @see
+ // org.eclipse.ui.views.properties.tabbed.ISection#createControls(org.eclipse.swt.widgets.Composite,
+ // org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ // */
+ // public void createControls(Composite parent, TabbedPropertySheetPage
+ // aTabbedPropertySheetPage)
+ // {
+ // super.createControls(parent, aTabbedPropertySheetPage);
+ // Composite composite = getWidgetFactory().createFlatFormComposite(parent);
+ //
+ // String label = getLabelText();
+ // labelTxt = getWidgetFactory().createCLabel(composite, label);
+ //
+ // contentKindCb = getWidgetFactory().createCCombo(composite, SWT.FLAT |
+ // SWT.READ_ONLY | SWT.BORDER);
+ //
+ // FormData data = new FormData();
+ // data.left = new FormAttachment(0, 0);
+ // data.right = new FormAttachment(contentKindCb,
+ // -ITabbedPropertyConstants.HSPACE);
+ // data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ // labelTxt.setLayoutData(data);
+ //
+ // data = new FormData();
+ // data.left = new FormAttachment(0, getStandardLabelWidth(composite, new
+ // String[] {label}));
+ // data.right = new FormAttachment(100, 0);
+ // data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ // contentKindCb.setLayoutData(data);
+ //
+ // hookListeners();
+ // }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#createWidgets(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createWidgets(Composite composite) {
+ labelTxt = getWidgetFactory().createCLabel(composite, getLabelText());
+
+ contentKindCb = getWidgetFactory().createCCombo(composite, SWT.FLAT | SWT.READ_ONLY | SWT.BORDER);
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#setSectionData(org.eclipse.swt.widgets.Composite)
+ */
+ protected void setSectionData(Composite composite) {
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(contentKindCb, -ITabbedPropertyConstants.HSPACE);
+ data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ labelTxt.setLayoutData(data);
+
+ data = new FormData();
+ data.left = new FormAttachment(0, getStandardLabelWidth(composite, new String[] { getLabelText() }));
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ contentKindCb.setLayoutData(data);
+ }
+
+ /**
+ * Adds the listeners on the widgets
+ */
+ protected void hookListeners() {
+ contentKindCb.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ handleComboModified();
+ }
+ });
+ }
+
+ /**
+ * Handle the combo modified event.
+ */
+ protected void handleComboModified() {
+ if (!isRefreshing) {
+ final int newContentKind = getIndex(contentKindCb.getText());
+ EditingDomain editingDomain = getEditingDomain();
+ if (getEObjectList().size() == 1) {
+ int oldContentKind = ExtendedMetaData.INSTANCE.getContentKind((EClass) getEObject());
+ if (oldContentKind != newContentKind) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(getEObject().eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setContentKind((EClass) getEObject(), newContentKind);
+ }
+ });
+ }
+ } else {
+ CompoundCommand compoundCommand = new CompoundCommand();
+ /* apply the property change to all selected elements */
+ for (Iterator<EObject> i = getEObjectList().iterator(); i.hasNext();) {
+ final EObject nextObject = i.next();
+
+ int oldContentKind = ExtendedMetaData.INSTANCE.getContentKind((EClass) nextObject);
+ if (oldContentKind != newContentKind) {
+ compoundCommand.append(new EMFRecordingChangeCommand(nextObject.eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setContentKind((EClass) nextObject, newContentKind);
+ }
+ });
+ }
+ }
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#refresh()
+ */
+ public void refresh() {
+ isRefreshing = true;
+
+ contentKindCb.setItems(ExtendedMetaData.CONTENT_KINDS);
+ int contentKind = ExtendedMetaData.INSTANCE.getContentKind((EClass) getEObject());
+ contentKindCb.setText(ExtendedMetaData.CONTENT_KINDS[contentKind]);
+
+ isRefreshing = false;
+ }
+
+ /**
+ * Gets the respectif index of the key inside this array. It returns -1 when
+ * the key is not find inside the array
+ *
+ * @param key
+ * @return the key index
+ */
+ private int getIndex(String key) {
+ String[] contentKinds = ExtendedMetaData.CONTENT_KINDS;
+ for (int i = 0; i < contentKinds.length; i++) {
+ if (contentKinds[i].equals(key)) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Content Kind";
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/FeatureKindSection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/FeatureKindSection.java
new file mode 100644
index 0000000..f18eba2
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/FeatureKindSection.java
@@ -0,0 +1,213 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.metadata;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.tabbedproperties.EMFRecordingChangeCommand;
+import org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+/**
+ * Section to edit feature kind extended metadata annotation
+ *
+ * @see ExtendedMetaData#setFeatureKind(EStructuralFeature, int)
+ * @author <a href="david.sciamma@anyware-tech.com">David Sciamma</a>
+ */
+public class FeatureKindSection extends AbstractTabbedPropertySection {
+
+ /**
+ * A boolean that store if refreshing is happening and no model
+ * modifications should be performed
+ */
+ private boolean isRefreshing = false;
+
+ /**
+ * The combo box control for the section.
+ */
+ private CCombo featureKindCb;
+
+ /**
+ * The section label;
+ */
+ private CLabel labelTxt;
+
+ // /**
+ // * @see
+ // org.eclipse.ui.views.properties.tabbed.ISection#createControls(org.eclipse.swt.widgets.Composite,
+ // * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ // */
+ // public void createControls(Composite parent, TabbedPropertySheetPage
+ // aTabbedPropertySheetPage)
+ // {
+ // super.createControls(parent, aTabbedPropertySheetPage);
+ // Composite composite = getWidgetFactory().createFlatFormComposite(parent);
+ // FormData data;
+ //
+ // String label = getLabelText();
+ // CLabel labelTxt = getWidgetFactory().createCLabel(composite, label);
+ //
+ // featureKindCb = getWidgetFactory().createCCombo(composite, SWT.FLAT |
+ // SWT.READ_ONLY | SWT.BORDER);
+ //
+ // data = new FormData();
+ // data.left = new FormAttachment(0, 0);
+ // data.right = new FormAttachment(featureKindCb,
+ // -ITabbedPropertyConstants.HSPACE);
+ // data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ // labelTxt.setLayoutData(data);
+ //
+ // data = new FormData();
+ // data.left = new FormAttachment(0, getStandardLabelWidth(composite, new
+ // String[] {label}));
+ // data.right = new FormAttachment(100, 0);
+ // data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ // featureKindCb.setLayoutData(data);
+ //
+ // hookListeners();
+ // }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#createWidgets(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createWidgets(Composite composite) {
+ labelTxt = getWidgetFactory().createCLabel(composite, getLabelText());
+
+ featureKindCb = getWidgetFactory().createCCombo(composite, SWT.FLAT | SWT.READ_ONLY | SWT.BORDER);
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#setSectionData(org.eclipse.swt.widgets.Composite)
+ */
+ protected void setSectionData(Composite composite) {
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(featureKindCb, -ITabbedPropertyConstants.HSPACE);
+ data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ labelTxt.setLayoutData(data);
+
+ data = new FormData();
+ data.left = new FormAttachment(0, getStandardLabelWidth(composite, new String[] { getLabelText() }));
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ featureKindCb.setLayoutData(data);
+ }
+
+ /**
+ * Adds the listeners on the widgets
+ */
+ protected void hookListeners() {
+ featureKindCb.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ handleComboModified();
+ }
+ });
+ }
+
+ /**
+ * Handle the combo modified event.
+ */
+ protected void handleComboModified() {
+ if (!isRefreshing) {
+ final int newFeatureKind = getIndex(featureKindCb.getText());
+ EditingDomain editingDomain = getEditingDomain();
+ if (getEObjectList().size() == 1) {
+ int oldFeatureKind = ExtendedMetaData.INSTANCE.getFeatureKind((EStructuralFeature) getEObject());
+ if (oldFeatureKind != newFeatureKind) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(getEObject().eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setFeatureKind((EStructuralFeature) getEObject(), newFeatureKind);
+ }
+ });
+ }
+ } else {
+ CompoundCommand compoundCommand = new CompoundCommand();
+ /* apply the property change to all selected elements */
+ for (Iterator<EObject> i = getEObjectList().iterator(); i.hasNext();) {
+ final EObject nextObject = i.next();
+
+ int oldFeatureKind = ExtendedMetaData.INSTANCE.getFeatureKind((EStructuralFeature) nextObject);
+ if (oldFeatureKind != newFeatureKind) {
+ compoundCommand.append(new EMFRecordingChangeCommand(nextObject.eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setFeatureKind((EStructuralFeature) nextObject, newFeatureKind);
+ }
+ });
+ }
+ }
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#refresh()
+ */
+ public void refresh() {
+ isRefreshing = true;
+
+ featureKindCb.setItems(ExtendedMetaData.FEATURE_KINDS);
+ int featureKind = ExtendedMetaData.INSTANCE.getFeatureKind((EStructuralFeature) getEObject());
+ featureKindCb.setText(ExtendedMetaData.FEATURE_KINDS[featureKind]);
+
+ isRefreshing = false;
+ }
+
+ /**
+ * Gets the respectif index of the key inside this array. It returns -1 when
+ * the key is not find inside the array
+ *
+ * @param key
+ * @return the key index
+ */
+ private int getIndex(String key) {
+ String[] contentKinds = ExtendedMetaData.FEATURE_KINDS;
+ for (int i = 0; i < contentKinds.length; i++) {
+ if (contentKinds[i].equals(key)) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Feature Kind";
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/FractionDigitsSection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/FractionDigitsSection.java
new file mode 100644
index 0000000..4377a6b
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/FractionDigitsSection.java
@@ -0,0 +1,205 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.metadata;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.tabbedproperties.EMFRecordingChangeCommand;
+import org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection;
+import org.eclipse.emf.tabbedproperties.utils.TextChangeListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+/**
+ * Section to edit fractionDigits extended metadata annotation
+ *
+ * @see ExtendedMetaData#setFractionDigitsFacet(org.eclipse.emf.ecore.EDataType,
+ * int)
+ * @author <a href="david.sciamma@anyware-tech.com">David Sciamma</a>
+ */
+public class FractionDigitsSection extends AbstractTabbedPropertySection {
+
+ /**
+ * A boolean that store if refreshing is happening and no model
+ * modifications should be performed
+ */
+ private boolean isRefreshing = false;
+
+ /**
+ * The text for the section.
+ */
+ private Text fractionTxt;
+
+ /**
+ * The section label;
+ */
+ private CLabel labelTxt;
+
+ // /**
+ // * @see
+ // org.eclipse.ui.views.properties.tabbed.ISection#createControls(org.eclipse.swt.widgets.Composite,
+ // * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ // */
+ // public void createControls(Composite parent, TabbedPropertySheetPage
+ // aTabbedPropertySheetPage)
+ // {
+ // super.createControls(parent, aTabbedPropertySheetPage);
+ // Composite composite = getWidgetFactory().createFlatFormComposite(parent);
+ // FormData data;
+ //
+ // String label = getLabelText();
+ // CLabel labelTxt = getWidgetFactory().createCLabel(composite, label);
+ //
+ // fractionTxt = getWidgetFactory().createText(composite, "");
+ //
+ // data = new FormData();
+ // data.left = new FormAttachment(0, 0);
+ // data.right = new FormAttachment(fractionTxt,
+ // -ITabbedPropertyConstants.HSPACE);
+ // data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ // labelTxt.setLayoutData(data);
+ //
+ // data = new FormData();
+ // data.left = new FormAttachment(0, getStandardLabelWidth(composite, new
+ // String[] {label}));
+ // data.right = new FormAttachment(100, 0);
+ // data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ // fractionTxt.setLayoutData(data);
+ //
+ // hookListeners();
+ // }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#createWidgets(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createWidgets(Composite composite) {
+ labelTxt = getWidgetFactory().createCLabel(composite, getLabelText());
+
+ fractionTxt = getWidgetFactory().createText(composite, "");
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#setSectionData(org.eclipse.swt.widgets.Composite)
+ */
+ protected void setSectionData(Composite composite) {
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(fractionTxt, -ITabbedPropertyConstants.HSPACE);
+ data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ labelTxt.setLayoutData(data);
+
+ data = new FormData();
+ data.left = new FormAttachment(0, getStandardLabelWidth(composite, new String[] { getLabelText() }));
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ fractionTxt.setLayoutData(data);
+ }
+
+ /**
+ * Adds the listeners on the widgets
+ */
+ protected void hookListeners() {
+ TextChangeListener listener = new TextChangeListener() {
+
+ public void textChanged(Control control) {
+ handleTextModified();
+ }
+ };
+ listener.startListeningTo(fractionTxt);
+ listener.startListeningForEnter(fractionTxt);
+ }
+
+ /**
+ * Handle the text modified event.
+ */
+ protected void handleTextModified() {
+ if (!isRefreshing) {
+ try {
+ if (fractionTxt.getText() == null || fractionTxt.getText().length() == 0) {
+ fractionTxt.setText("-1");
+ }
+ final int newFraction = Integer.parseInt(fractionTxt.getText());
+
+ EditingDomain editingDomain = getEditingDomain();
+ if (getEObjectList().size() == 1) {
+ int oldFraction = ExtendedMetaData.INSTANCE.getFractionDigitsFacet((EDataType) getEObject());
+ if (oldFraction != newFraction) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(getEObject().eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setFractionDigitsFacet((EDataType) getEObject(), newFraction);
+ }
+ });
+ }
+ } else {
+ CompoundCommand compoundCommand = new CompoundCommand();
+ /* apply the property change to all selected elements */
+ for (Iterator<EObject> i = getEObjectList().iterator(); i.hasNext();) {
+ final EObject nextObject = i.next();
+
+ int oldFraction = ExtendedMetaData.INSTANCE.getFractionDigitsFacet((EDataType) nextObject);
+ if (oldFraction != newFraction) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(nextObject.eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setFractionDigitsFacet((EDataType) nextObject, newFraction);
+ }
+ });
+ }
+ }
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+ } catch (NumberFormatException e) {
+ refresh();
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#refresh()
+ */
+ public void refresh() {
+ isRefreshing = true;
+
+ fractionTxt.setText("" + ExtendedMetaData.INSTANCE.getFractionDigitsFacet((EDataType) getEObject()));
+
+ isRefreshing = false;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Fraction Digits";
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/GroupSection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/GroupSection.java
new file mode 100644
index 0000000..3728dc6
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/GroupSection.java
@@ -0,0 +1,105 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.metadata;
+
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.emf.tabbedproperties.EMFRecordingChangeCommand;
+import org.eclipse.emf.tabbedproperties.sections.AbstractChooserPropertySection;
+import org.eclipse.jface.viewers.ILabelProvider;
+
+/**
+ * Section to edit group extended metadata annotation
+ *
+ * @see ExtendedMetaData#setGroup(EStructuralFeature, EStructuralFeature)
+ * @author <a href="david.sciamma@anyware-tech.com">David Sciamma</a>
+ */
+public class GroupSection extends AbstractChooserPropertySection {
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Group";
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractChooserPropertySection#getComboFeatureValues()
+ */
+ protected Object[] getComboFeatureValues() {
+ return getChoices(getEObject(), EcorePackage.eINSTANCE.getEStructuralFeature());
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractChooserPropertySection#getLabelProvider()
+ */
+ protected ILabelProvider getLabelProvider() {
+ return new AdapterFactoryLabelProvider(new EcoreItemProviderAdapterFactory());
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractChooserPropertySection#getFeatureValue()
+ */
+ protected Object getFeatureValue() {
+ return ExtendedMetaData.INSTANCE.getGroup((EStructuralFeature) getEObject());
+ }
+
+ /**
+ * Handle the combo modified event.
+ */
+ protected void handleComboModified() {
+ if (!isRefreshing()) {
+ final Object newGroup = getCSingleObjectChooser().getSelection();
+ EditingDomain editingDomain = getEditingDomain();
+ if (getEObjectList().size() == 1) {
+ EStructuralFeature oldGroup = ExtendedMetaData.INSTANCE.getGroup((EStructuralFeature) getEObject());
+ if (oldGroup != newGroup) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(getEObject().eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setGroup((EStructuralFeature) getEObject(), (EStructuralFeature) newGroup);
+ }
+ });
+ }
+ } else {
+ CompoundCommand compoundCommand = new CompoundCommand();
+ /* apply the property change to all selected elements */
+ for (final EObject nextObject : getEObjectList()) {
+ EStructuralFeature oldGroup = ExtendedMetaData.INSTANCE.getGroup((EStructuralFeature) nextObject);
+ if (oldGroup != newGroup) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(nextObject.eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setGroup((EStructuralFeature) nextObject, (EStructuralFeature) newGroup);
+ }
+ });
+ }
+ }
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/ItemTypeSection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/ItemTypeSection.java
new file mode 100644
index 0000000..74d6316
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/ItemTypeSection.java
@@ -0,0 +1,106 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.metadata;
+
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.emf.tabbedproperties.EMFRecordingChangeCommand;
+import org.eclipse.emf.tabbedproperties.sections.AbstractChooserPropertySection;
+import org.eclipse.jface.viewers.ILabelProvider;
+
+/**
+ * Section to edit item type extended metadata annotation
+ *
+ * @see ExtendedMetaData#setItemType(EDataType, EDataType)
+ * @author <a href="david.sciamma@anyware-tech.com">David Sciamma</a>
+ */
+public class ItemTypeSection extends AbstractChooserPropertySection {
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Item Type";
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractChooserPropertySection#getComboFeatureValues()
+ */
+ protected Object[] getComboFeatureValues() {
+ return getChoices(getEObject(), EcorePackage.eINSTANCE.getEDataType());
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractChooserPropertySection#getLabelProvider()
+ */
+ protected ILabelProvider getLabelProvider() {
+ return new AdapterFactoryLabelProvider(new EcoreItemProviderAdapterFactory());
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractChooserPropertySection#getFeatureValue()
+ */
+ protected Object getFeatureValue() {
+ return ExtendedMetaData.INSTANCE.getItemType((EDataType) getEObject());
+ }
+
+ /**
+ * Handle the combo modified event.
+ */
+ protected void handleComboModified() {
+ if (!isRefreshing()) {
+ final Object newItemType = getCSingleObjectChooser().getSelection();
+ EditingDomain editingDomain = getEditingDomain();
+ if (getEObjectList().size() == 1) {
+ EDataType oldItemType = ExtendedMetaData.INSTANCE.getItemType((EDataType) getEObject());
+ if (oldItemType != newItemType) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(getEObject().eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setItemType((EDataType) getEObject(), (EDataType) newItemType);
+ }
+ });
+ }
+ } else {
+ CompoundCommand compoundCommand = new CompoundCommand();
+ /* apply the property change to all selected elements */
+ for (final EObject nextObject : getEObjectList()) {
+ EDataType oldItemType = ExtendedMetaData.INSTANCE.getItemType((EDataType) nextObject);
+ if (oldItemType != newItemType) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(nextObject.eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setItemType((EDataType) nextObject, (EDataType) newItemType);
+ }
+ });
+ }
+ }
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/LengthSection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/LengthSection.java
new file mode 100644
index 0000000..e286c09
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/LengthSection.java
@@ -0,0 +1,204 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.metadata;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.tabbedproperties.EMFRecordingChangeCommand;
+import org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection;
+import org.eclipse.emf.tabbedproperties.utils.TextChangeListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+/**
+ * Section to edit length extended metadata annotation
+ *
+ * @see ExtendedMetaData#setLengthFacet(EDataType, int)
+ * @author <a href="david.sciamma@anyware-tech.com">David Sciamma</a>
+ */
+public class LengthSection extends AbstractTabbedPropertySection {
+
+ /**
+ * A boolean that store if refreshing is happening and no model
+ * modifications should be performed
+ */
+ private boolean isRefreshing = false;
+
+ /**
+ * The text for the section.
+ */
+ private Text lengthTxt;
+
+ /**
+ * The section label;
+ */
+ private CLabel labelTxt;
+
+ // /**
+ // * @see
+ // org.eclipse.ui.views.properties.tabbed.ISection#createControls(org.eclipse.swt.widgets.Composite,
+ // * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ // */
+ // public void createControls(Composite parent, TabbedPropertySheetPage
+ // aTabbedPropertySheetPage)
+ // {
+ // super.createControls(parent, aTabbedPropertySheetPage);
+ // Composite composite = getWidgetFactory().createFlatFormComposite(parent);
+ // FormData data;
+ //
+ // String label = getLabelText();
+ // CLabel labelTxt = getWidgetFactory().createCLabel(composite, label);
+ //
+ // lengthTxt = getWidgetFactory().createText(composite, "");
+ //
+ // data = new FormData();
+ // data.left = new FormAttachment(0, 0);
+ // data.right = new FormAttachment(lengthTxt,
+ // -ITabbedPropertyConstants.HSPACE);
+ // data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ // labelTxt.setLayoutData(data);
+ //
+ // data = new FormData();
+ // data.left = new FormAttachment(0, getStandardLabelWidth(composite, new
+ // String[] {label}));
+ // data.right = new FormAttachment(100, 0);
+ // data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ // lengthTxt.setLayoutData(data);
+ //
+ // hookListeners();
+ // }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#createWidgets(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createWidgets(Composite composite) {
+ labelTxt = getWidgetFactory().createCLabel(composite, getLabelText());
+
+ lengthTxt = getWidgetFactory().createText(composite, "");
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#setSectionData(org.eclipse.swt.widgets.Composite)
+ */
+ protected void setSectionData(Composite composite) {
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(lengthTxt, -ITabbedPropertyConstants.HSPACE);
+ data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ labelTxt.setLayoutData(data);
+
+ data = new FormData();
+ data.left = new FormAttachment(0, getStandardLabelWidth(composite, new String[] { getLabelText() }));
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ lengthTxt.setLayoutData(data);
+ }
+
+ /**
+ * Adds the listeners on the widgets
+ */
+ protected void hookListeners() {
+ TextChangeListener listener = new TextChangeListener() {
+
+ public void textChanged(Control control) {
+ handleTextModified();
+ }
+ };
+ listener.startListeningTo(lengthTxt);
+ listener.startListeningForEnter(lengthTxt);
+ }
+
+ /**
+ * Handle the text modified event.
+ */
+ protected void handleTextModified() {
+ if (!isRefreshing) {
+ try {
+ if (lengthTxt.getText() == null || lengthTxt.getText().length() == 0) {
+ lengthTxt.setText("-1");
+ }
+ final int newLength = Integer.parseInt(lengthTxt.getText());
+
+ EditingDomain editingDomain = getEditingDomain();
+ if (getEObjectList().size() == 1) {
+ int oldLength = ExtendedMetaData.INSTANCE.getLengthFacet((EDataType) getEObject());
+ if (oldLength != newLength) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(getEObject().eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setLengthFacet((EDataType) getEObject(), newLength);
+ }
+ });
+ }
+ } else {
+ CompoundCommand compoundCommand = new CompoundCommand();
+ /* apply the property change to all selected elements */
+ for (Iterator<EObject> i = getEObjectList().iterator(); i.hasNext();) {
+ final EObject nextObject = i.next();
+
+ int oldLength = ExtendedMetaData.INSTANCE.getLengthFacet((EDataType) nextObject);
+ if (oldLength != newLength) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(nextObject.eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setLengthFacet((EDataType) nextObject, newLength);
+ }
+ });
+ }
+ }
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+ } catch (NumberFormatException e) {
+ refresh();
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#refresh()
+ */
+ public void refresh() {
+ isRefreshing = true;
+
+ lengthTxt.setText("" + ExtendedMetaData.INSTANCE.getLengthFacet((EDataType) getEObject()));
+
+ isRefreshing = false;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Length";
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/MaxExclusiveSection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/MaxExclusiveSection.java
new file mode 100644
index 0000000..18f4b32
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/MaxExclusiveSection.java
@@ -0,0 +1,208 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.metadata;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.tabbedproperties.EMFRecordingChangeCommand;
+import org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection;
+import org.eclipse.emf.tabbedproperties.utils.TextChangeListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+/**
+ * Section to edit max exclusive extended metadata annotation
+ *
+ * @see ExtendedMetaData#setMaxExclusiveFacet(EDataType, String)
+ * @author <a href="david.sciamma@anyware-tech.com">David Sciamma</a>
+ */
+public class MaxExclusiveSection extends AbstractTabbedPropertySection {
+
+ /**
+ * A boolean that store if refreshing is happening and no model
+ * modifications should be performed
+ */
+ private boolean isRefreshing = false;
+
+ /**
+ * The text for the section.
+ */
+ private Text constraintTxt;
+
+ /**
+ * The section label;
+ */
+ private CLabel labelTxt;
+
+ // /**
+ // * @see
+ // org.eclipse.ui.views.properties.tabbed.ISection#createControls(org.eclipse.swt.widgets.Composite,
+ // org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ // */
+ // public void createControls(Composite parent, TabbedPropertySheetPage
+ // aTabbedPropertySheetPage)
+ // {
+ // super.createControls(parent, aTabbedPropertySheetPage);
+ // Composite composite = getWidgetFactory().createFlatFormComposite(parent);
+ // FormData data;
+ //
+ // String label = getLabelText();
+ // CLabel labelTxt = getWidgetFactory().createCLabel(composite, label);
+ //
+ // constraintTxt = getWidgetFactory().createText(composite, "");
+ //
+ // data = new FormData();
+ // data.left = new FormAttachment(0, 0);
+ // data.right = new FormAttachment(constraintTxt,
+ // -ITabbedPropertyConstants.HSPACE);
+ // data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ // labelTxt.setLayoutData(data);
+ //
+ // data = new FormData();
+ // data.left = new FormAttachment(0, getStandardLabelWidth(composite, new
+ // String[] {label}));
+ // data.right = new FormAttachment(100, 0);
+ // data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ // constraintTxt.setLayoutData(data);
+ //
+ // hookListeners();
+ // }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#createWidgets(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createWidgets(Composite composite) {
+ labelTxt = getWidgetFactory().createCLabel(composite, getLabelText());
+
+ constraintTxt = getWidgetFactory().createText(composite, "");
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#setSectionData(org.eclipse.swt.widgets.Composite)
+ */
+ protected void setSectionData(Composite composite) {
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(constraintTxt, -ITabbedPropertyConstants.HSPACE);
+ data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ labelTxt.setLayoutData(data);
+
+ data = new FormData();
+ data.left = new FormAttachment(0, getStandardLabelWidth(composite, new String[] { getLabelText() }));
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ constraintTxt.setLayoutData(data);
+ }
+
+ /**
+ * Adds the listeners on the widgets
+ */
+ protected void hookListeners() {
+ TextChangeListener listener = new TextChangeListener() {
+
+ public void textChanged(Control control) {
+ handleTextModified();
+ }
+ };
+ listener.startListeningTo(constraintTxt);
+ listener.startListeningForEnter(constraintTxt);
+ }
+
+ /**
+ * Handle the text modified event.
+ */
+ protected void handleTextModified() {
+ if (!isRefreshing) {
+ final String newConstraint = getText();
+ EditingDomain editingDomain = getEditingDomain();
+ if (getEObjectList().size() == 1) {
+ String oldConstraint = ExtendedMetaData.INSTANCE.getMaxExclusiveFacet((EDataType) getEObject());
+ if ((oldConstraint != null && !oldConstraint.equals(newConstraint)) || (oldConstraint == null && newConstraint != null)) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(getEObject().eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setMaxExclusiveFacet((EDataType) getEObject(), newConstraint);
+ }
+ });
+ }
+ } else {
+ CompoundCommand compoundCommand = new CompoundCommand();
+ /* apply the property change to all selected elements */
+ for (Iterator<EObject> i = getEObjectList().iterator(); i.hasNext();) {
+ final EObject nextObject = i.next();
+
+ String oldConstraint = ExtendedMetaData.INSTANCE.getMaxExclusiveFacet((EDataType) nextObject);
+ if ((oldConstraint != null && !oldConstraint.equals(newConstraint)) || (oldConstraint == null && newConstraint != null)) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(nextObject.eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setMaxExclusiveFacet((EDataType) nextObject, newConstraint);
+ }
+ });
+ }
+ }
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+ }
+ }
+
+ private String getText() {
+ if (constraintTxt.getText() != null && !"".equals(constraintTxt.getText())) {
+ return constraintTxt.getText();
+ }
+
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#refresh()
+ */
+ public void refresh() {
+ isRefreshing = true;
+
+ String text = ExtendedMetaData.INSTANCE.getMaxExclusiveFacet((EDataType) getEObject());
+ if (text == null) {
+ text = "";
+ }
+ constraintTxt.setText(text);
+
+ isRefreshing = false;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Maximum (exclusive) constraint";
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/MaxInclusiveSection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/MaxInclusiveSection.java
new file mode 100644
index 0000000..ebf3596
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/MaxInclusiveSection.java
@@ -0,0 +1,208 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.metadata;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.tabbedproperties.EMFRecordingChangeCommand;
+import org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection;
+import org.eclipse.emf.tabbedproperties.utils.TextChangeListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+/**
+ * Section to edit max inclusive extended metadata annotation
+ *
+ * @see ExtendedMetaData#setMaxInclusiveFacet(EDataType, String)
+ * @author <a href="david.sciamma@anyware-tech.com">David Sciamma</a>
+ */
+public class MaxInclusiveSection extends AbstractTabbedPropertySection {
+
+ /**
+ * A boolean that store if refreshing is happening and no model
+ * modifications should be performed
+ */
+ private boolean isRefreshing = false;
+
+ /**
+ * The text for the section.
+ */
+ private Text constraintTxt;
+
+ /**
+ * The section label;
+ */
+ private CLabel labelTxt;
+
+ // /**
+ // * @see
+ // org.eclipse.ui.views.properties.tabbed.ISection#createControls(org.eclipse.swt.widgets.Composite,
+ // org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ // */
+ // public void createControls(Composite parent, TabbedPropertySheetPage
+ // aTabbedPropertySheetPage)
+ // {
+ // super.createControls(parent, aTabbedPropertySheetPage);
+ // Composite composite = getWidgetFactory().createFlatFormComposite(parent);
+ // FormData data;
+ //
+ // String label = getLabelText();
+ // CLabel labelTxt = getWidgetFactory().createCLabel(composite, label);
+ //
+ // constraintTxt = getWidgetFactory().createText(composite, "");
+ //
+ // data = new FormData();
+ // data.left = new FormAttachment(0, 0);
+ // data.right = new FormAttachment(constraintTxt,
+ // -ITabbedPropertyConstants.HSPACE);
+ // data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ // labelTxt.setLayoutData(data);
+ //
+ // data = new FormData();
+ // data.left = new FormAttachment(0, getStandardLabelWidth(composite, new
+ // String[] {label}));
+ // data.right = new FormAttachment(100, 0);
+ // data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ // constraintTxt.setLayoutData(data);
+ //
+ // hookListeners();
+ // }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#createWidgets(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createWidgets(Composite composite) {
+ labelTxt = getWidgetFactory().createCLabel(composite, getLabelText());
+
+ constraintTxt = getWidgetFactory().createText(composite, "");
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#setSectionData(org.eclipse.swt.widgets.Composite)
+ */
+ protected void setSectionData(Composite composite) {
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(constraintTxt, -ITabbedPropertyConstants.HSPACE);
+ data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ labelTxt.setLayoutData(data);
+
+ data = new FormData();
+ data.left = new FormAttachment(0, getStandardLabelWidth(composite, new String[] { getLabelText() }));
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ constraintTxt.setLayoutData(data);
+ }
+
+ /**
+ * Adds the listeners on the widgets
+ */
+ protected void hookListeners() {
+ TextChangeListener listener = new TextChangeListener() {
+
+ public void textChanged(Control control) {
+ handleTextModified();
+ }
+ };
+ listener.startListeningTo(constraintTxt);
+ listener.startListeningForEnter(constraintTxt);
+ }
+
+ /**
+ * Handle the text modified event.
+ */
+ protected void handleTextModified() {
+ if (!isRefreshing) {
+ final String newConstraint = getText();
+ EditingDomain editingDomain = getEditingDomain();
+ if (getEObjectList().size() == 1) {
+ String oldConstraint = ExtendedMetaData.INSTANCE.getMaxInclusiveFacet((EDataType) getEObject());
+ if ((oldConstraint != null && !oldConstraint.equals(newConstraint)) || (oldConstraint == null && newConstraint != null)) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(getEObject().eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setMaxInclusiveFacet((EDataType) getEObject(), newConstraint);
+ }
+ });
+ }
+ } else {
+ CompoundCommand compoundCommand = new CompoundCommand();
+ /* apply the property change to all selected elements */
+ for (Iterator<EObject> i = getEObjectList().iterator(); i.hasNext();) {
+ final EObject nextObject = i.next();
+
+ String oldConstraint = ExtendedMetaData.INSTANCE.getMaxInclusiveFacet((EDataType) nextObject);
+ if ((oldConstraint != null && !oldConstraint.equals(newConstraint)) || (oldConstraint == null && newConstraint != null)) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(nextObject.eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setMaxInclusiveFacet((EDataType) nextObject, newConstraint);
+ }
+ });
+ }
+ }
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+ }
+ }
+
+ private String getText() {
+ if (constraintTxt.getText() != null && !"".equals(constraintTxt.getText())) {
+ return constraintTxt.getText();
+ }
+
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#refresh()
+ */
+ public void refresh() {
+ isRefreshing = true;
+
+ String text = ExtendedMetaData.INSTANCE.getMaxInclusiveFacet((EDataType) getEObject());
+ if (text == null) {
+ text = "";
+ }
+ constraintTxt.setText(text);
+
+ isRefreshing = false;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Maximum (inclusive) constraint";
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/MaxLengthSection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/MaxLengthSection.java
new file mode 100644
index 0000000..ae504c0
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/MaxLengthSection.java
@@ -0,0 +1,170 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.metadata;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.tabbedproperties.EMFRecordingChangeCommand;
+import org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection;
+import org.eclipse.emf.tabbedproperties.utils.TextChangeListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+/**
+ * Section to edit max length extended metadata annotation
+ *
+ * @see ExtendedMetaData#setMaxLengthFacet(EDataType, int)
+ * @author <a href="david.sciamma@anyware-tech.com">David Sciamma</a>
+ */
+public class MaxLengthSection extends AbstractTabbedPropertySection {
+
+ /**
+ * A boolean that store if refreshing is happening and no model
+ * modifications should be performed
+ */
+ private boolean isRefreshing = false;
+
+ /**
+ * The text for the section.
+ */
+ private Text lengthTxt;
+
+ /**
+ * The section label;
+ */
+ private CLabel labelTxt;
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#createWidgets(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createWidgets(Composite composite) {
+ labelTxt = getWidgetFactory().createCLabel(composite, getLabelText());
+
+ lengthTxt = getWidgetFactory().createText(composite, "");
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#setSectionData(org.eclipse.swt.widgets.Composite)
+ */
+ protected void setSectionData(Composite composite) {
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(lengthTxt, -ITabbedPropertyConstants.HSPACE);
+ data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ labelTxt.setLayoutData(data);
+
+ data = new FormData();
+ data.left = new FormAttachment(0, getStandardLabelWidth(composite, new String[] { getLabelText() }));
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ lengthTxt.setLayoutData(data);
+ }
+
+ /**
+ * Adds the listeners on the widgets
+ */
+ protected void hookListeners() {
+ TextChangeListener listener = new TextChangeListener() {
+
+ public void textChanged(Control control) {
+ handleTextModified();
+ }
+ };
+ listener.startListeningTo(lengthTxt);
+ listener.startListeningForEnter(lengthTxt);
+ }
+
+ /**
+ * Handle the text modified event.
+ */
+ protected void handleTextModified() {
+ if (!isRefreshing) {
+ try {
+ if (lengthTxt.getText() == null || lengthTxt.getText().length() == 0) {
+ lengthTxt.setText("-1");
+ }
+ final int newLength = Integer.parseInt(lengthTxt.getText());
+
+ EditingDomain editingDomain = getEditingDomain();
+ if (getEObjectList().size() == 1) {
+ int oldLength = ExtendedMetaData.INSTANCE.getMaxLengthFacet((EDataType) getEObject());
+ if (oldLength != newLength) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(getEObject().eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setMaxLengthFacet((EDataType) getEObject(), newLength);
+ }
+ });
+ }
+ } else {
+ CompoundCommand compoundCommand = new CompoundCommand();
+ /* apply the property change to all selected elements */
+ for (Iterator<EObject> i = getEObjectList().iterator(); i.hasNext();) {
+ final EObject nextObject = i.next();
+
+ int oldLength = ExtendedMetaData.INSTANCE.getMaxLengthFacet((EDataType) nextObject);
+ if (oldLength != newLength) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(nextObject.eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setMaxLengthFacet((EDataType) nextObject, newLength);
+ }
+ });
+ }
+ }
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+ } catch (NumberFormatException e) {
+ refresh();
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#refresh()
+ */
+ public void refresh() {
+ isRefreshing = true;
+
+ lengthTxt.setText("" + ExtendedMetaData.INSTANCE.getMaxLengthFacet((EDataType) getEObject()));
+
+ isRefreshing = false;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Maximum Length";
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/MinExclusiveSection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/MinExclusiveSection.java
new file mode 100644
index 0000000..70c0169
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/MinExclusiveSection.java
@@ -0,0 +1,208 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.metadata;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.tabbedproperties.EMFRecordingChangeCommand;
+import org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection;
+import org.eclipse.emf.tabbedproperties.utils.TextChangeListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+/**
+ * Section to edit min exclusive extended metadata annotation
+ *
+ * @see ExtendedMetaData#setMinExclusiveFacet(EDataType, String)
+ * @author <a href="david.sciamma@anyware-tech.com">David Sciamma</a>
+ */
+public class MinExclusiveSection extends AbstractTabbedPropertySection {
+
+ /**
+ * A boolean that store if refreshing is happening and no model
+ * modifications should be performed
+ */
+ private boolean isRefreshing = false;
+
+ /**
+ * The text for the section.
+ */
+ private Text constraintTxt;
+
+ /**
+ * The section label;
+ */
+ private CLabel labelTxt;
+
+ // /**
+ // * @see
+ // org.eclipse.ui.views.properties.tabbed.ISection#createControls(org.eclipse.swt.widgets.Composite,
+ // org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ // */
+ // public void createControls(Composite parent, TabbedPropertySheetPage
+ // aTabbedPropertySheetPage)
+ // {
+ // super.createControls(parent, aTabbedPropertySheetPage);
+ // Composite composite = getWidgetFactory().createFlatFormComposite(parent);
+ // FormData data;
+ //
+ // String label = getLabelText();
+ // CLabel labelTxt = getWidgetFactory().createCLabel(composite, label);
+ //
+ // constraintTxt = getWidgetFactory().createText(composite, "");
+ //
+ // data = new FormData();
+ // data.left = new FormAttachment(0, 0);
+ // data.right = new FormAttachment(constraintTxt,
+ // -ITabbedPropertyConstants.HSPACE);
+ // data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ // labelTxt.setLayoutData(data);
+ //
+ // data = new FormData();
+ // data.left = new FormAttachment(0, getStandardLabelWidth(composite, new
+ // String[] {label}));
+ // data.right = new FormAttachment(100, 0);
+ // data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ // constraintTxt.setLayoutData(data);
+ //
+ // hookListeners();
+ // }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#createWidgets(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createWidgets(Composite composite) {
+ labelTxt = getWidgetFactory().createCLabel(composite, getLabelText());
+
+ constraintTxt = getWidgetFactory().createText(composite, "");
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#setSectionData(org.eclipse.swt.widgets.Composite)
+ */
+ protected void setSectionData(Composite composite) {
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(constraintTxt, -ITabbedPropertyConstants.HSPACE);
+ data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ labelTxt.setLayoutData(data);
+
+ data = new FormData();
+ data.left = new FormAttachment(0, getStandardLabelWidth(composite, new String[] { getLabelText() }));
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ constraintTxt.setLayoutData(data);
+ }
+
+ /**
+ * Adds the listeners on the widgets
+ */
+ protected void hookListeners() {
+ TextChangeListener listener = new TextChangeListener() {
+
+ public void textChanged(Control control) {
+ handleTextModified();
+ }
+ };
+ listener.startListeningTo(constraintTxt);
+ listener.startListeningForEnter(constraintTxt);
+ }
+
+ /**
+ * Handle the text modified event.
+ */
+ protected void handleTextModified() {
+ if (!isRefreshing) {
+ final String newConstraint = getText();
+ EditingDomain editingDomain = getEditingDomain();
+ if (getEObjectList().size() == 1) {
+ String oldConstraint = ExtendedMetaData.INSTANCE.getMinExclusiveFacet((EDataType) getEObject());
+ if ((oldConstraint != null && !oldConstraint.equals(newConstraint)) || (oldConstraint == null && newConstraint != null)) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(getEObject().eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setMinExclusiveFacet((EDataType) getEObject(), newConstraint);
+ }
+ });
+ }
+ } else {
+ CompoundCommand compoundCommand = new CompoundCommand();
+ /* apply the property change to all selected elements */
+ for (Iterator<EObject> i = getEObjectList().iterator(); i.hasNext();) {
+ final EObject nextObject = i.next();
+
+ String oldConstraint = ExtendedMetaData.INSTANCE.getMinExclusiveFacet((EDataType) nextObject);
+ if ((oldConstraint != null && !oldConstraint.equals(newConstraint)) || (oldConstraint == null && newConstraint != null)) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(nextObject.eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setMinExclusiveFacet((EDataType) nextObject, newConstraint);
+ }
+ });
+ }
+ }
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+ }
+ }
+
+ private String getText() {
+ if (constraintTxt.getText() != null && !"".equals(constraintTxt.getText())) {
+ return constraintTxt.getText();
+ }
+
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#refresh()
+ */
+ public void refresh() {
+ isRefreshing = true;
+
+ String text = ExtendedMetaData.INSTANCE.getMinExclusiveFacet((EDataType) getEObject());
+ if (text == null) {
+ text = "";
+ }
+ constraintTxt.setText(text);
+
+ isRefreshing = false;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Minimum(exclusive) constraint";
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/MinInclusiveSection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/MinInclusiveSection.java
new file mode 100644
index 0000000..cdf8156
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/MinInclusiveSection.java
@@ -0,0 +1,208 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.metadata;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.tabbedproperties.EMFRecordingChangeCommand;
+import org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection;
+import org.eclipse.emf.tabbedproperties.utils.TextChangeListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+/**
+ * Section to edit min inclusive extended metadata annotation
+ *
+ * @see ExtendedMetaData#setMinInclusiveFacet(EDataType, String)
+ * @author <a href="david.sciamma@anyware-tech.com">David Sciamma</a>
+ */
+public class MinInclusiveSection extends AbstractTabbedPropertySection {
+
+ /**
+ * A boolean that store if refreshing is happening and no model
+ * modifications should be performed
+ */
+ private boolean isRefreshing = false;
+
+ /**
+ * The text for the section.
+ */
+ private Text constraintTxt;
+
+ /**
+ * The section label;
+ */
+ private CLabel labelTxt;
+
+ // /**
+ // * @see
+ // org.eclipse.ui.views.properties.tabbed.ISection#createControls(org.eclipse.swt.widgets.Composite,
+ // org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ // */
+ // public void createControls(Composite parent, TabbedPropertySheetPage
+ // aTabbedPropertySheetPage)
+ // {
+ // super.createControls(parent, aTabbedPropertySheetPage);
+ // Composite composite = getWidgetFactory().createFlatFormComposite(parent);
+ // FormData data;
+ //
+ // String label = getLabelText();
+ // CLabel labelTxt = getWidgetFactory().createCLabel(composite, label);
+ //
+ // constraintTxt = getWidgetFactory().createText(composite, "");
+ //
+ // data = new FormData();
+ // data.left = new FormAttachment(0, 0);
+ // data.right = new FormAttachment(constraintTxt,
+ // -ITabbedPropertyConstants.HSPACE);
+ // data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ // labelTxt.setLayoutData(data);
+ //
+ // data = new FormData();
+ // data.left = new FormAttachment(0, getStandardLabelWidth(composite, new
+ // String[] {label}));
+ // data.right = new FormAttachment(100, 0);
+ // data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ // constraintTxt.setLayoutData(data);
+ //
+ // hookListeners();
+ // }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#createWidgets(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createWidgets(Composite composite) {
+ labelTxt = getWidgetFactory().createCLabel(composite, getLabelText());
+
+ constraintTxt = getWidgetFactory().createText(composite, "");
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#setSectionData(org.eclipse.swt.widgets.Composite)
+ */
+ protected void setSectionData(Composite composite) {
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(constraintTxt, -ITabbedPropertyConstants.HSPACE);
+ data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ labelTxt.setLayoutData(data);
+
+ data = new FormData();
+ data.left = new FormAttachment(0, getStandardLabelWidth(composite, new String[] { getLabelText() }));
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ constraintTxt.setLayoutData(data);
+ }
+
+ /**
+ * Adds the listeners on the widgets
+ */
+ protected void hookListeners() {
+ TextChangeListener listener = new TextChangeListener() {
+
+ public void textChanged(Control control) {
+ handleTextModified();
+ }
+ };
+ listener.startListeningTo(constraintTxt);
+ listener.startListeningForEnter(constraintTxt);
+ }
+
+ /**
+ * Handle the text modified event.
+ */
+ protected void handleTextModified() {
+ if (!isRefreshing) {
+ final String newConstraint = getText();
+ EditingDomain editingDomain = getEditingDomain();
+ if (getEObjectList().size() == 1) {
+ String oldConstraint = ExtendedMetaData.INSTANCE.getMinInclusiveFacet((EDataType) getEObject());
+ if ((oldConstraint != null && !oldConstraint.equals(newConstraint)) || (oldConstraint == null && newConstraint != null)) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(getEObject().eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setMinInclusiveFacet((EDataType) getEObject(), newConstraint);
+ }
+ });
+ }
+ } else {
+ CompoundCommand compoundCommand = new CompoundCommand();
+ /* apply the property change to all selected elements */
+ for (Iterator<EObject> i = getEObjectList().iterator(); i.hasNext();) {
+ final EObject nextObject = i.next();
+
+ String oldConstraint = ExtendedMetaData.INSTANCE.getMinInclusiveFacet((EDataType) nextObject);
+ if ((oldConstraint != null && !oldConstraint.equals(newConstraint)) || (oldConstraint == null && newConstraint != null)) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(nextObject.eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setMinInclusiveFacet((EDataType) nextObject, newConstraint);
+ }
+ });
+ }
+ }
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+ }
+ }
+
+ private String getText() {
+ if (constraintTxt.getText() != null && !"".equals(constraintTxt.getText())) {
+ return constraintTxt.getText();
+ }
+
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#refresh()
+ */
+ public void refresh() {
+ isRefreshing = true;
+
+ String text = ExtendedMetaData.INSTANCE.getMinInclusiveFacet((EDataType) getEObject());
+ if (text == null) {
+ text = "";
+ }
+ constraintTxt.setText(text);
+
+ isRefreshing = false;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Minimum (inclusive) constraint";
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/MinLengthSection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/MinLengthSection.java
new file mode 100644
index 0000000..a16833b
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/MinLengthSection.java
@@ -0,0 +1,170 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.metadata;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.tabbedproperties.EMFRecordingChangeCommand;
+import org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection;
+import org.eclipse.emf.tabbedproperties.utils.TextChangeListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+/**
+ * Section to edit min length extended metadata annotation
+ *
+ * @see ExtendedMetaData#setMinLengthFacet(EDataType, int)
+ * @author <a href="david.sciamma@anyware-tech.com">David Sciamma</a>
+ */
+public class MinLengthSection extends AbstractTabbedPropertySection {
+
+ /**
+ * A boolean that store if refreshing is happening and no model
+ * modifications should be performed
+ */
+ private boolean isRefreshing = false;
+
+ /**
+ * The text for the section.
+ */
+ private Text lengthTxt;
+
+ /**
+ * The section label;
+ */
+ private CLabel labelTxt;
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#createWidgets(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createWidgets(Composite composite) {
+ labelTxt = getWidgetFactory().createCLabel(composite, getLabelText());
+
+ lengthTxt = getWidgetFactory().createText(composite, "");
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#setSectionData(org.eclipse.swt.widgets.Composite)
+ */
+ protected void setSectionData(Composite composite) {
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(lengthTxt, -ITabbedPropertyConstants.HSPACE);
+ data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ labelTxt.setLayoutData(data);
+
+ data = new FormData();
+ data.left = new FormAttachment(0, getStandardLabelWidth(composite, new String[] { getLabelText() }));
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ lengthTxt.setLayoutData(data);
+ }
+
+ /**
+ * Adds the listeners on the widgets
+ */
+ protected void hookListeners() {
+ TextChangeListener listener = new TextChangeListener() {
+
+ public void textChanged(Control control) {
+ handleTextModified();
+ }
+ };
+ listener.startListeningTo(lengthTxt);
+ listener.startListeningForEnter(lengthTxt);
+ }
+
+ /**
+ * Handle the text modified event.
+ */
+ protected void handleTextModified() {
+ if (!isRefreshing) {
+ try {
+ if (lengthTxt.getText() == null || lengthTxt.getText().length() == 0) {
+ lengthTxt.setText("-1");
+ }
+ final int newLength = Integer.parseInt(lengthTxt.getText());
+
+ EditingDomain editingDomain = getEditingDomain();
+ if (getEObjectList().size() == 1) {
+ int oldLength = ExtendedMetaData.INSTANCE.getMinLengthFacet((EDataType) getEObject());
+ if (oldLength != newLength) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(getEObject().eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setMinLengthFacet((EDataType) getEObject(), newLength);
+ }
+ });
+ }
+ } else {
+ CompoundCommand compoundCommand = new CompoundCommand();
+ /* apply the property change to all selected elements */
+ for (Iterator<EObject> i = getEObjectList().iterator(); i.hasNext();) {
+ final EObject nextObject = i.next();
+
+ int oldLength = ExtendedMetaData.INSTANCE.getMinLengthFacet((EDataType) nextObject);
+ if (oldLength != newLength) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(nextObject.eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setMinLengthFacet((EDataType) nextObject, newLength);
+ }
+ });
+ }
+ }
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+ } catch (NumberFormatException e) {
+ refresh();
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#refresh()
+ */
+ public void refresh() {
+ isRefreshing = true;
+
+ lengthTxt.setText("" + ExtendedMetaData.INSTANCE.getMinLengthFacet((EDataType) getEObject()));
+
+ isRefreshing = false;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Minimum Length";
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/NameSection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/NameSection.java
new file mode 100644
index 0000000..4e5592f
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/NameSection.java
@@ -0,0 +1,224 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.metadata;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.tabbedproperties.EMFRecordingChangeCommand;
+import org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection;
+import org.eclipse.emf.tabbedproperties.utils.TextChangeListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+/**
+ * Section to edit name extended metadata annotation
+ *
+ * @see ExtendedMetaData#setName(EStructuralFeature, String)
+ * @see ExtendedMetaData#setName(EClassifier, String)
+ * @author <a href="david.sciamma@anyware-tech.com">David Sciamma</a>
+ */
+public class NameSection extends AbstractTabbedPropertySection {
+
+ /**
+ * A boolean that store if refreshing is happening and no model
+ * modifications should be performed
+ */
+ private boolean isRefreshing = false;
+
+ /**
+ * The text for the section.
+ */
+ private Text nameTxt;
+
+ /**
+ * The section label;
+ */
+ private CLabel labelTxt;
+
+ // /**
+ // * @see
+ // org.eclipse.ui.views.properties.tabbed.ISection#createControls(org.eclipse.swt.widgets.Composite,
+ // * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ // */
+ // public void createControls(Composite parent, TabbedPropertySheetPage
+ // aTabbedPropertySheetPage)
+ // {
+ // super.createControls(parent, aTabbedPropertySheetPage);
+ // Composite composite = getWidgetFactory().createFlatFormComposite(parent);
+ // FormData data;
+ //
+ // String label = getLabelText();
+ // CLabel labelTxt = getWidgetFactory().createCLabel(composite, label);
+ //
+ // nameTxt = getWidgetFactory().createText(composite, "");
+ //
+ // data = new FormData();
+ // data.left = new FormAttachment(0, 0);
+ // data.right = new FormAttachment(nameTxt,
+ // -ITabbedPropertyConstants.HSPACE);
+ // data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ // labelTxt.setLayoutData(data);
+ //
+ // data = new FormData();
+ // data.left = new FormAttachment(0, getStandardLabelWidth(composite, new
+ // String[] {label}));
+ // data.right = new FormAttachment(100, 0);
+ // data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ // nameTxt.setLayoutData(data);
+ //
+ // hookListeners();
+ // }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#createWidgets(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createWidgets(Composite composite) {
+ labelTxt = getWidgetFactory().createCLabel(composite, getLabelText());
+
+ nameTxt = getWidgetFactory().createText(composite, "");
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#setSectionData(org.eclipse.swt.widgets.Composite)
+ */
+ protected void setSectionData(Composite composite) {
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(nameTxt, -ITabbedPropertyConstants.HSPACE);
+ data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ labelTxt.setLayoutData(data);
+
+ data = new FormData();
+ data.left = new FormAttachment(0, getStandardLabelWidth(composite, new String[] { getLabelText() }));
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ nameTxt.setLayoutData(data);
+ }
+
+ /**
+ * Adds the listeners on the widgets
+ */
+ protected void hookListeners() {
+ TextChangeListener listener = new TextChangeListener() {
+
+ public void textChanged(Control control) {
+ handleTextModified();
+ }
+ };
+ listener.startListeningTo(nameTxt);
+ listener.startListeningForEnter(nameTxt);
+ }
+
+ /**
+ * Handle the text modified event.
+ */
+ protected void handleTextModified() {
+ if (!isRefreshing) {
+ final String newName = nameTxt.getText();
+ EditingDomain editingDomain = getEditingDomain();
+ if (getEObjectList().size() == 1) {
+ String oldName = getName(getEObject());
+ if (oldName != null && !oldName.equals(newName)) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(getEObject().eResource()) {
+
+ protected void doExecute() {
+ if (getEObject() instanceof EStructuralFeature) {
+ ExtendedMetaData.INSTANCE.setName((EStructuralFeature) getEObject(), newName);
+ }
+ if (getEObject() instanceof EClassifier) {
+ ExtendedMetaData.INSTANCE.setName((EClassifier) getEObject(), newName);
+ }
+ }
+ });
+ }
+ } else {
+ CompoundCommand compoundCommand = new CompoundCommand();
+ /* apply the property change to all selected elements */
+ for (Iterator<EObject> i = getEObjectList().iterator(); i.hasNext();) {
+ final EObject nextObject = i.next();
+
+ String oldName = getName(nextObject);
+ if (oldName != null && !oldName.equals(newName)) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(nextObject.eResource()) {
+
+ protected void doExecute() {
+ if (nextObject instanceof EStructuralFeature) {
+ ExtendedMetaData.INSTANCE.setName((EStructuralFeature) nextObject, newName);
+ }
+ if (nextObject instanceof EClassifier) {
+ ExtendedMetaData.INSTANCE.setName((EClassifier) nextObject, newName);
+ }
+ }
+ });
+ }
+ }
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+ }
+ }
+
+ /**
+ * Get the name of the model object depending on its type
+ *
+ * @param model
+ * The model object
+ * @return String
+ */
+ private String getName(EObject model) {
+ if (model instanceof EStructuralFeature) {
+ return ExtendedMetaData.INSTANCE.getName((EStructuralFeature) model);
+ }
+ if (model instanceof EClassifier) {
+ return ExtendedMetaData.INSTANCE.getName((EClassifier) model);
+ }
+ return "";
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#refresh()
+ */
+ public void refresh() {
+ isRefreshing = true;
+
+ nameTxt.setText(getName(getEObject()));
+
+ isRefreshing = false;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Name";
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/NamespaceSection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/NamespaceSection.java
new file mode 100644
index 0000000..7975811
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/NamespaceSection.java
@@ -0,0 +1,200 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.metadata;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.tabbedproperties.EMFRecordingChangeCommand;
+import org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection;
+import org.eclipse.emf.tabbedproperties.utils.TextChangeListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+/**
+ * Section to edit namespace extended metadata annotation
+ *
+ * @see ExtendedMetaData#setNamespace(EStructuralFeature, String)
+ * @author <a href="david.sciamma@anyware-tech.com">David Sciamma</a>
+ */
+public class NamespaceSection extends AbstractTabbedPropertySection {
+
+ /**
+ * A boolean that store if refreshing is happening and no model
+ * modifications should be performed
+ */
+ private boolean isRefreshing = false;
+
+ /**
+ * The text for the section.
+ */
+ private Text namespaceTxt;
+
+ /**
+ * The section label;
+ */
+ private CLabel labelTxt;
+
+ // /**
+ // * @see
+ // org.eclipse.ui.views.properties.tabbed.ISection#createControls(org.eclipse.swt.widgets.Composite,
+ // * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ // */
+ // public void createControls(Composite parent, TabbedPropertySheetPage
+ // aTabbedPropertySheetPage)
+ // {
+ // super.createControls(parent, aTabbedPropertySheetPage);
+ // Composite composite = getWidgetFactory().createFlatFormComposite(parent);
+ // FormData data;
+ //
+ // String label = getLabelText();
+ // CLabel labelTxt = getWidgetFactory().createCLabel(composite, label);
+ //
+ // namespaceTxt = getWidgetFactory().createText(composite, "");
+ //
+ // data = new FormData();
+ // data.left = new FormAttachment(0, 0);
+ // data.right = new FormAttachment(namespaceTxt,
+ // -ITabbedPropertyConstants.HSPACE);
+ // data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ // labelTxt.setLayoutData(data);
+ //
+ // data = new FormData();
+ // data.left = new FormAttachment(0, getStandardLabelWidth(composite, new
+ // String[] {label}));
+ // data.right = new FormAttachment(100, 0);
+ // data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ // namespaceTxt.setLayoutData(data);
+ //
+ // hookListeners();
+ // }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#createWidgets(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createWidgets(Composite composite) {
+ labelTxt = getWidgetFactory().createCLabel(composite, getLabelText());
+
+ namespaceTxt = getWidgetFactory().createText(composite, "");
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#setSectionData(org.eclipse.swt.widgets.Composite)
+ */
+ protected void setSectionData(Composite composite) {
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(namespaceTxt, -ITabbedPropertyConstants.HSPACE);
+ data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ labelTxt.setLayoutData(data);
+
+ data = new FormData();
+ data.left = new FormAttachment(0, getStandardLabelWidth(composite, new String[] { getLabelText() }));
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ namespaceTxt.setLayoutData(data);
+ }
+
+ /**
+ * Adds the listeners on the widgets
+ */
+ protected void hookListeners() {
+ TextChangeListener listener = new TextChangeListener() {
+
+ public void textChanged(Control control) {
+ handleTextModified();
+ }
+ };
+ listener.startListeningTo(namespaceTxt);
+ listener.startListeningForEnter(namespaceTxt);
+ }
+
+ /**
+ * Handle the text modified event.
+ */
+ protected void handleTextModified() {
+ if (!isRefreshing) {
+ final String newNamespace = namespaceTxt.getText();
+ EditingDomain editingDomain = getEditingDomain();
+ if (getEObjectList().size() == 1) {
+ String oldNamespace = ExtendedMetaData.INSTANCE.getNamespace((EStructuralFeature) getEObject());
+ if (oldNamespace == null || !oldNamespace.equals(newNamespace)) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(getEObject().eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setNamespace((EStructuralFeature) getEObject(), newNamespace);
+ }
+ });
+ }
+ } else {
+ CompoundCommand compoundCommand = new CompoundCommand();
+ /* apply the property change to all selected elements */
+ for (Iterator<EObject> i = getEObjectList().iterator(); i.hasNext();) {
+ final EObject nextObject = i.next();
+
+ String oldNamespace = ExtendedMetaData.INSTANCE.getNamespace((EStructuralFeature) nextObject);
+ if (oldNamespace != null && !oldNamespace.equals(newNamespace)) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(nextObject.eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setNamespace((EStructuralFeature) nextObject, newNamespace);
+ }
+ });
+ }
+ }
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#refresh()
+ */
+ public void refresh() {
+ isRefreshing = true;
+
+ String txt = ExtendedMetaData.INSTANCE.getNamespace((EStructuralFeature) getEObject());
+ if (txt == null) {
+ txt = "";
+ }
+
+ namespaceTxt.setText(txt);
+
+ isRefreshing = false;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Namespace";
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/ProcessingKindSection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/ProcessingKindSection.java
new file mode 100644
index 0000000..fe799d6
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/ProcessingKindSection.java
@@ -0,0 +1,178 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.metadata;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.tabbedproperties.EMFRecordingChangeCommand;
+import org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+/**
+ * Section to edit processing kind extended metadata annotation
+ *
+ * @see ExtendedMetaData#setProcessingKind(EStructuralFeature, int)
+ * @author <a href="david.sciamma@anyware-tech.com">David Sciamma</a>
+ */
+public class ProcessingKindSection extends AbstractTabbedPropertySection {
+
+ /**
+ * A boolean that store if refreshing is happening and no model
+ * modifications should be performed
+ */
+ private boolean isRefreshing = false;
+
+ /**
+ * The combo box control for the section.
+ */
+ private CCombo processingKindCb;
+
+ /**
+ * The section label;
+ */
+ private CLabel labelTxt;
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#createWidgets(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createWidgets(Composite composite) {
+ labelTxt = getWidgetFactory().createCLabel(composite, getLabelText());
+
+ processingKindCb = getWidgetFactory().createCCombo(composite, SWT.FLAT | SWT.READ_ONLY | SWT.BORDER);
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#setSectionData(org.eclipse.swt.widgets.Composite)
+ */
+ protected void setSectionData(Composite composite) {
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(processingKindCb, -ITabbedPropertyConstants.HSPACE);
+ data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ labelTxt.setLayoutData(data);
+
+ data = new FormData();
+ data.left = new FormAttachment(0, getStandardLabelWidth(composite, new String[] { getLabelText() }));
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ processingKindCb.setLayoutData(data);
+ }
+
+ /**
+ * Adds the listeners on the widgets
+ */
+ protected void hookListeners() {
+ processingKindCb.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ handleComboModified();
+ }
+ });
+ }
+
+ /**
+ * Handle the combo modified event.
+ */
+ protected void handleComboModified() {
+ if (!isRefreshing) {
+ final int newProcessingKind = getIndex(processingKindCb.getText());
+ EditingDomain editingDomain = getEditingDomain();
+ if (getEObjectList().size() == 1) {
+ int oldProcessingKind = ExtendedMetaData.INSTANCE.getProcessingKind((EStructuralFeature) getEObject());
+ if (oldProcessingKind != newProcessingKind) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(getEObject().eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setProcessingKind((EStructuralFeature) getEObject(), newProcessingKind);
+ }
+ });
+ }
+ } else {
+ CompoundCommand compoundCommand = new CompoundCommand();
+ /* apply the property change to all selected elements */
+ for (Iterator<EObject> i = getEObjectList().iterator(); i.hasNext();) {
+ final EObject nextObject = i.next();
+
+ int oldProcessingKind = ExtendedMetaData.INSTANCE.getProcessingKind((EStructuralFeature) nextObject);
+ if (oldProcessingKind != newProcessingKind) {
+ compoundCommand.append(new EMFRecordingChangeCommand(nextObject.eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setProcessingKind((EStructuralFeature) nextObject, newProcessingKind);
+ }
+ });
+ }
+ }
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#refresh()
+ */
+ public void refresh() {
+ isRefreshing = true;
+
+ processingKindCb.setItems(ExtendedMetaData.PROCESSING_KINDS);
+ int processingKind = ExtendedMetaData.INSTANCE.getProcessingKind((EStructuralFeature) getEObject());
+ processingKindCb.setText(ExtendedMetaData.PROCESSING_KINDS[processingKind]);
+
+ isRefreshing = false;
+ }
+
+ /**
+ * Gets the respectif index of the key inside this array. It returns -1 when
+ * the key is not find inside the array
+ *
+ * @param key
+ * @return the key index
+ */
+ private int getIndex(String key) {
+ String[] contentKinds = ExtendedMetaData.PROCESSING_KINDS;
+ for (int i = 0; i < contentKinds.length; i++) {
+ if (contentKinds[i].equals(key)) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Processing Kind";
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/QualifiedSection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/QualifiedSection.java
new file mode 100644
index 0000000..32ee09d
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/QualifiedSection.java
@@ -0,0 +1,80 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.metadata;
+
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.tabbedproperties.EMFRecordingChangeCommand;
+import org.eclipse.emf.tabbedproperties.sections.AbstractBooleanPropertySection;
+
+/**
+ * Section to edit qualified extended metadata annotation
+ *
+ * @see ExtendedMetaData#setQualified(org.eclipse.emf.ecore.EPackage, boolean)
+ * @author <a href="david.sciamma@anyware-tech.com">David Sciamma</a>
+ */
+public class QualifiedSection extends AbstractBooleanPropertySection {
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractBooleanPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractBooleanPropertySection#getFeatureValue()
+ */
+ protected boolean getFeatureValue() {
+ return ExtendedMetaData.INSTANCE.isQualified((EPackage) getEObject());
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Qualified";
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractBooleanPropertySection#handleCheckButtonModified()
+ */
+ protected void handleCheckButtonModified() {
+ EditingDomain editingDomain = (EditingDomain) getPart().getAdapter(EditingDomain.class);
+ final boolean newValue = getCheckButton().getSelection();
+ if (getEObjectList().size() == 1) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(getEObject().eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setQualified((EPackage) getEObject(), newValue);
+ }
+ });
+ } else {
+ CompoundCommand compoundCommand = new CompoundCommand();
+ /* apply the property change to all selected elements */
+ for (final EObject nextObject : getEObjectList()) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(nextObject.eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setQualified((EPackage) nextObject, newValue);
+ }
+ });
+ }
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/TotalDigitsSection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/TotalDigitsSection.java
new file mode 100644
index 0000000..df1022c
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/TotalDigitsSection.java
@@ -0,0 +1,170 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.metadata;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.tabbedproperties.EMFRecordingChangeCommand;
+import org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection;
+import org.eclipse.emf.tabbedproperties.utils.TextChangeListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+/**
+ * Section to edit Total Digits extended metadata annotation
+ *
+ * @see ExtendedMetaData#setTotalDigitsFacet(EDataType, int)
+ * @author <a href="david.sciamma@anyware-tech.com">David Sciamma</a>
+ */
+public class TotalDigitsSection extends AbstractTabbedPropertySection {
+
+ /**
+ * A boolean that store if refreshing is happening and no model
+ * modifications should be performed
+ */
+ private boolean isRefreshing = false;
+
+ /**
+ * The text for the section.
+ */
+ private Text digitsTxt;
+
+ /**
+ * The section label;
+ */
+ private CLabel labelTxt;
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#createWidgets(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createWidgets(Composite composite) {
+ labelTxt = getWidgetFactory().createCLabel(composite, getLabelText());
+
+ digitsTxt = getWidgetFactory().createText(composite, "");
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#setSectionData(org.eclipse.swt.widgets.Composite)
+ */
+ protected void setSectionData(Composite composite) {
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(digitsTxt, -ITabbedPropertyConstants.HSPACE);
+ data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ labelTxt.setLayoutData(data);
+
+ data = new FormData();
+ data.left = new FormAttachment(0, getStandardLabelWidth(composite, new String[] { getLabelText() }));
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ digitsTxt.setLayoutData(data);
+ }
+
+ /**
+ * Adds the listeners on the widgets
+ */
+ protected void hookListeners() {
+ TextChangeListener listener = new TextChangeListener() {
+
+ public void textChanged(Control control) {
+ handleTextModified();
+ }
+ };
+ listener.startListeningTo(digitsTxt);
+ listener.startListeningForEnter(digitsTxt);
+ }
+
+ /**
+ * Handle the text modified event.
+ */
+ protected void handleTextModified() {
+ if (!isRefreshing) {
+ try {
+ if (digitsTxt.getText() == null || digitsTxt.getText().length() == 0) {
+ digitsTxt.setText("-1");
+ }
+ final int newDigits = Integer.parseInt(digitsTxt.getText());
+
+ EditingDomain editingDomain = getEditingDomain();
+ if (getEObjectList().size() == 1) {
+ int oldDigits = ExtendedMetaData.INSTANCE.getTotalDigitsFacet((EDataType) getEObject());
+ if (oldDigits != newDigits) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(getEObject().eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setTotalDigitsFacet((EDataType) getEObject(), newDigits);
+ }
+ });
+ }
+ } else {
+ CompoundCommand compoundCommand = new CompoundCommand();
+ /* apply the property change to all selected elements */
+ for (Iterator<EObject> i = getEObjectList().iterator(); i.hasNext();) {
+ final EObject nextObject = i.next();
+
+ int oldDigits = ExtendedMetaData.INSTANCE.getTotalDigitsFacet((EDataType) nextObject);
+ if (oldDigits != newDigits) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(nextObject.eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setTotalDigitsFacet((EDataType) nextObject, newDigits);
+ }
+ });
+ }
+ }
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+ } catch (NumberFormatException e) {
+ refresh();
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#refresh()
+ */
+ public void refresh() {
+ isRefreshing = true;
+
+ digitsTxt.setText("" + ExtendedMetaData.INSTANCE.getTotalDigitsFacet((EDataType) getEObject()));
+
+ isRefreshing = false;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Total Digits";
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/WhitespaceSection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/WhitespaceSection.java
new file mode 100644
index 0000000..85ecb00
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/metadata/WhitespaceSection.java
@@ -0,0 +1,198 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.metadata;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.tabbedproperties.EMFRecordingChangeCommand;
+import org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+/**
+ * Section to edit whitespace extended metadata annotation
+ *
+ * @see ExtendedMetaData#setWhiteSpaceFacet(org.eclipse.emf.ecore.EDataType,
+ * int)
+ * @author <a href="david.sciamma@anyware-tech.com">David Sciamma</a>
+ */
+public class WhitespaceSection extends AbstractTabbedPropertySection {
+
+ /**
+ * A boolean that store if refreshing is happening and no model
+ * modifications should be performed
+ */
+ private boolean isRefreshing = false;
+
+ /**
+ * The combo box control for the section.
+ */
+ private CCombo whitespaceCb;
+
+ /**
+ * The section label;
+ */
+ private CLabel labelTxt;
+
+ // /**
+ // * @see
+ // org.eclipse.ui.views.properties.tabbed.ISection#createControls(org.eclipse.swt.widgets.Composite,
+ // * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ // */
+ // public void createControls(Composite parent, TabbedPropertySheetPage
+ // aTabbedPropertySheetPage)
+ // {
+ // super.createControls(parent, aTabbedPropertySheetPage);
+ // Composite composite = getWidgetFactory().createFlatFormComposite(parent);
+ // FormData data;
+ //
+ // String label = getLabelText();
+ // CLabel labelTxt = getWidgetFactory().createCLabel(composite, label);
+ //
+ // whitespaceCb = getWidgetFactory().createCCombo(composite, SWT.FLAT |
+ // SWT.READ_ONLY | SWT.BORDER);
+ //
+ // data = new FormData();
+ // data.left = new FormAttachment(0, 0);
+ // data.right = new FormAttachment(whitespaceCb,
+ // -ITabbedPropertyConstants.HSPACE);
+ // data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ // labelTxt.setLayoutData(data);
+ //
+ // data = new FormData();
+ // data.left = new FormAttachment(0, getStandardLabelWidth(composite, new
+ // String[] {label}));
+ // data.right = new FormAttachment(100, 0);
+ // data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ // whitespaceCb.setLayoutData(data);
+ //
+ // hookListeners();
+ // }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#createWidgets(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createWidgets(Composite composite) {
+ labelTxt = getWidgetFactory().createCLabel(composite, getLabelText());
+
+ whitespaceCb = getWidgetFactory().createCCombo(composite, SWT.FLAT | SWT.READ_ONLY | SWT.BORDER);
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#setSectionData(org.eclipse.swt.widgets.Composite)
+ */
+ protected void setSectionData(Composite composite) {
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(whitespaceCb, -ITabbedPropertyConstants.HSPACE);
+ data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
+ labelTxt.setLayoutData(data);
+
+ data = new FormData();
+ data.left = new FormAttachment(0, getStandardLabelWidth(composite, new String[] { getLabelText() }));
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(labelTxt, 0, SWT.CENTER);
+ whitespaceCb.setLayoutData(data);
+ }
+
+ /**
+ * Adds the listeners on the widgets
+ */
+ protected void hookListeners() {
+ whitespaceCb.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ handleComboModified();
+ }
+ });
+ }
+
+ /**
+ * Handle the combo modified event.
+ */
+ protected void handleComboModified() {
+ if (!isRefreshing) {
+ final int newWhitespace = whitespaceCb.getSelectionIndex();
+ EditingDomain editingDomain = getEditingDomain();
+ if (getEObjectList().size() == 1) {
+ int oldWhitespace = ExtendedMetaData.INSTANCE.getWhiteSpaceFacet((EDataType) getEObject());
+ if (oldWhitespace != newWhitespace) {
+ editingDomain.getCommandStack().execute(new EMFRecordingChangeCommand(getEObject().eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setWhiteSpaceFacet((EDataType) getEObject(), newWhitespace);
+ }
+ });
+ }
+ } else {
+ CompoundCommand compoundCommand = new CompoundCommand();
+ /* apply the property change to all selected elements */
+ for (Iterator<EObject> i = getEObjectList().iterator(); i.hasNext();) {
+ final EObject nextObject = i.next();
+
+ int oldWhitespace = ExtendedMetaData.INSTANCE.getWhiteSpaceFacet((EDataType) nextObject);
+ if (oldWhitespace != newWhitespace) {
+ compoundCommand.append(new EMFRecordingChangeCommand(nextObject.eResource()) {
+
+ protected void doExecute() {
+ ExtendedMetaData.INSTANCE.setWhiteSpaceFacet((EDataType) nextObject, newWhitespace);
+ }
+ });
+ }
+ }
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#refresh()
+ */
+ public void refresh() {
+ isRefreshing = true;
+
+ whitespaceCb.setItems(ExtendedMetaData.WHITE_SPACE_KINDS);
+ int whitespace = ExtendedMetaData.INSTANCE.getWhiteSpaceFacet((EDataType) getEObject());
+ whitespaceCb.setText(ExtendedMetaData.WHITE_SPACE_KINDS[whitespace]);
+
+ isRefreshing = false;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Whitespace";
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/DetailEntryKeyPropertySection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/DetailEntryKeyPropertySection.java
new file mode 100644
index 0000000..cddd759
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/DetailEntryKeyPropertySection.java
@@ -0,0 +1,41 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.sections;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.tabbedproperties.sections.AbstractStringPropertySection;
+
+/**
+ * The section for the key property of an EStringToStringMapEntry Object.
+ *
+ * Creation 5 avr. 2006
+ *
+ * @author jlescot
+ */
+public class DetailEntryKeyPropertySection extends AbstractStringPropertySection {
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Key:";
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return EcorePackage.eINSTANCE.getEStringToStringMapEntry_Key();
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/DetailEntryValuePropertySection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/DetailEntryValuePropertySection.java
new file mode 100644
index 0000000..775940d
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/DetailEntryValuePropertySection.java
@@ -0,0 +1,56 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.sections;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.tabbedproperties.sections.AbstractStringPropertySection;
+import org.eclipse.swt.SWT;
+
+/**
+ * The section for the value property of an EStringToStringMapEntry Object.
+ *
+ * Creation 5 avr. 2006
+ *
+ * @author jlescot
+ */
+public class DetailEntryValuePropertySection extends AbstractStringPropertySection {
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Value:";
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return EcorePackage.eINSTANCE.getEStringToStringMapEntry_Value();
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#getStyle()
+ */
+ protected int getStyle() {
+ return SWT.MULTI | SWT.WRAP;
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#shouldUseExtraSpace()
+ */
+ public boolean shouldUseExtraSpace() {
+ return true;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/EAnnotationSourcePropertySection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/EAnnotationSourcePropertySection.java
new file mode 100644
index 0000000..f3eae16
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/EAnnotationSourcePropertySection.java
@@ -0,0 +1,41 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.sections;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.tabbedproperties.sections.AbstractStringPropertySection;
+
+/**
+ * The section for the source property of an EAnnotation Object.
+ *
+ * Creation 5 avr. 2006
+ *
+ * @author jlescot
+ */
+public class EAnnotationSourcePropertySection extends AbstractStringPropertySection {
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Source:";
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return EcorePackage.eINSTANCE.getEAnnotation_Source();
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/EEnumLiteralLiteralPropertySection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/EEnumLiteralLiteralPropertySection.java
new file mode 100644
index 0000000..3ea9af1
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/EEnumLiteralLiteralPropertySection.java
@@ -0,0 +1,41 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.sections;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.tabbedproperties.sections.AbstractStringPropertySection;
+
+/**
+ * The section for the literal property of an EEnumLiteral Object.
+ *
+ * Creation 5 avr. 2006
+ *
+ * @author jlescot
+ */
+public class EEnumLiteralLiteralPropertySection extends AbstractStringPropertySection {
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Literal:";
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return EcorePackage.eINSTANCE.getEEnumLiteral_Literal();
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/EEnumLiteralValuePropertySection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/EEnumLiteralValuePropertySection.java
new file mode 100644
index 0000000..c71dcb2
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/EEnumLiteralValuePropertySection.java
@@ -0,0 +1,50 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.sections;
+
+import org.eclipse.emf.ecore.EEnumLiteral;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.tabbedproperties.sections.AbstractIntegerPropertySection;
+
+/**
+ * A section for the value property of an EEnumLiteral Object.
+ *
+ * Creation 5 avr. 2006
+ *
+ * @author jlescot
+ */
+public class EEnumLiteralValuePropertySection extends AbstractIntegerPropertySection {
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return EcorePackage.eINSTANCE.getEEnumLiteral_Value();
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractIntegerPropertySection#getFeatureInteger()
+ */
+ protected Integer getFeatureInteger() {
+ return new Integer(((EEnumLiteral) getEObject()).getValue());
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Value:";
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/EOperationParameterSection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/EOperationParameterSection.java
new file mode 100644
index 0000000..384b925
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/EOperationParameterSection.java
@@ -0,0 +1,295 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.sections;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EOperation;
+import org.eclipse.emf.ecore.EParameter;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.tabbedproperties.providers.TabbedPropertiesLabelProvider;
+import org.eclipse.emf.tabbedproperties.sections.AbstractListPropertySection;
+import org.eclipse.emf.tabbedproperties.sections.widgets.CSingleObjectChooser;
+import org.eclipse.emf.tabbedproperties.utils.TextChangeListener;
+import org.eclipse.jface.viewers.IBaseLabelProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+/**
+ * TODO Comment this class
+ */
+public class EOperationParameterSection extends AbstractListPropertySection {
+
+ /** The widgets */
+ private Text parameterNameTxt;
+
+ private CSingleObjectChooser typeChooser;
+
+ /**
+ * A boolean that store if refreshing is happening and no model
+ * modifications should be performed
+ */
+ private boolean isRefreshing = false;
+
+ /**
+ * The group Details
+ */
+ private Group groupDetails;
+
+ // /**
+ // * @see
+ // org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite,
+ // org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ // */
+ // public void createControls(Composite parent, TabbedPropertySheetPage
+ // aTabbedPropertySheetPage)
+ // {
+ // super.createControls(parent, aTabbedPropertySheetPage);
+ //
+ // Composite composite = getSectionComposite();
+ // FormData data;
+ //
+ // Group groupDetails = getWidgetFactory().createGroup(composite, "Parameter
+ // Details");
+ // groupDetails.setLayout(new GridLayout());
+ //
+ // data = new FormData();
+ // data.left = new FormAttachment(0, 0);
+ // data.right = new FormAttachment(100, 0);
+ // data.top = new FormAttachment(getTable(),
+ // ITabbedPropertyConstants.VSPACE);
+ // groupDetails.setLayoutData(data);
+ //
+ // createGroupContents(groupDetails);
+ // hookListeners();
+ // }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractListPropertySection#createWidgets(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createWidgets(Composite composite) {
+ super.createWidgets(composite);
+ groupDetails = getWidgetFactory().createGroup(composite, "Parameter Details");
+ groupDetails.setLayout(new GridLayout());
+
+ createGroupContents(groupDetails);
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractListPropertySection#setSectionData(org.eclipse.swt.widgets.Composite)
+ */
+ protected void setSectionData(Composite composite) {
+ super.setSectionData(composite);
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(getTable(), ITabbedPropertyConstants.VSPACE);
+ groupDetails.setLayoutData(data);
+ }
+
+ /**
+ * Create the group contents
+ *
+ * @param parent
+ * the parent Composite
+ */
+ protected void createGroupContents(Composite parent) {
+ TabbedPropertySheetWidgetFactory widgetFactory = getWidgetFactory();
+ Composite composite = widgetFactory.createComposite(parent);
+ composite.setLayout(new GridLayout(2, false));
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ widgetFactory.createLabel(composite, "Name : ");
+ parameterNameTxt = widgetFactory.createText(composite, "", SWT.BORDER);
+ parameterNameTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ widgetFactory.createLabel(composite, "Type : ");
+ typeChooser = new CSingleObjectChooser(composite, getWidgetFactory(), SWT.NONE);
+ typeChooser.setLabelProvider((ILabelProvider) getLabelProvider());
+ typeChooser.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractListPropertySection#hookListeners()
+ */
+ protected void hookListeners() {
+ // Add the Listener for the eparameter name
+ TextChangeListener parameterNameListener = new TextChangeListener() {
+
+ public void textChanged(Control control) {
+ String newText = parameterNameTxt.getText();
+ EParameter parameter = (EParameter) getTable().getSelectionItem();
+ if (parameter != null && !newText.equals(parameter.getName())) {
+ getEditingDomain().getCommandStack().execute(SetCommand.create(getEditingDomain(), parameter, EcorePackage.eINSTANCE.getENamedElement_Name(), newText));
+ }
+ refresh();
+ }
+ };
+ parameterNameListener.startListeningTo(parameterNameTxt);
+ parameterNameListener.startListeningForEnter(parameterNameTxt);
+
+ // Add a listener to the parameter type field
+ typeChooser.addSelectionListener(new SelectionAdapter() {
+
+ /**
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ public void widgetSelected(SelectionEvent e) {
+ handleComboModified();
+ }
+ });
+ }
+
+ /**
+ * Update the model when the combo is modified
+ */
+ protected void handleComboModified() {
+ if (!isRefreshing && getParameterType() != typeChooser.getSelection()) {
+ EditingDomain editingDomain = getEditingDomain();
+ EParameter parameter = (EParameter) getTable().getSelectionItem();
+ if (getEObjectList().size() == 1) {
+ /* apply the property change to single selected object */
+ editingDomain.getCommandStack().execute(SetCommand.create(editingDomain, parameter, EcorePackage.eINSTANCE.getETypedElement_EType(), typeChooser.getSelection()));
+ } else {
+ CompoundCommand compoundCommand = new CompoundCommand();
+ /* apply the property change to all selected elements */
+ for (Iterator<EObject> i = getEObjectList().iterator(); i.hasNext();) {
+ EObject nextObject = i.next();
+ compoundCommand.append(SetCommand.create(editingDomain, nextObject, EcorePackage.eINSTANCE.getETypedElement_EType(), typeChooser.getSelection()));
+ }
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+ }
+
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractListPropertySection#getLabelProvider()
+ */
+ protected IBaseLabelProvider getLabelProvider() {
+ return new TabbedPropertiesLabelProvider(new EcoreItemProviderAdapterFactory());
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractListPropertySection#getListValues()
+ */
+ protected Object getListValues() {
+ return ((EOperation) getEObject()).getEParameters();
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return EcorePackage.eINSTANCE.getEOperation_EParameters();
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Parameters";
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#refresh()
+ */
+ public void refresh() {
+ isRefreshing = true;
+ super.refresh();
+ typeChooser.setChoices(getComboFeatureValues());
+ typeChooser.setSelection(getParameterType());
+ EParameter parameter = (EParameter) getTable().getSelectionItem();
+ String nameToDisplay = getEParameterName(parameter);
+ parameterNameTxt.setText(nameToDisplay);
+ isRefreshing = false;
+
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractListPropertySection#updateSelection(java.lang.Object)
+ */
+ public void updateSelection(Object data) {
+ if (data instanceof EParameter) {
+ EParameter parameter = (EParameter) data;
+ String nameToDisplay = getEParameterName(parameter);
+ parameterNameTxt.setText(nameToDisplay);
+ typeChooser.setSelection(getParameterType());
+ }
+ }
+
+ /**
+ * Returns the name of the given parameters
+ *
+ * @param parameter
+ * The parameter to know the name
+ * @return the parameters name
+ */
+ private String getEParameterName(EParameter parameter) {
+ return parameter == null ? "" : parameter.getName() != null ? parameter.getName() : "";
+ }
+
+ /**
+ * Search for all reachable events in the model
+ *
+ * @return An array ob events
+ */
+ private Object[] getComboFeatureValues() {
+
+ Iterator<Adapter> iter = getEObject().eAdapters().iterator();
+ while (iter.hasNext()) {
+ Adapter adapter = iter.next();
+ if (adapter instanceof ItemProviderAdapter) {
+ IItemPropertyDescriptor descriptor = ((ItemProviderAdapter) adapter).getPropertyDescriptor(getEObject(), "EType");
+ if (descriptor != null) {
+ return descriptor.getChoiceOfValues(getEObject()).toArray();
+ }
+ }
+ }
+ return new String[] { "" };
+ }
+
+ /**
+ * Returns the parameters type
+ *
+ * @return the parameters type
+ */
+ private Object getParameterType() {
+ EParameter parameter = (EParameter) getTable().getSelectionItem();
+ if (parameter != null) {
+ return parameter.getEType();
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/EOppositePropertySection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/EOppositePropertySection.java
new file mode 100644
index 0000000..fd0af4a
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/EOppositePropertySection.java
@@ -0,0 +1,99 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.sections;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.emf.tabbedproperties.sections.AbstractChooserPropertySection;
+import org.eclipse.jface.viewers.ILabelProvider;
+
+/**
+ * A section for the EOpposite property of an EReference.
+ *
+ * Creation 16 oct. 07
+ *
+ * @author <a href="mailto:jacques.lescot@anyware-tech.com">Jacques LESCOT</a>
+ */
+public class EOppositePropertySection extends AbstractChooserPropertySection {
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return EcorePackage.eINSTANCE.getEReference_EOpposite();
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "EOpposite:";
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractChooserPropertySection#getComboFeatureValues()
+ */
+ protected Object[] getComboFeatureValues() {
+ return getPropertyDescriptor() != null ? getPropertyDescriptor().getChoiceOfValues(getEObject()).toArray() : new String[] { "" };
+ }
+
+ /**
+ * Use the setPropertyValue() method implemented by the generated EMF code.
+ * This automatically handle the refreshment of the two complementary
+ * EOpposite references.
+ *
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractChooserPropertySection#handleComboModified()
+ */
+ protected void handleComboModified() {
+ if (!isRefreshing() && getFeatureValue() != getCSingleObjectChooser().getSelection() && getEObjectList().size() == 1) {
+ if (getPropertyDescriptor() != null) {
+ getPropertyDescriptor().setPropertyValue(getEObject(), getCSingleObjectChooser().getSelection());
+ } else {
+ super.handleComboModified();
+ }
+ }
+ }
+
+ private IItemPropertyDescriptor getPropertyDescriptor() {
+ for (Adapter adapter : getEObject().eAdapters()) {
+ if (adapter instanceof ItemProviderAdapter) {
+ IItemPropertyDescriptor descriptor = ((ItemProviderAdapter) adapter).getPropertyDescriptor(getEObject(), "EOpposite");
+ if (descriptor != null) {
+ return descriptor;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractChooserPropertySection#getLabelProvider()
+ */
+ protected ILabelProvider getLabelProvider() {
+ return new AdapterFactoryLabelProvider(new EcoreItemProviderAdapterFactory());
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractChooserPropertySection#getFeatureValue()
+ */
+ protected Object getFeatureValue() {
+ return ((EReference) getEObject()).getEOpposite();
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/ETypePropertySection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/ETypePropertySection.java
new file mode 100644
index 0000000..e294f06
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/ETypePropertySection.java
@@ -0,0 +1,78 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.sections;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.emf.tabbedproperties.sections.AbstractChooserPropertySection;
+import org.eclipse.jface.viewers.ILabelProvider;
+
+/**
+ * A section for the shot property of a selected player Object.
+ *
+ * Creation 5 avr. 2006
+ *
+ * @author jlescot
+ */
+public class ETypePropertySection extends AbstractChooserPropertySection {
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return EcorePackage.eINSTANCE.getETypedElement_EType();
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "EType:";
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractChooserPropertySection#getComboFeatureValues()
+ */
+ protected Object[] getComboFeatureValues() {
+ for (Adapter adapter : getEObject().eAdapters()) {
+ if (adapter instanceof ItemProviderAdapter) {
+ IItemPropertyDescriptor descriptor = ((ItemProviderAdapter) adapter).getPropertyDescriptor(getEObject(), "EType");
+ if (descriptor != null) {
+ return descriptor.getChoiceOfValues(getEObject()).toArray();
+ }
+ }
+ }
+ return new String[] { "" };
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractChooserPropertySection#getLabelProvider()
+ */
+ protected ILabelProvider getLabelProvider() {
+ return new AdapterFactoryLabelProvider(new EcoreItemProviderAdapterFactory());
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractChooserPropertySection#getFeatureValue()
+ */
+ protected Object getFeatureValue() {
+ return ((ETypedElement) getEObject()).getEType();
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/InstanceClassNamePropertySection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/InstanceClassNamePropertySection.java
new file mode 100644
index 0000000..dfc2fce
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/InstanceClassNamePropertySection.java
@@ -0,0 +1,41 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.sections;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.tabbedproperties.sections.AbstractStringPropertySection;
+
+/**
+ * The section for the name instanceClassName of an EClassifier Object.
+ *
+ * Creation 19 may 2006
+ *
+ * @author jlescot
+ */
+public class InstanceClassNamePropertySection extends AbstractStringPropertySection {
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Instance Class Name:";
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return EcorePackage.eINSTANCE.getEClassifier_InstanceClassName();
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/IsAbstractPropertySection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/IsAbstractPropertySection.java
new file mode 100644
index 0000000..c4197b9
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/IsAbstractPropertySection.java
@@ -0,0 +1,40 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.sections;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.tabbedproperties.sections.AbstractBooleanPropertySection;
+
+/**
+ * A section for the abstract property of an EClass Object.
+ *
+ * @author Jacques LESCOT
+ */
+public class IsAbstractPropertySection extends AbstractBooleanPropertySection {
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return EcorePackage.eINSTANCE.getEClass_Abstract();
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Is Abstract";
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/IsContainmentPropertySection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/IsContainmentPropertySection.java
new file mode 100644
index 0000000..cc8f0b4
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/IsContainmentPropertySection.java
@@ -0,0 +1,39 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.sections;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.tabbedproperties.sections.AbstractBooleanPropertySection;
+
+/**
+ * A section for the containment property of an EReference Object.
+ *
+ * @author Jacques LESCOT
+ */
+public class IsContainmentPropertySection extends AbstractBooleanPropertySection {
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractBooleanPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return EcorePackage.eINSTANCE.getEReference_Containment();
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Is Containment";
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/IsInterfacePropertySection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/IsInterfacePropertySection.java
new file mode 100644
index 0000000..fea2a64
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/IsInterfacePropertySection.java
@@ -0,0 +1,40 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.sections;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.tabbedproperties.sections.AbstractBooleanPropertySection;
+
+/**
+ * A section for the interface property of an EClass Object.
+ *
+ * @author Jacques LESCOT
+ */
+public class IsInterfacePropertySection extends AbstractBooleanPropertySection {
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractBooleanPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return EcorePackage.eINSTANCE.getEClass_Interface();
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Is Interface";
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/IsSerializablePropertySection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/IsSerializablePropertySection.java
new file mode 100644
index 0000000..91c3152
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/IsSerializablePropertySection.java
@@ -0,0 +1,40 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.sections;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.tabbedproperties.sections.AbstractBooleanPropertySection;
+
+/**
+ * A section for the serializable property of an EDataType Object.
+ *
+ * @author Jacques LESCOT
+ */
+public class IsSerializablePropertySection extends AbstractBooleanPropertySection {
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractBooleanPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return EcorePackage.eINSTANCE.getEDataType_Serializable();
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTabbedPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "isSerializable";
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/LowerBoundPropertySection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/LowerBoundPropertySection.java
new file mode 100644
index 0000000..fc82208
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/LowerBoundPropertySection.java
@@ -0,0 +1,50 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.sections;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.tabbedproperties.sections.AbstractIntegerPropertySection;
+
+/**
+ * A section for the lower bound property of an ETypedElement Object.
+ *
+ * Creation 5 avr. 2006
+ *
+ * @author jlescot
+ */
+public class LowerBoundPropertySection extends AbstractIntegerPropertySection {
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return EcorePackage.eINSTANCE.getETypedElement_LowerBound();
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractIntegerPropertySection#getFeatureInteger()
+ */
+ protected Integer getFeatureInteger() {
+ return new Integer(((ETypedElement) getEObject()).getLowerBound());
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Lower Bound:";
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/NamePropertySection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/NamePropertySection.java
new file mode 100644
index 0000000..0e6493a
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/NamePropertySection.java
@@ -0,0 +1,41 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.sections;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.tabbedproperties.sections.AbstractStringPropertySection;
+
+/**
+ * The section for the name property of an ENamedElement Object.
+ *
+ * Creation 5 avr. 2006
+ *
+ * @author jlescot
+ */
+public class NamePropertySection extends AbstractStringPropertySection {
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Name:";
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return EcorePackage.eINSTANCE.getENamedElement_Name();
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/NsPrefixPropertySection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/NsPrefixPropertySection.java
new file mode 100644
index 0000000..f57bcd2
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/NsPrefixPropertySection.java
@@ -0,0 +1,41 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.sections;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.tabbedproperties.sections.AbstractStringPropertySection;
+
+/**
+ * A section for the nsPrefix property of an EPackage Object.
+ *
+ * Creation 5 avr. 2006
+ *
+ * @author jlescot
+ */
+public class NsPrefixPropertySection extends AbstractStringPropertySection {
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Ns Prefix:";
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return EcorePackage.eINSTANCE.getEPackage_NsPrefix();
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/NsURIPropertySection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/NsURIPropertySection.java
new file mode 100644
index 0000000..ed53345
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/NsURIPropertySection.java
@@ -0,0 +1,41 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.sections;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.tabbedproperties.sections.AbstractStringPropertySection;
+
+/**
+ * A section for the nsURI property of an EPackage Object.
+ *
+ * Creation 5 avr. 2006
+ *
+ * @author jlescot
+ */
+public class NsURIPropertySection extends AbstractStringPropertySection {
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Ns URI:";
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return EcorePackage.eINSTANCE.getEPackage_NsURI();
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/UpperBoundPropertySection.java b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/UpperBoundPropertySection.java
new file mode 100644
index 0000000..9585231
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.properties/src/org/eclipse/emf/ecoretools/properties/internal/sections/UpperBoundPropertySection.java
@@ -0,0 +1,87 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * 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:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.properties.internal.sections;
+
+import java.util.regex.Pattern;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.tabbedproperties.sections.AbstractIntegerPropertySection;
+
+/**
+ * A section for the upper bound property of an ETypedElement Object.
+ *
+ * Creation 5 avr. 2006
+ *
+ * @author jlescot
+ */
+public class UpperBoundPropertySection extends AbstractIntegerPropertySection {
+
+ /** Predefined string pattern value for numerics and absloute with '-' : -25 */
+ public static final String UPPER_BOUND_PATTERN = "\\*|^[-\\d][\\d]*"; //$NON-NLS-1$
+
+ /** The Pattern used to check an Integer value */
+ public static final Pattern UPPER_PATTERN = Pattern.compile(UPPER_BOUND_PATTERN);
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#getFeature()
+ */
+ protected EStructuralFeature getFeature() {
+ return EcorePackage.eINSTANCE.getETypedElement_UpperBound();
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractIntegerPropertySection#getFeatureInteger()
+ */
+ protected Integer getFeatureInteger() {
+ return new Integer(((ETypedElement) getEObject()).getUpperBound());
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#getLabelText()
+ */
+ protected String getLabelText() {
+ return "Upper Bound:";
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#isTextValid()
+ */
+ protected boolean isTextValid() {
+ return UPPER_PATTERN.matcher(getText().getText()).matches();
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#getNewFeatureValue(java.lang.String)
+ */
+ protected Object getNewFeatureValue(String newText) {
+ String text = newText;
+ if ("*".equals(newText)) {
+ text = "-1";
+ }
+ return new Integer(Integer.parseInt(text));
+ }
+
+ /**
+ * @see org.eclipse.emf.tabbedproperties.sections.AbstractTextPropertySection#getFeatureAsString()
+ */
+ protected String getFeatureAsString() {
+ Integer upper = getFeatureInteger();
+ if (upper.intValue() == -1) {
+ return "*";
+ } else {
+ return getFeatureInteger().toString();
+ }
+ }
+} \ No newline at end of file

Back to the top