Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 155410 Details for
Bug 295003
[UI] Design and implement a EPartService API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
EPartService v03
partService-v03.txt (text/plain), 6.58 KB, created by
Paul Webster
on 2010-01-06 10:43:41 EST
(
hide
)
Description:
EPartService v03
Filename:
MIME Type:
Creator:
Paul Webster
Created:
2010-01-06 10:43:41 EST
Size:
6.58 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.e4.ui.tests >Index: src/org/eclipse/e4/ui/tests/application/EPartServiceTest.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.ui/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EPartServiceTest.java,v >retrieving revision 1.6 >diff -u -r1.6 EPartServiceTest.java >--- src/org/eclipse/e4/ui/tests/application/EPartServiceTest.java 17 Dec 2009 20:36:51 -0000 1.6 >+++ src/org/eclipse/e4/ui/tests/application/EPartServiceTest.java 6 Jan 2010 15:42:45 -0000 >@@ -27,6 +27,9 @@ > import org.eclipse.e4.ui.workbench.swt.internal.E4Application; > import org.eclipse.e4.workbench.modeling.EPartService; > import org.eclipse.e4.workbench.ui.IPresentationEngine; >+import org.eclipse.e4.workbench.ui.internal.UIEventPublisher; >+import org.eclipse.e4.workbench.ui.internal.Workbench; >+import org.eclipse.emf.common.notify.Notifier; > > public class EPartServiceTest extends TestCase { > >@@ -649,6 +652,9 @@ > // setup the context > applicationContext.set(MApplication.class.getName(), application); > application.setContext(applicationContext); >+ Workbench.processHierarchy(application); >+ ((Notifier) application).eAdapters().add( >+ new UIEventPublisher(applicationContext)); > > // render the windows > engine.createGui(window1); >@@ -721,6 +727,9 @@ > > applicationContext.set(MApplication.class.getName(), application); > application.setContext(applicationContext); >+ Workbench.processHierarchy(application); >+ ((Notifier) application).eAdapters().add( >+ new UIEventPublisher(applicationContext)); > > return application; > } >#P org.eclipse.e4.ui.workbench >Index: src/org/eclipse/e4/workbench/modeling/EPartService.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.ui/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/workbench/modeling/EPartService.java,v >retrieving revision 1.2 >diff -u -r1.2 EPartService.java >--- src/org/eclipse/e4/workbench/modeling/EPartService.java 4 Dec 2009 20:20:33 -0000 1.2 >+++ src/org/eclipse/e4/workbench/modeling/EPartService.java 6 Jan 2010 15:42:45 -0000 >@@ -14,6 +14,7 @@ > import org.eclipse.e4.ui.model.application.MPart; > > public interface EPartService { >+ public static final String PART_SERVICE_ROOT = "partServiceRoot"; //$NON-NLS-1$ > > public void activate(MPart part); > >Index: src/org/eclipse/e4/workbench/ui/internal/PartServiceImpl.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.ui/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/workbench/ui/internal/PartServiceImpl.java,v >retrieving revision 1.6 >diff -u -r1.6 PartServiceImpl.java >--- src/org/eclipse/e4/workbench/ui/internal/PartServiceImpl.java 4 Dec 2009 20:20:33 -0000 1.6 >+++ src/org/eclipse/e4/workbench/ui/internal/PartServiceImpl.java 6 Jan 2010 15:42:45 -0000 >@@ -23,15 +23,36 @@ > import org.eclipse.e4.ui.model.application.MUIElement; > import org.eclipse.e4.ui.model.application.MWindow; > import org.eclipse.e4.ui.services.IServiceConstants; >+import org.eclipse.e4.ui.services.events.IEventBroker; > import org.eclipse.e4.workbench.modeling.EPartService; >+import org.eclipse.e4.workbench.ui.UIEvents; >+import org.osgi.service.event.Event; >+import org.osgi.service.event.EventHandler; > > public class PartServiceImpl implements EPartService { >+ public static void addListener(IEventBroker broker) { >+ EventHandler windowHandler = new EventHandler() { >+ public void handleEvent(Event event) { >+ Object element = event.getProperty(UIEvents.EventTags.ELEMENT); >+ if (element instanceof MWindow) { >+ MContext contextAware = (MContext) element; >+ IEclipseContext context = contextAware.getContext(); >+ if (context != null) { >+ context.set(EPartService.PART_SERVICE_ROOT, element); >+ } >+ } >+ } >+ }; >+ broker.subscribe(UIEvents.buildTopic(UIEvents.Context.TOPIC, UIEvents.Context.CONTEXT), >+ windowHandler); >+ } > > /** > * This is the specific implementation. TODO: generalize it > */ > @Inject >- private MWindow windowContainer; >+ @Named(EPartService.PART_SERVICE_ROOT) >+ private MElementContainer<MUIElement> rootContainer; > > @Inject > void setPart(@Optional @Named(IServiceConstants.ACTIVE_PART) MPart p) { >@@ -86,11 +107,11 @@ > } > > public MPart findPart(String id) { >- return findPart(windowContainer, id); >+ return findPart(rootContainer, id); > } > > public Collection<MPart> getParts() { >- return getParts(new ArrayList<MPart>(), windowContainer); >+ return getParts(new ArrayList<MPart>(), rootContainer); > } > > private Collection<MPart> getParts(Collection<MPart> parts, >@@ -132,7 +153,7 @@ > } > > private boolean isInContainer(MPart part) { >- return isInContainer(windowContainer, part); >+ return isInContainer(rootContainer, part); > } > > private boolean isInContainer(MElementContainer<?> container, MPart part) { >Index: src/org/eclipse/e4/workbench/ui/internal/Workbench.java >=================================================================== >RCS file: /cvsroot/eclipse/e4/org.eclipse.e4.ui/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/workbench/ui/internal/Workbench.java,v >retrieving revision 1.84 >diff -u -r1.84 Workbench.java >--- src/org/eclipse/e4/workbench/ui/internal/Workbench.java 17 Dec 2009 20:36:46 -0000 1.84 >+++ src/org/eclipse/e4/workbench/ui/internal/Workbench.java 6 Jan 2010 15:42:45 -0000 >@@ -57,6 +57,8 @@ > import org.eclipse.e4.ui.model.application.MWindow; > import org.eclipse.e4.ui.services.IServiceConstants; > import org.eclipse.e4.ui.services.IStylingEngine; >+import org.eclipse.e4.ui.services.events.IEventBroker; >+import org.eclipse.e4.workbench.modeling.EPartService; > import org.eclipse.e4.workbench.ui.IExceptionHandler; > import org.eclipse.e4.workbench.ui.IPresentationEngine; > import org.eclipse.e4.workbench.ui.IWorkbench; >@@ -403,6 +405,12 @@ > } > > public static void processHierarchy(Object me) { >+ if (me instanceof MApplication) { >+ MContext contextAware = (MContext) me; >+ IEclipseContext c = contextAware.getContext(); >+ IEventBroker broker = (IEventBroker) c.get(IEventBroker.class.getName()); >+ PartServiceImpl.addListener(broker); >+ } > > if (me instanceof MHandlerContainer) { > MContext contextModel = (MContext) me; >@@ -450,6 +458,13 @@ > } > } > } >+ if (me instanceof MWindow) { >+ MContext contextAware = (MContext) me; >+ IEclipseContext c = contextAware.getContext(); >+ if (c != null) { >+ c.set(EPartService.PART_SERVICE_ROOT, me); >+ } >+ } > if (me instanceof MElementContainer<?>) { > EList children = ((MElementContainer) me).getChildren(); > Iterator i = children.iterator();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 295003
:
153159
|
153273
|
153815
| 155410 |
155599
|
155880
|
156933
|
157181
|
157513
|
157542