Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Fasani2017-07-18 16:03:18 +0000
committerLaurent Fasani2017-07-19 07:48:06 +0000
commit64440fea741fd0b6fcdc6def3ccad7d282effabb (patch)
tree9e957189ce1f56b7c6bb763e20099543a3cab216
parent18580ba53e9329c13d5a172779ad39fd81b14a42 (diff)
downloadorg.eclipse.sirius-64440fea741fd0b6fcdc6def3ccad7d282effabb.tar.gz
org.eclipse.sirius-64440fea741fd0b6fcdc6def3ccad7d282effabb.tar.xz
org.eclipse.sirius-64440fea741fd0b6fcdc6def3ccad7d282effabb.zip
[516669] Allow to overload DRepLocationRuleForLocalResource for subClass
* Add the protected method org.eclipse.sirius.business.internal.representation.DRepLocationRuleForLocalResource.getSuffix(String) so that it can be overloaded Bug: 516669 Change-Id: I0daa58a61f7231fbe780c686ce0f1572191c9e98 Signed-off-by: Laurent Fasani <laurent.fasani@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/representation/DRepLocationRuleForLocalResource.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/representation/DRepLocationRuleForLocalResource.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/representation/DRepLocationRuleForLocalResource.java
index 7eb83dcf2c..38506268f1 100644
--- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/representation/DRepLocationRuleForLocalResource.java
+++ b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/representation/DRepLocationRuleForLocalResource.java
@@ -62,13 +62,18 @@ public class DRepLocationRuleForLocalResource implements DRepresentationLocation
protected URI getDedicatedRepResourceURI(DRepresentation representation, Resource airdResource) {
int count = 1;
ResourceSet resourceSet = airdResource.getResourceSet();
- URI repUri = createRepURI(airdResource, representation, count++);
+ String suffix = getSuffix();
+ URI repUri = createRepURI(airdResource, representation, suffix, count++);
while (!isUsableURI(repUri, resourceSet, representation)) {
- repUri = createRepURI(airdResource, representation, count++);
+ repUri = createRepURI(airdResource, representation, suffix, count++);
}
return repUri;
}
+ protected String getSuffix() {
+ return null;
+ }
+
private boolean isUsableURI(URI repUri, ResourceSet resourceSet, DRepresentation representation) {
boolean usableURI = true;
Resource resource = resourceSet.getResource(repUri, false);
@@ -115,14 +120,18 @@ public class DRepLocationRuleForLocalResource implements DRepresentationLocation
* the aird resource
* @param representation
* the representation
+ * @param providedSuffix
+ * suffix to add to the URI. If null, the count is used instead
* @param count
+ * the counter that may be used to have an unique URI
* @return the representation URI
*/
- private URI createRepURI(Resource airdResource, DRepresentation representation, int count) {
+ protected URI createRepURI(Resource airdResource, DRepresentation representation, String providedSuffix, int count) {
// get the representation URI fragment
RepresentationDescription description = DialectManager.INSTANCE.getDescription(representation);
String repName = description.getName().replace(' ', '_');
- repName += "_" + String.valueOf(count); //$NON-NLS-1$
+ String suffix = providedSuffix != null ? providedSuffix : String.valueOf(count);
+ repName += "_" + suffix; //$NON-NLS-1$
URI airdURI = airdResource.getURI();

Back to the top