[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.modeling.gmf] Re: Change Popup Strings and Icons in Mindmap example
|
Joe,
Customizing ElementType's ID is a way to solve your problem.
In XXXElementTypes.java generated in your diagram's project, you can
find IElementType fields which are initialized by
XXXElementTypes.getElementType(String id). You edit their ids, mark
"@generated NOT", and add new ElementTypes with the customized ids in
your custom project.
I think this tricky way works, but the original ElementTypes remain
redundantly in the diagram project...
Does anyone have a better idea?
Koji
From: "Joe Dente" <jdente@xxxxxxxxxxxxxxxxxx>
Subject: Re: Change Popup Strings and Icons in Mindmap example
Date: Fri, 28 Sep 2007 13:45:45 -0500
> Thanks for the response.
> This worked well for replacing the icons as well as the labels in the popup
> menus. I have one issue in that I needed to modify the elementTypes
> extension point in my diagram project. If I added that extension in my own
> custom project, it would not override the behavior already dictated in the
> diagram's extension. If I edit the diagram's extensions, then the changes I
> make will get overwritten the next time I generate diagram code. Is there
> any way around this?
> Thanks,
> Joe.
>
>
> "Koji Hashimoto" <kojihashi@xxxxxxxxx> wrote in message
> news:44443b10f08e1716293a6f79b6750aa5$1@xxxxxxxxxxxxxxxxxx
> > Joe,
> >
> > You can change the text of a popup menu by modifying the "name" attribute
> > of ElementType. ElementTypes are registered in
> > org.eclipse.gmf.runtime.emf.type.core.elementTypes extension point.
> >
> > To customize the icons, from p.12 to p.24 of the following slides will
> > help you.
> >
> > http://eclipsezilla.eclipsecon.org/php/attachment.php?bugid=3739
> >
> > Koji
> >
> >
> > Joe Dente wrote:
> >
> >> Upon further investigation, it does not seem possible to adjust the text
> >> and icons of a popup menu based on attributes in an EObject. The icons
> >> are looked up based upon an EClass, not an EObject or instance of an
> >> EClass. In the mindmap example, Depends, Extends, and Includes all share
> >> the same EClass (Relationship), meaning they all fetch identical text and
> >> icons for any popup menus. So even though using OCL, the tooling and
> >> graphical definitions, I can assign different figures and tools to each
> >> of these relationships, there is no way to provide unique popup menus for
> >> using the 3 different tools. In my scenario, I have 14 different enum
> >> attribute values that have individual tooling, which would mean that the
> >> popup menus will have 14 identical appearing options that reference
> >> different tools!!! If I model these 14 different attribute values as 14
> >> different classes, I can assign unique icons and text to the popup menus,
> >> but I lose flexibility in the way the user can edit and change the
> >> properties.
> >
> >> Is there a solution to this issue? It seems somebody out there would have
> >> run into this problem, especially since it exists in the Mindmap
> >> tutorial.
> >
> >> Thanks,
> >> Joe
> >
> >> "Joe Dente" <jdente@xxxxxxxxxxxxxxxxxx> wrote in message
> >> news:fdet6o$fvi$1@xxxxxxxxxxxxxxxxxxxx
> >>> Hi,
> >>>
> >>> Does anybody know how to change the icon and string that gets displayed
> >>> in hover/popup menus?
> >>>
> >>> In part 2 of the mindmap example,
> >>> http://wiki.eclipse.org/index.php/GMF_Tutorial_Part_2, there are 3 types
> >>> of relationships (depends, includes, and extends). These relationships
> >>> are created by 3 seperate tools and distinguished by an enumeration as
> >>> explained in the tutorial. There is a problem with this approach
> >>> however. Since there is a single class for all 3 types (depends,
> >>> includes, and extends), I cannot assign these 3 types unique icons and
> >>> strings. So if I create a relationship without using the pallet, (by
> >>> dragging an arrow from one node to another node), the popup menu will
> >>> ask me to "Create a Relationship" three times and simply displays the
> >>> generic Relationship icon for all 3 options. Instead, I would like this
> >>> popup menu to say something like "Create a DependsRelationship", "Create
> >>> an ExtendsRelationship", "Create an Includes Reltionship" and display
> >>> custom icons for each action. This problem does not exist in the
> >>> pallet, because the pallet extracts names and icons from the tools. The
> >>> popup menus, however, appear to extract names and icons from the edit
> >>> and model code. How can I customize the icons and strings in the popup
> >>> menus depending on an attribute value?
> >>>
> >>> Thanks,
> >>> Joe
> >>>
> >
> >
>
>