Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Adding "underline" and "strikethrough" in appereance
Adding "underline" and "strikethrough" in appereance [message #16926] Mon, 14 August 2006 03:18 Go to next message
Eclipse UserFriend
Hi,

I have to add "underline" and "strikethrough" features in Appearance
page in Properties view. Can someone give me any hints?

Regards,
Trifonov
Re: Adding "underline" and "strikethrough" in appereance [message #18181 is a reply to message #16926] Mon, 14 August 2006 19:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: khai.n.situvista.com

This is going to take some effort so I hope you're up for it:-)

The Appearance tab is contributed by the
org.eclipse.gmf.runtime.diagram.ui.properties plug-in; the required
three extension point declarations, and the corresponding implementation
classes are found in this plug-in.

This plug-in contributes three tabs; the Appearance and Advanced tabs
are always shown when anything in the editor is selected, and
additionally the Grid tab is shown when the canvas itself is selected.
These contributions are fixed with no built-in capability to 'swap out'
the appearance tab with your own or for adding additional items to the
existing tab.


The quick and dirty solution is to import
org.eclipse.gmf.runtime.diagram.ui.properties into your workspace (as
source) then clone ....appearance.ConnectionAppearancePropertySection
and any other required classes (put the clones in your own plug-in) then
add your own "underline" and "strikethrough" properties to your
clone(s). Then in the plugin.xml of
org.eclipse.gmf.runtime.diagram.ui.properties modify the extension point
declaration(s) to point to your 'cloned' version(s) instead. This is
not your final solution because you really don't want to hack Eclipse
code and distribute it with your plug-in or application (bad Karma :-P).
What the quick and dirty solution can do is get you up and running
pretty quickly with prototyping/developing your enhancements.


Once you're satisfied that the enhancements are working then it's time
to make them official.

Making it official means stopping the hijacking of
org.eclipse.gmf.runtime.diagram.ui.properties and properly declaring
your own custom propertyContributor.


There are just 3 basic steps to this process:

1. Implement and override .getContributorId() in the generated
<your>DiagramEditor by returning your own ID for the custom
contribution. This ID is a string that you choose so it can be just
about anything; you can simply follow any convention you have now for
other extension point ID's in your application. As an example let's
make the ID = "com.my.own.contributor.id"


2. Copy/paste the following three extension point declarations from the
'hacked' org.eclipse.gmf.runtime.diagram.ui.properties#plugin.xml into
your own plugin.xml:

org.eclipse.ui.views.properties.tabbed.propertyContributor
org.eclipse.ui.views.properties.tabbed.propertyTabs
org.eclipse.ui.views.properties.tabbed.propertySections


3. Now in your own plugin.xml replace the three:
contributorId="org.eclipse.gmf.runtime.diagram.ui.properties "
with
contributorId="com.my.own.contributor.id"


That's about it.

You can delete the hacked version of
org.eclipse.gmf.runtime.diagram.ui.properties at this point since you
don't need it any more.

I hope this is enough of a hint on how you can get started; the bulk of
your work (and maybe headaches:-P) is to get to know how the existing
code utilizes the editing domain, commands, etc... and then adding your
own stuff to it.


Have fun!!!
-- Khai --









Trifonov wrote:
> Hi,
>
> I have to add "underline" and "strikethrough" features in Appearance
> page in Properties view. Can someone give me any hints?
>
> Regards,
> Trifonov
Re: Adding "underline" and "strikethrough" in appereance (amended!!!) [message #18197 is a reply to message #18181] Mon, 14 August 2006 19:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: khai.n.situvista.com

I forgot a couple of more hints so I added them to the bottom:-)

============================================================ =========
This is going to take some effort so I hope you're up for it:-)

The Appearance tab is contributed by the
org.eclipse.gmf.runtime.diagram.ui.properties plug-in; the required
three extension point declarations, and the corresponding implementation
classes are found in this plug-in.

This plug-in contributes three tabs; the Appearance and Advanced tabs
are always shown when anything in the editor is selected, and
additionally the Grid tab is shown when the canvas itself is selected.
These contributions are fixed with no built-in capability to 'swap out'
the appearance tab with your own or for adding additional items to the
existing tab.


The quick and dirty solution is to import
org.eclipse.gmf.runtime.diagram.ui.properties into your workspace (as
source) then clone ....appearance.ConnectionAppearancePropertySection
and any other required classes (put the clones in your own plug-in) then
add your own "underline" and "strikethrough" properties to your
clone(s). Then in the plugin.xml of
org.eclipse.gmf.runtime.diagram.ui.properties modify the extension point
declaration(s) to point to your 'cloned' version(s) instead. This is
not your final solution because you really don't want to hack Eclipse
code and distribute it with your plug-in or application (bad Karma :-P).
What the quick and dirty solution can do is get you up and running
pretty quickly with prototyping/developing your enhancements.


Once you're satisfied that the enhancements are working then it's time
to make them official.

Making it official means stopping the hijacking of
org.eclipse.gmf.runtime.diagram.ui.properties and properly declaring
your own custom propertyContributor.


There are just 3 basic steps to this process:

1. Implement and override .getContributorId() in the generated
<your>DiagramEditor by returning your own ID for the custom
contribution. This ID is a string that you choose so it can be just
about anything; you can simply follow any convention you have now for
other extension point ID's in your application. As an example let's
make the ID = "com.my.own.contributor.id"


2. Copy/paste the following three extension point declarations from the
'hacked' org.eclipse.gmf.runtime.diagram.ui.properties#plugin.xml into
your own plugin.xml:

org.eclipse.ui.views.properties.tabbed.propertyContributor
org.eclipse.ui.views.properties.tabbed.propertyTabs
org.eclipse.ui.views.properties.tabbed.propertySections


3. Now in your own plugin.xml replace the three:
contributorId="org.eclipse.gmf.runtime.diagram.ui.properties "
with
contributorId="com.my.own.contributor.id"


That's about it.

You can delete the hacked version of
org.eclipse.gmf.runtime.diagram.ui.properties at this point since you
don't need it any more.

I hope this is enough of a hint on how you can get started; the bulk of
your work (and maybe headaches:-P) is to get to know how the existing
code utilizes the editing domain, commands, etc... and then adding your
own stuff to it.


Hints +1 -- If your editor has some non-standard or tricky hierarchy you
may have to extend the default ModelElementTypeMapper or provide your
own custom implementation of ITypeManager.

Hint +2 -- Likewise with the LabelProvider

Hint +3 -- If you want finer control of when these new properties show
up (maybe they're only applicable for certain nodes???) then you would
want to extend the default filters or provide your own implementation of
IFilter.



Have fun!!!
-- Khai --









Trifonov wrote:
> Hi,
>
> I have to add "underline" and "strikethrough" features in Appearance
page in Properties view. Can someone give me any hints?
>
> Regards,
> Trifonov
Re: Adding "underline" and "strikethrough" in appereance (amended!!!) [message #19323 is a reply to message #18197] Tue, 15 August 2006 09:33 Go to previous messageGo to next message
Eclipse UserFriend
Hi Khai,

Thank you very much for the help. I created one more "bold" button in
appearance page following your guides but I have two more questions.

- How to persist the values (underline, strikethrough). I think to add
values into each element and to keep it there.. if the element there is
no such structural feature I'll not do anything. Is it appropriate way
to do it?

- How the changes of the properties will reflect into the Editor? Now,
If I set an element to be bold, the text in associated Label is bold...
How can I do the same for the underline?

Regards,
Trifonov



Khai M Nguyen wrote:
> I forgot a couple of more hints so I added them to the bottom:-)
>
> ============================================================ =========
> This is going to take some effort so I hope you're up for it:-)
>
> The Appearance tab is contributed by the
> org.eclipse.gmf.runtime.diagram.ui.properties plug-in; the required
> three extension point declarations, and the corresponding implementation
> classes are found in this plug-in.
>
> This plug-in contributes three tabs; the Appearance and Advanced tabs
> are always shown when anything in the editor is selected, and
> additionally the Grid tab is shown when the canvas itself is selected.
> These contributions are fixed with no built-in capability to 'swap out'
> the appearance tab with your own or for adding additional items to the
> existing tab.
>
>
> The quick and dirty solution is to import
> org.eclipse.gmf.runtime.diagram.ui.properties into your workspace (as
> source) then clone ....appearance.ConnectionAppearancePropertySection
> and any other required classes (put the clones in your own plug-in) then
> add your own "underline" and "strikethrough" properties to your
> clone(s). Then in the plugin.xml of
> org.eclipse.gmf.runtime.diagram.ui.properties modify the extension point
> declaration(s) to point to your 'cloned' version(s) instead. This is
> not your final solution because you really don't want to hack Eclipse
> code and distribute it with your plug-in or application (bad Karma :-P).
> What the quick and dirty solution can do is get you up and running
> pretty quickly with prototyping/developing your enhancements.
>
>
> Once you're satisfied that the enhancements are working then it's time
> to make them official.
>
> Making it official means stopping the hijacking of
> org.eclipse.gmf.runtime.diagram.ui.properties and properly declaring
> your own custom propertyContributor.
>
>
> There are just 3 basic steps to this process:
>
> 1. Implement and override .getContributorId() in the generated
> <your>DiagramEditor by returning your own ID for the custom
> contribution. This ID is a string that you choose so it can be just
> about anything; you can simply follow any convention you have now for
> other extension point ID's in your application. As an example let's
> make the ID = "com.my.own.contributor.id"
>
>
> 2. Copy/paste the following three extension point declarations from the
> 'hacked' org.eclipse.gmf.runtime.diagram.ui.properties#plugin.xml into
> your own plugin.xml:
>
> org.eclipse.ui.views.properties.tabbed.propertyContributor
> org.eclipse.ui.views.properties.tabbed.propertyTabs
> org.eclipse.ui.views.properties.tabbed.propertySections
>
>
> 3. Now in your own plugin.xml replace the three:
> contributorId="org.eclipse.gmf.runtime.diagram.ui.properties "
> with
> contributorId="com.my.own.contributor.id"
>
>
> That's about it.
>
> You can delete the hacked version of
> org.eclipse.gmf.runtime.diagram.ui.properties at this point since you
> don't need it any more.
>
> I hope this is enough of a hint on how you can get started; the bulk of
> your work (and maybe headaches:-P) is to get to know how the existing
> code utilizes the editing domain, commands, etc... and then adding your
> own stuff to it.
>
>
> Hints +1 -- If your editor has some non-standard or tricky hierarchy you
> may have to extend the default ModelElementTypeMapper or provide your
> own custom implementation of ITypeManager.
>
> Hint +2 -- Likewise with the LabelProvider
>
> Hint +3 -- If you want finer control of when these new properties show
> up (maybe they're only applicable for certain nodes???) then you would
> want to extend the default filters or provide your own implementation of
> IFilter.
>
>
>
> Have fun!!!
> -- Khai --
>
>
>
>
>
>
>
>
>
> Trifonov wrote:
> > Hi,
> >
> > I have to add "underline" and "strikethrough" features in Appearance
> page in Properties view. Can someone give me any hints?
> >
> > Regards,
> > Trifonov
Re: Adding "underline" and "strikethrough" in appereance (amended!!!) [message #19919 is a reply to message #19323] Tue, 15 August 2006 19:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: khai.n.situvista.com

OK, I did a little digging and this is what I have found out so far.

First, There is a bug with comments about the styles 'underline' and
'strikethrough' not being supported on all platforms so you want to keep
this in mind.

See https://bugs.eclipse.org/bugs/show_bug.cgi?id=71901

Second, when you have a node selected in the editor go to the Properties
View/Advanced tab then choose View\Styles and you will see the 'Strike
Through" and 'Underline' styles available; you can set these to
true/false and the styles are applied appropriately(I'm on Windows so I
don't know how this would behave on Mac or other).

Third, you don't have to add any custom persistence for these two styles
because the GMF Notation model already has them. As a matter of fact
the generated code already has the handlers for these; look in any of
your XXXNameEditPart for these:
.handleNotificationEvent()
.refreshUnderline()
.refreshStrikeThrough()


And finally, if you really want to add the buttons for these to the
Appearance tab then you can copy the implementation for the other
buttons. These are the basic steps:

Add your new buttons

Add two methods updateFontUnderline() and updateFontStrikeThrough().
You can copy the updateFontBold() for these and change the code to use
your new buttons and the appropriate
NotationPackage.eINSTANCE.getFontStyle_StrikeThrough() or
NotationPackage.eINSTANCE.getFontStyle_Underline()()

Then add selection listeners to your buttons and call these methods.


I haven't tried this so I hope it works for you.

-- Khai --



Trifonov wrote:
> Hi Khai,
>
> Thank you very much for the help. I created one more "bold" button in
> appearance page following your guides but I have two more questions.
>
> - How to persist the values (underline, strikethrough). I think to add
> values into each element and to keep it there.. if the element there is
> no such structural feature I'll not do anything. Is it appropriate way
> to do it?
>
> - How the changes of the properties will reflect into the Editor? Now,
> If I set an element to be bold, the text in associated Label is bold...
> How can I do the same for the underline?
>
> Regards,
> Trifonov
>
>
>
> Khai M Nguyen wrote:
>> I forgot a couple of more hints so I added them to the bottom:-)
>>
>> ============================================================ =========
>> This is going to take some effort so I hope you're up for it:-)
>>
>> The Appearance tab is contributed by the
>> org.eclipse.gmf.runtime.diagram.ui.properties plug-in; the required
>> three extension point declarations, and the corresponding
>> implementation classes are found in this plug-in.
>>
>> This plug-in contributes three tabs; the Appearance and Advanced tabs
>> are always shown when anything in the editor is selected, and
>> additionally the Grid tab is shown when the canvas itself is selected.
>> These contributions are fixed with no built-in capability to 'swap
>> out' the appearance tab with your own or for adding additional items
>> to the existing tab.
>>
>>
>> The quick and dirty solution is to import
>> org.eclipse.gmf.runtime.diagram.ui.properties into your workspace (as
>> source) then clone ....appearance.ConnectionAppearancePropertySection
>> and any other required classes (put the clones in your own plug-in)
>> then add your own "underline" and "strikethrough" properties to your
>> clone(s). Then in the plugin.xml of
>> org.eclipse.gmf.runtime.diagram.ui.properties modify the extension
>> point declaration(s) to point to your 'cloned' version(s) instead.
>> This is not your final solution because you really don't want to hack
>> Eclipse code and distribute it with your plug-in or application (bad
>> Karma :-P). What the quick and dirty solution can do is get you up
>> and running pretty quickly with prototyping/developing your enhancements.
>>
>>
>> Once you're satisfied that the enhancements are working then it's time
>> to make them official.
>>
>> Making it official means stopping the hijacking of
>> org.eclipse.gmf.runtime.diagram.ui.properties and properly declaring
>> your own custom propertyContributor.
>>
>>
>> There are just 3 basic steps to this process:
>>
>> 1. Implement and override .getContributorId() in the generated
>> <your>DiagramEditor by returning your own ID for the custom
>> contribution. This ID is a string that you choose so it can be just
>> about anything; you can simply follow any convention you have now for
>> other extension point ID's in your application. As an example let's
>> make the ID = "com.my.own.contributor.id"
>>
>>
>> 2. Copy/paste the following three extension point declarations from
>> the 'hacked' org.eclipse.gmf.runtime.diagram.ui.properties#plugin.xml
>> into your own plugin.xml:
>>
>> org.eclipse.ui.views.properties.tabbed.propertyContributor
>> org.eclipse.ui.views.properties.tabbed.propertyTabs
>> org.eclipse.ui.views.properties.tabbed.propertySections
>>
>>
>> 3. Now in your own plugin.xml replace the three:
>> contributorId="org.eclipse.gmf.runtime.diagram.ui.properties "
>> with
>> contributorId="com.my.own.contributor.id"
>>
>>
>> That's about it.
>>
>> You can delete the hacked version of
>> org.eclipse.gmf.runtime.diagram.ui.properties at this point since you
>> don't need it any more.
>>
>> I hope this is enough of a hint on how you can get started; the bulk
>> of your work (and maybe headaches:-P) is to get to know how the
>> existing code utilizes the editing domain, commands, etc... and then
>> adding your own stuff to it.
>>
>>
>> Hints +1 -- If your editor has some non-standard or tricky hierarchy
>> you may have to extend the default ModelElementTypeMapper or provide
>> your own custom implementation of ITypeManager.
>>
>> Hint +2 -- Likewise with the LabelProvider
>>
>> Hint +3 -- If you want finer control of when these new properties show
>> up (maybe they're only applicable for certain nodes???) then you would
>> want to extend the default filters or provide your own implementation
>> of IFilter.
>>
>>
>>
>> Have fun!!!
>> -- Khai --
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> Trifonov wrote:
>> > Hi,
>> >
>> > I have to add "underline" and "strikethrough" features in
>> Appearance page in Properties view. Can someone give me any hints?
>> >
>> > Regards,
>> > Trifonov
Re: Adding "underline" and "strikethrough" in appereance (amended!!!) [message #20742 is a reply to message #19919] Wed, 16 August 2006 09:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: michael_proba.yahoo.com

Hi,
I've got similar problem. I have to add different styles for borders of
shapes (dashed, dotted, solit, etc.) and width of the borders. I tried to
follow this tread but it didn't help. Any ideas?

Michael
Re: Adding "underline" and "strikethrough" in appereance (amended!!!) [message #21726 is a reply to message #20742] Wed, 16 August 2006 22:25 Go to previous message
Eclipse UserFriend
Originally posted by: khai.n.situvista.com

How far have you gotten? And what problems are you running into?

It's important to note that your requirements are different than
'underline' and 'strikethrough' because the GMF Notation model does not
support them. You will need to take the extra steps of adding these new
properties to your model, initialize your figure(s) based on these
properties, and handling the repainting of your figure(s) when the user
changes the properties.

Tell me more about where you are in the code so I can better help you.

-- Khai --

Michael Proba wrote:
> Hi,
> I've got similar problem. I have to add different styles for borders of
> shapes (dashed, dotted, solit, etc.) and width of the borders. I tried
> to follow this tread but it didn't help. Any ideas?
>
> Michael
>
Previous Topic:Custom Tabbed Properties Contribution declarations (through code instead of in the plugin.xml) ?
Next Topic:when to use GMF?
Goto Forum:
  


Current Time: Thu Mar 13 13:51:59 EDT 2025

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

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

Back to the top