Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Make diagram readonly and hide pallet
Make diagram readonly and hide pallet [message #1718488] Thu, 24 December 2015 15:35 Go to next message
Koen Staal is currently offline Koen StaalFriend
Messages: 70
Registered: October 2014
Member
Hi
I want to show a diagram to the user but this diagram should not be edited.
I have looked through the api but dont see how.

Is there a way to programmatically hide the pallete of the diagram and set it to read only?

Thanks Koen

[Updated on: Thu, 24 December 2015 15:36]

Report message to a moderator

Re: Make diagram readonly and hide pallet [message #1718615 is a reply to message #1718488] Mon, 28 December 2015 10:34 Go to previous messageGo to next message
Esteban Dugueperoux is currently offline Esteban DugueperouxFriend
Messages: 472
Registered: July 2009
Senior Member
Hi Koen,

You can do that by using a IPermissionAuthority which returns false for
its methods. By default there is a ReadOnlyPermissionAuthority which is
not active, you can activate it by calling
ReadOnlyPermissionAuthority.activate().

Best Regards.

Le 24/12/2015 16:35, Koen Staal a écrit :
> Hi
> I want to show the diagram to the user but this diagram should not be
> edited.
> I have looked through the api but dont see a way.
>
> Is there a way to programmatically hide the pallete of the diagram and
> set it to read only?
>
> Thanks Koen



--
Esteban Dugueperoux - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Make diagram readonly and hide pallet [message #1718921 is a reply to message #1718615] Sat, 02 January 2016 14:14 Go to previous messageGo to next message
Koen Staal is currently offline Koen StaalFriend
Messages: 70
Registered: October 2014
Member
Esteban thanks for the tip.

By activating readonly on the ReadonlyPermissionAuthority, the whole editingsession becomes readonly and can not even be cancelled.
Im wondering if i should extend ReadonlyPermissionAuthority to fit my needs but comments in there says i should not.
Another way is to intercept all changes/commands and check somehow if the representation should not be edited.

I found that the DDiagramEditor also has a palettemanager but it does not have a hide or show which i did expect.

[Updated on: Sun, 03 January 2016 12:11]

Report message to a moderator

Re: Make diagram readonly and hide pallet [message #1718997 is a reply to message #1718921] Mon, 04 January 2016 10:36 Go to previous messageGo to next message
Laurent Fasani is currently offline Laurent FasaniFriend
Messages: 174
Registered: October 2014
Senior Member
Hello Koen

Le 02/01/2016 15:14, Koen Staal a écrit :
> Esteban thanks for the tip.
>
> By activating readonly on the ReadonlyPermissionAuthority, the whole
> editingsession becomes and can not even be cancelled.
>
> Im wondering if i should extend ReadonlyPermissionAuthority to fit my
> needs but comments in there says i should not.
Yes, you can provide your own permissionAuthority extending
ReadonlyPermissionAuthority and overloading checkApproval method

In addition to what Esteban said, you can provide this
PermissionAuthority also using the following extension point:
org.eclipse.sirius.ecore.extender.PermissionProvider

>
> Another way is to intercept all changes/commands and check if the editor
> is in my readonly.
>
>
>
> I found that the DDiagramEditor also has a palettemanager but it does
> not have a hide or show which i did expect.
>
The palette can be emptied but not hidden.

Regards
Laurent


Laurent Fasani - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Make diagram readonly and hide pallet [message #1720401 is a reply to message #1718997] Mon, 18 January 2016 12:30 Go to previous messageGo to next message
Koen Staal is currently offline Koen StaalFriend
Messages: 70
Registered: October 2014
Member
thanks for the responses, the extension point helped a lot
I got back to this last week. i used the extension point org.eclipse.sirius.ecore.extender.PermissionProvider.
Creating my own IPermissionProvider and IPermissionAuthority i can make the diagram readonly.

Though, the red lock icons that appear all over the diagram are a bit too much.
The lock icon on the editor tab is enough in my opinion.

Is there a way to not show these icons in the diagram?

And as for the pallete, i do not necessarely want to hide it completely. I want to close it, fold it back in to the side. There is no functionallity in there anyway, a waste of space.

Re: Make diagram readonly and hide pallet [message #1720403 is a reply to message #1720401] Mon, 18 January 2016 12:54 Go to previous messageGo to next message
Koen Staal is currently offline Koen StaalFriend
Messages: 70
Registered: October 2014
Member
It seems that when i return LockStatus.NOT_LOCKED from getLockStatus(EObject element) the locks no longer are show. For the same object i also return 'false' for canEdit, canCreate, canDelete etc.
Can this cause any problems?

[Updated on: Mon, 18 January 2016 12:56]

Report message to a moderator

Re: Make diagram readonly and hide pallet [message #1720981 is a reply to message #1720403] Fri, 22 January 2016 09:35 Go to previous message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 554
Registered: July 2009
Senior Member
Le 18/01/2016 13:54, Koen Staal a écrit :
> It seems that when i return LockStatus.NOT_LOCKED from
> getLockStatus(EObject element) the locks no longer are show. For the
> same object i aslo return 'false' for canEdit, canCreate, canDelete etc.
> Can this cause any problems?

It should not. It's perfectly legitimate for these operations to be
disabled for other reasons than a lock on the element. For example if
the underlying resource is read-only, or the corresponding feature is
not changeable in the metamodel definition.

Regards,
Pierre-Charles.

--
Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Eclipse error when show properties of container
Next Topic:NodeMappingImport loses bordered nodes of imported node
Goto Forum:
  


Current Time: Wed Jan 27 20:25:05 GMT 2021

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

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

Back to the top