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 (71)
Showing
with 151 additions and 73 deletions
......@@ -2,10 +2,10 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Tooling Base UI
Bundle-SymbolicName: org.fortiss.tooling.base.ui;singleton:=true
Bundle-Version: 2.14.0.qualifier
Bundle-Version: 2.15.0.qualifier
Bundle-Activator: org.fortiss.tooling.base.ui.ToolingBaseUIActivator
Require-Bundle: org.fortiss.tooling.base;bundle-version="2.14.0";visibility:=reexport,
org.fortiss.tooling.kernel.ui;bundle-version="2.14.0";visibility:=reexport,
Require-Bundle: org.fortiss.tooling.base;bundle-version="2.15.0";visibility:=reexport,
org.fortiss.tooling.kernel.ui;bundle-version="2.15.0";visibility:=reexport,
org.eclipse.swt
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-11
......
AnnotationLabelProvider.java b45aa4fcfb72726a4c43d2053a713aa5f6b3b7b5 GREEN
AnnotationLabelProvider.java 27d5bbb02d122e603abd158fa5a1fb39e79b0dc5 GREEN
CheckBoxLabelProvider.java 4030bef65a3b919cb087828b4616e5c966380e3e GREEN
ElementCommentLabelProvider.java 76aa6e9b930ce5680607852fd776172942c89ce5 GREEN
ElementLabelProviderBase.java f33502f73033ebdf30316df627e8a9c87e7d1b28 GREEN
......
......@@ -35,7 +35,7 @@ import org.fortiss.tooling.base.ui.annotation.view.IAnnotationViewPart;
public class AnnotationLabelProvider extends LabelProviderBase {
/** Background color for annotations that cannot be edited (and that are not derived). */
private static final Color READ_ONLY_ANNOTATION_BACKGROUND_COLOR =
public static final Color READ_ONLY_ANNOTATION_BACKGROUND_COLOR =
SWTResourceManager.getColor(230, 230, 230);
/** Background color for derived (computed) annotations. */
......@@ -96,21 +96,33 @@ public class AnnotationLabelProvider extends LabelProviderBase {
/** {@inheritDoc} */
@Override
public Color getBackground(Object element) {
Color color = super.getBackground(element);
if(element instanceof AnnotationEntry) {
AnnotationEntry annotationEntry = (AnnotationEntry)element;
if(annotationEntry.getModelElement().equals(viewPart.getCurrentlySelectedObject())) {
return super.getBackground(element);
return color;
}
if(!annotationEntry.canEdit(clazz)) {
if(IDerivedAnnotation.class.isAssignableFrom(clazz) &&
annotationEntry.getSpecificationValue(clazz) != null) {
return DERIVED_ANNOTATION_BACKGROUND_COLOR;
}
return READ_ONLY_ANNOTATION_BACKGROUND_COLOR;
}
return getAnnotatationBackgroundColor(annotationEntry, clazz, color);
}
return color;
}
/**
* Returns the background {@link Color} for the {@link AnnotationEntry} of the given
* {@code type}. The method returns dedicated colors for special cases such as read-only or
* "derived" annotations. Otherwise, the provided {@code defaultColor} is returned.
*/
public static Color getAnnotatationBackgroundColor(AnnotationEntry annotationEntry,
Class<? extends IAnnotatedSpecification> type, Color defaultColor) {
if(annotationEntry.canEdit(type)) {
return defaultColor;
}
if(IDerivedAnnotation.class.isAssignableFrom(type) &&
annotationEntry.getSpecificationValue(type) != null) {
return DERIVED_ANNOTATION_BACKGROUND_COLOR;
}
return super.getBackground(element);
return READ_ONLY_ANNOTATION_BACKGROUND_COLOR;
}
/**
......
ColumnHandle.java 8fc5f04cbb0127e5df8c7a9e3b2620502bf93716 GREEN
GenericAnnotationView.java 3986c6ab6f1b5f9ec04780c3d6256e7c70b91c1d GREEN
GenericAnnotationView.java 68a6eb91a4db97a58ebfacf400e73c297ab6b1a3 GREEN
......@@ -15,8 +15,11 @@
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.ui.annotation.view.generic;
import static org.apache.commons.lang3.reflect.MethodUtils.getMatchingMethod;
import static org.fortiss.tooling.base.ui.annotation.editingsupport.EditingSupportFactory.createEditingSupport;
import static org.fortiss.tooling.base.ui.annotation.labelprovider.LabelProviderFactory.createLabelProvider;
import static org.fortiss.tooling.kernel.utils.LoggingUtils.error;
import static org.fortiss.tooling.kernel.utils.LoggingUtils.warning;
import java.lang.reflect.Method;
import java.util.Collection;
......@@ -70,6 +73,7 @@ import org.fortiss.tooling.base.annotation.valueprovider.IAnnotationValueProvide
import org.fortiss.tooling.base.annotation.valueprovider.IAnnotationValueProvider.AnnotationActionParameters;
import org.fortiss.tooling.base.model.element.IAnnotatedSpecification;
import org.fortiss.tooling.base.model.element.IModelElement;
import org.fortiss.tooling.base.ui.ToolingBaseUIActivator;
import org.fortiss.tooling.base.ui.annotation.editingsupport.EditingSupportFactory;
import org.fortiss.tooling.base.ui.annotation.editingsupport.ElementCommentEditingSupport;
import org.fortiss.tooling.base.ui.annotation.editingsupport.ElementNameEditingSupport;
......@@ -220,11 +224,6 @@ public class GenericAnnotationView extends AnnotationViewPartBase {
// Minimize flickering while updating the table
tableViewer.getTable().setRedraw(false);
// Input must be set before the construction of the columns, since the editing support
// for a given cell might need to query the contents of other model elements (e.g., in
// order to aggregate a set of admissible choices for its value).
tableViewer.setInput(annotationEntries);
// Sorted set of {@link ColumnHandle} used to instantiate this {@link
// GenericAnnotationView}'s columns in the right order.
Set<ColumnHandle<?>> sortedColumnHandles = new TreeSet<ColumnHandle<?>>();
......@@ -236,6 +235,11 @@ public class GenericAnnotationView extends AnnotationViewPartBase {
column.dispose();
}
// Input must be set before the construction of the columns, since the editing support
// for a given cell might need to query the contents of other model elements (e.g., in
// order to aggregate a set of admissible choices for its value).
tableViewer.setInput(annotationEntries);
// Aggregate required columns. Column order is defined by ColumnHandle.compareTo().
for(AnnotationEntry entry : annotationEntries) {
for(IAnnotatedSpecification spec : entry.getSpecificationsList()) {
......@@ -295,15 +299,19 @@ public class GenericAnnotationView extends AnnotationViewPartBase {
*/
private void setTableItemHeight(Table table, int height) {
try {
Method method = table.getClass().getDeclaredMethod("setItemHeight", int.class);
Method method = getMatchingMethod(table.getClass(), "setItemHeight", int.class);
if(method != null) {
boolean accessible = method.isAccessible();
method.setAccessible(true);
method.invoke(table, height);
method.setAccessible(accessible);
boolean accessible = method.canAccess(table);
if(method.trySetAccessible()) {
method.invoke(table, height);
method.setAccessible(accessible);
} else {
warning(ToolingBaseUIActivator.getDefault(),
"Could not set annotation table height.");
}
}
} catch(Exception e) {
return;
error(ToolingBaseUIActivator.getDefault(), "Failed to set annotation table height.", e);
}
}
......
AutoLayoutMenu.java bca7986c209678ed937548a37db494430877d80e GREEN
AutoLayoutMenu.java 67dc2d04a6f39ec72ea640b745997baa8ff63a49 GREEN
DiagramTapeMeasure.java 72454e6fe5225dab11d3d691baad93aab7a171c0 GREEN
IAutoLayouter.java de1b11d9e202c7e23352ad85684dbf8a3fd17c7d GREEN
IAutoLayouterTapeMeasure.java df186e0ba505e0ecda211b1df76cf12f3245b47e GREEN
......
......@@ -82,8 +82,10 @@ public class AutoLayoutMenu implements IContextMenuContributor {
* outgoing {@link IConnection}.
*/
private boolean hasConnectedConnectorWithAngle(IHierarchicElement element) {
for(IConnector connector : element.getConnectors()) {
if(getAngle((ILayoutedModelElement)connector, CONNECTOR_ANGLE) != null) {
for(ILayoutedModelElement conLayouted : pickInstanceOf(ILayoutedModelElement.class,
element.getConnectors())) {
if(getAngle(conLayouted, CONNECTOR_ANGLE) != null) {
IConnector connector = (IConnector)conLayouted;
return !connector.getIncoming().isEmpty() || !connector.getOutgoing().isEmpty();
}
}
......
......@@ -2,14 +2,14 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.fortiss.tooling.base;singleton:=true
Bundle-Version: 2.14.0.qualifier
Bundle-Version: 2.15.0.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.emf.ecore;visibility:=reexport,
org.fortiss.tooling.kernel;visibility:=reexport;bundle-version="2.14.0"
org.fortiss.tooling.kernel;visibility:=reexport;bundle-version="2.15.0"
Bundle-ActivationPolicy: lazy
Export-Package: org.fortiss.tooling.base,
org.fortiss.tooling.base.annotation,
......
......@@ -671,27 +671,6 @@
</ownedStyle>
<actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
</ownedDiagramElements>
<ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_yQ9OAEosEei1a5h03EPS7w" name="IModelElementSpecificationArray" visible="false" tooltipText="" width="14" height="5">
<target xmi:type="ecore:EDataType" href="platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElementSpecificationArray"/>
<semanticElements xmi:type="ecore:EDataType" href="platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElementSpecificationArray"/>
<graphicalFilters xmi:type="diagram:HideFilter" xmi:id="_19HWsEosEei1a5h03EPS7w"/>
<ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_yQ9OAUosEei1a5h03EPS7w" borderSize="1" borderSizeComputationExpression="1" borderColor="125,125,125" backgroundStyle="Liquid" foregroundColor="255,250,191">
<description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EDataType']/@style"/>
</ownedStyle>
<actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EDataType']"/>
<ownedElements xmi:type="diagram:DNodeListElement" xmi:id="_yRFw4EosEei1a5h03EPS7w" name="org.fortiss.tooling.base.model.element.IModelElementSpecification[]" visible="false" tooltipText="">
<target xmi:type="ecore:EDataType" href="platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElementSpecificationArray"/>
<semanticElements xmi:type="ecore:EDataType" href="platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElementSpecificationArray"/>
<decorations xmi:type="viewpoint:Decoration" xmi:id="_yRFw4kosEei1a5h03EPS7w">
<description xmi:type="description:SemanticBasedDecoration" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@decorationDescriptionsSet/@decorationDescriptions[name='External']"/>
</decorations>
<ownedStyle xmi:type="diagram:BundledImage" xmi:id="_yRFw4UosEei1a5h03EPS7w" showIcon="false">
<labelFormat>italic</labelFormat>
<description xmi:type="style:BundledImageDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EDataType']/@subNodeMappings[name='EC_DataType_InstanceClassName']/@style"/>
</ownedStyle>
<actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EDataType']/@subNodeMappings[name='EC_DataType_InstanceClassName']"/>
</ownedElements>
</ownedDiagramElements>
<ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_yQ9OAkosEei1a5h03EPS7w" name="IDerivedAnnotation" tooltipText="" outgoingEdges="_yRI0P0osEei1a5h03EPS7w _yRJbQEosEei1a5h03EPS7w" width="12" height="10">
<target xmi:type="ecore:EClass" href="platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IDerivedAnnotation"/>
<semanticElements xmi:type="ecore:EClass" href="platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IDerivedAnnotation"/>
......
base.ecore d7254f90603d838d7371bfe830d6a7d20aa8bd59 GREEN
base.ecore 598ac2f27293be7344b762471a3570f45e63950d GREEN
......@@ -146,12 +146,6 @@
<details key="documentation" value="Super class of model element specifications that represent annotations (i.e., specifications that are guaranteed to exist exactly once for the model elements for which the annotation has been registered)"/>
</eAnnotations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EDataType" name="IModelElementSpecificationArray"
instanceClassName="org.fortiss.tooling.base.model.element.IModelElementSpecification[]">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="@deprecated An array of model element specifications."/>
</eAnnotations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="IDerivedAnnotation" abstract="true"
interface="true" eSuperTypes="#//element/IAnnotatedSpecification #//element/IHiddenSpecification">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
......
......@@ -10,7 +10,6 @@
ecorePackage="base.ecore#/">
<nestedGenPackages prefix="Element" basePackage="org.fortiss.tooling.base.model"
disposableProviderFactory="true" ecorePackage="base.ecore#//element">
<genDataTypes ecoreDataType="base.ecore#//element/IModelElementSpecificationArray"/>
<genClasses ecoreClass="base.ecore#//element/IModelElement">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference base.ecore#//element/IModelElement/specifications"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true"
......
......@@ -37,9 +37,11 @@
</extension>
<extension point="org.fortiss.tooling.kernel.migrationProvider">
<migrationProvider migrationProvider="org.fortiss.tooling.base.migration.AddMissingAnnotationsMigrationProvider">
<objectClass objectClass="org.fortiss.tooling.base.model.element.IModelElement"/>
</migrationProvider>
<migrationProvider migrationProvider="org.fortiss.tooling.base.migration.RemoveDuplicatedAnnotationsMigrationProvider">
<objectClass objectClass="org.fortiss.tooling.kernel.extension.data.ITopLevelElement"/>
<objectClass objectClass="org.fortiss.tooling.base.model.element.IModelElement"/>
</migrationProvider>
</extension>
</plugin>
AnnotationInstSpec.java b4f2ed47a8984e751e04049de5bdb3cad2c0a933 GREEN
DerivedAnnotationValueProviderBase.java 15da44b7b92b7fd351aa48422ff5957a2ce34e35 GREEN
DerivedAnnotationValueProviderBase.java afedd21d3469127bbb20adb34c191b5c9c980f6c GREEN
EStructuralFeatureDescriptor.java 2e14df3830d854bc1693382727b2033b23d0051c GREEN
EStructuralFeatureValueProviderBase.java 7e3f41a7e5c22fda63058fb5cd1c8036df0e8a3f GREEN
IAnnotationValueProvider.java d093cb522e7c484420331f0c77690bebe7e131b4 GREEN
EStructuralFeatureValueProviderBase.java 287facbbce47c16d892bae82a214f64ceeef2263 GREEN
IAnnotationValueProvider.java 08e0e5f66dc97865e9ac03e1ac646af332845e14 GREEN
ValueProviderBase.java e4e866840845346ec99a4304048f5327c4890996 GREEN
......@@ -98,7 +98,7 @@ public abstract class DerivedAnnotationValueProviderBase<T extends IDerivedAnnot
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
public <U> U getAnnotationValue(T specification) throws Exception {
public <U> U getAnnotationValue(T specification) {
U calculatedValue = (U)specification.getValue();
if(calculatedValue != null) {
return calculatedValue;
......
......@@ -163,7 +163,7 @@ public abstract class EStructuralFeatureValueProviderBase<T extends IAnnotatedSp
specification.eSet(structuralFeature,
eFactory.createFromString(eAttributeType, value));
} catch(Exception e) {
specification.eSet(structuralFeature, null);
// Keep previous value
}
} else {
throw new Exception(
......@@ -280,7 +280,7 @@ public abstract class EStructuralFeatureValueProviderBase<T extends IAnnotatedSp
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
public <U> U getAnnotationValue(T specification) throws Exception {
public <U> U getAnnotationValue(T specification) {
return (U)specification
.eGet(getEStructuralFeatureDescriptor().getEStructuralFeature(specification));
}
......
......@@ -64,10 +64,10 @@ public interface IAnnotationValueProvider<T extends IAnnotatedSpecification>
public class AnnotationActionEntry {
/** Scope defining the {@link AnnotationEntry}s to apply the corresponding action to. */
public enum ActionScope {
/** All {@link AnnotationEntry}s that are matching the selected filter. */
ALL_VISIBLE_ITEMS,
/** Apply the action only to the selected item. */
SINGLE_ITEM
/** All {@link AnnotationEntry}s that are matching the selected filter. */
ALL_VISIBLE_ITEMS,
/** Apply the action only to the selected item. */
SINGLE_ITEM
}
/** Name of the associated action, i.e. its entry. */
......@@ -292,7 +292,7 @@ public interface IAnnotationValueProvider<T extends IAnnotatedSpecification>
public boolean canEdit(T specification);
/** Returns the value of the annotation. */
public <U> U getAnnotationValue(T specification) throws Exception;
public <U> U getAnnotationValue(T specification);
/**
* Sets a new value for the annotation.
......
ConnectionCompositorBase.java 692689b535d7136acab2ab67a015f70809e64b6b GREEN
ConnectorCompositorBase.java 0264edd4034da7187d1dbdf35a674c7067adf3cd GREEN
ConnectorConnectionCompositorBase.java eed310a4710492b7ce3bc302c3db4e5c40f4d817 GREEN
ConnectorHierarchicElementConnectionCompositorBase.java 7a8e4acf235d5eb006c859056cce89fbb0aac05d GREEN
ConstraintInstanceContainerCompositor.java 9cb23f13c6cddba18ac7f9dcfd1afd9e7bce4d77 GREEN
......
/*-------------------------------------------------------------------------+
| Copyright 2017 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.base.compose;
import static org.fortiss.tooling.base.utils.RectangleLayoutUtils.layoutConnectorInRectangle;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.tooling.base.dnd.ElementDropContext;
import org.fortiss.tooling.base.model.element.IConnector;
import org.fortiss.tooling.base.model.element.IHierarchicElement;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
import org.fortiss.tooling.base.model.layout.Point;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
import org.fortiss.tooling.kernel.extension.data.Prototype;
/**
* Compositor base class for {@link IConnector}s.
*
* @author zverlov
* @author barner
*/
public abstract class ConnectorCompositorBase<T extends IHierarchicElement & ILayoutedModelElement>
extends HierarchicElementCompositorBase<T> {
/** {@inheritDoc} */
@Override
public boolean canCompose(T container, EObject contained, IElementCompositionContext context) {
return isCorrectElementClass(contained);
}
/** {@inheritDoc} */
@Override
public boolean canComposePrototype(Prototype prototype) {
return isCorrectElementClass(prototype.getPrototype());
}
/** {@inheritDoc} */
@Override
public boolean compose(T container, EObject contained, IElementCompositionContext context) {
super.compose(container, contained, context);
if(isCorrectElementClass(contained)) {
IConnector connector = (IConnector)contained;
if(context instanceof ElementDropContext) {
final ElementDropContext ctx = (ElementDropContext)context;
Point ctxPosition = ctx.getPosition();
if(((ElementDropContext)context).isRootFigureCanvas()) {
ctxPosition.translate(ctx.getViewLocationZoomed());
}
layoutConnectorInRectangle((ILayoutedModelElement)connector, container,
ctxPosition);
}
container.getConnectors().add(connector);
return true;
}
return false;
}
/** {@inheritDoc} */
@Override
public boolean canDecompose(EObject contained) {
return isCorrectElementClass(contained);
}
/** Returns whether the given element is of an acceptable class. */
protected abstract boolean isCorrectElementClass(EObject element);
}
AddMissingAnnotationsMigrationProvider.java a3f2b3cbcd39f85e15bc998650f899f55d9f563e GREEN
RemoveDuplicatedAnnotationsMigrationProvider.java f1bdb4733d5b9c6003a2b7fee59b89240a0a3b61 GREEN
RemoveOutdatedAnnotationInstanceMigrationProvider.java 29c29f2bb7515cad1de45a30ffc185001b47a016 GREEN