60 likes | 199 Views
Plug-In example. We want to contribute a new view – “Java files” view The view will contain a list of java files selected in the “Resource Navigator view”. Selection changes in the “Resource Navigator view” have to be properly reflected in the “Java files” view
E N D
Plug-In example • We want to contribute a new view – “Java files” view • The view will contain a list of java files selected in the “Resource Navigator view”. • Selection changes in the “Resource Navigator view” have to be properly reflected in the “Java files” view • “Java files” view should also respond to user’s “double-clicks” by opening an editor for selected file.
Plug-in manifest file. <?xml version="1.0" encoding="UTF-8"?> <plugin id="edu.neu.ccs.eclipse.LoDChecker" name="LoDChecker plugin" version="1.0.0" provider-name="CCS NEU"> <requires> <import plugin="org.eclipse.core.resources"/> <import plugin="org.eclipse.ui"/> <import plugin="org.eclipse.swt"/> </requires> <runtime> <library name="checker.jar"> <export name="*"/> </library> </runtime> <extension point="org.eclipse.ui.views"> <category name="Checker Views“ id="edu.neu.ccs.eclipse.LoDChecker.views"/> <view id="edu.neu.ccs.eclipse.LoDChecker.JFView" name="Java Files View" icon="icons/view.gif" category="edu.neu.ccs.eclipse.LoDChecker.views“ class="edu.neu.ccs.eclipse.LoDChecker.JFView" /> </extension> </plugin>
edu.neu.ccs.eclipse.LoDChecker. JFView • Must implement org.eclipse.ui.IViewPart • Have to represent selected objects in the list form • Implementation will use • org.eclipse.ui.part.ViewPart as base class for View class • org.eclipse.jface.viewers.ListViewer for representation selected java files as list.
Viewer framework Viewer Label Provider Displays domain objects by first converting them into items with Content Provider and by obtaining text/image for each from Label Provider Provides images or/and text for each item in the viewer text/images Input Content Provider items Knows how to transform input into viewer items. Keeps viewer in sync with domain model. Domain objects model. Domain change notifications
How to start? • Documentation (plug-in developer section) dev.eclipse.org:8080/help/help.jsp • Articles on www.eclipse.org/articles • “Your First Plug-in” Jim Amsden • “Creating an Eclipse View” Dave Springgay • “How do use the JFace Tree Viewer” Chris Grindstaff • API (documentation) • Source code. AspectJ plug-in source code (www.eclipse.org/ajdt) is a good place to learn about plug-in development techniques.