Commit 3e9251f4 authored by Johannes Eder's avatar Johannes Eder

Merge branch '3979' into 'master'

3979

See merge request !333
parents 2bf23edc 512a5b5c
AF3SafetyCasesUIActivator.java f1f4a24ee67283a9410be9ec2bb0442f2553f7bc GREEN
AF3SafetyCasesUIActivator.java 607baeaa170508d975867f5f7bdfcb3d346fed4e GREEN
DefaultStyle.java 3ba5df36d48da2b55bc8137932fc6defacba466e GREEN
......@@ -23,6 +23,7 @@ import java.util.HashMap;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.fortiss.tooling.kernel.service.ILibraryService;
import org.osgi.framework.BundleContext;
import javafx.scene.image.Image;
......
......@@ -11,7 +11,7 @@ GoalToBeSupportedByContract.java 77a97f68382aa99350120a91f84517eee1d363ad GREEN
GoalUndevelopedEntity.java 8b83d59da580cb431a00d0072e5fbefb022d3637 GREEN
MakeAChoice.java f8e7f4185bfeb451faf47b111826830aee3f55e3 GREEN
SCElementIsImpacted.java 745436bf71435bd50e28450cdd3090201e1a175c GREEN
SCElementIsInstantiated.java 87284c59ee3f65266cf746bf64ab9605b2ea39a5 GREEN
SCElementIsInstantiated.java cefa135b7a6ec514405d26e3a5c32f60aacc21a0 GREEN
SCElementIsPrivate.java 30a3bf574a42284a97d6a840de31aad61f4258f8 GREEN
ShowPotentialChangeImpact.java 747a3c979e9a58e025bb6b9377f9125809a04a7d GREEN
StrategyUndevelopedEntity.java 753b40ae7d6a5230ee12becea6a01971dc64eb46 GREEN
......@@ -24,6 +24,7 @@ import static org.fortiss.tooling.kernel.ui.service.IContextMenuService.AFTER_GL
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.action.Action;
......@@ -70,7 +71,7 @@ public class SCElementIsInstantiated implements IContextMenuContributor {
return AFTER_GLOBAL_MENU_SECTION_ID;
}
/** The action to uninstantiated. */
/** The action to annotate an element instantiated. */
private class ElementIsUninstantiatedAction extends Action {
/** The selected element. */
private ArgumentElement selectedArgumentElement;
......@@ -96,21 +97,18 @@ public class SCElementIsInstantiated implements IContextMenuContributor {
return;
}
String textualInformation = selectedArgumentElement.getTextualInformation();
if(selectedArgumentElement.isToBeInstantiated() == true &&
!textualInformation.contains("{") &&
!textualInformation.contains("}")) {
selectedArgumentElement.setToBeInstantiated(false);
} else if(textualInformation.contains("{") ||
textualInformation.contains("}")) {
if(Pattern.matches("^\\{((.|\\n)*)}$", textualInformation)) {
openWarning(getCurrent().getActiveShell(), "",
"This element cannot be set as instantiated since its claim still contains uninstantiated words!");
} else {
selectedArgumentElement.setToBeInstantiated(false);
}
}
});
}
}
/** The action to uninstantiated. */
/** The action to annotate an element as uninstantiated. */
public class ElementIsInstantiatedAction extends Action {
/** The selected element. */
private ArgumentElement selectedArgumentElement;
......
......@@ -10,7 +10,7 @@ ContractModuleHandler.java 289d45ee01ed1c87c72f8e31574ad5ff9dbf643d GREEN
EntryConnectorHandler.java 20ff38072063995a4d6ae14e6b305fe30339ba48 GREEN
ExitConnectorHandler.java 3cd4dc02127ba6475538dda82274ad90d19a9ea8 GREEN
GoalHandler.java ae316bccc94f47358554e05ee8911fe7c905fa3e GREEN
InContextOfHandler.java ecc268e321968db3b0e73112e9d81f88c283ee85 GREEN
InContextOfHandler.java 2015ef3f7ed0008f1f0288025b937e87ecc00335 GREEN
JustificationHandler.java 14c741379dbd33c78efd335de483264a438d6ec5 GREEN
LibraryModuleHandler.java 5181a1685835c4b9b2a1334b0204ff92700a1f91 GREEN
LibraryModulePackageHandler.java 76389383c251cbe91b53cab6614df8db1af9c0ce GREEN
......@@ -24,5 +24,5 @@ SafetyClaimPatternsCollectionHandler.java 7d8f1e007178f2e501e050669eb8074f71a9de
SafetyClaimPatternsDatabaseHandler.java f8d5ab95e4f8000adcbfd9ca366a14aa4245ac08 GREEN
SolutionHandler.java 5a4257a1710085c0c3f2c64b8d73e47140555b61 GREEN
StrategyHandler.java f432c08e4fd6c8bd7a7dcd0d214eb7f8fe2bbdb7 GREEN
SupportedByHandler.java ad4bd5f11c30d692ca6b1095fe15a3216ef9a5cd GREEN
SupportedByHandler.java 91111b8e1b2ef885261fe728d645f8b5b5f8be09 GREEN
WordAndObjectTypeHandler.java 4a1a34343662001b2d8026972a9baa21f8f5c6e0 GREEN
......@@ -37,6 +37,6 @@ public class InContextOfHandler extends NamedCommentedModelElementHandlerBase<In
/** {@inheritDoc} */
@Override
protected String getIconPath(InContextOf element) {
return null;
return "icons/SupportedByIcon.png";
}
}
......@@ -22,6 +22,6 @@ public class SupportedByHandler extends NamedCommentedModelElementHandlerBase<Su
/** {@inheritDoc} */
@Override
protected String getIconPath(SupportedBy element) {
return null;
return "icons/SupportedByIcon.png";
}
}
......@@ -6,6 +6,6 @@ AwayEntityPropertySection.java d842ca008db9bc2fb370718221a65c995dd475bd GREEN
ChangePropertySection.java fdcd457de707448a7f7d98c42db1f284fb678cc4 GREEN
ConnectionPropertySection.java 6101c574492d76c75a5062a6bb173626403cacd4 GREEN
ContextPropertySection.java 3901c88aee6a6e659a997d1fe76ab333a227c526 GREEN
GSNStatesPropertySection.java af635854649f8f477c3d92de8189ae08ff5b917a GREEN
GSNStatesPropertySection.java ef75c66659b87cdf4fcafac7f02555cd296362fe GREEN
OptionEntityPropertySection.java 783afb90532861c185a2e4ea5bd3c1b7e92483c2 GREEN
QuantitativeEvaluationPropertySection.java 3abfb63be471ff17ac97cc19078da83f99e48a41 GREEN
......@@ -252,7 +252,7 @@ public class GSNStatesPropertySection extends PropertySectionBase {
} else {
isPrivateCheckbox.setVisible(false);
}
isInstantiatedCheckbox.setSelection(currentlySelectedSection.isToBeInstantiated());
isInstantiatedCheckbox.setSelection(!currentlySelectedSection.isToBeInstantiated());
if(getActualMaintainanceStatus(currentlySelectedSection) == CHALLENGED) {
isChallengedCheckbox.setSelection(true);
} else {
......@@ -281,16 +281,11 @@ public class GSNStatesPropertySection extends PropertySectionBase {
isUndevelopedCheckbox.setVisible(true);
if(currentlySelectedSection instanceof Goal) {
isUndevelopedCheckbox
.setSelection(((Goal)currentlySelectedSection).isToBeDeveloped());
.setSelection(!((Goal)currentlySelectedSection).isToBeDeveloped());
}
if(currentlySelectedSection instanceof Strategy) {
if(((Strategy)currentlySelectedSection).isToBeDeveloped() == true) {
isUndevelopedCheckbox.setSelection(false);
} else {
isUndevelopedCheckbox.setSelection(true);
}
isUndevelopedCheckbox
.setSelection(((Strategy)currentlySelectedSection).isToBeDeveloped());
.setSelection(!((Strategy)currentlySelectedSection).isToBeDeveloped());
}
} else {
isUndevelopedCheckbox.setVisible(false);
......
requirementspatterns.ecore b2f09bfc949bafb0392929115b3c0321bf2b192c YELLOW
safetyargumentationpackage.ecore e95d1c0c64d12fa1660899df86cc9009dbae1754 YELLOW
safetycases.ecore d42a452d3ca06f769a50852d68b0207dd822b0c7 YELLOW
safetycases.ecore 6f5959903d681d91823dc2524722e983626bc297 YELLOW
......@@ -99,7 +99,8 @@
</eOperations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DecomposableSpinalElement" eSuperTypes="#//SpinalElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="toBeDeveloped" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="toBeDeveloped" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
defaultValueLiteral="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="scope" eType="ecore:EClass platform:/resource/org.fortiss.af3.component/model/component.ecore#//Component"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="VISIBILITY">
......
AF3SafetyCasesActivator.java 414777e12757652b2229cc88bad0301cf988d669 GREEN
AF3SafetyCasesActivator.java 3e80542cf40919240edf8c687eb27ac33207c9e1 GREEN
......@@ -16,6 +16,8 @@
package org.fortiss.af3.safetycases;
import org.eclipse.core.runtime.Plugin;
import org.fortiss.af3.safetycases.listener.AutomaticSetListenerPersistency;
import org.fortiss.tooling.kernel.service.IPersistencyService;
import org.osgi.framework.BundleContext;
/**
......@@ -36,6 +38,9 @@ public class AF3SafetyCasesActivator extends Plugin {
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
IPersistencyService ps = IPersistencyService.getInstance();
ps.addTopLevelElementListener(new AutomaticSetListenerPersistency());
}
/** {@inheritDoc} */
......
AutomaticSetListener.java a38b08cb17a570c0a8a8cbc8a61676b06c1d9cab GREEN
AutomaticSetListenerPersistency.java fdf9f4af3ec798af6c5f95d7b1f6a3ed39de2b14 GREEN
/*-------------------------------------------------------------------------+
| Copyright 2020 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.safetycases.listener;
import static org.fortiss.tooling.common.util.LambdaUtils.filter;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf;
import static org.fortiss.tooling.kernel.utils.LoggingUtils.warning;
import java.util.List;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EContentAdapter;
import org.fortiss.af3.project.model.FileProject;
import org.fortiss.af3.safetyargumentationpackage.model.SafetyArgumentationPackage;
import org.fortiss.af3.safetycases.AF3SafetyCasesActivator;
import org.fortiss.af3.safetycases.model.ArgumentElement;
import org.fortiss.af3.safetycases.model.DecomposableSpinalElement;
import org.fortiss.af3.safetycases.model.ExitConnector;
import org.fortiss.tooling.base.model.base.HierarchicElementBase;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
/**
* Listener that installs a {@link AutomaticSetListener} to {@link ITopLevelElement}s that are
* loaded at startup or during runtime.
*
* @author soima
*/
public class AutomaticSetListener extends EContentAdapter {
/** Holds the instance of the {@link AutomaticSetListener}. */
private volatile static AutomaticSetListener INSTANCE;
/** Constructor. */
private AutomaticSetListener() {
// Prevents direct instantiation.
}
/** The instance (singleton) of the {@link AutomaticSetListener}. */
public static synchronized AutomaticSetListener getInstance() {
if(INSTANCE == null) {
INSTANCE = new AutomaticSetListener();
}
return INSTANCE;
}
/**
* Installs {@code this} renaming listener to all that reside
* below the passed {@link ITopLevelElement}.
*/
public static void installAutomaticSetListeners(ITopLevelElement element) {
EObject rootElement = element.getRootModelElement();
if(!(rootElement instanceof FileProject)) {
warning(AF3SafetyCasesActivator.getDefault(),
"Got a root element that is not a file project while trying to install " +
"listeners. This could indicate a model corruption.");
return;
}
FileProject fileProject = (FileProject)rootElement;
List<SafetyArgumentationPackage> safetyPackages =
pickInstanceOf(SafetyArgumentationPackage.class, fileProject.getRootElements());
filter(safetyPackages, argEl -> !argEl.eAdapters().contains(getInstance()))
.forEach(argEl -> argEl.eAdapters().add(getInstance()));
}
/** {@inheritDoc} */
@Override
public void notifyChanged(Notification notification) {
super.notifyChanged(notification);
// Automatic set as instantiated/uninstantiated ArgumentElement.
if(notification.getNotifier() instanceof ArgumentElement &&
notification.getEventType() == Notification.SET) {
// Input checks.
if(!(notification.getFeature() instanceof EAttribute)) {
return;
}
EAttribute attribute = (EAttribute)notification.getFeature();
if(attribute.getName().equals("textualInformation")) {
ArgumentElement argElement = ((ArgumentElement)notification.getNotifier());
String textualInformation = argElement.getTextualInformation();
// Check if a text is written between curly brackets. Example: {Claim}.
if(!Pattern.matches("^\\{((.|\\n)*)}$", textualInformation) &&
!textualInformation.isEmpty()) {
argElement.setToBeInstantiated(false);
} else {
argElement.setToBeInstantiated(true);
}
}
return;
}
// Automatic set as developed/undeveloped entity.
if((notification.getNotifier() instanceof ExitConnector) &&
(notification.getEventType() == Notification.ADD ||
notification.getEventType() == Notification.REMOVE)) {
HierarchicElementBase element =
((ExitConnector)notification.getNotifier()).getGSNElement();
if(notification.getEventType() == Notification.ADD) {
if(element instanceof DecomposableSpinalElement) {
((DecomposableSpinalElement)element).setToBeDeveloped(false);
}
} else if(notification.getEventType() == Notification.REMOVE) {
if(element instanceof DecomposableSpinalElement) {
List<ExitConnector> connectors = ((DecomposableSpinalElement)element)
.getExitConnectors().stream().filter(e -> !e.getOutgoing().isEmpty())
.collect(Collectors.toList());
if(connectors.isEmpty()) {
((DecomposableSpinalElement)element).setToBeDeveloped(true);
}
}
}
}
}
}
/*-------------------------------------------------------------------------+
| Copyright 2020 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.safetycases.listener;
import static org.fortiss.af3.safetycases.listener.AutomaticSetListener.installAutomaticSetListeners;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
import org.fortiss.tooling.kernel.service.listener.IPersistencyServiceListener;
/**
* Listener that installs a {@link AutomaticSetListener} to {@link ITopLevelElement}s that are
* loaded at startup or during runtime.
*
* @author liana
*/
public class AutomaticSetListenerPersistency implements IPersistencyServiceListener {
/** {@inheritDoc} */
@Override
public void topLevelElementLoaded(ITopLevelElement element) {
installAutomaticSetListeners(element);
}
/** {@inheritDoc} */
@Override
public void topLevelElementAdded(ITopLevelElement element) {
installAutomaticSetListeners(element);
}
/** {@inheritDoc} */
@Override
public void topLevelElementRemoved(ITopLevelElement element) {
// ignore
}
/** {@inheritDoc} */
@Override
public void topLevelElementContentChanged(ITopLevelElement element) {
installAutomaticSetListeners(element);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment