Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 367204

Summary: AbstractFeatureProvider's addIfPossible method always returns null
Product: [Modeling] Graphiti Reporter: Rhett Hudson <rhett.hudson>
Component: CoreAssignee: Michael Wenz <michael.wenz>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: matthias.gorning, michael.wenz
Version: 0.8.0Flags: michael.wenz: juno+
Target Milestone: 0.9.0   
Hardware: All   
OS: All   
Whiteboard: Juno M5 Theme_bugs

Description Rhett Hudson CLA 2011-12-20 10:53:04 EST
Build Identifier: 20110916-0149

The addIfPossible method of AbstractFeatureProvider always returns null. It looks like this commit http://git.eclipse.org/c/gmp/org.eclipse.gmp.graphiti.git/commit/plugins/org.eclipse.graphiti/src/org/eclipse/graphiti/features/impl/AbstractFeatureProvider.java?id=17f492ad5b4c29d17d08c2f0a5b865c866e47c29, removed the conditional block that performed an assignment to the local ret variable. In the current code, the only assignment to the ret variable is the initialization to null.

Previously, the method returned the newly added PictogramElement.

Reproducible: Always
Comment 1 Michael Wenz CLA 2011-12-29 10:27:29 EST
I fixed this by adding a return value to the method executeFeature in IDiagramEditor. The implementation in DiagramEditor returns the added PE in case of an add feature being executed, in all other cases it continues to return null.
The method addIfPossible grabs that return value and itself returns it. Also added a test case for this in GFOtherTests (testAddReturnsAddedPictogramElement).
Checked in and pushed to Eclipse:
commit 70c4695586a0f149d4f618bc797f60296c29c7d7
Author: mwenz <michael.wenz@sap.com> 2011-12-29 16:23:26
Committer: mwenz <michael.wenz@sap.com> 2011-12-29 16:23:38
Parent: ace4106947b31ad291bf068ca0c260c7a79ee2ce (.)
Branches: origin/master, master
Comment 2 Michael Wenz CLA 2012-04-11 10:50:54 EDT
Bookkeeping: Set target release
Comment 3 Michael Wenz CLA 2012-06-29 04:17:54 EDT
Part of Graphiti 0.9.0 (Eclipse Juno)