Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » How to disable multi selection of elements in graphiti(How to disable multi select in graphiti)
How to disable multi selection of elements in graphiti [message #1116496] Wed, 25 September 2013 14:25 Go to next message
PALANI SANKAR is currently offline PALANI SANKAR
Messages: 35
Registered: April 2013
Member
HI All

Is there any way to control multi selection of elements in graphiti?

I wish to disable delete if multiple elements are selected.


Thanks
Palani
Re: How to disable multi selection of elements in graphiti [message #1116503 is a reply to message #1116496] Wed, 25 September 2013 14:31 Go to previous messageGo to next message
Marek Jagielski is currently offline Marek Jagielski
Messages: 59
Registered: April 2012
Member
Hi,
In public class MyToolBehaviorProvider extends DefaultToolBehaviorProvider

I wrote this code to deselect labels when there are more object selected:
	@Override
	public PictogramElement getSelection(PictogramElement originalPe, PictogramElement[] oldSelection) {
		if(oldSelection.length > 1) {
			List<PictogramElement> withoutLabels = new ArrayList<PictogramElement>();
			for(PictogramElement pe : oldSelection) {
				String labelProperty = Graphiti.getPeService().getPropertyValue(pe,	AddElementFeature.LABEL_PROPERTY);
				if (Boolean.parseBoolean(labelProperty)) continue;
				withoutLabels.add(pe);
			}
			PictogramElement[] withoutLabelsArray = new PictogramElement[withoutLabels.size()];
			withoutLabels.toArray(withoutLabelsArray);
			getDiagramTypeProvider().getDiagramBehavior().getDiagramContainer().selectPictogramElements(withoutLabelsArray);
		}
		
		return null;
	}


Marek
Re: How to disable multi selection of elements in graphiti [message #1121092 is a reply to message #1116503] Mon, 30 September 2013 09:05 Go to previous message
PALANI SANKAR is currently offline PALANI SANKAR
Messages: 35
Registered: April 2013
Member
Hi Marek,

Thanks For you reply. There is another option in toolBehaviourprovider

@Override
public boolean isMultiSelectionEnabled() {
return false;
}

If you override the above code multiselection can be disabled.

Thanks
Palani


Thanks
Palani
Previous Topic:Outline view not available in plugin
Next Topic:Distinguish Containers
Goto Forum:
  


Current Time: Tue Sep 16 23:51:43 GMT 2014

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

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