Community
Participate
Working Groups
It would be nice if I can remove EJBs from my project directly deleting them from the DD Node in the Project Explorer View. Currently, it seems I have to go to the code and delete or the classes related to my EJB (the EJB itself and the interfaces). Thanks, Chemi.
I think we could consider adding a Remove action in the maintenance release. However, the situation with deleting the interfaces is a little bit delicate, because: - the interfaces can be just in the classpath of the EJB project, but not a Java source files of the project itself. - several beans could share one and the same business interface. Deleting one of them together with the interface would corrupt the others. May be upon calling the Remove action a dialog should popup to the user explicitly asking which interfaces to delete. Chemi, what is your opinion on this?
I didn't consider the scenarios you commented. I was just thinking in EJBs with no shared code between them, and all EJBs contained in the source files of the project. But yes, I agree with you. It could be an option.
I think it is safer to consider this enhancement for the next major release.
Using the model of the project one can check if an interface of a bean is implemented by other beans. This way the dialog might be open only when a bean interface is not implemented by other beans.
Created attachment 131613 [details] Delete EJBs 3.0 Action
Created attachment 133107 [details] Delete EJB 3.0 Action
Created attachment 133119 [details] Delete EJB 3.0 Action In this patch a dialog with available removable interfaces is opened only if the business interfaces are source files and are not implemented by other beans.
Petya: Looks really good, but is missing a few touches, 1. put some icons for the labels, so the user can see the types of the interfaces. 2. place the bean in the space as well and the interfaces as children 3. enable multi-selection for beans.
Created attachment 140177 [details] Delete EJB 3.0 Action
Created attachment 140244 [details] Delete ejb from DD tree action This patch supports deletion of session bean 2.x interfaces too.
Created attachment 140569 [details] Delete ejb from DD tree action
Hi Petya, last request :) During removal of Message Driven Bean there is no confirmation dialog, since this operation cannot be undone. This is true for 2.x entity beans as well, as well as Entities are not removed from ejb-jar.xml
Created attachment 141758 [details] Delete EJBs There are already confirmation dialogs, when a Message-driven bean or an Entity is trying to be removed . And with this patch, the action removes EJB of any type from the ejb-jar.xml.
Hi Petya, I got this exception with the attached project.
Created attachment 141868 [details] project java.lang.NullPointerException at org.eclipse.jst.jee.ui.internal.navigator.ejb.DeleteEJBAction.deleteBean(DeleteEJBAction.java:81) at org.eclipse.jst.jee.ui.internal.navigator.ejb.DeleteEJBAction.run(DeleteEJBAction.java:69) at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
I could not reproduce the problem this is something local I guess. Committing the changes.
Created attachment 141871 [details] delete ejb Avoid the NullPointerException if there is no existing ejb-jar.xml in the project.
Created attachment 141872 [details] delete action Avoid ClassCastException when deleting interfaces.
The more generic bug 289767 is open to replace the several bugs that are related to refactoring Java EE artifacts. *** This bug has been marked as a duplicate of bug 289767 ***