Bug 538007 - Create EModelService.deleteElement() method
Summary: Create EModelService.deleteElement() method
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.8   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 4.11 M3   Edit
Assignee: Lars Vogel CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks:
 
Reported: 2018-08-16 12:31 EDT by Lars Vogel CLA
Modified: 2019-02-11 05:58 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Vogel CLA 2018-08-16 12:31:43 EDT
Currently, the platform uses the following patter to remove a "someElement" model element.

------
someElement.setToBeRendered(false); // Causes the rendering engine to call 'removeGui'
someElement.getParent().getChildren().remove(someElement);
---------

Tom suggested a long time ago, to add a EModel.deleteElement() method which does that.

See https://www.eclipse.org/forums/index.php?t=msg&th=757211&goto=1371824&#msg_1371824
Comment 1 Lars Vogel CLA 2018-08-16 12:37:25 EDT
Tom, do you still think this method would be useful?
Comment 2 Thomas Schindl CLA 2018-08-17 04:12:44 EDT
+1 for an API on EModelService
Comment 3 Eclipse Genie CLA 2018-12-13 08:44:50 EST
New Gerrit change created: https://git.eclipse.org/r/133991
Comment 4 Lars Vogel CLA 2018-12-15 15:28:07 EST
(In reply to Thomas Schindl from comment #2)
> +1 for an API on EModelService

(In reply to Eclipse Genie from comment #3)
> New Gerrit change created: https://git.eclipse.org/r/133991

Tom, is this what you had in mind?
Comment 6 Andrey Loskutov CLA 2019-02-10 11:23:03 EST
(In reply to Eclipse Genie from comment #5)
> Gerrit change https://git.eclipse.org/r/133991 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/
> ?id=a98ab4975e6eb898e4111418a10b76c7e00eadab

https://download.eclipse.org/eclipse/downloads/drops4/I20190209-1800/testresults/html/org.eclipse.releng.tests_ep411I-unit-win32-java8_win32.win32.x86_64_8.0.html

Lars, this patch probably causes this error below (one from three, full list see bug 543933 comment 11) :

https://download.eclipse.org/eclipse/downloads/drops4/I20190209-1800/compilelogs/platform.doc.isv.javadoc.txt

../../../eclipse.platform.ui/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java:74: error: package org.eclipse.jdt.annotation does not exist
import org.eclipse.jdt.annotation.NonNull;
                                 ^
../../../eclipse.platform.ui/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java:164: error: cannot find symbol
	public void deleteModelElement(@NonNull MUIElement element) {
	                                ^
  symbol:   class NonNull
  location: class ModelServiceImpl
2 errors
Comment 7 Lars Vogel CLA 2019-02-11 02:52:12 EST
(In reply to Andrey Loskutov from comment #6)

Thanks, Andrey. As a temporary fix I will remove the annotation. Opened Bug 544322 for the support in the Javadoc build of @NonNull.
Comment 8 Eclipse Genie CLA 2019-02-11 02:53:39 EST
New Gerrit change created: https://git.eclipse.org/r/136645
Comment 10 Thomas Schindl CLA 2019-02-11 05:58:20 EST
(In reply to Lars Vogel from comment #7)
> (In reply to Andrey Loskutov from comment #6)
> 
> Thanks, Andrey. As a temporary fix I will remove the annotation. Opened Bug
> 544322 for the support in the Javadoc build of @NonNull.

I don't think it is a good idea to paritially introduce @NonNull/@Nullable.

Generally speaking: @NonNull is the default and @Nullable the exception (which is also true today where if not explictly stated you are not allowed to pass null).