Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Make context buttons API and components accessible to clients.
Make context buttons API and components accessible to clients. [message #554136] Fri, 20 August 2010 09:42 Go to next message
Ken Wenzel is currently offline Ken Wenzel
Messages: 39
Registered: July 2009
Member
Hello,

it would save a lot of work and/or duplicate code if Graphiti would expose its context buttons API and implementations to clients.

A use case could be the proposal of appropriate connection types after a user created a connection with a generic connection tool.

Best regards,

Ken
Re: Make context buttons API and components accessible to clients. [message #554161 is a reply to message #554136] Fri, 20 August 2010 11:08 Go to previous message
Michael Wenz is currently offline Michael Wenz
Messages: 1592
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Actually you can already achieve your use case. You can define a "multi"
connection entry for the palette that opens a menu when the target from the
connection was selected. In your case you would define a generic connection
tool, that contains all the specific ones and the user can then select from
those.

Here's a code snippet that collects all create connection features into such
an entry (to be placed into the ToolBehaviorProvider method
getPaletteCompartments). If you define only icons and no texts for the
create connection features it will still appear as menu but look very
similar to the contect buttons. If you see the need for supporting real
contect buttons there or have other use cases, simply open a Bugzilla with
that request.
ConnectionCreationToolEntry multiTool = null;

if (createConnectionFeatures.length > 1) {

multiTool = new ConnectionCreationToolEntry("Connection", "dynamic
connection", null, null);

connectionsCompartmentEntry.addToolEntry(multiTool);

}


for (ICreateConnectionFeature createConnectionFeature :
createConnectionFeatures) {

ConnectionCreationToolEntry ccTool = new
ConnectionCreationToolEntry(createConnectionFeature.getCreat eName(),

createConnectionFeature.getCreateDescription(),
createConnectionFeature.getCreateImageId(),

createConnectionFeature.getCreateLargeImageId());

ccTool.addCreateConnectionFeature(createConnectionFeature);

if (multiTool != null) {

multiTool.addCreateConnectionFeature(createConnectionFeature );

}

connectionsCompartmentEntry.addToolEntry(ccTool);

}



-Michael


"Ken Wenzel" <kenwenzel@gmx.net> wrote in message
news:i4limf$doc$1@build.eclipse.org...
> Hello,
>
> it would save a lot of work and/or duplicate code if Graphiti would expose
> its context buttons API and implementations to clients.
>
> A use case could be the proposal of appropriate connection types after a
> user created a connection with a generic connection tool.
>
> Best regards,
>
> Ken
Re: Make context buttons API and components accessible to clients. [message #563713 is a reply to message #554136] Fri, 20 August 2010 11:08 Go to previous message
Michael Wenz is currently offline Michael Wenz
Messages: 1592
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Actually you can already achieve your use case. You can define a "multi"
connection entry for the palette that opens a menu when the target from the
connection was selected. In your case you would define a generic connection
tool, that contains all the specific ones and the user can then select from
those.

Here's a code snippet that collects all create connection features into such
an entry (to be placed into the ToolBehaviorProvider method
getPaletteCompartments). If you define only icons and no texts for the
create connection features it will still appear as menu but look very
similar to the contect buttons. If you see the need for supporting real
contect buttons there or have other use cases, simply open a Bugzilla with
that request.
ConnectionCreationToolEntry multiTool = null;

if (createConnectionFeatures.length > 1) {

multiTool = new ConnectionCreationToolEntry("Connection", "dynamic
connection", null, null);

connectionsCompartmentEntry.addToolEntry(multiTool);

}


for (ICreateConnectionFeature createConnectionFeature :
createConnectionFeatures) {

ConnectionCreationToolEntry ccTool = new
ConnectionCreationToolEntry(createConnectionFeature.getCreat eName(),

createConnectionFeature.getCreateDescription(),
createConnectionFeature.getCreateImageId(),

createConnectionFeature.getCreateLargeImageId());

ccTool.addCreateConnectionFeature(createConnectionFeature);

if (multiTool != null) {

multiTool.addCreateConnectionFeature(createConnectionFeature );

}

connectionsCompartmentEntry.addToolEntry(ccTool);

}



-Michael


"Ken Wenzel" <kenwenzel@gmx.net> wrote in message
news:i4limf$doc$1@build.eclipse.org...
> Hello,
>
> it would save a lot of work and/or duplicate code if Graphiti would expose
> its context buttons API and implementations to clients.
>
> A use case could be the proposal of appropriate connection types after a
> user created a connection with a generic connection tool.
>
> Best regards,
>
> Ken
Previous Topic:How do I get started?
Next Topic:Auto layout support in Graphiti
Goto Forum:
  


Current Time: Wed Sep 17 03:37:40 GMT 2014

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

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