Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » activate print preview dialog
activate print preview dialog [message #219820] Tue, 24 February 2009 04:28 Go to next message
Eclipse UserFriend
Hi all,
I've modeled a GMF application which runs fine. No I want to add a
print preview dialog. I see that in the generated classes
(..processmodel.model.diagram.providers) is a class
(ProjectnameContributionItemProvider) that holds a createAction method
which in turn calls RenderedPrintPreviewAction. But I don't know where I
have to activate this class. In the extension points I'm not able to add
this class for an item because it's not in the list.

How can I do this? Thanks in advance,
Ralf.
Re: activate print preview dialog [message #219847 is a reply to message #219820] Tue, 24 February 2009 05:29 Go to previous messageGo to next message
Eclipse UserFriend
Hi Ralf,

Do you want to create your own print preview dialog or do you just want
to enable the default one?

In the latter case, just set the property "Printing Enabled" for "Gen
Plugin" in your gmfgen file to true.

R. Heydenreich schrieb:
> Hi all,
> I've modeled a GMF application which runs fine. No I want to add a
> print preview dialog. I see that in the generated classes
> (..processmodel.model.diagram.providers) is a class
> (ProjectnameContributionItemProvider) that holds a createAction method
> which in turn calls RenderedPrintPreviewAction. But I don't know where I
> have to activate this class. In the extension points I'm not able to add
> this class for an item because it's not in the list.
>
> How can I do this? Thanks in advance,
> Ralf.
Re: activate print preview dialog [message #219855 is a reply to message #219847] Tue, 24 February 2009 05:58 Go to previous messageGo to next message
Eclipse UserFriend
Adrian Gygax schrieb:
> Hi Ralf,
>
> Do you want to create your own print preview dialog or do you just want
> to enable the default one?
>
> In the latter case, just set the property "Printing Enabled" for "Gen
> Plugin" in your gmfgen file to true.

I want to enable the default one. The property is set to true, yet. But
I get only the Print dialog, not the Print Preview dialog. In general,
how can I add an arbitrary ItemProvider to the application? I think, if
I activate the ContributionItemProvider with its
RenderedPrintPreviewAction inside then I could solve the problem.

Greetings,
Ralf.

>
> R. Heydenreich schrieb:
>> Hi all,
>> I've modeled a GMF application which runs fine. No I want to add a
>> print preview dialog. I see that in the generated classes
>> (..processmodel.model.diagram.providers) is a class
>> (ProjectnameContributionItemProvider) that holds a createAction method
>> which in turn calls RenderedPrintPreviewAction. But I don't know where
>> I have to activate this class. In the extension points I'm not able to
>> add this class for an item because it's not in the list.
>>
>> How can I do this? Thanks in advance,
>> Ralf.
SOLVED: activate print preview dialog [message #220169 is a reply to message #219855] Fri, 27 February 2009 05:12 Go to previous messageGo to next message
Eclipse UserFriend
R. Heydenreich schrieb:
> Adrian Gygax schrieb:
>> Hi Ralf,
>>
>> Do you want to create your own print preview dialog or do you just
>> want to enable the default one?
>>
>> In the latter case, just set the property "Printing Enabled" for "Gen
>> Plugin" in your gmfgen file to true.
>
> I want to enable the default one. The property is set to true, yet. But
> I get only the Print dialog, not the Print Preview dialog. In general,
> how can I add an arbitrary ItemProvider to the application? I think, if
> I activate the ContributionItemProvider with its
> RenderedPrintPreviewAction inside then I could solve the problem.
>
> Greetings,
> Ralf.
>
>>
>> R. Heydenreich schrieb:
>>> Hi all,
>>> I've modeled a GMF application which runs fine. No I want to add a
>>> print preview dialog. I see that in the generated classes
>>> (..processmodel.model.diagram.providers) is a class
>>> (ProjectnameContributionItemProvider) that holds a createAction
>>> method which in turn calls RenderedPrintPreviewAction. But I don't
>>> know where I have to activate this class. In the extension points I'm
>>> not able to add this class for an item because it's not in the list.
>>>
>>> How can I do this? Thanks in advance,
>>> Ralf.

Hi all,
after a bunch of sleepless nights I found the solution ;-) I have to
overwrite the init() method in my DiagramActionBarContributor:

/**
* @generated NOT
*/
public void init(IActionBars bars, IWorkbenchPage page) {
super.init(bars, page);
// print preview
IMenuManager fileMenu =
bars.getMenuManager().findMenuUsingPath(IWorkbenchActionCons tants.M_FILE);
assert fileMenu != null;
IAction printPreviewAction = new RenderedPrintPreviewAction(new
EnhancedPrintActionHelper());
fileMenu.insertBefore("close", printPreviewAction); //$NON-NLS-1$
IAction pageSetupAction = new
org.eclipse.gmf.runtime.diagram.ui.actions.internal.PageSetu pAction();
}

That's all.

Greetz,
R.
Re: SOLVED: activate print preview dialog [message #220179 is a reply to message #220169] Fri, 27 February 2009 05:13 Go to previous message
Eclipse UserFriend
> IAction pageSetupAction = new
> org.eclipse.gmf.runtime.diagram.ui.actions.internal.PageSetu pAction();

^^^^^please remove this line from my last post.
Previous Topic:Object multiplicity in the diagram
Next Topic:[Announce] GMF 2.2.0 I200902270802 is available
Goto Forum:
  


Current Time: Tue Jul 08 05:50:25 EDT 2025

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

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

Back to the top