Skip to content

Commit

Permalink
[1801] Add option to store RPL elements in RPL specific packages
Browse files Browse the repository at this point in the history
This replaces the 'Use default parents' checkbox on the create/update
RPL dialog with a group of three radio buttons:

* Locate parents manually corresponds to the previous version with the
checkbox deselected

* Use default parents corresponds to the prevous version with the
checkbox selected

* Create specific packages is a new parent locator option where RPL
elements are grouped by their type and put into specific packages, e.g.
functions go to a FunctionPkg below the root function, components go
into a ComponentPkg below the root component etc. The package name is
the name of the target RPL. Note however that not all elements will be
stored in packages. E.g. Parts and Functional Exchanges will still use
the default parents. This is by requirement.

Change-Id: I70e714a4c6862c476463cdb461858a4b86badd92
Bug: 1801
Signed-off-by: Felix Dorner <felix.dorner@gmail.com>
  • Loading branch information
felixdo committed Mar 21, 2018
1 parent 0334c9b commit f8af09a
Show file tree
Hide file tree
Showing 31 changed files with 2,184 additions and 490 deletions.
18 changes: 9 additions & 9 deletions common/plugins/org.polarsys.capella.common.re.ui/plugin.xml
Expand Up @@ -385,10 +385,6 @@
renderer="targetTextRenderer">
</propertyBinding>

<propertyBinding
property="useDefaultLocation"
renderer="checkboxRenderer">
</propertyBinding>

<propertyBinding
property="targetContent"
Expand All @@ -403,6 +399,10 @@
property="readOnly"
renderer="checkboxRenderer">
</propertyBinding>
<propertyBinding
property="parentLocatorOption"
renderer="optionRenderer">
</propertyBinding>

</bindings>

Expand All @@ -415,10 +415,6 @@
<!-- ReplicableElement, name edit not allowed -->
</propertyBinding>

<propertyBinding
property="useDefaultLocation"
renderer="checkboxRenderer">
</propertyBinding>

<propertyBinding
property="itarget"
Expand Down Expand Up @@ -458,7 +454,11 @@
property="readOnly"
renderer="checkboxRenderer">
</propertyBinding>
</bindings>
<propertyBinding
property="parentLocatorOption"
renderer="optionRenderer">
</propertyBinding>
</bindings>

</extension>

Expand Down
@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2006, 2016 THALES GLOBAL SERVICES.
* Copyright (c) 2006, 2017 THALES GLOBAL SERVICES.
* 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:
* Thales - initial API and implementation
*******************************************************************************/
Expand All @@ -19,7 +19,6 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
import org.eclipse.jface.util.LocalSelectionTransfer;
Expand Down Expand Up @@ -191,23 +190,20 @@ protected Object getLocation(EObject element) {
}
location = LocationHandlerHelper.getInstance(ctx).getLocation(link, link.getOrigin(), ctx);
if (location == null) {
EObject defaultLocation = LocationHandlerHelper.getInstance(ctx).getDefaultLocation(link, link.getOrigin(), ctx);
if (defaultLocation != null) {
Object value =
context.getPropertyContext().getCurrentValue(
context.getPropertyContext().getProperties().getProperty(IReConstants.PROPERTY__USE_DEFAULT_LOCATION));
if (Boolean.FALSE.equals(value)) {
return null;
}
Object parentLocator =
context.getPropertyContext().getCurrentValue(
context.getPropertyContext().getProperties().getProperty(IReConstants.PROPERTY__PARENT_LOCATOR));

EObject defaultLocation = null;
if (!IReConstants.LOCATOR_OPTION_MANUAL.equals(parentLocator)) {
defaultLocation = LocationHandlerHelper.getInstance(ctx).getDefaultLocation(link, link.getOrigin(), ctx);
if (defaultLocation instanceof CatalogElementLink) {
if (!ContextScopeHandlerHelper.getInstance(ctx).contains(IReConstants.VIRTUAL_LINKS, defaultLocation, ctx)) {
return ((CatalogElementLink) defaultLocation).getTarget();
}
}
return defaultLocation;
}
return null;
return defaultLocation;
}

// For all links referencing a catalogElement, we put it in the link instead of the element
Expand Down
Expand Up @@ -262,14 +262,20 @@ protected IStatus getStatus(Object element, IRendererContext context) {
}
location = LocationHandlerHelper.getInstance(ctx).getLocation(link, link.getOrigin(), ctx);
if (location == null) {
EObject defaultLocation = LocationHandlerHelper.getInstance(ctx).getDefaultLocation(link, link.getOrigin(), ctx);

Object value =
Object parentLocator =
context.getPropertyContext().getCurrentValue(
context.getPropertyContext().getProperties().getProperty(IReConstants.PROPERTY__USE_DEFAULT_LOCATION));
if (Boolean.FALSE.equals(value) || (defaultLocation == null)) {
context.getPropertyContext().getProperties().getProperty(IReConstants.PROPERTY__PARENT_LOCATOR));

EObject defaultLocation = null;
if (!IReConstants.LOCATOR_OPTION_MANUAL.equals(parentLocator)) {
defaultLocation = LocationHandlerHelper.getInstance(ctx).getDefaultLocation(link, link.getOrigin(), ctx);
}

if (defaultLocation == null) {
return new Status(IStatus.WARNING, " ", "no location");
}

return new Status(IStatus.INFO, " ", "default location");
}
}
Expand Down
2 changes: 1 addition & 1 deletion common/plugins/org.polarsys.capella.common.re/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
Expand Down
@@ -1,7 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.compiler.source=1.8
Expand Up @@ -15,7 +15,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.polarsys.capella.common.model.helpers,
org.polarsys.capella.common.transition;visibility:=reexport,
com.google.guava;bundle-version="[15.0.0,16.0.0)"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Export-Package: org.polarsys.capella.common.re,
Expand Down
94 changes: 69 additions & 25 deletions common/plugins/org.polarsys.capella.common.re/plugin.xml
Expand Up @@ -605,17 +605,6 @@
name="Compliancy">
</property>

