Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » CrossTable: Delete tool
CrossTable: Delete tool [message #1830470] Mon, 27 July 2020 13:04 Go to next message
Alexandra Tritean is currently offline Alexandra TriteanFriend
Messages: 6
Registered: March 2020
Junior Member
Hello,

Is it possible to implement a Delete tool for the 'Intersection' Mapping in a Sirius Cross Table or to override the action of the delete key?

What I want to achieve is one of the following:
- having some kind of delete tool on a cell, which will clear the content of that cell
OR
- when using the delete key to delete only the content of the selected cell instead of deleting the whole row

Thank you!

Kind regards,

Alexandra
Re: CrossTable: Delete tool [message #1830528 is a reply to message #1830470] Tue, 28 July 2020 13:53 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 492
Registered: May 2011
Senior Member
Hello,

Indeed, there is no Delete tool for the 'Intersection' only.
As this deletion is processed by the DeleteLinesAction, it would take a few classes to override it from the Editor to the listener that triggers this action. It is possible but a little bit overkill.

Instead of having a delete tool (triggers by the delete key), I think it would be easier that you implement a new contextual action that would clear the information stored in this intersection (I guess it is just a reference to remove). There is no contextual menu tool in a Table description unfortunately. You have to use the Eclipse way to create popup menus. For org.eclipse.ui.menus extension point, you should use popup:org.eclipse.sirius.table.ui.EditiontableEditorID?after=additions as location URI.

Best regards,
Steve


Steve Monnier - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: CrossTable: Delete tool [message #1830550 is a reply to message #1830528] Wed, 29 July 2020 03:34 Go to previous message
Alexandra Tritean is currently offline Alexandra TriteanFriend
Messages: 6
Registered: March 2020
Junior Member
Hello,

Thank you for the idea. That would be a more elegant solution than the one I've put in place for now.

Since I don't really need the delete tool for the column, I decided to use that one and to calculate the index of the selected cell by myself.

public void clearContent(EObject element) {
		int columnIndex =  ((Cell) element).getCoordinates().getColumnIndex();
		IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
		ITreeSelection selection = ((DTableCrossEditor) activeEditor).getTableViewer().getTreeViewer().getStructuredSelection();
		Object lineSelected = selection.getFirstElement();
		if(lineSelected instanceof DLineSpec) {
			 EObject line = ((DLineSpec)lineSelected).getTarget();
			 Row row = (Row) line;
			 row.getCells().get(columnIndex).setValue("");
		}
	}


Works like a charm, but I will definitely keep in mind your idea.

Thank you!

Kind Regards,
Alexandra
Previous Topic:How can I use drop down selection list in Sirius edition table
Next Topic:Modelling an EMF model from memory
Goto Forum:
  


Current Time: Wed Oct 28 15:22:50 GMT 2020

Powered by FUDForum. Page generated in 0.01769 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top