diff options
Diffstat (limited to 'plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/CustomStyleModelElementFactory.java')
-rw-r--r-- | plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/CustomStyleModelElementFactory.java | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/CustomStyleModelElementFactory.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/CustomStyleModelElementFactory.java index ba79180cb05..09936e4f83e 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/CustomStyleModelElementFactory.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.properties/src/org/eclipse/papyrus/infra/gmfdiag/properties/modelelement/CustomStyleModelElementFactory.java @@ -1,52 +1,52 @@ -/*****************************************************************************
- * Copyright (c) 2012, 2015 CEA LIST, Christian W. Damus, 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 417409
- * Christian W. Damus - bug 455075
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.properties.modelelement;
-
-import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
-import org.eclipse.papyrus.infra.gmfdiag.properties.Activator;
-import org.eclipse.papyrus.infra.properties.contexts.DataContextElement;
-import org.eclipse.papyrus.views.properties.modelelement.AbstractEMFModelElementFactory;
-
-
-public class CustomStyleModelElementFactory extends AbstractEMFModelElementFactory<CustomStyleModelElement> {
-
- @Override
- protected CustomStyleModelElement doCreateFromSource(Object sourceElement, DataContextElement context) {
- View view = NotationHelper.findView(sourceElement);
-
- if (view != null) {
- EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(view);
- return new CustomStyleModelElement(view, domain, context);
- }
-
- Activator.log.warn("The selected element cannot be resolved to a GMF View");
- return null;
- }
-
- @Override
- protected void updateModelElement(CustomStyleModelElement modelElement, Object newSourceElement) {
- View view = NotationHelper.findView(newSourceElement);
- if (view == null) {
- throw new IllegalArgumentException("Cannot resolve GMF notation view selection: " + newSourceElement);
- }
-
- updateEMFModelElement(modelElement, view);
- modelElement.view = view;
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2012, 2015 CEA LIST, Christian W. Damus, 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 417409 + * Christian W. Damus - bug 455075 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.properties.modelelement; + +import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper; +import org.eclipse.papyrus.infra.gmfdiag.properties.Activator; +import org.eclipse.papyrus.infra.properties.contexts.DataContextElement; +import org.eclipse.papyrus.infra.properties.ui.modelelement.AbstractEMFModelElementFactory; + + +public class CustomStyleModelElementFactory extends AbstractEMFModelElementFactory<CustomStyleModelElement> { + + @Override + protected CustomStyleModelElement doCreateFromSource(Object sourceElement, DataContextElement context) { + View view = NotationHelper.findView(sourceElement); + + if (view != null) { + EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(view); + return new CustomStyleModelElement(view, domain, context); + } + + Activator.log.warn("The selected element cannot be resolved to a GMF View"); + return null; + } + + @Override + protected void updateModelElement(CustomStyleModelElement modelElement, Object newSourceElement) { + View view = NotationHelper.findView(newSourceElement); + if (view == null) { + throw new IllegalArgumentException("Cannot resolve GMF notation view selection: " + newSourceElement); + } + + updateEMFModelElement(modelElement, view); + modelElement.view = view; + } + +} |