Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How insere an image
How insere an image [message #221693] Tue, 17 March 2009 14:09 Go to next message
Arij is currently offline ArijFriend
Messages: 40
Registered: July 2009
Member
My problem is in the graphic modification, because for example to draw a
gateways, which has a shape of diamond with an icon in the internal, we
cannot with the forms already exists in the .gmfgraph (ellipse,
rectengle...) then it is necessary to use an image.
Re: How insere an image [message #221752 is a reply to message #221693] Tue, 17 March 2009 21:58 Go to previous messageGo to next message
BG is currently offline BGFriend
Messages: 45
Registered: July 2009
Member
Hello Arij,
Can be bit clear here. In our application we are also inserting custom
images through the gmfgraph model by adding through the customfigure
option is this what you require ?

Regards
Byre bg
Re: How insere an image [message #221759 is a reply to message #221752] Wed, 18 March 2009 01:35 Go to previous messageGo to next message
Arij is currently offline ArijFriend
Messages: 40
Registered: July 2009
Member
yes Mr
Re: How insere an image [message #221765 is a reply to message #221752] Wed, 18 March 2009 01:45 Go to previous messageGo to next message
Arij is currently offline ArijFriend
Messages: 40
Registered: July 2009
Member
Thanks
yes Mr i mean that
Re: How insere an image [message #221802 is a reply to message #221765] Wed, 18 March 2009 14:01 Go to previous message
BG is currently offline BGFriend
Messages: 45
Registered: July 2009
Member
Then you can do it this way

To your gmfgraph model
1 Add a figuredescriptor
2 Add a child node "Custom figure"
3 Now if u check the properties of custom figure in properties view
4 There u have three option Descriptor,Name and Qualified class name
5 for Qualified class name provide the class which reads your custom figure
eg: "com.bosch.rtc.flowVinci.diagram.edit.parts.NormalFigure"

And the class will look some thing like this

public class NormalFigure extends Figure {

//name for portcontainer
private WrapLabel fFigureShortNameFigure;

public NormalFigure(String filepath) {
createContents();
add(new ImageFigure(getPortContainerImage(filepath)),new
GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); }

protected Image getPortContainerImage(String filepath) {
return getImageImage(filepath); //$NON-NLS-1$
}

protected Image getImageImage(String path) {
Image image = JFaceResources.getImageRegistry().get(path);
if (image == null) {
ImageDescriptor descriptor =
AbstractUIPlugin.imageDescriptorFromPlugin("com.bosch.rtc.flowVinci.diagram.custom ",
path); //$NON-NLS-1$
if (descriptor == null) {
descriptor = ImageDescriptor.getMissingImageDescriptor();
}
JFaceResources.getImageRegistry().put(path, image =
descriptor.createImage());
}
return image;
}

private void createContents() {

fFigureShortNameFigure = new WrapLabel();
fFigureShortNameFigure.setText("");

this.add(fFigureShortNameFigure);

}

public WrapLabel getFigurePortContainerShortNameImage() {
return fFigureShortNameFigure;
}
}

Let me know incase if you have need further clarification on this
Previous Topic:How to make one forced on a link?
Next Topic:Label-text doesn`t have the right color
Goto Forum:
  


Current Time: Fri Apr 26 17:50:57 GMT 2024

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

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

Back to the top