Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 161000 Details for
Bug 304719
Support converting a toplevel CMOF package into a metamodel.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
New version of the patch for org.eclipse.uml2.examples.ui, org.eclipse.uml2.uml.editor
CMOFPackage2MetamodelConversion-v2.patch (text/plain), 15.55 KB, created by
Nicolas Rouquette
on 2010-03-04 13:49:07 EST
(
hide
)
Description:
New version of the patch for org.eclipse.uml2.examples.ui, org.eclipse.uml2.uml.editor
Filename:
MIME Type:
Creator:
Nicolas Rouquette
Created:
2010-03-04 13:49:07 EST
Size:
15.55 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.uml2.examples.uml.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/examples/org.eclipse.uml2.examples.uml.ui/plugin.xml,v >retrieving revision 1.5 >diff -u -r1.5 plugin.xml >--- plugin.xml 30 Nov 2006 05:16:16 -0000 1.5 >+++ plugin.xml 4 Mar 2010 18:45:49 -0000 >@@ -195,7 +195,7 @@ > id="org.eclipse.uml2.examples.uml.ui.ConvertToMetamodelActionID"> > <enablement> > <objectClass >- name="org.eclipse.uml2.uml.Model"> >+ name="org.eclipse.uml2.uml.Package"> > </objectClass> > </enablement> > </action> >Index: src/org/eclipse/uml2/examples/uml/ui/actions/ConvertModelAction.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/examples/org.eclipse.uml2.examples.uml.ui/src/org/eclipse/uml2/examples/uml/ui/actions/ConvertModelAction.java,v >retrieving revision 1.4 >diff -u -r1.4 ConvertModelAction.java >--- src/org/eclipse/uml2/examples/uml/ui/actions/ConvertModelAction.java 4 Jan 2007 18:47:13 -0000 1.4 >+++ src/org/eclipse/uml2/examples/uml/ui/actions/ConvertModelAction.java 4 Mar 2010 18:45:49 -0000 >@@ -25,7 +25,6 @@ > import org.eclipse.emf.edit.domain.EditingDomain; > import org.eclipse.uml2.common.util.UML2Util; > import org.eclipse.uml2.uml.Element; >-import org.eclipse.uml2.uml.Model; > import org.eclipse.uml2.uml.Profile; > import org.eclipse.uml2.uml.Stereotype; > import org.eclipse.uml2.uml.UMLPackage; >@@ -39,7 +38,7 @@ > Collection<?> collection) { > > if (collection.size() == 1 >- && collection.iterator().next() instanceof Model) { >+ && collection.iterator().next() instanceof org.eclipse.uml2.uml.Package) { > > return IdentityCommand.INSTANCE; > } >Index: src/org/eclipse/uml2/examples/uml/ui/actions/ConvertToMetamodelAction.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/examples/org.eclipse.uml2.examples.uml.ui/src/org/eclipse/uml2/examples/uml/ui/actions/ConvertToMetamodelAction.java,v >retrieving revision 1.5 >diff -u -r1.5 ConvertToMetamodelAction.java >--- src/org/eclipse/uml2/examples/uml/ui/actions/ConvertToMetamodelAction.java 24 Mar 2008 19:57:00 -0000 1.5 >+++ src/org/eclipse/uml2/examples/uml/ui/actions/ConvertToMetamodelAction.java 4 Mar 2010 18:45:49 -0000 >@@ -19,7 +19,7 @@ > import org.eclipse.uml2.examples.uml.ui.UMLExamplesUIPlugin; > import org.eclipse.uml2.uml.Classifier; > import org.eclipse.uml2.uml.DataType; >-import org.eclipse.uml2.uml.Model; >+import org.eclipse.uml2.uml.Package; > import org.eclipse.uml2.uml.Profile; > import org.eclipse.uml2.uml.Stereotype; > import org.eclipse.uml2.uml.VisibilityKind; >@@ -37,20 +37,22 @@ > public void run(IAction action) { > > if (command != UnexecutableCommand.INSTANCE) { >- final Model model = (Model) collection.iterator().next(); >+ final Package pkg = (Package) collection.iterator().next(); > > editingDomain.getCommandStack().execute( > new RefreshingChangeCommand(editingDomain, new Runnable() { > > public void run() { >- EcoreUtil.resolveAll(model); >+ EcoreUtil.resolveAll(pkg); > >- Profile umlProfile = applyProfile(model, >+ Profile umlProfile = applyProfile(pkg, > UMLResource.STANDARD_PROFILE_URI); > > if (umlProfile != null) { >- applyStereotype(model, umlProfile >- .getOwnedStereotype(STEREOTYPE_NAME__METAMODEL)); >+ Stereotype metamodelS = umlProfile >+ .getOwnedStereotype(STEREOTYPE_NAME__METAMODEL); >+ if (pkg.isStereotypeApplicable(metamodelS)) >+ applyStereotype(pkg, metamodelS); > } > > final Stereotype metaclassStereotype = umlProfile == null >@@ -75,14 +77,6 @@ > > return defaultCase(object); > } >- >- @Override >- public Object caseClassifier(Classifier classifier) { >- classifier >- .setVisibility(VisibilityKind.PRIVATE_LITERAL); >- >- return defaultCase(classifier); >- } > > @Override > public Object defaultCase(EObject eObject) { >@@ -94,12 +88,12 @@ > > return this; > } >- }.doSwitch(model); >+ }.doSwitch(pkg); > > } > }, UMLExamplesUIPlugin.INSTANCE.getString( > "_UI_ConvertToMetamodelActionCommand_label", //$NON-NLS-1$ >- new Object[]{getLabelProvider().getText(model)}))); >+ new Object[]{getLabelProvider().getText(pkg)}))); > } > } > >#P org.eclipse.uml2.uml.editor >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/plugins/org.eclipse.uml2.uml.editor/plugin.properties,v >retrieving revision 1.18 >diff -u -r1.18 plugin.properties >--- plugin.properties 30 Apr 2009 21:15:28 -0000 1.18 >+++ plugin.properties 4 Mar 2010 18:45:50 -0000 >@@ -76,6 +76,7 @@ > _UI_ApplyProfileAction_label = &Apply Profile... > _UI_ImportPrimitiveTypeAction_label = &Import Primitive Type... > _UI_MergePackageAction_label = &Merge... >+_UI_OMGMergePackageAction_label = &OMG Merge... > _UI_UnapplyProfileAction_label = &Unapply Profile... > > _UI_DefineProfileAction_label = &Define >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/plugins/org.eclipse.uml2.uml.editor/plugin.xml,v >retrieving revision 1.13 >diff -u -r1.13 plugin.xml >--- plugin.xml 21 Apr 2008 13:27:42 -0000 1.13 >+++ plugin.xml 4 Mar 2010 18:45:50 -0000 >@@ -146,6 +146,18 @@ > </enablement> > </action> > <action >+ label="%_UI_OMGMergePackageAction_label" >+ class="org.eclipse.uml2.uml.editor.actions.OMGMergePackageAction" >+ menubarPath="org.eclipse.uml2.umlMenuID/org.eclipse.uml2.uml.editor.PackageMenuID/additions" >+ enablesFor="1" >+ id="org.eclipse.uml2.uml.editor.OMGMergePackageActionID"> >+ <enablement> >+ <objectClass >+ name="org.eclipse.uml2.uml.Package"> >+ </objectClass> >+ </enablement> >+ </action> >+ <action > label="%_UI_ImportTypeAction_label" > class="org.eclipse.uml2.uml.editor.actions.ImportTypeAction" > menubarPath="org.eclipse.uml2.umlMenuID/org.eclipse.uml2.uml.editor.PackageMenuID/additions" >Index: src/org/eclipse/uml2/uml/editor/actions/MergePackageAction.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/plugins/org.eclipse.uml2.uml.editor/src/org/eclipse/uml2/uml/editor/actions/MergePackageAction.java,v >retrieving revision 1.3 >diff -u -r1.3 MergePackageAction.java >--- src/org/eclipse/uml2/uml/editor/actions/MergePackageAction.java 5 Jan 2007 21:48:51 -0000 1.3 >+++ src/org/eclipse/uml2/uml/editor/actions/MergePackageAction.java 4 Mar 2010 18:45:50 -0000 >@@ -77,7 +77,7 @@ > > OptionsDialog optionsDialog = new PackageMergerOptionsDialog(shell, > label, UMLEditorPlugin.INSTANCE >- .getString("_UI_OptionsDialog_message"), options); //$NON-NLS-1$ >+ .getString("_UI_OptionsDialog_message"), options, PackageMergerOptionsDialog.OptionSettings.ECLIPSE_PACKAGE_MERGE_OPTIONS); //$NON-NLS-1$ > > if (optionsDialog.open() == Window.OK) { > editingDomain.getCommandStack().execute( >Index: src/org/eclipse/uml2/uml/editor/actions/OMGMergePackageAction.java >=================================================================== >RCS file: src/org/eclipse/uml2/uml/editor/actions/OMGMergePackageAction.java >diff -N src/org/eclipse/uml2/uml/editor/actions/OMGMergePackageAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/uml2/uml/editor/actions/OMGMergePackageAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,150 @@ >+/* >+ * Copyright (c) 2005, 2007 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - initial API and implementation >+ * >+ * $Id: MergePackageAction.java,v 1.3 2007/01/05 21:48:51 khussey Exp $ >+ */ >+package org.eclipse.uml2.uml.editor.actions; >+ >+import java.lang.reflect.InvocationTargetException; >+import java.util.Collection; >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.emf.common.command.Command; >+import org.eclipse.emf.common.command.IdentityCommand; >+import org.eclipse.emf.common.command.UnexecutableCommand; >+import org.eclipse.emf.common.util.BasicDiagnostic; >+import org.eclipse.emf.common.util.Diagnostic; >+import org.eclipse.emf.ecore.EValidator; >+import org.eclipse.emf.ecore.plugin.EcorePlugin; >+import org.eclipse.emf.edit.domain.EditingDomain; >+import org.eclipse.jface.action.IAction; >+import org.eclipse.jface.dialogs.ProgressMonitorDialog; >+import org.eclipse.jface.operation.IRunnableWithProgress; >+import org.eclipse.jface.window.Window; >+import org.eclipse.swt.widgets.Shell; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.uml2.common.edit.command.ChangeCommand; >+import org.eclipse.uml2.uml.editor.UMLEditorPlugin; >+import org.eclipse.uml2.uml.editor.dialogs.OptionsDialog; >+import org.eclipse.uml2.uml.editor.dialogs.PackageMergerOptionsDialog; >+import org.eclipse.uml2.uml.util.UMLUtil; >+import org.eclipse.uml2.uml.util.UMLValidator; >+ >+public class OMGMergePackageAction >+ extends DiagnosticAction { >+ >+ public OMGMergePackageAction() { >+ super(); >+ } >+ >+ @Override >+ protected Command createActionCommand(EditingDomain editingDomain, >+ Collection<?> collection) { >+ >+ if (collection.size() == 1 >+ && collection.iterator().next() instanceof org.eclipse.uml2.uml.Package) { >+ >+ return IdentityCommand.INSTANCE; >+ } >+ >+ return UnexecutableCommand.INSTANCE; >+ } >+ >+ @Override >+ public void run(IAction action) { >+ >+ if (command != UnexecutableCommand.INSTANCE) { >+ final org.eclipse.uml2.uml.Package package_ = (org.eclipse.uml2.uml.Package) collection >+ .iterator().next(); >+ >+ final Shell shell = PlatformUI.getWorkbench() >+ .getActiveWorkbenchWindow().getShell(); >+ >+ final Map<String, String> options = new HashMap<String, String>(); >+ >+ final String label = UMLEditorPlugin.INSTANCE.getString( >+ "_UI_MergePackageActionCommand_label", //$NON-NLS-1$ >+ new Object[]{getLabelProvider().getText(package_)}); >+ >+ OptionsDialog optionsDialog = new PackageMergerOptionsDialog(shell, >+ label, UMLEditorPlugin.INSTANCE >+ .getString("_UI_OptionsDialog_message"), options, PackageMergerOptionsDialog.OptionSettings.OMG_PACKAGE_MERGE_OPTIONS); //$NON-NLS-1$ >+ >+ if (optionsDialog.open() == Window.OK) { >+ editingDomain.getCommandStack().execute( >+ new ChangeCommand(editingDomain, new Runnable() { >+ >+ public void run() { >+ IRunnableWithProgress runnableWithProgress = new IRunnableWithProgress() { >+ >+ public void run( >+ final IProgressMonitor progressMonitor) >+ throws InvocationTargetException, >+ InterruptedException { >+ >+ try { >+ final BasicDiagnostic diagnostics = new BasicDiagnostic( >+ UMLValidator.DIAGNOSTIC_SOURCE, >+ 0, >+ EcorePlugin.INSTANCE >+ .getString( >+ "_UI_DiagnosticRoot_diagnostic", //$NON-NLS-1$ >+ new Object[]{substitutionLabelProvider >+ .getObjectLabel(package_)}), >+ new Object[]{package_}); >+ >+ Map<Object, Object> context = new HashMap<Object, Object>(); >+ context >+ .put( >+ EValidator.SubstitutionLabelProvider.class, >+ substitutionLabelProvider); >+ >+ progressMonitor >+ .beginTask( >+ UMLEditorPlugin.INSTANCE >+ .getString( >+ "_UI_MergingPackage_message", //$NON-NLS-1$ >+ new Object[]{substitutionLabelProvider >+ .getObjectLabel(package_)}), >+ IProgressMonitor.UNKNOWN); >+ >+ UMLUtil.merge(package_, options, >+ diagnostics, context); >+ >+ handleDiagnostic(progressMonitor >+ .isCanceled() >+ ? Diagnostic.CANCEL_INSTANCE >+ : diagnostics, label); >+ } finally { >+ progressMonitor.done(); >+ } >+ } >+ }; >+ >+ if (eclipseResourcesUtil != null) { >+ runnableWithProgress = eclipseResourcesUtil >+ .getWorkspaceModifyOperation(runnableWithProgress); >+ } >+ >+ try { >+ new ProgressMonitorDialog(shell).run(false, >+ true, runnableWithProgress); >+ } catch (Exception e) { >+ UMLEditorPlugin.INSTANCE.log(e); >+ } >+ } >+ }, label)); >+ } >+ } >+ } >+ >+} >Index: src/org/eclipse/uml2/uml/editor/dialogs/PackageMergerOptionsDialog.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/plugins/org.eclipse.uml2.uml.editor/src/org/eclipse/uml2/uml/editor/dialogs/PackageMergerOptionsDialog.java,v >retrieving revision 1.2 >diff -u -r1.2 PackageMergerOptionsDialog.java >--- src/org/eclipse/uml2/uml/editor/dialogs/PackageMergerOptionsDialog.java 5 Jan 2007 21:48:51 -0000 1.2 >+++ src/org/eclipse/uml2/uml/editor/dialogs/PackageMergerOptionsDialog.java 4 Mar 2010 18:45:51 -0000 >@@ -22,15 +22,40 @@ > public class PackageMergerOptionsDialog > extends OptionsDialog { > >+ public static enum OptionSettings { >+ ECLIPSE_PACKAGE_MERGE_OPTIONS, >+ OMG_PACKAGE_MERGE_OPTIONS >+ }; >+ >+ private final OptionSettings optionSettings; >+ > public PackageMergerOptionsDialog(Shell parent, String title, >- String message, Map<String, String> options) { >+ String message, Map<String, String> options, OptionSettings settings) { > super(parent, title, message, options); >+ this.optionSettings = settings; > } > > @Override > protected void createOptionAreas(Composite parent) { > super.createOptionAreas(parent); > >+ String propertyUniquenessOption = null; >+ String associationSpecializationOption = null; >+ String capabilitiesOption = null; >+ >+ switch (optionSettings) { >+ case ECLIPSE_PACKAGE_MERGE_OPTIONS: >+ propertyUniquenessOption = reportChoiceLabel; >+ associationSpecializationOption = processChoiceLabel; >+ capabilitiesOption = processChoiceLabel; >+ break; >+ case OMG_PACKAGE_MERGE_OPTIONS: >+ propertyUniquenessOption = ignoreChoiceLabel; >+ associationSpecializationOption = ignoreChoiceLabel; >+ capabilitiesOption = ignoreChoiceLabel; >+ break; >+ } >+ > createOptionArea( > parent, > UMLEditorPlugin.INSTANCE >@@ -39,13 +64,14 @@ > new String[]{ignoreChoiceLabel, reportChoiceLabel}, > reportChoiceLabel); > >+ > createOptionArea( > parent, > UMLEditorPlugin.INSTANCE > .getString("_UI_DifferentPropertyUniqueness_label"), //$NON-NLS-1$ > UMLUtil.PackageMerger.OPTION__DIFFERENT_PROPERTY_UNIQUENESS, > new String[]{ignoreChoiceLabel, reportChoiceLabel}, >- reportChoiceLabel); >+ propertyUniquenessOption); > > createOptionArea(parent, > UMLEditorPlugin.INSTANCE.getString("_UI_EmptyUnions_label"), //$NON-NLS-1$ >@@ -77,7 +103,7 @@ > .getString("_UI_AssociationSpecializations_label"), //$NON-NLS-1$ > UMLUtil.PackageMerger.OPTION__ASSOCIATION_SPECIALIZATIONS, > new String[]{ignoreChoiceLabel, reportChoiceLabel, >- processChoiceLabel}, processChoiceLabel); >+ processChoiceLabel}, associationSpecializationOption); > > createOptionArea(parent, > UMLEditorPlugin.INSTANCE >@@ -90,7 +116,7 @@ > UMLEditorPlugin.INSTANCE.getString("_UI_Capabilities_label"), //$NON-NLS-1$ > UMLUtil.PackageMerger.OPTION__CAPABILITIES, new String[]{ > ignoreChoiceLabel, reportChoiceLabel, processChoiceLabel}, >- processChoiceLabel); >+ capabilitiesOption); > } > > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 304719
:
160990
| 161000