[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] SOLVED: activate print preview dialog

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(IWorkbenchActionConstants.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.PageSetupAction();
}


That's all.

Greetz,
R.