Commit 6598d42b authored by Alexander Diewald's avatar Alexander Diewald
Browse files

CR: RED



Issue-Ref: 3815
Signed-off-by: Alexander Diewald's avatarAlexander Diewald <diewald@fortiss.org>
parent cf98118a
ContextMenuUtil.java b0eaa896a4a237bad418f788314976a383b1fb8a YELLOW ContextMenuUtil.java 7f72dbd78a3dd9da2c083dd325ba7a686c7be778 RED
EObjectBasedDiagramControllerBase.java 77cad946c06ab73790220c4b07c392f183cc54cb YELLOW EObjectBasedDiagramControllerBase.java 66eb20fa8f6e320009226e1c284531d0be138367 RED
EObjectBasedRectangularResizableContentControllerBase.java 422211e075f8dc80f5a7096e059822fc39cc81a6 YELLOW EObjectBasedRectangularResizableContentControllerBase.java 79f3006141306ca3173c4f5f20121b46ce3fd009 RED
LayoutedModelElementBasedContentAnchorageController.java 37e91dc8639966cb7f802182211105f61385072d YELLOW LayoutedModelElementBasedContentAnchorageController.java 95535008b6468e459c70d8a987e021fb0c17f4b8 RED
LayoutedModelElementBasedDiagramAnchorageController.java a20392301d2cbb2cd85dfc391090453a2cb3b674 YELLOW LayoutedModelElementBasedDiagramAnchorageController.java 785aea3cdd5501ebf60f3096b54192beb5394086 RED
LayoutedModelElementBasedLinkBendPointController.java 4b4a5b81186fd485973f2a407648c50f7115ca57 YELLOW LayoutedModelElementBasedLinkBendPointController.java 8ff042ebd226e6e65aa860f0845ceddc4c117610 RED
...@@ -43,6 +43,7 @@ final class ContextMenuUtil { ...@@ -43,6 +43,7 @@ final class ContextMenuUtil {
/** Creates the menu populated with composable prototypes. */ /** Creates the menu populated with composable prototypes. */
public static List<MenuItem> createPrototypeMenu(EObject target, public static List<MenuItem> createPrototypeMenu(EObject target,
IElementCompositionContext context) { IElementCompositionContext context) {
// TODO(AD): Maybe get the used services in the beginning for more compact functional code.
List<MenuItem> result = new ArrayList<>(); List<MenuItem> result = new ArrayList<>();
Menu newMenu = new Menu("New ..."); Menu newMenu = new Menu("New ...");
List<Prototype> protos = List<Prototype> protos =
...@@ -52,6 +53,7 @@ final class ContextMenuUtil { ...@@ -52,6 +53,7 @@ final class ContextMenuUtil {
EObject prototypeCopy = p.getPrototypeCopy(); EObject prototypeCopy = p.getPrototypeCopy();
if(ecs.canCompose(target, prototypeCopy, context)) { if(ecs.canCompose(target, prototypeCopy, context)) {
MenuItem mi = new MenuItem(p.getName()); MenuItem mi = new MenuItem(p.getName());
// TODO(AD): Avoid curly braces in lambdas for single statements.
mi.setOnAction(evt -> { mi.setOnAction(evt -> {
ICommandStackService.getInstance().runAsCommand(target, () -> { ICommandStackService.getInstance().runAsCommand(target, () -> {
ecs.compose(target, prototypeCopy, context); ecs.compose(target, prototypeCopy, context);
...@@ -80,12 +82,14 @@ final class ContextMenuUtil { ...@@ -80,12 +82,14 @@ final class ContextMenuUtil {
// link highlighting // link highlighting
if(features.isLinkHighlightingEnabled()) { if(features.isLinkHighlightingEnabled()) {
MenuItem disableLinkHighlighting = new MenuItem("Disable Link Highlighting"); MenuItem disableLinkHighlighting = new MenuItem("Disable Link Highlighting");
// TODO(AD): Avoid curly braces in lambdas for single statements.
disableLinkHighlighting.setOnAction(evt -> { disableLinkHighlighting.setOnAction(evt -> {
features.setLinkHighlightingEnabled(false); features.setLinkHighlightingEnabled(false);
}); });
menu.getItems().add(disableLinkHighlighting); menu.getItems().add(disableLinkHighlighting);
} else { } else {
MenuItem enableLinkHighlighting = new MenuItem("Enable Link Highlighting"); MenuItem enableLinkHighlighting = new MenuItem("Enable Link Highlighting");
// TODO(AD): Avoid curly braces in lambdas for single statements.
enableLinkHighlighting.setOnAction(evt -> { enableLinkHighlighting.setOnAction(evt -> {
features.setLinkHighlightingEnabled(true); features.setLinkHighlightingEnabled(true);
}); });
...@@ -94,12 +98,14 @@ final class ContextMenuUtil { ...@@ -94,12 +98,14 @@ final class ContextMenuUtil {
// interaction area shading // interaction area shading
if(features.isInteractionAreaShadingEnabled()) { if(features.isInteractionAreaShadingEnabled()) {
MenuItem disableInteractionShading = new MenuItem("Disable Interactive Area Shading"); MenuItem disableInteractionShading = new MenuItem("Disable Interactive Area Shading");
// TODO(AD): Avoid curly braces in lambdas for single statements.
disableInteractionShading.setOnAction(evt -> { disableInteractionShading.setOnAction(evt -> {
features.setInteractionAreaShadingEnabled(false); features.setInteractionAreaShadingEnabled(false);
}); });
menu.getItems().add(disableInteractionShading); menu.getItems().add(disableInteractionShading);
} else { } else {
MenuItem enableInteractionShading = new MenuItem("Enable Interactive Area Shading"); MenuItem enableInteractionShading = new MenuItem("Enable Interactive Area Shading");
// TODO(AD): Avoid curly braces in lambdas for single statements.
enableInteractionShading.setOnAction(evt -> { enableInteractionShading.setOnAction(evt -> {
features.setInteractionAreaShadingEnabled(true); features.setInteractionAreaShadingEnabled(true);
}); });
......
...@@ -47,7 +47,12 @@ import javafx.scene.control.MenuItem; ...@@ -47,7 +47,12 @@ import javafx.scene.control.MenuItem;
/** /**
* Diagram controller that uses the {@link IElementCompositorService} to create context menu * Diagram controller that uses the {@link IElementCompositorService} to create context menu
* entries for prototypes provided by the {@link IContextMenuService}. * entries for prototypes provided by the {@link IContextMenuService}.
*
* @author hoelzl
*/ */
// TODO(AD): There are several duplicates in the implemented methods across the controllers in this
// package: Please consider adding another base class. For instance, the addListener/removeListener
// methods could be unified.
public abstract class EObjectBasedDiagramControllerBase extends ControllerBase public abstract class EObjectBasedDiagramControllerBase extends ControllerBase
implements IModelChangeProvider { implements IModelChangeProvider {
/** Notification adapter for model change events. */ /** Notification adapter for model change events. */
...@@ -77,6 +82,11 @@ public abstract class EObjectBasedDiagramControllerBase extends ControllerBase ...@@ -77,6 +82,11 @@ public abstract class EObjectBasedDiagramControllerBase extends ControllerBase
double y = max(features.getVerticalSpacing(), diagramLocation.getY()); double y = max(features.getVerticalSpacing(), diagramLocation.getY());
// wild cast works: see constructor exception // wild cast works: see constructor exception
// TODO(AD):
// * Are there use cases where the IContentMVCBundle is not an EObject?
// * Is tooling.common required to support any kind of model?
// * Would it be a viable alternative to parameterize the IContentMVCBundle class with the
// model type?
EObject modelParent = (EObject)getModel(); EObject modelParent = (EObject)getModel();
IElementCompositionContext edc = createElementCompositionContext(modelParent, x, y, true, IElementCompositionContext edc = createElementCompositionContext(modelParent, x, y, true,
getViewer().getFeatures().getCurrentZoomFactor()); getViewer().getFeatures().getCurrentZoomFactor());
...@@ -93,6 +103,7 @@ public abstract class EObjectBasedDiagramControllerBase extends ControllerBase ...@@ -93,6 +103,7 @@ public abstract class EObjectBasedDiagramControllerBase extends ControllerBase
@Override @Override
public void addListener(IModelChangeListener l) { public void addListener(IModelChangeListener l) {
if(changeListeners.isEmpty()) { if(changeListeners.isEmpty()) {
// Lazily install model listeners when the first listener is installed here.
connectToModel(); connectToModel();
} }
if(!changeListeners.contains(l)) { if(!changeListeners.contains(l)) {
......
...@@ -38,7 +38,12 @@ import javafx.scene.control.MenuItem; ...@@ -38,7 +38,12 @@ import javafx.scene.control.MenuItem;
/** /**
* {@link RectangularResizableContentControllerBase} with a listener mechanism connected to * {@link RectangularResizableContentControllerBase} with a listener mechanism connected to
* {@link EObject#eAdapters()}. * {@link EObject#eAdapters()}.
*
* @author hoelzl
*/ */
// TODO(AD): There are several duplicates in the implemented methods across the controllers in this
// package: Please consider adding another base class. For instance, the addListener/removeListener
// methods could be unified.
public abstract class EObjectBasedRectangularResizableContentControllerBase public abstract class EObjectBasedRectangularResizableContentControllerBase
extends RectangularResizableContentControllerBase implements IModelChangeProvider { extends RectangularResizableContentControllerBase implements IModelChangeProvider {
/** Layout model adapter used for listening to EMF model changes. */ /** Layout model adapter used for listening to EMF model changes. */
......
...@@ -36,7 +36,12 @@ import org.fortiss.tooling.kernel.service.IElementCompositorService; ...@@ -36,7 +36,12 @@ import org.fortiss.tooling.kernel.service.IElementCompositorService;
/** /**
* {@link DelegatingContentAnchorageController} for * {@link DelegatingContentAnchorageController} for
* {@link org.fortiss.tooling.base.model.layout.ILayoutedModelElement}s. * {@link org.fortiss.tooling.base.model.layout.ILayoutedModelElement}s.
*
* @author hoelzl
*/ */
// TODO(AD): There are several duplicates in the implemented methods across the controllers in this
// package: Please consider adding another base class. For instance, the addListener/removeListener
// methods could be unified.
public class LayoutedModelElementBasedContentAnchorageController public class LayoutedModelElementBasedContentAnchorageController
extends DelegatingContentAnchorageController implements IModelChangeProvider { extends DelegatingContentAnchorageController implements IModelChangeProvider {
/** Layout model adapter used for listening to EMF model changes. */ /** Layout model adapter used for listening to EMF model changes. */
......
...@@ -34,7 +34,14 @@ import org.fortiss.tooling.base.utils.LayoutModelElementAdapter; ...@@ -34,7 +34,14 @@ import org.fortiss.tooling.base.utils.LayoutModelElementAdapter;
import org.fortiss.tooling.kernel.service.IConnectionCompositorService; import org.fortiss.tooling.kernel.service.IConnectionCompositorService;
import org.fortiss.tooling.kernel.service.IElementCompositorService; import org.fortiss.tooling.kernel.service.IElementCompositorService;
/** {@link MoveControllerBase} for {@link ILayoutedModelElement}s. */ /**
* {@link MoveControllerBase} for {@link ILayoutedModelElement}s.
*
* @author hoelzl
*/
// TODO(AD): There are several duplicates in the implemented methods across the controllers in this
// package: Please consider adding another base class. For instance, the addListener/removeListener
// methods could be unified.
public class LayoutedModelElementBasedDiagramAnchorageController extends MoveControllerBase public class LayoutedModelElementBasedDiagramAnchorageController extends MoveControllerBase
implements IModelChangeProvider { implements IModelChangeProvider {
/** Layout model adapter used for listening to EMF model changes. */ /** Layout model adapter used for listening to EMF model changes. */
......
...@@ -38,6 +38,8 @@ import org.fortiss.tooling.kernel.service.IConnectionCompositorService; ...@@ -38,6 +38,8 @@ import org.fortiss.tooling.kernel.service.IConnectionCompositorService;
/** /**
* {@link IController} for {@link ILayoutedModelElement}s representing links and connections in a * {@link IController} for {@link ILayoutedModelElement}s representing links and connections in a
* {@link DiagramViewer}. * {@link DiagramViewer}.
*
* @author hoelzl
*/ */
public class LayoutedModelElementBasedLinkBendPointController extends LinkControllerBase public class LayoutedModelElementBasedLinkBendPointController extends LinkControllerBase
implements IModelChangeProvider { implements IModelChangeProvider {
......
...@@ -6,7 +6,7 @@ ConstraintsBaseUtils.java bba938b43756ce6f35c338f6cef21c3ab5d49a9d GREEN ...@@ -6,7 +6,7 @@ ConstraintsBaseUtils.java bba938b43756ce6f35c338f6cef21c3ab5d49a9d GREEN
DimensionUtils.java 0dc67f9de11a84e6e4c6e1eb627817dee91ff30a GREEN DimensionUtils.java 0dc67f9de11a84e6e4c6e1eb627817dee91ff30a GREEN
EllipseLayoutUtils.java 5c3a0126fdca5d5b4fb441694747e1cb0f49cd9f GREEN EllipseLayoutUtils.java 5c3a0126fdca5d5b4fb441694747e1cb0f49cd9f GREEN
LayoutDataUtils.java 5739dd16f0212e8f94927c0a0f51503390f2be69 GREEN LayoutDataUtils.java 5739dd16f0212e8f94927c0a0f51503390f2be69 GREEN
LayoutModelElementAdapter.java 1a1c9700513ec2e74f99ea20a830bf8d0db5983a YELLOW LayoutModelElementAdapter.java fcbd25ff4fa93e10692cdbbe7a2adf6cd04b93a2 RED
LayoutModelElementFactory.java c49fca2de5a8cb7502fb28cc2b7e64a272df11b0 GREEN LayoutModelElementFactory.java c49fca2de5a8cb7502fb28cc2b7e64a272df11b0 GREEN
MigrationUtils.java ab9d8682233313c21c6a52b8b03e1c796aacd29c GREEN MigrationUtils.java ab9d8682233313c21c6a52b8b03e1c796aacd29c GREEN
OffsetOrientationUtils.java 913cebbac2a5628bdd08b4df669b9412d6e07d94 GREEN OffsetOrientationUtils.java 913cebbac2a5628bdd08b4df669b9412d6e07d94 GREEN
......
...@@ -48,6 +48,8 @@ public class LayoutModelElementAdapter extends EContentAdapter implements Comman ...@@ -48,6 +48,8 @@ public class LayoutModelElementAdapter extends EContentAdapter implements Comman
private final List<Notification> notifications = new ArrayList<>(); private final List<Notification> notifications = new ArrayList<>();
/** Constructor. */ /** Constructor. */
// TODO(AD): The service references could also be moved to fields to save some chars/method
// accesses.
public LayoutModelElementAdapter(ILayoutedModelElement layouted) { public LayoutModelElementAdapter(ILayoutedModelElement layouted) {
this.modelElement = requireNonNull(layouted); this.modelElement = requireNonNull(layouted);
modelElement.eAdapters().add(this); modelElement.eAdapters().add(this);
...@@ -71,6 +73,8 @@ public class LayoutModelElementAdapter extends EContentAdapter implements Comman ...@@ -71,6 +73,8 @@ public class LayoutModelElementAdapter extends EContentAdapter implements Comman
if(notifier == modelElement) { if(notifier == modelElement) {
Object feature = notification.getFeature(); Object feature = notification.getFeature();
if(feature instanceof EAttribute) { if(feature instanceof EAttribute) {
// TODO(AD): Just for my understanding: Why is it required to add the notification
// in this case?
notifications.add(notification); notifications.add(notification);
// no selfAdapt needed for attributes // no selfAdapt needed for attributes
return; return;
......
...@@ -7,7 +7,7 @@ EReferencePropertySectionBase.java 0548da6778516003257f59d0b4c2b60d458be3b6 GREE ...@@ -7,7 +7,7 @@ EReferencePropertySectionBase.java 0548da6778516003257f59d0b4c2b60d458be3b6 GREE
EditorBase.java 9c09fff92945256bb8680992ae7bb2c78f47b150 GREEN EditorBase.java 9c09fff92945256bb8680992ae7bb2c78f47b150 GREEN
FXEditorBase.java 2e520be0bbae7d0aebdff70218a124dbe0896ce2 YELLOW FXEditorBase.java 2e520be0bbae7d0aebdff70218a124dbe0896ce2 YELLOW
IListPropertySection.java 8bb00fe7959583e794ff9437b7a77404c9a9e70f GREEN IListPropertySection.java 8bb00fe7959583e794ff9437b7a77404c9a9e70f GREEN
LWFXEFEditorBase.java ab11a24ea8d5ef9fe6d37eca2e11092c40791dc5 YELLOW LWFXEFEditorBase.java 5c53864d395ec15a0b31fa4e33cc5384d01d6f0a RED
ModelEditorBindingBase.java 4c5ac569c0b6e7678fc8191096b26dfd09fdcb98 GREEN ModelEditorBindingBase.java 4c5ac569c0b6e7678fc8191096b26dfd09fdcb98 GREEN
ModelElementHandlerBase.java 384727748f125c9d43f19d9c0eba4ba1be5a7a26 GREEN ModelElementHandlerBase.java 384727748f125c9d43f19d9c0eba4ba1be5a7a26 GREEN
MultiEObjectActionBase.java 9e237d8ea640c4194e4877af4a9cfce88698e543 GREEN MultiEObjectActionBase.java 9e237d8ea640c4194e4877af4a9cfce88698e543 GREEN
......
...@@ -50,6 +50,7 @@ public abstract class LWFXEFEditorBase<T extends EObject> extends FXEditorBase<T ...@@ -50,6 +50,7 @@ public abstract class LWFXEFEditorBase<T extends EObject> extends FXEditorBase<T
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
// TODO(AD): Avoid curly braces in lambdas for single statements.
protected final Parent createSceneRoot() { protected final Parent createSceneRoot() {
viewer = new DiagramViewer(createModelFactory(), createVisualFactory(), viewer = new DiagramViewer(createModelFactory(), createVisualFactory(),
createControllerFactory(), cb -> { createControllerFactory(), cb -> {
...@@ -83,6 +84,7 @@ public abstract class LWFXEFEditorBase<T extends EObject> extends FXEditorBase<T ...@@ -83,6 +84,7 @@ public abstract class LWFXEFEditorBase<T extends EObject> extends FXEditorBase<T
/** Called when some change to the model happens. */ /** Called when some change to the model happens. */
protected void applyModelChange(Change chg) { protected void applyModelChange(Change chg) {
// TODO(AD): Avoid curly braces in lambdas for single statements.
ICommandStackService.getInstance().runAsCommand(editedObject, () -> { ICommandStackService.getInstance().runAsCommand(editedObject, () -> {
chg.applyChange(); chg.applyChange();
}); });
...@@ -118,6 +120,7 @@ public abstract class LWFXEFEditorBase<T extends EObject> extends FXEditorBase<T ...@@ -118,6 +120,7 @@ public abstract class LWFXEFEditorBase<T extends EObject> extends FXEditorBase<T
} }
/** Creates an {@link IStructuredSelection} from {@link DiagramViewerSelection}. */ /** Creates an {@link IStructuredSelection} from {@link DiagramViewerSelection}. */
// TODO(AD): Can't this be put directly in the getSelection method?
private IStructuredSelection createSelection() { private IStructuredSelection createSelection() {
DiagramViewerSelection vsel = viewer.getSelection(); DiagramViewerSelection vsel = viewer.getSelection();
if(vsel.isEmpty()) { if(vsel.isEmpty()) {
......
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