Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 358429 - [Table Editor] Table creation is available when the selected element is not an Element
Summary: [Table Editor] Table creation is available when the selected element is not a...
Status: RESOLVED FIXED
Alias: None
Product: Papyrus
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 0.9.0   Edit
Assignee: Vincent Lorenzo CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-21 10:27 EDT by Vincent Lorenzo CLA
Modified: 2014-03-13 12:59 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vincent Lorenzo CLA 2011-09-21 10:27:57 EDT
Table creation is available when the selected element is not an Element.
Steps to reproduce : 
	1/ Create a new diagram or a new table in a model
	2/ Select the table of the diagram in the ModelExplorer
	3/ In the menu "New Table", the Default Table is available (the table will be created using the root of the model)
Comment 1 Vincent Lorenzo CLA 2011-09-21 11:08:06 EDT
A first part has been done in R5531 on branch and merged in R5532 on the trunk and reverted in R5533
The action is not correctly refreshed in the Menu table and in the Toolbar.
I think we should create a new PropertyTester to refresh the action. 
We give it as argument the ClassName of the Handler for the command creation. We load the handler class from its name and the property tester return handler.isEnabled(). I think this solution should be generalized to force the refresh of the action.

Drawback : we use java reflexive with the method class.load

+ we should comment the following lines in AbstractCreateNattableEditorCommand.getTableContext() : 
//we shouldn't try to find a valid context when the selection is not valid!
		ModelSet modelSet = null;
		ServicesRegistry serviceRegistry;
		try {
			serviceRegistry = ServiceUtilsForActionHandlers.getInstance().getServiceRegistry();
			modelSet = ServiceUtils.getInstance().getModelSet(serviceRegistry);
		} catch (NullPointerException npe) {
			//
		} catch (ServiceException exception) {

		}


		if(modelSet != null) {
			IModel model = modelSet.getModel(org.eclipse.papyrus.resource.uml.UmlModel.MODEL_ID);

			if(model instanceof AbstractBaseModel) {
				return getRootElement(((AbstractBaseModel)model).getResource());
			}
		}
Comment 2 Camille Letavernier CLA 2014-03-13 12:59:08 EDT
Works as expected in the current version (New table implementation)