diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/.ratings b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/.ratings index 1008aedfb929e3676dd8664538032565f3e98ced..2be3c22576f6b3a43dd415bc0705ddd3a4ca540a 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/.ratings +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/.ratings @@ -1,2 +1,2 @@ DynamicTreeTableNameProvider.java 3ca45f24b94e97b02313e80b16ba8b370f541541 GREEN -ModelElementTreeViewer.java c27c57ae21b32de790c6fb5a86695dd5952fcf32 GREEN +ModelElementTreeViewer.java 83a3693cf820161e42e7d84a697a3cd0d55f8c1f GREEN diff --git a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/ModelElementTreeViewer.java b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/ModelElementTreeViewer.java index c27c57ae21b32de790c6fb5a86695dd5952fcf32..83a3693cf820161e42e7d84a697a3cd0d55f8c1f 100644 --- a/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/ModelElementTreeViewer.java +++ b/org.fortiss.tooling.base.ui/src/org/fortiss/tooling/base/ui/javafx/control/treetableview/ModelElementTreeViewer.java @@ -18,9 +18,6 @@ package org.fortiss.tooling.base.ui.javafx.control.treetableview; import static javafx.embed.swt.SWTFXUtils.toFXImage; import static org.fortiss.tooling.kernel.ui.util.KernelUIUtils.getName; -import java.util.ArrayList; -import java.util.List; - import org.fortiss.tooling.base.model.element.IHierarchicElement; import org.fortiss.tooling.base.model.element.IModelElement; import org.fortiss.tooling.common.ui.javafx.AF3FXViewPart; @@ -32,8 +29,6 @@ import org.fortiss.tooling.kernel.model.INamedElement; import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService; import javafx.scene.Node; -import javafx.scene.control.ContextMenu; -import javafx.scene.control.MenuItem; import javafx.scene.control.TreeView; import javafx.scene.image.Image; import javafx.scene.image.ImageView; @@ -74,25 +69,11 @@ public class ModelElementTreeViewer<T extends INamedElement> { } return null; } - - /** {@inheritDoc} */ - @Override - public ContextMenu createContextMenu(T element) { - ContextMenu menu = new ContextMenu(); - contextMenuEntries.forEach(entry -> menu.getItems().add(entry)); - return menu; - } } /** References the constructed {@link DynamicTreeViewer} "controller". */ protected DynamicTreeViewer<T> dynTreeViewer; - /** - * List of context menu entries that supplied by clients (see - * {@link #addContextMenuEntry(MenuItem)}). - */ - protected List<MenuItem> contextMenuEntries = new ArrayList<>(); - /** Constructor. */ public ModelElementTreeViewer(TreeView<T> treeView, T modelRoot, DynamicTreeContentProviderBase<T> contentProvider) { @@ -112,18 +93,6 @@ public class ModelElementTreeViewer<T extends INamedElement> { return new ModelElementUIProvider(); } - /** - * Method to define context {@link MenuItem}s for items of the underlying content. The given - * function may use the selected element (given as a parameter to the function) to define - * dynamic behavior. - * - * @param menuItem - * {@link MenuItem} and its logic to be added to the context menu. - */ - public void addContextMenuEntry(MenuItem menuItem) { - contextMenuEntries.add(menuItem); - } - /** Update the internal viewer. */ public void update() { dynTreeViewer.update(); diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/.ratings index cd94a3ec1ca619a50c6a3e40fbffb9864dac9a5a..9b035751bcf9808861316118428252410fbe50a4 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/.ratings @@ -6,10 +6,11 @@ DynamicTreeContentProviderBase.java 91896b1fb5104d126544c44c1ff8c30f2a13a8d6 GRE DynamicTreeItem.java 7e81ea98038b5eca90df583e0268d4e8f37aaf25 GREEN DynamicTreeItemBase.java d883066ecc181120302ca32f328538de7a45b093 GREEN DynamicTreeTableUIProviderBase.java c52a1f9598de25874f83c133a8cbbcddc86442e9 GREEN -DynamicTreeTableViewer.java 77e9995a3bee37d57578dad9434a53c702128efa YELLOW -DynamicTreeUIProviderBase.java 82d3c051213f0147f4c67ad247a08696cee73110 GREEN -DynamicTreeViewer.java 33066062a82101cf28410e4d04f85bb9c24251db GREEN +DynamicTreeTableViewer.java 6e1fcc7a45076d741b80c3a5642a5c688fc651a6 GREEN +DynamicTreeUIProviderBase.java 606d2f199f82aba3fcc33f96caa07157b087cbe5 GREEN +DynamicTreeViewer.java b0d8cc4b3e11aa970446af12d1e54c750713b297 GREEN DynamicTreeViewerBase.java a2013538b62d86f6a09efdf2cd78babac2072484 GREEN EmptyChildrenContentProvider.java 51b4468f9df8423abeea5ac6aa2f6cf99c2eb512 GREEN IDoubleClickHandler.java 447f7769dead9a106b3ea3139ef0da51eb0b9a89 GREEN IDynamicItem.java 083d02459e7ec33542d9910c04abe2581e0b5422 GREEN +TreeContextMenuItem.java 893b1ca2535bb581e192b0f351429957de6766da GREEN diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableViewer.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableViewer.java index 77e9995a3bee37d57578dad9434a53c702128efa..6e1fcc7a45076d741b80c3a5642a5c688fc651a6 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableViewer.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeTableViewer.java @@ -210,6 +210,16 @@ public final class DynamicTreeTableViewer<T> extends DynamicTreeViewerBase<T> { view.scrollTo(count); } + /** Clears the current selection. */ + public void clearSelection() { + view.getSelectionModel().clearSelection(); + } + + /** Selects the items referencing the provided values (a previous selection is NOT cleared). */ + public void selectValues(List<T> values) { + selectValues(view.getRoot(), values); + } + /** Selects the given values in item's subtree */ private void selectValues(TreeItem<T> item, List<T> values) { if(values.contains(item.getValue())) { diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeUIProviderBase.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeUIProviderBase.java index 82d3c051213f0147f4c67ad247a08696cee73110..606d2f199f82aba3fcc33f96caa07157b087cbe5 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeUIProviderBase.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeUIProviderBase.java @@ -13,6 +13,9 @@ *******************************************************************************/ package org.fortiss.tooling.common.ui.javafx.control.treetableview; +import java.util.ArrayList; +import java.util.List; + import javafx.scene.Node; import javafx.scene.control.ContextMenu; import javafx.scene.control.TreeItem; @@ -55,12 +58,27 @@ public abstract class DynamicTreeUIProviderBase<T> { } /** - * @param element - * the displayed element - * @return the context menu + * List of context menu entries types supplied by clients + * (see{@link #addContextMenuEntry(Class)}). */ - public ContextMenu createContextMenu(T element) { - return null; + private List<Class<? extends TreeContextMenuItem<T>>> contextMenuEntryTypes = new ArrayList<>(); + + /** + * Method to define context {@link TreeContextMenuItem}s. Depending on the selected content, the + * editor will show and enable the context menu. {@code null} may be used to denote menu + * separators. + */ + protected void addContextMenuEntry(Class<? extends TreeContextMenuItem<T>> menuItemType) { + contextMenuEntryTypes.add(menuItemType); + } + + /** + * Creates a context menu based on the the {@link TreeContextMenuItem} types registered via + * {@link #addContextMenuEntry(Class)}. + */ + /** package */ + final ContextMenu createContextMenu(T element) { + return TreeContextMenuItem.createTreeContextMenu(contextMenuEntryTypes, element); } /** diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeViewer.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeViewer.java index 33066062a82101cf28410e4d04f85bb9c24251db..b0d8cc4b3e11aa970446af12d1e54c750713b297 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeViewer.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/DynamicTreeViewer.java @@ -102,6 +102,7 @@ public final class DynamicTreeViewer<T> extends DynamicTreeViewerBase<T> { // wild cast works: see constructor DynamicTreeItemBase<T> rootItem = (DynamicTreeItemBase<T>)view.getRoot(); rootItem.update(); + view.refresh(); } /** Sets the selection of this tree view. */ diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/TreeContextMenuItem.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/TreeContextMenuItem.java new file mode 100644 index 0000000000000000000000000000000000000000..893b1ca2535bb581e192b0f351429957de6766da --- /dev/null +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/control/treetableview/TreeContextMenuItem.java @@ -0,0 +1,147 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2023 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.tooling.common.ui.javafx.control.treetableview; + +import static javafx.embed.swt.SWTFXUtils.toFXImage; + +import java.lang.reflect.Constructor; +import java.util.List; + +import org.eclipse.jface.resource.ImageDescriptor; + +import javafx.event.ActionEvent; +import javafx.event.EventHandler; +import javafx.scene.Node; +import javafx.scene.control.ContextMenu; +import javafx.scene.control.MenuItem; +import javafx.scene.control.SeparatorMenuItem; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; + +/** + * Base class for {@link MenuItem}s used by {@link DynamicTreeViewer}s (but in principle generally + * applicable for JavaFX {@link ContextMenu}s). + * <ul> + * <li>Subclasses must provide exactly one public constructor that takes the underlying tree element + * as single argument.</li> + * <li>Instances must be created using factory method + * {@link #createTreeContextMenu(List, Object)}.</li> + * </ul> + */ +public abstract class TreeContextMenuItem<T> extends MenuItem { + + /** The model element on which the context menu operates. */ + private T element; + + /** Constructor. */ + protected TreeContextMenuItem(T element, String label) { + super(label); + init(element); + } + + /** Constructor. */ + protected TreeContextMenuItem(T element, String label, Node graphic) { + super(label, graphic); + init(element); + } + + /** Constructor. */ + protected TreeContextMenuItem(T element, String label, ImageDescriptor imgDescr) { + this(element, label, getSelectIcon(imgDescr)); + } + + /** Helper to build the select icon. */ + private static Node getSelectIcon(ImageDescriptor imgDescr) { + + Image fxIcon = toFXImage(imgDescr.getImageData(100), null); + return new ImageView(fxIcon); + } + + /** Helper for constructors. */ + private void init(T element) { + this.element = element; + setOnAction(createOnActionHandler()); + } + + /** Getter for {@link #element}. */ + protected T getElement() { + return element; + } + + /** Predicate iff this {@link TreeContextMenuItem} is hidden. */ + public abstract boolean isHidden(); + + /** Predicate when this {@link TreeContextMenuItem} is disabled. */ + public abstract boolean isDisabled(); + + /** + * Factory method for {@link EventHandler} that implements the action triggered by the + * context menu. + */ + protected abstract EventHandler<ActionEvent> createOnActionHandler(); + + /** + * Factory method for a {@link ContextMenu} defined based on {@link TreeContextMenuItem}s. + * {@code null} may be used to denote menu separators. + */ + public static <T> ContextMenu createTreeContextMenu( + List<Class<? extends TreeContextMenuItem<T>>> contextMenuEntryTypes, T element) { + + boolean previousWasItem = false; + boolean needSeparator = false; + ContextMenu menu = new ContextMenu(); + + for(Class<? extends TreeContextMenuItem<T>> entryType : contextMenuEntryTypes) { + if(entryType == null) { + if(previousWasItem) { + // Separator is only needed if there is a preceding visible item + needSeparator = true; + previousWasItem = false; + } + } else { + try { + Constructor<?>[] ctrs = entryType.getConstructors(); + if(ctrs.length != 1) { + throw new RuntimeException( + "Subclasses of TreeContextMenuItem must provide exactly one public constructor"); + } + @SuppressWarnings("unchecked") Constructor<? extends TreeContextMenuItem<T>> ctr = + (Constructor<? extends TreeContextMenuItem<T>>)ctrs[0]; + if(ctr.getParameterCount() != 1) { + throw new RuntimeException( + "The constructor of subclasses of TreeContextMenuItem must take the tree element for which the context menu is created as single argument."); + } + + TreeContextMenuItem<?> entry = ctr.newInstance(element); + if(!entry.isHidden()) { + // Add separator only if there is a subsequent visible item + if(needSeparator) { + menu.getItems().add(new SeparatorMenuItem()); + needSeparator = false; + } + menu.getItems().add(entry); + entry.setDisable(entry.isDisabled()); + previousWasItem = true; + } + } catch(Exception e) { + e.printStackTrace(); + } + } + } + + return menu; + } +} diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/.ratings index 07fbfbf0cef067efae30e0271183f7b36e65b3fa..223041a6eab78d0dfad960fff7c508488cf487fd 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/.ratings @@ -2,7 +2,7 @@ DiagramCoordinate.java 6b00aec99054d4cd19003a72bd4e5e774ac6a641 GREEN DiagramLayers.java aa1f95dbae290c8b00202abe4385b01b8f36e5ab GREEN DiagramViewer.java 537358db18da8b5ba2bf56082bfd87dec3ca88d8 GREEN DiagramViewerDefaultTags.java 6230763252409c60009ab8887b4ef582cf883229 GREEN -DiagramViewerFeatures.java 3dd78d9c117fc156924a151c6f8d770c53c103bc GREEN +DiagramViewerFeatures.java b48515b91e81cb07b405a92ab02925815f128ce9 GREEN DiagramViewerSelection.java e833f592543bc97077907d980a39b123fc4044e6 GREEN EDragGesture.java 5cfa098d3877db11981c2750e5e103156d62fc5e GREEN FeedbackChange.java b088fa89af648f1674f2f9c1f7f99d585ce801ca GREEN diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/DiagramViewerFeatures.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/DiagramViewerFeatures.java index 3dd78d9c117fc156924a151c6f8d770c53c103bc..b48515b91e81cb07b405a92ab02925815f128ce9 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/DiagramViewerFeatures.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/DiagramViewerFeatures.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2020 fortiss GmbH. + * Copyright (c) 2019, 2020, 2023 fortiss GmbH. * * This program and the accompanying materials are made available under the * terms of the Apache License, Version 2.0 which is available at @@ -51,7 +51,9 @@ public final class DiagramViewerFeatures { /** The flag for drawing the outer border, which occupies the first grid row and lane. */ private boolean drawOuterBorder = true; /** The indicator type. */ - private IndicatorType indicatorType = IndicatorType.CROSS; + private IndicatorType currentIndicatorType = IndicatorType.INVISIBLE; + /** The indicator type to be used, when enabling the grid. */ + private IndicatorType defaultIndicatorType = IndicatorType.CROSS; /** The background color. */ private Color backgroundColor = LIGHTGRAY; /** The help text for the diagram viewer in-place help */ @@ -149,15 +151,20 @@ public final class DiagramViewerFeatures { /** Returns the indicator type. */ public IndicatorType getIndicatorType() { - return indicatorType; + return currentIndicatorType; } /** Sets the indicator type. */ public void setIndicatorType(IndicatorType indicatorType) { - this.indicatorType = indicatorType; + this.currentIndicatorType = indicatorType; viewer.updateAllVisuals(); } + /** Sets the displayed indicator type to the default value. */ + public void setIndicatorTypeToDefault() { + setIndicatorType(defaultIndicatorType); + } + /** Returns the background color. */ public Color getBackgroundColor() { return backgroundColor; @@ -316,4 +323,14 @@ public final class DiagramViewerFeatures { public void setHelpText(String helpText) { this.helpText = helpText; } + + /** Retrieves the indicator type to be used, when enabling indicators. */ + public IndicatorType getDefaultIndicatorType() { + return defaultIndicatorType; + } + + /** Sets the indicator type to be used when enabling the grid. */ + public void setDefaultIndicatorType(IndicatorType defaultIndicatorType) { + this.defaultIndicatorType = defaultIndicatorType; + } } diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/base/.ratings b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/base/.ratings index fdb866d1694b6cdb55edc61c1dc9832229c8fb44..82b1512af126fdc8e96230d33fe4cc95261e015d 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/base/.ratings +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/base/.ratings @@ -2,7 +2,7 @@ AnchorageContentControllerBase.java da56b10cbf2711b5da69f0b59f43eacbe54f4eea GRE ClickControllerBase.java 8e5861ed5f9318008ad0fdd5497ed320cd5bd647 GREEN ContentAnchorageMoveControllerBase.java c18e7915ce23e124757f5b736086ecc46694800a GREEN ControllerBase.java 9311521b252e46640e26d409610e527fd5ed6922 GREEN -DefaultDiagramController.java 3f60229b2e0fe0b6ac40c617858cc5a0685a59eb GREEN +DefaultDiagramController.java f707d03674e42aacc7d5d8b3eb8d15b45add2004 GREEN DelegatingContentAnchorageController.java 1889628a346a2183082ffe213978f9d15a949494 GREEN DragControllerBase.java b15ff874304f679fe494d85f57cc8cbe4d0d1d15 GREEN DraggingUtils.java 95117e2ea4c36b6c6a31f8088bb95b484e0e6612 GREEN diff --git a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/base/DefaultDiagramController.java b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/base/DefaultDiagramController.java index 3f60229b2e0fe0b6ac40c617858cc5a0685a59eb..f707d03674e42aacc7d5d8b3eb8d15b45add2004 100644 --- a/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/base/DefaultDiagramController.java +++ b/org.fortiss.tooling.common.ui/src/org/fortiss/tooling/common/ui/javafx/lwfxef/controller/base/DefaultDiagramController.java @@ -34,9 +34,6 @@ public class DefaultDiagramController extends ControllerBase { /** Flag for ignoring mouse click event after dragging gesture. */ private boolean ignoreNextMouseClick = false; - /** Previous grid indicator type (to restore grid after it has been hidden). */ - private IndicatorType previousGridIndicatorType = null; - /** Constructor. */ public DefaultDiagramController(IMVCBundle mvcb) { super(mvcb); @@ -83,16 +80,13 @@ public class DefaultDiagramController extends ControllerBase { private MenuItem createGridMenuItem(DiagramViewerFeatures features) { MenuItem gridMenuItem = null; if(features.getIndicatorType() == IndicatorType.INVISIBLE) { - if(previousGridIndicatorType != null) { - gridMenuItem = new MenuItem("Show Grid"); - gridMenuItem.setOnAction(evt -> { - features.setIndicatorType(previousGridIndicatorType); - }); - } + gridMenuItem = new MenuItem("Show Grid"); + gridMenuItem.setOnAction(evt -> { + features.setIndicatorTypeToDefault(); + }); } else { gridMenuItem = new MenuItem("Hide Grid"); gridMenuItem.setOnAction(evt -> { - previousGridIndicatorType = features.getIndicatorType(); features.setIndicatorType(IndicatorType.INVISIBLE); }); } diff --git a/org.fortiss.tooling.ext.variability.ui/src/org/fortiss/tooling/ext/variability/ui/properties/.ratings b/org.fortiss.tooling.ext.variability.ui/src/org/fortiss/tooling/ext/variability/ui/properties/.ratings index efc110735ce14601ff0f14ee9e94cf0f2cc62f45..a0504ca88c26217c2d516289c1f95dc33f29fc27 100644 --- a/org.fortiss.tooling.ext.variability.ui/src/org/fortiss/tooling/ext/variability/ui/properties/.ratings +++ b/org.fortiss.tooling.ext.variability.ui/src/org/fortiss/tooling/ext/variability/ui/properties/.ratings @@ -1,3 +1,3 @@ CrossFeatureConstraintPropertySectionBase.java 37e772fb3471f85320170d373cbe2f319c350655 GREEN -FeaturePropertySectionBase.java 598842b12b5bbb6f3cf2461a4d05fc721b637f54 GREEN +FeaturePropertySectionBase.java 9b338ff5ab4c70179d406bc0d76b8c62a1dbc8ae GREEN HasPresenceConditionPropertySectionBase.java ef300f0d9294d76f5d80e45b8cc0d94c24586a24 GREEN diff --git a/org.fortiss.tooling.ext.variability.ui/src/org/fortiss/tooling/ext/variability/ui/properties/FeaturePropertySectionBase.java b/org.fortiss.tooling.ext.variability.ui/src/org/fortiss/tooling/ext/variability/ui/properties/FeaturePropertySectionBase.java index 598842b12b5bbb6f3cf2461a4d05fc721b637f54..9b338ff5ab4c70179d406bc0d76b8c62a1dbc8ae 100644 --- a/org.fortiss.tooling.ext.variability.ui/src/org/fortiss/tooling/ext/variability/ui/properties/FeaturePropertySectionBase.java +++ b/org.fortiss.tooling.ext.variability.ui/src/org/fortiss/tooling/ext/variability/ui/properties/FeaturePropertySectionBase.java @@ -56,6 +56,7 @@ public class FeaturePropertySectionBase extends PropertySectionBase { if(feature.eContainer() instanceof AbstractAlternativeFeature || feature instanceof AbstractFeatureModel) { optionalCheckbox.setEnabled(false); + optionalCheckbox.setSelection(false); } else { optionalCheckbox.setEnabled(true); optionalCheckbox.setSelection(feature.isOptional()); diff --git a/org.fortiss.variability/src/org/fortiss/variability/model/.ratings b/org.fortiss.variability/src/org/fortiss/variability/model/.ratings index 21c8c4adb340b726f01f431432b90b55e2322124..4b54c831621b6bcf35f4ed0fc6eec363252d08ca 100644 --- a/org.fortiss.variability/src/org/fortiss/variability/model/.ratings +++ b/org.fortiss.variability/src/org/fortiss/variability/model/.ratings @@ -1,2 +1,2 @@ VariabilityModelElementFactory.java 5a50d78b0fc94a20329b95991b519a3e3fbf4410 GREEN -VariabilityStaticImpl.java d274310be2b110c002b3e514bc570fd5f4f6e48a GREEN +VariabilityStaticImpl.java 96bc4364ebe635c94fafbd3ef60b8237b18c17c6 GREEN diff --git a/org.fortiss.variability/src/org/fortiss/variability/model/VariabilityStaticImpl.java b/org.fortiss.variability/src/org/fortiss/variability/model/VariabilityStaticImpl.java index d274310be2b110c002b3e514bc570fd5f4f6e48a..96bc4364ebe635c94fafbd3ef60b8237b18c17c6 100644 --- a/org.fortiss.variability/src/org/fortiss/variability/model/VariabilityStaticImpl.java +++ b/org.fortiss.variability/src/org/fortiss/variability/model/VariabilityStaticImpl.java @@ -30,6 +30,7 @@ import org.eclipse.emf.ecore.EObject; import org.fortiss.variability.model.base.RemoveBindingStrategy; import org.fortiss.variability.model.features.AbstractAlternativeFeature; import org.fortiss.variability.model.features.AbstractFeature; +import org.fortiss.variability.model.features.AbstractFeatureModel; import org.fortiss.variability.model.features.configuration.AlternativeFeatureConfiguration; import org.fortiss.variability.model.features.configuration.CompositionalFeatureConfiguration; import org.fortiss.variability.model.features.configuration.IFeatureConfiguration; @@ -327,6 +328,10 @@ public class VariabilityStaticImpl { return false; } + if(target instanceof AbstractFeatureModel) { + return subject == target; + } + return target.getClass() == subject.getClass() && ((AbstractFeature)target).getName().equals(subject.getName()); }