90 likes | 199 Views
Extending Eclipse. General concepts and Project related APIs. Yearly project, Winter 05/06 The Technion. Eclipse – an overview. Eclipse is a collection of plugins Each plugin may provide Extension points APIs To be used by other plugin ’ s extensions. UI contribution.
E N D
Extending Eclipse General concepts and Project related APIs Yearly project, Winter 05/06 The Technion
Eclipse – an overview • Eclipse is a collection of plugins • Each plugin may provide • Extension points • APIs • To be used by other plugin’s extensions
UI contribution • The starting point: • org.eclipse.ui.* extension points • Usually, for implementing UI features, extensions use org.eclipse.jface.* helper classes (Dialogs, Wizard, etc.) • JFace is implemented on top of SWT (Standard Widget Toolkit, org.eclipse.swt.*) • (Extensions may use SWT directly)
Resources • The workspace contains the user’s resources: projects, folders and files • Resources plug-in provides APIs for manipulating the workspace (org.eclipse.core.resources) • Manipulation is done via handles • IResource, IProject, IFile… • IResource.exist() IWorkspaceRoot myWorkspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); IProject myProject = myWorkspaceRoot.getProject("MyProj");
The Java Model • Java-based view on resources • Java handles are retrieved via JavaCore • IJavaElement, ICompilationUnit, IMethod… • Use DOM/AST API for a detailed analysis of a compilation unit • org.eclipse.jdt.core.dom
Eclipse Runtime • The Plugin class represents a plug-in that is running in the platform • Managed as an OSGI bundle • start(BundleContextcontext) • initialization behavior for a plug-in • Use BundleContextto obtain information of all bundles (excluding extensions’ info) • And to register listeners to changes in other bundles’ life-cycle • stop(BundleContextcontext)
Eclipse Runtime (Cont.) • IExtensionRegistry provides information related to extension-points and extensions import org.eclipse.core.runtime.Platform; IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint point = registry.getExtensionPoint("org.eclipse.ui.views"); IExtension[] extensions = point.getExtensions(); [Then, IConfigurationElement can be used to examine the attributes of an extension and to create a new instance of the related class by calling: createExecutableExtension(…)]
Eclipse debug model • Defines generic interfaces • To be implemented and extended by…(?) • ILaunch, IDebugTarget, IThread, IStackFrame, IBreakpoint, DebugEvent… • org.eclipse.debug.* • org.eclipse.debug.core.DebugPlugin (a starting point)
JDT debug • supports running and debugging of Java code • org.eclipse.jdt.debug.* • org.eclipse.jdt.debug.core.JDIDebugModel • May be used to create BPs for resources • To register BPs listeners