Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » MPart contribution to Outline view and Properties view
MPart contribution to Outline view and Properties view [message #1091005] Tue, 20 August 2013 23:55 Go to next message
Jakub Czerny is currently offline Jakub CzernyFriend
Messages: 3
Registered: July 2013
Junior Member
Hi,

I develop an Eclipse plugin intended to tun in Eclipse IDE. I want my MPart to contribute (define custom content) to standard Outline and Properties view.
How can I achieve that?
Thanks for advice.

Jakub
Re: MPart contribution to Outline view and Properties view [message #1092441 is a reply to message #1091005] Thu, 22 August 2013 20:08 Go to previous messageGo to next message
Eric Moffatt is currently offline Eric MoffattFriend
Messages: 118
Registered: July 2009
Senior Member

You should look into the documentation on extenging a PageBookView (which both of these views are). Essentially a PageBookView allows you to contribute a 'page' but I've never actually done any work here. You will likely find a lot of info about adding a specific Outline page for an editor...
Re: MPart contribution to Outline view and Properties view [message #1092498 is a reply to message #1092441] Thu, 22 August 2013 22:01 Go to previous messageGo to next message
Jakub Czerny is currently offline Jakub CzernyFriend
Messages: 3
Registered: July 2013
Junior Member
Thank you for your answer.

However below attached stacktrace (execution paused when JavaEditor class is asked for adapter of class IContentOutlinePage) shows that class PageBookView is called from org.eclipse.ui.internal.WorkbenchPage$15 (7th and 8th entries). Both of these classes are part of standard (non-e4) eclipse.

I'm looking for some way, how my custom MPart can provide its implementation of IContentOutlinePage.

Thread [main] (Suspended (entry into method getAdapter in org.eclipse.jdt.internal.ui.javaeditor.JavaEditor))	
	org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor(org.eclipse.jdt.internal.ui.javaeditor.JavaEditor).getAdapter(java.lang.Class) line: 2199	
	org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.getAdapter(java.lang.Class) line: 1779	
	org.eclipse.ui.internal.views.ViewsPlugin.getAdapter(java.lang.Object, java.lang.Class, boolean) line: 103	
	org.eclipse.ui.views.contentoutline.ContentOutline.doCreatePage(org.eclipse.ui.IWorkbenchPart) line: 131	
	org.eclipse.ui.views.contentoutline.ContentOutline(org.eclipse.ui.part.PageBookView).createPage(org.eclipse.ui.IWorkbenchPart) line: 411	
	org.eclipse.ui.views.contentoutline.ContentOutline(org.eclipse.ui.part.PageBookView).partActivated(org.eclipse.ui.IWorkbenchPart) line: 754	
	org.eclipse.ui.part.PageBookView$4.partActivated(org.eclipse.ui.IWorkbenchPartReference) line: 1044	
	org.eclipse.ui.internal.WorkbenchPage$15.run() line: 4798	
	org.eclipse.core.runtime.SafeRunner.run(org.eclipse.core.runtime.ISafeRunnable) line: 42	
	org.eclipse.ui.internal.WorkbenchPage.firePartActivated(org.eclipse.e4.ui.model.application.ui.basic.MPart) line: 4796	
	org.eclipse.ui.internal.WorkbenchPage.access$16(org.eclipse.ui.internal.WorkbenchPage, org.eclipse.e4.ui.model.application.ui.basic.MPart) line: 4776	
	org.eclipse.ui.internal.WorkbenchPage$E4PartListener.partActivated(org.eclipse.e4.ui.model.application.ui.basic.MPart) line: 195	
	org.eclipse.e4.ui.internal.workbench.PartServiceImpl$2.run() line: 183	
	org.eclipse.core.runtime.SafeRunner.run(org.eclipse.core.runtime.ISafeRunnable) line: 42	
	org.eclipse.e4.ui.internal.workbench.PartServiceImpl.firePartActivated(org.eclipse.e4.ui.model.application.ui.basic.MPart) line: 181	
	org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(org.eclipse.e4.ui.model.application.ui.basic.MPart, boolean, boolean) line: 595	
	org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(org.eclipse.e4.ui.model.application.ui.basic.MPart, boolean) line: 539	
	org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer(org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer).activate(org.eclipse.e4.ui.model.application.ui.basic.MPart) line: 104	
	org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer$1.handleEvent(org.eclipse.swt.widgets.Event) line: 59	
	org.eclipse.swt.widgets.EventTable.sendEvent(org.eclipse.swt.widgets.Event) line: 84	
	org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer$2(org.eclipse.swt.widgets.Widget).sendEvent(org.eclipse.swt.widgets.Event) line: 1392	
	org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer$2(org.eclipse.swt.widgets.Widget).sendEvent(int, org.eclipse.swt.widgets.Event, boolean) line: 1416	
	org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer$2(org.eclipse.swt.widgets.Widget).sendEvent(int, org.eclipse.swt.widgets.Event) line: 1401	
	org.eclipse.swt.widgets.Shell.setActiveControl(org.eclipse.swt.widgets.Control, int) line: 1675	
	org.eclipse.swt.custom.StyledText(org.eclipse.swt.widgets.Control).gtk_button_press_event(long, long, boolean) line: 3004	
	org.eclipse.swt.custom.StyledText(org.eclipse.swt.widgets.Control).gtk_button_press_event(long, long) line: 2940	
	org.eclipse.swt.custom.StyledText(org.eclipse.swt.widgets.Composite).gtk_button_press_event(long, long) line: 706	
	org.eclipse.swt.custom.StyledText(org.eclipse.swt.widgets.Canvas).gtk_button_press_event(long, long) line: 152	
	org.eclipse.swt.custom.StyledText(org.eclipse.swt.widgets.Widget).windowProc(long, long, long) line: 2078	
	org.eclipse.swt.custom.StyledText(org.eclipse.swt.widgets.Control).windowProc(long, long, long) line: 5467	
	org.eclipse.swt.widgets.Display.windowProc(long, long, long) line: 4569	
	org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(long) line: not available [native method]	
	org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(long) line: 8707	
	org.eclipse.swt.widgets.Display.eventProc(long, long) line: 1243	
	org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(long, boolean) line: not available [native method]	
	org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(long, boolean) line: 2287	
	org.eclipse.swt.widgets.Display.readAndDispatch() line: 3361	
	org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run() line: 1113	
	org.eclipse.core.databinding.observable.Realm.runWithDefault(org.eclipse.core.databinding.observable.Realm, java.lang.Runnable) line: 331	
	org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(org.eclipse.e4.ui.model.application.MApplicationElement, org.eclipse.e4.core.contexts.IEclipseContext) line: 997	
	org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(org.eclipse.e4.ui.model.application.MApplicationElement) line: 138	
	org.eclipse.ui.internal.Workbench$5.run() line: 610	
	org.eclipse.core.databinding.observable.Realm.runWithDefault(org.eclipse.core.databinding.observable.Realm, java.lang.Runnable) line: 331	
	org.eclipse.ui.internal.Workbench.createAndRunWorkbench(org.eclipse.swt.widgets.Display, org.eclipse.ui.application.WorkbenchAdvisor) line: 567	
	org.eclipse.ui.PlatformUI.createAndRunWorkbench(org.eclipse.swt.widgets.Display, org.eclipse.ui.application.WorkbenchAdvisor) line: 150	
	org.eclipse.ui.internal.ide.application.IDEApplication.start(org.eclipse.equinox.app.IApplicationContext) line: 124	
	org.eclipse.equinox.internal.app.EclipseAppHandle.run(java.lang.Object) line: 196	
	org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(java.lang.Object) line: 110	
	org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(java.lang.Object) line: 79	
	org.eclipse.core.runtime.adaptor.EclipseStarter.run(java.lang.Object) line: 354	
	org.eclipse.core.runtime.adaptor.EclipseStarter.run(java.lang.String[], java.lang.Runnable) line: 181	
	sun.reflect.NativeMethodAccessorImpl.invoke0(java.lang.reflect.Method, java.lang.Object, java.lang.Object[]) line: not available [native method]	
	sun.reflect.NativeMethodAccessorImpl.invoke(java.lang.Object, java.lang.Object[]) line: 57	
	sun.reflect.DelegatingMethodAccessorImpl.invoke(java.lang.Object, java.lang.Object[]) line: 43	
	java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object...) line: 606	
	org.eclipse.equinox.launcher.Main.invokeFramework(java.lang.String[], java.net.URL[]) line: 636	
	org.eclipse.equinox.launcher.Main.basicRun(java.lang.String[]) line: 591	
	org.eclipse.equinox.launcher.Main.run(java.lang.String[]) line: 1450	
	org.eclipse.equinox.launcher.Main.main(java.lang.String[]) line: 1426	
Re: MPart contribution to Outline view and Properties view [message #1092952 is a reply to message #1092498] Fri, 23 August 2013 11:15 Go to previous message
Andrzej Szczepanski is currently offline Andrzej SzczepanskiFriend
Messages: 16
Registered: May 2013
Junior Member
Bad news: Outline and Properties views, together with interfaces needed to contribute to them, all belong to org.eclipse.ui(...) plug-in(s), so it is not possible at the moment with pure Eclipse4. Or at least that is what I was lead to believe.

If you haven't already, check out Tom Schindl's e4bridge:
http://tomsondev.bestsolution.at/2011/06/10/how-to-apply-the-e4-programming-model-to-3-x/
In my project I've followed this approach. I have my editor implemented in pure E4 (it is a part of pure E4 RCP product), but I also have this, sort-of "adapter" plug-in where I implement DIEditorPart, that wraps over my editor and allows me to reuse it as contribution to Eclipse IDE.


public class WrapperEditor extends DIEditorPart<MyE4EditorPart> {

    (...)

    /* and as you already know, you can contruibute to Outline
     * like that */
    @Override
    public Object getAdapter(Class adapter) {
        if (adapter.equals(IContentOutlinePage.class)) {
            return new ContentOutlinePage() {
                (...) 
            }
        }
        return super.getAdapter(adapter);
    }

    (...)

}


Of course, your case may be different, so you may chose different approach than e4-bridge (like using Comaptibility layer or stuff...).
Previous Topic:Advice for Kepler based Product
Next Topic:PropertyDialog for e4 app
Goto Forum:
  


Current Time: Tue Mar 19 04:43:07 GMT 2024

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

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

Back to the top