Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2008-07-01 07:40:19 -0400
committeratikhomirov2008-07-01 07:40:19 -0400
commit29525b13732b1ddf0cf04da292d4332d1b05e002 (patch)
treef7707a5d17ce1ea5b28b7ccec17fcd19e3c4d9aa /plugins
parent5b485b7e3872b5fc62a9746d620cf26dd150c35e (diff)
downloadorg.eclipse.gmf-tooling-29525b13732b1ddf0cf04da292d4332d1b05e002.tar.gz
org.eclipse.gmf-tooling-29525b13732b1ddf0cf04da292d4332d1b05e002.tar.xz
org.eclipse.gmf-tooling-29525b13732b1ddf0cf04da292d4332d1b05e002.zip
[227127] support literal values for feature initializers. step 1: models updated to specify new possible values
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.gmf.codegen.edit/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.gmf.codegen.edit/icons/full/ctool16/CreateGenExpressionProviderContainer_providers_GenLiteralExpressionProvider.gifbin0 -> 223 bytes
-rw-r--r--plugins/org.eclipse.gmf.codegen.edit/icons/full/obj16/GenLiteralExpressionProvider.gifbin0 -> 129 bytes
-rw-r--r--plugins/org.eclipse.gmf.codegen.edit/plugin.properties5
-rw-r--r--plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/presentation/GMFGenEditor.java6
-rw-r--r--plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/presentation/GMFGenModelWizard.java41
-rw-r--r--plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GMFGenItemProviderAdapterFactory.java24
-rw-r--r--plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GenExpressionProviderContainerItemProvider.java7
-rw-r--r--plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GenLiteralExpressionProviderItemProvider.java109
9 files changed, 177 insertions, 17 deletions
diff --git a/plugins/org.eclipse.gmf.codegen.edit/META-INF/MANIFEST.MF b/plugins/org.eclipse.gmf.codegen.edit/META-INF/MANIFEST.MF
index 19df0b3a4..4ba87a847 100644
--- a/plugins/org.eclipse.gmf.codegen.edit/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.gmf.codegen.edit/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.gmf.codegen.edit; singleton:=true
-Bundle-Version: 2.1.0.qualifier
+Bundle-Version: 2.2.0.qualifier
Bundle-Activator: org.eclipse.gmf.codegen.gmfgen.presentation.EditorPlugin$Implementation
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.gmf.codegen.edit/icons/full/ctool16/CreateGenExpressionProviderContainer_providers_GenLiteralExpressionProvider.gif b/plugins/org.eclipse.gmf.codegen.edit/icons/full/ctool16/CreateGenExpressionProviderContainer_providers_GenLiteralExpressionProvider.gif
new file mode 100644
index 000000000..5625a6447
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen.edit/icons/full/ctool16/CreateGenExpressionProviderContainer_providers_GenLiteralExpressionProvider.gif
Binary files differ
diff --git a/plugins/org.eclipse.gmf.codegen.edit/icons/full/obj16/GenLiteralExpressionProvider.gif b/plugins/org.eclipse.gmf.codegen.edit/icons/full/obj16/GenLiteralExpressionProvider.gif
new file mode 100644
index 000000000..d3dc5a9ad
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen.edit/icons/full/obj16/GenLiteralExpressionProvider.gif
Binary files differ
diff --git a/plugins/org.eclipse.gmf.codegen.edit/plugin.properties b/plugins/org.eclipse.gmf.codegen.edit/plugin.properties
index 88a9f3c78..9fc8d9986 100644
--- a/plugins/org.eclipse.gmf.codegen.edit/plugin.properties
+++ b/plugins/org.eclipse.gmf.codegen.edit/plugin.properties
@@ -871,3 +871,8 @@ _UI_LineStyle_DOT_literal = DOT
_UI_LineStyle_DASHDOT_literal = DASHDOT
_UI_LineStyle_DASHDOTDOT_literal = DASHDOTDOT
_UI_LineStyle_CUSTOM_literal = CUSTOM
+_UI_GenLiteralExpressionProvider_type = Gen Literal Expression Provider
+_UI_GenLanguage_literal_literal = literal
+_UI_GMFGenEditorFilenameExtensions = gmfgen
+ _WARN_FilenameExtensions = The file name must have one of the following extensions: {0}
+ \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/presentation/GMFGenEditor.java b/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/presentation/GMFGenEditor.java
index 8c8603541..a1bfefa83 100644
--- a/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/presentation/GMFGenEditor.java
+++ b/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/presentation/GMFGenEditor.java
@@ -71,6 +71,7 @@ import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider;
import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper;
+import org.eclipse.emf.edit.ui.util.EditUIUtil;
import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage;
import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator;
import org.eclipse.gmf.codegen.gmfgen.provider.GMFGenItemProviderAdapterFactory;
@@ -1461,8 +1462,11 @@ public class GMFGenEditor
for (Resource resource : editingDomain.getResourceSet().getResources()) {
if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource)) {
try {
- savedResources.add(resource);
+ long timeStamp = resource.getTimeStamp();
resource.save(saveOptions);
+ if (resource.getTimeStamp() != timeStamp) {
+ savedResources.add(resource);
+ }
}
catch (Exception exception) {
resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
diff --git a/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/presentation/GMFGenModelWizard.java b/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/presentation/GMFGenModelWizard.java
index 338dbb18b..2f377529f 100644
--- a/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/presentation/GMFGenModelWizard.java
+++ b/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/presentation/GMFGenModelWizard.java
@@ -7,6 +7,7 @@
package org.eclipse.gmf.codegen.gmfgen.presentation;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
@@ -70,6 +71,24 @@ import org.eclipse.ui.part.ISetSelectionTarget;
*/
public class GMFGenModelWizard extends Wizard implements INewWizard {
/**
+ * The supported extensions for created files.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<String> FILE_EXTENSIONS =
+ Collections.unmodifiableList(Arrays.asList(EditorPlugin.INSTANCE.getString("_UI_GMFGenEditorFilenameExtensions").split("\\s*,\\s*")));
+
+ /**
+ * A formatted list of supported file extensions, suitable for display.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String FORMATTED_FILE_EXTENSIONS =
+ EditorPlugin.INSTANCE.getString("_UI_GMFGenEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", ");
+
+ /**
* This caches an instance of the model package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -289,21 +308,15 @@ public class GMFGenModelWizard extends Wizard implements INewWizard {
@Override
protected boolean validatePage() {
if (super.validatePage()) {
- // Make sure the file ends in ".gmfgen".
- //
- String requiredExt = EditorPlugin.INSTANCE.getString("_UI_GMFGenEditorFilenameExtension");
- String enteredExt = new Path(getFileName()).getFileExtension();
- if (enteredExt == null || !enteredExt.equals(requiredExt)) {
- setErrorMessage(EditorPlugin.INSTANCE.getString("_WARN_FilenameExtension", new Object [] { requiredExt }));
+ String extension = new Path(getFileName()).getFileExtension();
+ if (extension == null || !FILE_EXTENSIONS.contains(extension)) {
+ String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension";
+ setErrorMessage(EditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS }));
return false;
}
- else {
- return true;
- }
- }
- else {
- return false;
+ return true;
}
+ return false;
}
/**
@@ -537,7 +550,7 @@ public class GMFGenModelWizard extends Wizard implements INewWizard {
newFileCreationPage = new GMFGenModelWizardNewFileCreationPage("Whatever", selection);
newFileCreationPage.setTitle(EditorPlugin.INSTANCE.getString("_UI_GMFGenModelWizard_label"));
newFileCreationPage.setDescription(EditorPlugin.INSTANCE.getString("_UI_GMFGenModelWizard_description"));
- newFileCreationPage.setFileName(EditorPlugin.INSTANCE.getString("_UI_GMFGenEditorFilenameDefaultBase") + "." + EditorPlugin.INSTANCE.getString("_UI_GMFGenEditorFilenameExtension"));
+ newFileCreationPage.setFileName(EditorPlugin.INSTANCE.getString("_UI_GMFGenEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0));
addPage(newFileCreationPage);
// Try and get the resource selection to determine a current directory for the file dialog.
@@ -564,7 +577,7 @@ public class GMFGenModelWizard extends Wizard implements INewWizard {
// Make up a unique new name here.
//
String defaultModelBaseFilename = EditorPlugin.INSTANCE.getString("_UI_GMFGenEditorFilenameDefaultBase");
- String defaultModelFilenameExtension = EditorPlugin.INSTANCE.getString("_UI_GMFGenEditorFilenameExtension");
+ String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0);
String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension;
for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) {
modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension;
diff --git a/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GMFGenItemProviderAdapterFactory.java b/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GMFGenItemProviderAdapterFactory.java
index 0bec5ad1a..a211d2f8c 100644
--- a/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GMFGenItemProviderAdapterFactory.java
+++ b/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GMFGenItemProviderAdapterFactory.java
@@ -1584,6 +1584,29 @@ public class GMFGenItemProviderAdapterFactory extends GMFGenAdapterFactory imple
}
/**
+ * This keeps track of the one adapter used for all {@link org.eclipse.gmf.codegen.gmfgen.GenLiteralExpressionProvider} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected GenLiteralExpressionProviderItemProvider genLiteralExpressionProviderItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.gmf.codegen.gmfgen.GenLiteralExpressionProvider}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createGenLiteralExpressionProviderAdapter() {
+ if (genLiteralExpressionProviderItemProvider == null) {
+ genLiteralExpressionProviderItemProvider = new GenLiteralExpressionProviderItemProvider(this);
+ }
+
+ return genLiteralExpressionProviderItemProvider;
+ }
+
+ /**
* This keeps track of the one adapter used for all {@link org.eclipse.gmf.codegen.gmfgen.GenNavigator} instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -2190,6 +2213,7 @@ public class GMFGenItemProviderAdapterFactory extends GMFGenAdapterFactory imple
if (genExpressionProviderContainerItemProvider != null) genExpressionProviderContainerItemProvider.dispose();
if (genJavaExpressionProviderItemProvider != null) genJavaExpressionProviderItemProvider.dispose();
if (genExpressionInterpreterItemProvider != null) genExpressionInterpreterItemProvider.dispose();
+ if (genLiteralExpressionProviderItemProvider != null) genLiteralExpressionProviderItemProvider.dispose();
if (genNavigatorItemProvider != null) genNavigatorItemProvider.dispose();
if (genNavigatorChildReferenceItemProvider != null) genNavigatorChildReferenceItemProvider.dispose();
if (genNavigatorPathItemProvider != null) genNavigatorPathItemProvider.dispose();
diff --git a/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GenExpressionProviderContainerItemProvider.java b/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GenExpressionProviderContainerItemProvider.java
index 95f6fc34d..2dc82ca35 100644
--- a/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GenExpressionProviderContainerItemProvider.java
+++ b/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GenExpressionProviderContainerItemProvider.java
@@ -2,7 +2,7 @@
* <copyright>
* </copyright>
*
- * $Id: GenExpressionProviderContainerItemProvider.java,v 1.5 2008/03/03 18:38:20 atikhomirov Exp $
+ * $Id: GenExpressionProviderContainerItemProvider.java,v 1.6 2008/07/01 11:40:19 atikhomirov Exp $
*/
package org.eclipse.gmf.codegen.gmfgen.provider;
@@ -212,6 +212,11 @@ public class GenExpressionProviderContainerItemProvider
(createChildParameter
(GMFGenPackage.eINSTANCE.getGenExpressionProviderContainer_Providers(),
GMFGenFactory.eINSTANCE.createGenExpressionInterpreter()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (GMFGenPackage.eINSTANCE.getGenExpressionProviderContainer_Providers(),
+ GMFGenFactory.eINSTANCE.createGenLiteralExpressionProvider()));
}
/**
diff --git a/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GenLiteralExpressionProviderItemProvider.java b/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GenLiteralExpressionProviderItemProvider.java
new file mode 100644
index 000000000..d3b0312be
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GenLiteralExpressionProviderItemProvider.java
@@ -0,0 +1,109 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.gmf.codegen.gmfgen.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.gmf.codegen.gmfgen.GenLiteralExpressionProvider} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class GenLiteralExpressionProviderItemProvider
+ extends GenExpressionProviderBaseItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public GenLiteralExpressionProviderItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This returns GenLiteralExpressionProvider.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/GenLiteralExpressionProvider"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ return getString("_UI_GenLiteralExpressionProvider_type");
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+}

Back to the top