### 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"> + name="org.eclipse.uml2.uml.Package"> 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 @@ + + + + + + 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 options = new HashMap(); + + 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 context = new HashMap(); + 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 options) { + String message, Map 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); } }