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 (14)
Showing
with 71 additions and 54 deletions
AnnotationFxViewPart.java ca1548c49aa3842a9436262531464ba345b83688 GREEN
AnnotationTreeTableUIProvider.java 4d9ea9f5267e1a04985c5f67e748f34474c97e0f GREEN
AnnotationViewFXController.java 87d70534cde579cbd5f6470e729783306a139324 GREEN
AnnotationTreeTableUIProvider.java 85dfcf003c79d45f82c901b0f3f6bb30db59effa GREEN
AnnotationViewFXController.java 4351373c216d0aa4539784c9742f4db8bbf161e6 GREEN
AnnotationsFXUtils.java 754152735e037da59a4c40fa045602c3ed85a40f GREEN
ColumnHandle.java 761c2517b3f3e4725feb7ce7e8d5927ba191a4bb GREEN
FXAnnotationFilterContentProvider.java 2d3b32115f47bea44279e8bdf54691b93311d27b GREEN
ColumnHandle.java 7b0fe536d4eb9faa63c4d812f0c078cf83d0fd42 GREEN
FXAnnotationFilterContentProvider.java ca4587ef5dce1288ee4d7bf3bea5bd544ce6b89e GREEN
......@@ -19,6 +19,7 @@ import static org.fortiss.tooling.base.ui.annotation.view.fx.AnnotationsFXUtils.
import static org.fortiss.tooling.base.ui.annotation.view.fx.AnnotationsFXUtils.getBackgroundColorForEntry;
import org.fortiss.tooling.base.annotation.AnnotationEntry;
import org.fortiss.tooling.base.annotation.IAnnotationValueService;
import org.fortiss.tooling.base.annotation.valueprovider.IAnnotationValueProvider;
import org.fortiss.tooling.base.model.element.IAnnotatedSpecification;
import org.fortiss.tooling.base.model.element.IModelElement;
......@@ -57,10 +58,11 @@ import javafx.scene.paint.Color;
}
return "";
default:
IAnnotatedSpecification columnSpec = this.viewController.colIdxAnnotationMap
.get(column).getAnnotatedSpecification();
Class<? extends IAnnotatedSpecification> columnSpecType =
this.viewController.colIdxAnnotationMap.get(column)
.getAnnotatedSpecificationType();
Object specificationValue = entry.getSpecificationValue(columnSpec.getClass());
Object specificationValue = entry.getSpecificationValue(columnSpecType);
if(specificationValue != null) {
return specificationValue.toString();
}
......@@ -88,25 +90,38 @@ import javafx.scene.paint.Color;
/** {@inheritDoc} */
@Override
public void updateValue(AnnotationEntry element, int column, Object value) {
IAnnotatedSpecification specification =
this.viewController.colIdxAnnotationMap.get(column).getAnnotatedSpecification();
this.viewController.setAnnotationEntryValue(specification, element, (String)value);
IAnnotatedSpecification spec = getAnnotation(column, element);
this.viewController.setAnnotationEntryValue(spec, element, (String)value);
super.updateValue(element, column, value);
}
/** {@inheritDoc} */
@Override
public boolean isEditable(int column, AnnotationEntry element) {
public boolean isEditable(int column, AnnotationEntry ae) {
IAnnotatedSpecification spec = getAnnotation(column, ae);
// Check 'editable' predicate for specification/annotation contained by model element
// associated to given annotation entry (if it exists)
IAnnotationValueProvider<IAnnotatedSpecification> valueProvider =
spec != null ? ae.getAnnotationValueProvider(spec.getClass()) : null;
return valueProvider != null && valueProvider.canEdit(spec);
}
/** Get annotation specification associated to given annotation entry and column. */
private IAnnotatedSpecification getAnnotation(int column, AnnotationEntry ae) {
if(column > 1 && this.viewController.colIdxAnnotationMap.containsKey(column)) {
ColumnHandle<IAnnotatedSpecification> columnHandle =
this.viewController.colIdxAnnotationMap.get(column);
Class<IAnnotatedSpecification> specType = columnHandle.getAnnotatedSpecificationType();
IAnnotationValueService as = IAnnotationValueService.getInstance();
IAnnotatedSpecification spec =
this.viewController.colIdxAnnotationMap.get(column).getAnnotatedSpecification();
IAnnotationValueProvider<IAnnotatedSpecification> valueProvider =
element.getAnnotationValueProvider(spec.getClass());
return valueProvider != null && valueProvider.canEdit(spec);
as.getAnnotationEntry(ae.getModelElement()).getSpecification(specType);
return spec;
}
return false;
return null;
}
/** {@inheritDoc} */
......
......@@ -250,7 +250,8 @@ public class AnnotationViewFXController extends CompositeFXControllerBase<SplitP
for(AnnotationEntry entry : annotationEntries) {
for(IAnnotatedSpecification spec : entry.getSpecificationsList()) {
ColumnHandle<IAnnotatedSpecification> columnHandle =
new ColumnHandle<IAnnotatedSpecification>(entry, spec);
new ColumnHandle<IAnnotatedSpecification>(entry,
(Class<IAnnotatedSpecification>)spec.getClass());
columnHandles.add(columnHandle);
colNameToSpecification.put(columnHandle.getColumnName(), spec);
}
......@@ -390,12 +391,11 @@ public class AnnotationViewFXController extends CompositeFXControllerBase<SplitP
/** Creates the annotation column for the given handle. */
private TreeTableColumn<AnnotationEntry, ?> createColumnForHandle(int columnIdx,
ColumnHandle<IAnnotatedSpecification> handle) {
Class<IAnnotatedSpecification> annotationClass =
(Class<IAnnotatedSpecification>)handle.getAnnotatedSpecification().getClass();
Class<IAnnotatedSpecification> annotationType = handle.getAnnotatedSpecificationType();
AnnotationEntry entry = handle.getEntry();
IAnnotationValueProvider<IAnnotatedSpecification> valueProvider =
entry.getAnnotationValueProvider(annotationClass);
IAnnotatedSpecification specification = entry.getSpecification(annotationClass);
entry.getAnnotationValueProvider(annotationType);
IAnnotatedSpecification specification = entry.getSpecification(annotationType);
EClassifier valueType =
valueProvider.getEStructuralFeatureDescriptor().getEType(specification);
......@@ -418,11 +418,11 @@ public class AnnotationViewFXController extends CompositeFXControllerBase<SplitP
column = annotationViewer.addComboColumn(columnName, 150, rowEntry -> {
ValueProviderBase<IAnnotatedSpecification> annotationValueProvider =
(ValueProviderBase<IAnnotatedSpecification>)rowEntry
.getAnnotationValueProvider(annotationClass);
.getAnnotationValueProvider(annotationType);
EStructuralFeatureDescriptor structuralFeature =
annotationValueProvider.getEStructuralFeatureDescriptor();
EClassifier type =
structuralFeature.getEType(rowEntry.getSpecification(annotationClass));
structuralFeature.getEType(rowEntry.getSpecification(annotationType));
// Get the enum literals again, as it might be different for each row.
if(type instanceof EEnum) {
......
......@@ -30,8 +30,8 @@ public class ColumnHandle<T extends IAnnotatedSpecification> extends AnnotationI
implements Comparable<ColumnHandle<T>> {
/** Constructs a new {@link ColumnHandle}. */
public ColumnHandle(AnnotationEntry entry, T annotatedSpecification) {
super(entry, annotatedSpecification);
public ColumnHandle(AnnotationEntry entry, Class<T> specType) {
super(entry, specType);
}
/**
......
......@@ -175,8 +175,8 @@ public class FXAnnotationFilterContentProvider
* Returns true if the given specification passes the current annotation type
* filter.
*/
private boolean passesAnnotationTypeFilter(IAnnotatedSpecification spec) {
return annotationTypeFilter == null || spec.getClass().equals(annotationTypeFilter);
private boolean passesAnnotationTypeFilter(Class<? extends IAnnotatedSpecification> specType) {
return annotationTypeFilter == null || specType.equals(annotationTypeFilter);
}
/**
......@@ -186,8 +186,8 @@ public class FXAnnotationFilterContentProvider
public boolean passesColumnFilter(ColumnHandle<?> columnHandle) {
// Whether the annotation is visible (i.e., not principally hidden from any
// view)
boolean passesHiddenFilter = !columnHandle.getEntry()
.isHidden(columnHandle.getAnnotatedSpecification().getClass());
boolean passesHiddenFilter =
!columnHandle.getEntry().isHidden(columnHandle.getAnnotatedSpecificationType());
// Pass name filter, if: name is not filtered, or the condition is met
boolean passesNameFilter =
......@@ -196,7 +196,7 @@ public class FXAnnotationFilterContentProvider
// Check if column passes all tests
// @CodeFormatterOff
return passesHiddenFilter && passesNameFilter && passesSelectedElementTypeFilter(columnHandle.getEntry())
&& passesAnnotationTypeFilter(columnHandle.getAnnotatedSpecification());
&& passesAnnotationTypeFilter(columnHandle.getAnnotatedSpecificationType());
// @CodeFormatterOn
}
......
AnnotationInstSpec.java b4f2ed47a8984e751e04049de5bdb3cad2c0a933 GREEN
AnnotationInstSpec.java 7a6cb55bfa9cafa9ead1f72089e554ee8142e8bf GREEN
DerivedAnnotationValueProviderBase.java afedd21d3469127bbb20adb34c191b5c9c980f6c GREEN
EStructuralFeatureDescriptor.java 9665d0d3040278243dd37591535e411a90fa63bf GREEN
EStructuralFeatureValueProviderBase.java 287facbbce47c16d892bae82a214f64ceeef2263 GREEN
......
......@@ -35,12 +35,12 @@ public class AnnotationInstSpec<T extends IAnnotatedSpecification> {
* {@link IAnnotatedSpecification} from {@code entry} to be displayed in the column
* represented by this {@link AnnotationInstSpec}.
*/
private IAnnotatedSpecification annotatedSpecification;
private Class<T> specType;
/** Constructor. */
public AnnotationInstSpec(AnnotationEntry entry, T annotatedSpecification) {
public AnnotationInstSpec(AnnotationEntry entry, Class<T> specType) {
this.entry = entry;
this.annotatedSpecification = annotatedSpecification;
this.specType = specType;
}
/**
......@@ -52,20 +52,11 @@ public class AnnotationInstSpec<T extends IAnnotatedSpecification> {
}
/**
* Returns the {@link IAnnotatedSpecification} from {@code entry} to be displayed in the
* Returns the type of {@link IAnnotatedSpecification} from {@code entry} to be displayed in the
* column represented by this {@link AnnotationInstSpec}.
*/
@SuppressWarnings("unchecked")
public Class<T> getAnnotatedSpecificationType() {
return (Class<T>)annotatedSpecification.getClass();
}
/**
* Returns the {@link IAnnotatedSpecification} from {@code entry} to be displayed in the
* column represented by this {@link AnnotationInstSpec}.
*/
public IAnnotatedSpecification getAnnotatedSpecification() {
return annotatedSpecification;
return specType;
}
/**
......
......@@ -5,7 +5,7 @@ DynamicTextFieldTreeTableCell.java de24117e6f785b328f1ff62383626a0b4b54e8ff GREE
DynamicTreeContentProviderBase.java 91896b1fb5104d126544c44c1ff8c30f2a13a8d6 GREEN
DynamicTreeItem.java 7486071d20e896d6ca9a9101bf105caccf3656d0 GREEN
DynamicTreeItemBase.java d883066ecc181120302ca32f328538de7a45b093 GREEN
DynamicTreeTableUIProviderBase.java a4cd60795d114984f7fd255f273fc39937889f22 GREEN
DynamicTreeTableUIProviderBase.java 668fb957d5c0c0f67d6bfd0b8d1130bc58997e3f GREEN
DynamicTreeTableViewer.java ead6f6671e9cb6b14632940bf440cba7e81fcd98 GREEN
DynamicTreeUIProviderBase.java 82d3c051213f0147f4c67ad247a08696cee73110 GREEN
DynamicTreeViewer.java 545f1ca10b7b3cad171b294a4b447875da45c9ed GREEN
......
......@@ -296,6 +296,9 @@ public abstract class DynamicTreeTableUIProviderBase<T> {
String colorStr = colorToRgbaString(bgColor, alpha);
cell.setStyle("-fx-background-color: " + colorStr);
}
final Node icon = getIconNode(data, columnIndex);
cell.setGraphic(icon);
}
}
}
......@@ -409,6 +412,13 @@ public abstract class DynamicTreeTableUIProviderBase<T> {
});
}
/** {@inheritDoc} */
@Override
public void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
styleCell(this, this.columnIndex);
}
/** {@inheritDoc} */
@Override
public void cancelEdit() {
......@@ -456,10 +466,8 @@ public abstract class DynamicTreeTableUIProviderBase<T> {
super.updateItem(item, empty);
ContextMenu menu = null;
Node icon = null;
if(!empty && item != null) {
T data = this.getTreeTableRow().getItem();
icon = getIconNode(data, colIndex);
menu = createContextMenu(data, colIndex);
if(IS_OS_LINUX && menu != null) {
......@@ -472,7 +480,7 @@ public abstract class DynamicTreeTableUIProviderBase<T> {
this.setStyle(style);
}
}
this.setGraphic(icon);
this.setContextMenu(menu);
styleCell(this, colIndex);
}
......
ContextMenuSubMenuContributorBase.java 6275d96fe8690d9d4744bcbaef3c7d14ba8e30ff GREEN
DialogMessageHandler.java 8714da09a777c8557de0a5c48ff68c340f9fa91d GREEN
EObjectActionBase.java 4ef9f8be59e64d4838acc9e268d418ba5d94fa1a GREEN
EObjectActionBase.java dba517c7527d71637239483dbe15b447fd1e6b19 GREEN
EReferenceListPropertySectionBase.java 7390dd7bfdc979e8ff0c5c30c67ab7b6c9d70c92 GREEN
EReferencePropertySectionBase.java 0548da6778516003257f59d0b4c2b60d458be3b6 GREEN
EditorBase.java 9c09fff92945256bb8680992ae7bb2c78f47b150 GREEN
......
......@@ -16,6 +16,7 @@
package org.fortiss.tooling.kernel.ui.extension.base;
import static java.util.Arrays.asList;
import static org.eclipse.emf.common.util.ECollections.unmodifiableEList;
import java.util.List;
......@@ -66,7 +67,7 @@ public abstract class EObjectActionBase<T extends EObject> extends Action {
}
/** Sets the target object. */
public void setTargets(List<T> newTargets) {
public synchronized void setTargets(List<T> newTargets) {
if(targets == null) {
targets = new BasicEList<T>(newTargets);
} else {
......@@ -82,14 +83,16 @@ public abstract class EObjectActionBase<T extends EObject> extends Action {
/** Returns the current target. */
public T getTarget() {
List<T> targets = getTargets();
// For actions that cannot deal with multiple selections, only the first
// item is picked, hence the get(0)
return(targets.isEmpty() ? null : targets.get(0));
}
/** Returns the current targets. */
public EList<T> getTargets() {
return targets;
public synchronized EList<T> getTargets() {
return unmodifiableEList(targets);
}
/** Refreshes the enabled state for the current action target. */
......