Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to move the "DiagramActionBarContributor" to the "MultiPageEditorPart"
How to move the "DiagramActionBarContributor" to the "MultiPageEditorPart" [message #231885] Mon, 01 June 2009 10:57 Go to next message
Eclipse UserFriend
Originally posted by: jiezi506.gmail.com

I want to use a MultiPageEditorPart instead of the
"DiagramDocumentEditor" which GMF generated. But I could find a solution
to move the

public class Xpdl2DiagramActionBarContributor extends
DiagramActionBarContributor {

/**
* @generated
*/
protected Class getEditorClass() {
return Xpdl2DiagramEditor.class;
}

/**
* @generated
*/
protected String getEditorId() {
return Xpdl2DiagramEditor.ID;
}
}

to a MultiPageEditorActionBarContributor.



The all "delelte""redo""undo"... will lose in thie DiagramDocumentEditor
of MyMultiPageEditor. I can't find how to resolve it , I need some help
:)
Re: How to move the "DiagramActionBarContributor" to the "MultiPageEditorPart" [message #231979 is a reply to message #231885] Tue, 02 June 2009 08:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jiezi506.gmail.com

jiezi 写道:
> I want to use a MultiPageEditorPart instead of the
> "DiagramDocumentEditor" which GMF generated. But I could find a solution
> to move the
>
> public class Xpdl2DiagramActionBarContributor extends
> DiagramActionBarContributor {
>
> /**
> * @generated
> */
> protected Class getEditorClass() {
> return Xpdl2DiagramEditor.class;
> }
>
> /**
> * @generated
> */
> protected String getEditorId() {
> return Xpdl2DiagramEditor.ID;
> }
> }
>
> to a MultiPageEditorActionBarContributor.
>
>
>
> The all "delelte""redo""undo"... will lose in thie DiagramDocumentEditor
> of MyMultiPageEditor. I can't find how to resolve it , I need some help
> :)


I have built a new Contributor like:

public class ProcessMultiPageEditorActionBarContributor extends
MultiPageEditorActionBarContributor {

private Xpdl2DiagramActionBarContributor processContributor; //The
Original GMF Diagram ActionBar Contributor
private ActionBarContributor emptyContributor;


public ProcessMultiPageEditorActionBarContributor(){
processContributor=new Xpdl2DiagramActionBarContributor();
emptyContributor=new EmptyActionBarContributor();
}
public void setActivePage(IEditorPart activeEditor) {
IToolBarManager toolbarManager=getActionBars().getToolBarManager();
processContributor.contributeToToolBar(toolbarManager);
processContributor.setActiveEditor(activeEditor);
/* if(activeEditor instanceof Xpdl2DiagramEditor){
//toolbarManager.removeAll();
processContributor.contributeToToolBar(toolbarManager);
processContributor.setActiveEditor(activeEditor);
}else{
//toolbarManager.removeAll();
emptyContributor.contributeToToolBar(toolbarManager);
emptyContributor.setActiveEditor(activeEditor);
}*/
// toolbarManager.update(true);
}

public void init(IActionBars bars, IWorkbenchPage page) {
super.init(bars, page);
processContributor.init(bars, getPage());
emptyContributor.init(bars, getPage());
}

public void dispose(){
super.dispose();
processContributor.dispose();
emptyContributor.dispose();
}

public static class EmptyActionBarContributor extends
ActionBarContributor{

protected void buildActions() {}

protected void declareGlobalActionKeys() {}

}
}

and add it to the new MulitPageEditor in plugin.xml:

<extension point="org.eclipse.ui.editors">
<?gmfgen generated="true"?>
<editor
class="xpdl2.diagram.part.Xpdl2DiagramEditor"

contributorClass="xpdl2.diagram.part.Xpdl2DiagramActionBarContributor "
default="false"
extensions="xpdl2_diagram"
icon="icons/obj16/Xpdl2DiagramFile.gif"
id="xpdl2.diagram.part.Xpdl2DiagramEditorID"
name="%editorName">
</editor>
<editor
class="xpdl2.diagram.risesoft.DiagramMultiPageEditorPart"

contributorClass=" xpdl2.diagram.risesoft.ProcessMultiPageEditorActionBarContri butor "
default="false"
id="xpdl2.diagram.risesoft.DiagramMultiPageEditorPart"
name="mulitpageEditor">
</editor>
</extension>


but all the actions didn't work still, are there something related with :
<extension
point=" org.eclipse.gmf.runtime.common.ui.services.action.globalActi onHandlerProviders ">
<?gmfgen generated="true"?>
<GlobalActionHandlerProvider

class=" org.eclipse.gmf.runtime.diagram.ui.providers.DiagramGlobalAc tionHandlerProvider "
id="Xpdl2Presentation">
<Priority name="Lowest"/>
<ViewId id="xpdl2.diagram.part.Xpdl2DiagramEditorID">
<ElementType
class=" org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditP art ">
<GlobalActionId actionId="delete"/>
</ElementType>
<ElementType
class=" org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart ">
<GlobalActionId actionId="save"/>
</ElementType>
</ViewId>
</GlobalActionHandlerProvider>
<GlobalActionHandlerProvider

class=" org.eclipse.gmf.runtime.diagram.ui.providers.ide.providers.D iagramIDEGlobalActionHandlerProvider "
id="Xpdl2PresentationIDE">
<Priority name="Lowest"/>
<ViewId id="xpdl2.diagram.part.Xpdl2DiagramEditorID">
<ElementType
class=" org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditP art ">
<GlobalActionId actionId="bookmark"/>
</ElementType>
</ViewId>
</GlobalActionHandlerProvider>
<GlobalActionHandlerProvider

class=" org.eclipse.gmf.runtime.diagram.ui.render.providers.DiagramU IRenderGlobalActionHandlerProvider "
id="Xpdl2Render">
<Priority name="Lowest"/>
<ViewId id="xpdl2.diagram.part.Xpdl2DiagramEditorID">
<ElementType
class=" org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditP art ">
<GlobalActionId actionId="cut"/>
<GlobalActionId actionId="copy"/>
<GlobalActionId actionId="paste"/>
</ElementType>
</ViewId>
</GlobalActionHandlerProvider>
</extension>?
Re: How to move the "DiagramActionBarContributor" to the "MultiPageEditorPart" [message #558090 is a reply to message #231885] Fri, 10 September 2010 07:37 Go to previous message
popjxc is currently offline popjxcFriend
Messages: 36
Registered: March 2010
Member
I meet the same problem, Does anyone know how to resolve this?
Previous Topic:How to add GMF editor to MultiPageEditorPart?
Next Topic:Better control af labels
Goto Forum:
  


Current Time: Tue Apr 23 11:31:35 GMT 2024

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

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

Back to the top