Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCedric Dumoulin2014-05-30 14:22:36 +0000
committerCedric Dumoulin2014-11-29 22:41:33 +0000
commitb2b1b55d93da66efd428624804b819a6c242f522 (patch)
treea91f87e9ebce7597aea295d532b97f7fddd14ee5 /plugins/uml/org.eclipse.papyrus.uml.profile
parent47eaabe9a883c5f5414bc32a3bbcf7db0ce38c3c (diff)
downloadorg.eclipse.papyrus-b2b1b55d93da66efd428624804b819a6c242f522.tar.gz
org.eclipse.papyrus-b2b1b55d93da66efd428624804b819a6c242f522.tar.xz
org.eclipse.papyrus-b2b1b55d93da66efd428624804b819a6c242f522.zip
432802 [profile] - Move ReadWrite handler to draft.profile
Diffstat (limited to 'plugins/uml/org.eclipse.papyrus.uml.profile')
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/AppliedProfileReadOptionalyWriteHandler.java87
1 files changed, 0 insertions, 87 deletions
diff --git a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/AppliedProfileReadOptionalyWriteHandler.java b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/AppliedProfileReadOptionalyWriteHandler.java
deleted file mode 100644
index 05f41ef261a..00000000000
--- a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/AppliedProfileReadOptionalyWriteHandler.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012, 2014 CEA LIST 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:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- * Christian W. Damus (CEA) - bug 429826
- * Camille Letavernier (CEA LIST) - Bug 430118
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.profile;
- import java.util.Set;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.papyrus.infra.core.resource.AbstractReadOnlyHandler;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.resource.ReadOnlyAxis;
-import org.eclipse.papyrus.uml.tools.model.UmlModel;
-import org.eclipse.uml2.uml.Profile;
-
-import com.google.common.base.Optional;
-
-
-/**
- * Discretion-based read-only handler for applied profiles.
- */
-public class AppliedProfileReadOptionalyWriteHandler extends AbstractReadOnlyHandler {
-
- public AppliedProfileReadOptionalyWriteHandler(EditingDomain editingDomain) {
- super(editingDomain);
- }
-
- public Optional<Boolean> anyReadOnly(Set<ReadOnlyAxis> axes, URI[] uris) {
- if((getEditingDomain() != null) && axes.contains(ReadOnlyAxis.DISCRETION)) {
- Resource mainUmlResource = null;
- if(getEditingDomain().getResourceSet() instanceof ModelSet) {
- UmlModel umlModel = (UmlModel)((ModelSet)getEditingDomain().getResourceSet()).getModel(UmlModel.MODEL_ID);
- if(umlModel == null) {
- return Optional.absent();
- }
- mainUmlResource = umlModel.getResource();
- }
-
- for(URI uri : uris) {
- Resource resource = getEditingDomain().getResourceSet().getResource(uri.trimFragment(), false);
- if(isProfileResource(resource) && mainUmlResource != resource) {
- return Optional.absent();
-// return Optional.of(Boolean.TRUE);
- }
- }
- }
-
- return Optional.absent();
- }
-
- private boolean isProfileResource(Resource resource) {
- if(resource == null) {
- return false;
- }
-
- if(!resource.getContents().isEmpty() && resource.getContents().get(0) instanceof Profile) {
- return true;
- }
-
- return false;
- }
-
- /**
- * We want to be able to modify existing profiles.
- *
- * @see org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler2#makeWritable(java.util.Set, org.eclipse.emf.common.util.URI[])
- *
- * @param axes
- * @param uris
- * @return
- */
- public Optional<Boolean> makeWritable(Set<ReadOnlyAxis> axes, URI[] uris) {
- return Optional.of(Boolean.TRUE);
- }
-
-}

Back to the top