Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • af3/kernel
  • diewald/kernel
2 results
Show changes
Commits on Source (25)
Showing
with 74 additions and 8 deletions
......@@ -5,7 +5,7 @@ DynamicTextFieldTreeTableCell.java 62fa0c08b11d87e0eed41f84be85505c2740e75d GREE
DynamicTreeContentProviderBase.java 91896b1fb5104d126544c44c1ff8c30f2a13a8d6 GREEN
DynamicTreeItem.java 7e81ea98038b5eca90df583e0268d4e8f37aaf25 GREEN
DynamicTreeItemBase.java d883066ecc181120302ca32f328538de7a45b093 GREEN
DynamicTreeTableUIProviderBase.java 360df9d5114c5d4a391a7a7afe70a5b8ad584490 GREEN
DynamicTreeTableUIProviderBase.java 11565b3f72bb5a861043d1d68a93a939e37baafc GREEN
DynamicTreeTableViewer.java 77e9995a3bee37d57578dad9434a53c702128efa YELLOW
DynamicTreeUIProviderBase.java 82d3c051213f0147f4c67ad247a08696cee73110 GREEN
DynamicTreeViewer.java 33066062a82101cf28410e4d04f85bb9c24251db GREEN
......
......@@ -15,6 +15,8 @@ package org.fortiss.tooling.common.ui.javafx.control.treetableview;
import static java.util.stream.Collectors.toMap;
import static javafx.collections.FXCollections.observableArrayList;
import static javafx.scene.text.Font.font;
import static javafx.util.Duration.seconds;
import static org.apache.commons.lang3.SystemUtils.IS_OS_LINUX;
import java.util.Map;
......@@ -28,6 +30,7 @@ import javafx.scene.Node;
import javafx.scene.control.ComboBox;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.TextField;
import javafx.scene.control.Tooltip;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeTableCell;
import javafx.scene.control.TreeTableColumn;
......@@ -40,6 +43,7 @@ import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.util.Callback;
import javafx.util.converter.DefaultStringConverter;
......@@ -64,6 +68,22 @@ public abstract class DynamicTreeTableUIProviderBase<T> {
return "";
}
/**
* Retrieves the tooltip text which shall be displayed for the given element in the given
* column.
*
* No tooltip will be displayed, if this method return 'null'.
*
* @param element
* The element to get a tooltip for.
* @param column
* The column index for which to get a tooltip.
* @return The tooltip as a {@link String}.
*/
public String getTooltip(T element, int column) {
return null;
}
/**
* Determines, which {@link String} is in text editor cells when stating to edit.
*
......@@ -324,6 +344,19 @@ public abstract class DynamicTreeTableUIProviderBase<T> {
cell.setStyle(getCellStyle(data, columnIndex));
addContextMenuToCell(cell, columnIndex);
final String tooltipStr = getTooltip(data, columnIndex);
if(tooltipStr != null) {
Tooltip tt = new Tooltip();
double fontSize = 14.0;
Font font = font(fontSize);
tt.setText(tooltipStr);
tt.setShowDuration(seconds(15));
tt.setFont(font);
cell.setTooltip(tt);
}
} else {
// reset icon for cases, in which a row was styled before, but became empty by now.
cell.setGraphic(null);
......
CrossFeatureConstraintPropertySectionBase.java 37e772fb3471f85320170d373cbe2f319c350655 GREEN
FeaturePropertySectionBase.java 2ac0a6a56ea4755852fd14a9b5df81dff4a5dc7e GREEN
FeaturePropertySectionBase.java 598842b12b5bbb6f3cf2461a4d05fc721b637f54 GREEN
HasPresenceConditionPropertySectionBase.java ef300f0d9294d76f5d80e45b8cc0d94c24586a24 GREEN
......@@ -28,6 +28,7 @@ import org.fortiss.tooling.kernel.service.ICommandStackService;
import org.fortiss.tooling.kernel.ui.extension.base.PropertySectionBase;
import org.fortiss.variability.model.features.AbstractAlternativeFeature;
import org.fortiss.variability.model.features.AbstractFeature;
import org.fortiss.variability.model.features.AbstractFeatureModel;
/**
* Property Section for {@link AbstractFeature}s.
......@@ -52,10 +53,13 @@ public class FeaturePropertySectionBase extends PropertySectionBase {
feature = (AbstractFeature)input;
if(optionalCheckbox != null) {
if(feature.eContainer() instanceof AbstractAlternativeFeature) {
if(feature.eContainer() instanceof AbstractAlternativeFeature ||
feature instanceof AbstractFeatureModel) {
optionalCheckbox.setEnabled(false);
} else
} else {
optionalCheckbox.setEnabled(true);
optionalCheckbox.setSelection(feature.isOptional());
}
}
}
}
......
VariabilityUtils.java 6f2ffd231c27f5f7ab8c62d05350c0a92392eaf8 GREEN
VariabilityUtils.java fcaa561bdbe6bd9d6fff4312086a6c97177301f8 GREEN
......@@ -18,6 +18,8 @@ package org.fortiss.tooling.ext.variability.util;
import static org.fortiss.tooling.ext.variability.model.VariabilityModelElementFactory.createOptionalVariationPointSpecification;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getFirstChildWithType;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickFirstInstanceOf;
import static org.fortiss.variability.util.VariabilityUtils.FEATURE_LITERAL_LEGAL_CHAR_REGEX;
import static org.fortiss.variability.util.VariabilityUtils.PRESENCE_CONDITIONS_KEYWORDS;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.base.model.element.IModelElement;
......@@ -35,6 +37,12 @@ import org.fortiss.variability.presence.compiler.PresenceConditionCompiler;
*/
public class VariabilityUtils {
/** Failure message for incorrect Feature names. */
public final static String FEATURE_NAME_ERROR_MSG = "Feature names may only contain " +
FEATURE_LITERAL_LEGAL_CHAR_REGEX.replaceAll("\\\\", "") +
", must not be empty and must be different from the keywords " +
PRESENCE_CONDITIONS_KEYWORDS.replaceAll("\\|", ", ") + ".";
/**
* Checks for the given {@link EObject} whether it has been deactivated by a
* {@link DeactivationSpecification}.
......
FeatureModelTransformationUtils.java b38702296dcb48ff311b382bb9c05d2590e2dfac GREEN
Pair.java 2dfd7dc65f7b9ba09a120f1a6058d1e8e9556a37 GREEN
VariabilityUtils.java 66a727bdb58715dc7b1bd0ce320bd647f374f7d6 GREEN
VariabilityUtils.java 3e57a37ced6396076c71227aea8de534381b6ace GREEN
VariabilityUtilsInternal.java 9c781a47513bb0c4ddcd13be1c27d62b70f25998 GREEN
......@@ -17,6 +17,7 @@ package org.fortiss.variability.util;
import static java.util.stream.Collectors.toList;
import static org.fortiss.variability.model.VariabilityModelElementFactory.createFeatureConfigurationForFeature;
import static org.fortiss.variability.util.VariabilityUtilsInternal.getAllElementsFromSameContainmentTree;
import static org.fortiss.variability.util.VariabilityUtilsInternal.getAllReferences;
import static org.fortiss.variability.util.VariabilityUtilsInternal.getParentsWithType;
......@@ -27,6 +28,7 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.variability.model.features.AbstractCompositionalFeature;
import org.fortiss.variability.model.features.AbstractCrossFeatureConstraint;
import org.fortiss.variability.model.features.AbstractFeature;
......@@ -163,14 +165,15 @@ public class VariabilityUtils {
*
* @param literalName
* {@link String} with the name to be checked.
* @return Whether the given name is compatible with the presence condition systax.
* @return Whether the given name is compatible with the presence condition syntax.
*/
public static boolean isNameLegalInPresenceCondition(String literalName) {
if(literalName.matches(PRESENCE_CONDITIONS_KEYWORDS)) {
return false;
}
return literalName.matches(FEATURE_LITERAL_LEGAL_CHAR_REGEX + "*");
// Add "+" to regex to make only non-empty names legal (instead of "*")
return literalName.matches(FEATURE_LITERAL_LEGAL_CHAR_REGEX + "+");
}
/**
......@@ -192,4 +195,22 @@ public class VariabilityUtils {
features.removeAll(getParentsWithType(constraint, AbstractFeature.class));
return features;
}
/**
* Retrieves all literals with the given name from the whole containment tree in which 'context'
* is contained in.
*
* Note, that the resulting {@link List} should usually contain at most one literal, as literal
* names should be unique.
*
* @param context
* Any {@link EObject} in the containment tree to search in.
* @param name
* The name of the literal which is searched.
* @return A {@link List} of all literals with the given name.
*/
public static List<ILiteralReferencable> getLiteralsWithName(EObject context, String name) {
return getAllElementsFromSameContainmentTree(context, ILiteralReferencable.class).stream()
.filter(l -> l.getName().equals(name)).collect(toList());
}
}