Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2014-01-28 09:31:32 -0500
committervlorenzo2014-01-28 09:31:32 -0500
commit1d6e3377c3654ae798b46c4f60f1d94777f16e7b (patch)
tree84121171963e5ff1e8970848a21aec414c69ec40 /plugins
parent8389847f0bb01e701347bfb419b6dac3b2f4f0dc (diff)
parent4889444a92221b1a6584b5d748ff3aa9dc8cb9d5 (diff)
downloadorg.eclipse.papyrus-1d6e3377c3654ae798b46c4f60f1d94777f16e7b.tar.gz
org.eclipse.papyrus-1d6e3377c3654ae798b46c4f60f1d94777f16e7b.tar.xz
org.eclipse.papyrus-1d6e3377c3654ae798b46c4f60f1d94777f16e7b.zip
Merge branch 'master' of ssh://vlorenzo@git.eclipse.org/gitroot/papyrus/org.eclipse.papyrus.git
Diffstat (limited to 'plugins')
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ProxyModificationTrackingAdapter.java264
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/BasicControlCommand.java157
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/draw2d/StickMan.java32
3 files changed, 223 insertions, 230 deletions
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ProxyModificationTrackingAdapter.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ProxyModificationTrackingAdapter.java
index 417e650abfb..1c3e510af84 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ProxyModificationTrackingAdapter.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/ProxyModificationTrackingAdapter.java
@@ -1,128 +1,136 @@
-/*****************************************************************************
- * Copyright (c) 2013 Atos.
- *
- *
- * 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:
- * Mathieu Velten (Atos) mathieu.velten@atos.net - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.core.resource;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.util.TreeIterator;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.EStructuralFeature.Setting;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.util.EContentAdapter;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.papyrus.infra.core.utils.EMFHelper;
-
-/**
- * This adapter handles "modified" flag of resources for tricky cases :
- *
- * - when there is a change in an URI all the resources containing a proxy
- * to the modified resource should be marked as modified
- *
- * - when adding/removing objects from resources they should be marked as modified,
- * and all the resources containing a proxy too
- *
- * - when doing control/uncontrol operations the resource of the parent object
- * should be marked as modified
- *
- * @author mvelten
- *
- */
-public class ProxyModificationTrackingAdapter extends EContentAdapter {
-
- @Override
- protected void setTarget(Resource target) {
- basicSetTarget(target);
- }
-
- @Override
- protected void unsetTarget(Resource target) {
- basicUnsetTarget(target);
- }
-
- @Override
- protected void setTarget(EObject target) {
- }
-
- @Override
- protected void unsetTarget(EObject target) {
- }
-
- @Override
- public void notifyChanged(Notification n) {
- Object notifier = n.getNotifier();
-
- if (notifier instanceof Resource) {
- Resource r = (Resource)notifier;
-
- if (n.getEventType() == Notification.SET && n.getFeatureID(Resource.class) == Resource.RESOURCE__URI) {
- r.setModified(true);
-
- TreeIterator<Object> properContents = EcoreUtil.getAllProperContents(r, false);
- while(properContents.hasNext()) {
- Object obj = properContents.next();
- if (obj instanceof EObject) {
- setReferencingResourcesAsModified((EObject)obj);
- }
- }
-
- } else {
- List objects = new ArrayList();
-
- switch(n.getEventType()) {
- case Notification.ADD_MANY:
- objects = (List<?>)n.getNewValue();
- break;
- case Notification.REMOVE_MANY:
- objects = (List<?>)n.getOldValue();
- break;
- case Notification.ADD:
- objects.add(n.getNewValue());
- break;
- case Notification.REMOVE:
- objects.add(n.getOldValue());
- break;
- }
-
- if (!objects.isEmpty()) {
- r.setModified(true);
- }
-
- for (Object o : objects) {
- if (o instanceof EObject) {
- setReferencingResourcesAsModified((EObject)o);
- }
- }
- }
- }
-
- super.notifyChanged(n);
- }
-
- protected void setReferencingResourcesAsModified(EObject eObj) {
- Collection<Setting> references = EMFHelper.getUsages(eObj);
- for (Setting setting : references) {
- EStructuralFeature f = setting.getEStructuralFeature();
- if(setting.getEObject() != null && !f.isDerived() && !f.isTransient()) {
- Resource refResource = setting.getEObject().eResource();
- if(refResource != null) {
- refResource.setModified(true);
- }
- }
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 Atos.
+ *
+ *
+ * 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:
+ * Mathieu Velten (Atos) mathieu.velten@atos.net - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.core.resource;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EStructuralFeature.Setting;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EContentAdapter;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.papyrus.infra.core.utils.EMFHelper;
+
+/**
+ * This adapter handles "modified" flag of resources for tricky cases :
+ *
+ * - when there is a change in an URI all the resources containing a proxy
+ * to the modified resource should be marked as modified
+ *
+ * - when adding/removing objects from resources they should be marked as modified,
+ * and all the resources containing a proxy too
+ *
+ * - when doing control/uncontrol operations the resource of the parent object
+ * should be marked as modified
+ *
+ * @author mvelten
+ *
+ */
+public class ProxyModificationTrackingAdapter extends EContentAdapter {
+
+ @Override
+ protected void setTarget(Resource target) {
+ basicSetTarget(target);
+ }
+
+ @Override
+ protected void unsetTarget(Resource target) {
+ basicUnsetTarget(target);
+ }
+
+ @Override
+ protected void setTarget(EObject target) {
+ }
+
+ @Override
+ protected void unsetTarget(EObject target) {
+ }
+
+ @Override
+ public void notifyChanged(Notification n) {
+ Object notifier = n.getNotifier();
+
+ if(notifier instanceof Resource.Internal) {
+ Resource.Internal r = (Resource.Internal)notifier;
+
+ if (n.getEventType() == Notification.SET && n.getFeatureID(Resource.class) == Resource.RESOURCE__URI) {
+ r.setModified(true);
+
+ TreeIterator<Object> properContents = EcoreUtil.getAllProperContents(r, false);
+ while(properContents.hasNext()) {
+ Object obj = properContents.next();
+ if (obj instanceof EObject) {
+ setReferencingResourcesAsModified((EObject)obj);
+ }
+ }
+
+ } else {
+ List objects = new ArrayList();
+
+ switch(n.getEventType()) {
+ case Notification.ADD_MANY:
+ objects = (List<?>)n.getNewValue();
+ break;
+ case Notification.REMOVE_MANY:
+ objects = (List<?>)n.getOldValue();
+ break;
+ case Notification.ADD:
+ objects.add(n.getNewValue());
+ break;
+ case Notification.REMOVE:
+ objects.add(n.getOldValue());
+ break;
+ }
+
+ if(!r.isLoading()) {
+ if(!objects.isEmpty()) {
+ r.setModified(true);
+ }
+
+ for(Object o : objects) {
+ if(o instanceof EObject) {
+ TreeIterator<Object> properContents = EcoreUtil.getAllProperContents((EObject)o, false);
+ while(properContents.hasNext()) {
+ Object obj = properContents.next();
+ if(obj instanceof EObject) {
+ setReferencingResourcesAsModified((EObject)obj);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ super.notifyChanged(n);
+ }
+
+ protected void setReferencingResourcesAsModified(EObject eObj) {
+ Collection<Setting> references = EMFHelper.getUsages(eObj);
+ for (Setting setting : references) {
+ EStructuralFeature f = setting.getEStructuralFeature();
+ if(setting.getEObject() != null && !f.isDerived() && !f.isTransient()) {
+ Resource.Internal refResource = (org.eclipse.emf.ecore.resource.Resource.Internal)setting.getEObject().eResource();
+ if(refResource != null && !refResource.isLoading()) {
+ refResource.setModified(true);
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/BasicControlCommand.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/BasicControlCommand.java
index 9fc09aea5f4..7827eebf609 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/BasicControlCommand.java
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.controlmode/src/org/eclipse/papyrus/infra/services/controlmode/commands/BasicControlCommand.java
@@ -1,76 +1,81 @@
-/*****************************************************************************
- * Copyright (c) 2013 Atos.
- *
- *
- * 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:
- * Arthur Daussy (Atos) arthur.daussy@atos.net - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.services.controlmode.commands;
-
-import java.util.Collections;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest;
-
-/**
- * This command do the basic operation of the control. That is to say move the semantic element to a new resource previously created.
- * This resource id got thanks to the request.
- *
- * @author adaussy
- *
- */
-public class BasicControlCommand extends AbstractControlCommand {
-
-
- /**
- * @param request
- */
- public BasicControlCommand(ControlModeRequest request) {
- super("Control command", Collections.singletonList(WorkspaceSynchronizer.getFile(request.getTargetObject().eResource())), request);
- }
-
- @Override
- public boolean canExecute() {
- return super.canExecute() && getObjectToControl() != null && !getObjectToControl().eIsProxy();
- }
-
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- ResourceSet currentResourceSet = getRequest().getModelSet();
- Resource resource = currentResourceSet.getResource(getNewURI(), false);
- if(resource == null) {
- throw new ExecutionException("The resource was not created");
- }
- resource.getContents().add(getObjectToControl());
- return CommandResult.newOKCommandResult(resource);
- }
-
-
- /**
- * @return the object being controled
- */
- public EObject getObjectToControl() {
- return getRequest().getTargetObject();
- }
-
- /**
- * @return
- */
- public URI getNewURI() {
- return getRequest().getNewURI();
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2013 Atos.
+ *
+ *
+ * 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:
+ * Arthur Daussy (Atos) arthur.daussy@atos.net - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.services.controlmode.commands;
+
+import java.util.Collections;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest;
+
+/**
+ * This command do the basic operation of the control. That is to say move the semantic element to a new resource previously created.
+ * This resource id got thanks to the request.
+ *
+ * @author adaussy
+ *
+ */
+public class BasicControlCommand extends AbstractControlCommand {
+
+
+ /**
+ * @param request
+ */
+ public BasicControlCommand(ControlModeRequest request) {
+ super("Control command", Collections.singletonList(WorkspaceSynchronizer.getFile(request.getTargetObject().eResource())), request);
+ }
+
+ @Override
+ public boolean canExecute() {
+ return super.canExecute() && getObjectToControl() != null && !getObjectToControl().eIsProxy();
+ }
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ ResourceSet currentResourceSet = getRequest().getModelSet();
+ Resource resource = currentResourceSet.getResource(getNewURI(), false);
+ if(resource == null) {
+ throw new ExecutionException("The resource was not created");
+ }
+ EObject objectToControl = getObjectToControl();
+ // as a safeguard, add this object's resource so it is tagged as modified and savable
+ if(objectToControl != null && objectToControl.eResource() != null) {
+ objectToControl.eResource().setModified(true);
+ }
+ resource.getContents().add(objectToControl);
+ return CommandResult.newOKCommandResult(resource);
+ }
+
+
+ /**
+ * @return the object being controled
+ */
+ public EObject getObjectToControl() {
+ return getRequest().getTargetObject();
+ }
+
+ /**
+ * @return
+ */
+ public URI getNewURI() {
+ return getRequest().getNewURI();
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/draw2d/StickMan.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/draw2d/StickMan.java
index 593a7c3a50b..bac3ad180df 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/draw2d/StickMan.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/draw2d/StickMan.java
@@ -60,9 +60,15 @@ public class StickMan extends ShadowShape implements IPapyrusNodeNamedElementFig
@Override
protected void outlineShape(Graphics graphics, Rectangle bounds) {
PointList pl = setupPoints(bounds);
+ int oldLW = graphics.getLineWidth();
+ if (graphics.getLineWidth() < 1) {
+ // fix for bug 425182 - [Use Case Diagram] Actor invisible in use case diagram
+ graphics.setLineWidth(1);
+ }
graphics.drawPolygon(pl);
int add = graphics.getLineWidth() / 2;
graphics.drawOval(new Rectangle(ovalX, ovalY, ovalD + add, ovalD + add));
+ graphics.setLineWidth(oldLW);
}
/**
@@ -163,98 +169,76 @@ public class StickMan extends ShadowShape implements IPapyrusNodeNamedElementFig
@Override
public void setStereotypePropertiesInBrace(String stereotypeProperties) {
- // TODO Auto-generated method stub
}
@Override
public void setStereotypePropertiesInCompartment(String stereotypeProperties) {
- // TODO Auto-generated method stub
}
@Override
public Label getStereotypesLabel() {
- // TODO Auto-generated method stub
return null;
}
@Override
public void setStereotypeDisplay(String stereotypes, Image image) {
- // TODO Auto-generated method stub
}
@Override
public void setQualifiedName(String qualifiedName) {
- // TODO Auto-generated method stub
}
@Override
public Label getQualifiedNameLabel() {
- // TODO Auto-generated method stub
return null;
}
@Override
public Label getTaggedLabel() {
- // TODO Auto-generated method stub
return null;
}
@Override
public void setDepth(int depth) {
- // TODO Auto-generated method stub
}
@Override
public WrappingLabel getNameLabel() {
- // TODO Auto-generated method stub
return null;
}
@Override
public void setNameLabelIcon(boolean displayNameLabelIcon) {
- // TODO Auto-generated method stub
}
@Override
public Color getBorderColor() {
- // TODO Auto-generated method stub
return null;
}
@Override
public boolean isShadow() {
- // TODO Auto-generated method stub
return false;
}
@Override
public void setBorderColor(Color borderColor) {
- // TODO Auto-generated method stub
-
}
@Override
public void setShadow(boolean shadow) {
- // TODO Auto-generated method stub
-
}
@Override
public void setTransparency(int transparency) {
- // TODO Auto-generated method stub
-
}
@Override
public void setGradientData(int gradientColor1, int gradientColor2, int gradientStyle) {
- // TODO Auto-generated method stub
-
}
@Override
public void setIsUsingGradient(boolean b) {
- // TODO Auto-generated method stub
-
}
@Override
@@ -269,21 +253,17 @@ public class StickMan extends ShadowShape implements IPapyrusNodeNamedElementFig
@Override
public void removeStereotypeLabel() {
-
}
@Override
public void restoreStereotypeLabel() {
-
}
@Override
public void restoreTaggedLabel() {
-
}
@Override
public void removeTaggedLabel() {
-
}
}

Back to the top