Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "E4/Doc/Adapting Objects"

< E4‎ | Doc
Line 8: Line 8:
 
== Consumer  ==
 
== Consumer  ==
 
<div style="margin-left:10px;">
 
<div style="margin-left:10px;">
e4 specific description of the service/ implementation details etc.  
+
In order for a class to be able to adapt an object, there needs to be a respective ModelEditor. The ModelEditor implements two interfaces which are essential for the Adapting Objects service: IAdaptable and IModelProvider. Once the ModelEditor is implemented, a client class can access the adapted object without casting.
  
 
=== Usage  ===
 
=== Usage  ===
  
(natural breakdown relevant to the service itself here)
+
 
  
 
=== Code Samples  ===
 
=== Code Samples  ===
  
 
==== Java ====
 
==== Java ====
 +
 +
===== Getting an IAdapterManager =====
 
<source lang="java">
 
<source lang="java">
System.out.println("I'm some java code");
+
private IAdapterManager getAdapterManager(IEclipseContext context) {
 +
  return (IAdapterManager) context.get(IAdapterManager.class.getName());
 +
}
 
</source>
 
</source>
  
==== JavaScript ====
 
<source lang="javascript">
 
alert("I'm some javascript");
 
</source>
 
 
=== Eclipse 3.x  ===
 
 
(only if it's relevant AND helpful)
 
</div>
 
== Producer ==
 
<div style="margin-left:10px;">
 
e4 specific description of the service/ implementation details etc.
 
 
=== Usage  ===
 
 
=== Code Samples  ===
 
 
=== Eclipse 3.x  ===
 
 
(this is not likely needed here)
 
 
</div>
 
</div>
 
== Related Materials  ==
 
== Related Materials  ==

Revision as of 15:15, 12 February 2010

Under Construction: Please read first!

The evolution of this document is a collaborative effort between a team of students at the University of Manitoba and the wider Eclipse community. Details about the project can be found here and on our Blog.

Your input is not just welcome; it is needed! Please contribute as your expertise allows, while adhering to our template. To send your feedback and any questions or comments you may have please email us. Also, while we do our very best to be as accurate and precise as possible, it is worth noting that we are students with limited exposure to the Eclipse platform, so if you see any incorrect technical details please let us know.

Description

The Adapting Objects service allows a consumer to access shared data in a relevant way within the current context. Classes can retrieve information about various objects by adapting them to the applicable model. For example, a Javadoc view can access information necessary to render javadoc of the selected class, while an Overview view can access the structure of the class necessary to render a tree.

Consumer

In order for a class to be able to adapt an object, there needs to be a respective ModelEditor. The ModelEditor implements two interfaces which are essential for the Adapting Objects service: IAdaptable and IModelProvider. Once the ModelEditor is implemented, a client class can access the adapted object without casting.

Usage

Code Samples

Java

Getting an IAdapterManager
private IAdapterManager getAdapterManager(IEclipseContext context) {
  return (IAdapterManager) context.get(IAdapterManager.class.getName());
}

Related Materials

Related Services

Related API's

it would be nice to link to some actual api docs, but alas they don't live anywhere yet

See Also

Back to the top