<property
class="org.polarsys.capella.common.flexibility.properties.property.BooleanPropertyPreference"
enabled="true"
group="org.polarsys.capella.common.re.description.replicableElementGroup"
id="useDefaultLocation"
name="Use default location for RPL elements">

<parameter
id="scope" value="org.polarsys.capella.common.re">
</parameter>
</property>



Expand Down Expand Up @@ -658,6 +647,39 @@
id="readOnly"
name="Enforce RPL Compliance On The Fly">
</property>
<property
class="org.polarsys.capella.common.re.properties.ParentLocatorProperty"
enabled="true"
group="replicableElementGroup"
id="parentLocatorOption"
name="Parent Location">
<option
enabled="true"
id="defaultLocator"
name="Use default locations"
value="defaultLocator">
</option>
<option
enabled="true"
id="packageLocator"
name="Create specific packages"
value="packageLocator">
</option>
<option
enabled="true"
id="manualLocator"
name="Locate parents manually"
value="manualLocator">
</option>
<parameter
id="default"
value="defaultLocator">
</parameter>
<parameter
id="scope"
value="org.polarsys.capella.common.re">
</parameter>
</property>

</properties>

Expand Down Expand Up @@ -730,20 +752,7 @@
id="currentCompliancy"
name="Compliancy">
</property>

<property
class="org.polarsys.capella.common.flexibility.properties.property.BooleanPropertyPreference"
enabled="true"
group="org.polarsys.capella.common.re.description.replicableElementGroup"
id="useDefaultLocation"
name="Use default location for RPL elements">

<parameter
id="scope" value="org.polarsys.capella.common.re">
</parameter>

</property>


<property
class="org.polarsys.capella.common.re.re2rpl.update.properties.ReplicaProperty"
enabled="true"
Expand Down Expand Up @@ -776,6 +785,41 @@
name="Enforce RPL Compliance On The Fly">
</property>

<property
class="org.polarsys.capella.common.re.properties.ParentLocatorProperty"
enabled="true"
group="replicableElementGroup"
id="parentLocatorOption"
name="Parent Location">
<option
enabled="true"
id="defaultLocator"
name="Use default locations"
value="defaultLocator">
</option>
<option
enabled="true"
id="packageLocator"
name="Create specific packages"
value="packageLocator">
</option>
<option
enabled="true"
id="manualLocator"
name="Locate parents manually"
value="manualLocator">
</option>
<parameter
id="default"
value="defaultLocator">
</parameter>
<parameter
id="scope"
value="org.polarsys.capella.common.re">
</parameter>
</property>


</properties>

</extension>
Expand Down
Expand Up @@ -4,55 +4,68 @@
* 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:
* Thales - initial API and implementation
*******************************************************************************/
package org.polarsys.capella.common.re;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.osgi.framework.BundleContext;
import org.osgi.service.prefs.BackingStoreException;

/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends Plugin {

// The plug-in ID
public static final String PLUGIN_ID = "org.polarsys.capella.common.re"; //$NON-NLS-1$

// The shared instance
private static Activator plugin;

/**
* The constructor
*/
public Activator() {
}

/**
* {@inheritDoc}
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}

/**
* {@inheritDoc}
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}

/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
// The plug-in ID
public static final String PLUGIN_ID = "org.polarsys.capella.common.re"; //$NON-NLS-1$

// The shared instance
private static Activator plugin;

/**
* The constructor
*/
public Activator() {
}

/**
* {@inheritDoc}
*/
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}

/**
* {@inheritDoc}
*/
@Override
public void stop(BundleContext context) throws Exception {
try {
// persist parent locator option preference
InstanceScope.INSTANCE.getNode(PLUGIN_ID).flush();
} catch (BackingStoreException e) {
getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, e.getLocalizedMessage(), e));
} finally {
plugin = null;
super.stop(context);
}
}

/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}

}
Expand Up @@ -32,7 +32,12 @@ public class IReConstants {

public static final String PROPERTY__SCOPE = "source.scopeElements"; //$NON-NLS-1$
public static final String PROPERTY__ALL_SCOPE = "source.allScopeElements"; //$NON-NLS-1$
public static final String PROPERTY__USE_DEFAULT_LOCATION = "useDefaultLocation"; //$NON-NLS-1$

public static final String PROPERTY__PARENT_LOCATOR = "parentLocatorOption"; //$NON-NLS-1$
public static final String LOCATOR_OPTION_DEFAULT = "defaultLocator"; //$NON-NLS-1$
public static final String LOCATOR_OPTION_SPECIFIC_PACKAGES = "packageLocator"; //$NON-NLS-1$
public static final String LOCATOR_OPTION_MANUAL = "manualLocator"; //$NON-NLS-1$

public static final String PROPERTY__MERGE_SOURCE_SCOPE = "merge_sourceScope"; //$NON-NLS-1$
public static final String PROPERTY__MERGE_TARGET_SCOPE = "merge_targetScope"; //$NON-NLS-1$

Expand Down

0 comments on commit f8af09a

Please sign in to comment.