Download presentation
Presentation is loading. Please wait.
Published byEric Whitehead Modified over 9 years ago
1
© 2008 by Roy Ganor; made available under the EPL v1.0 | 19 th March 2008 Roy Ganor, Team Leader Zend Technologies, Ltd. March 19th 2008 EXTENDING THE ECLIPSE PHP DEVELOPMENT TOOLS PROJECT
2
Extending The PDT Project | Architecture and Extension Points | © 2008 by Roy Ganor; made available under the EPL v1.0 Allowing extensibility due to the nature of PHP PROJECT’S GOAL Making Eclipse-PDT the de-facto standard for PHP development
3
Extending The PDT Project | Architecture and Extension Points | © 2008 by Roy Ganor; made available under the EPL v1.0 WHY EXTEND? Integrate your extension or framework with PDT
4
Extending The PDT Project | Architecture and Extension Points | © 2008 by Roy Ganor; made available under the EPL v1.0 EXAMPLES Zend Framework Testing Framework Advanced Code Analysis Run-time Analysis Syntax Coloring Extended Syntax Validation Adaptable Explorer
5
Extending The PDT Project | Architecture and Extension Points | © 2008 by Roy Ganor; made available under the EPL v1.0 ARCHITECTURE Eclipse Platform Web Tools GEF Graphical Editing EMF-XSD -SDO Modeling Framework Source Editing Editor Capabilities Common Validations Web Services Development WTP All the Rest Other Tools DLTK Language Support PDT DTP Data Tools Platform UI View Core Modeling Server Configuration Debug Protocol Help Documentation RelEng Release Tools Test JUnit Testing
6
Extending The PDT Project | Architecture and Extension Points | © 2008 by Roy Ganor; made available under the EPL v1.0 WORKSPACE MODELING Represents php projects in a tree structure, visualized by the “php Explorer" view Base class is org.eclipse.dltk.core.IModelElement Get model by ModelManager.getModelManager().getModel() IScriptProject IScriptFolder IType IField IMethod IPackageFragment[] BuiltinProjectFragment IScriptModule
7
Extending The PDT Project | Architecture and Extension Points | © 2008 by Roy Ganor; made available under the EPL v1.0 CODE REPRESENTATION & MANIPULATION Based upon the Abstract Syntax Tree (AST) Allows you to modify the tree and reflects modifications in the php source code //... Create a Program AST instance... program.recordModifications(); //... fetch the statement component... statements.add(ast.newEchoStatement (ast.newScalar("'Hello World!'"))); //.. More changes go here... TextEdit edits = program.rewrite(document, null);
8
Extending The PDT Project | Architecture and Extension Points | © 2008 by Roy Ganor; made available under the EPL v1.0 SHARED AST PROVIDER Protected and shared AST (Rewriting is restricted) SharedASTProvider.getAST(ISourceModule, WAIT_FLAG, IPM) Mark occurrence feature is available by analyzing the shared AST
9
Extending The PDT Project | Architecture and Extension Points | © 2008 by Roy Ganor; made available under the EPL v1.0 PHP EDITOR Based upon wst.sse.ui.StructuredTextEditor Extend syntax coloring with: Setting your own source parser internal.core.documentModel.parser.SourceParser Construct php regions core.documentModel.parser.regions.IPhpScriptRegion Set your coloring policy with ui.editor.highlighter.LineStyleProviderForPhp
10
Extending The PDT Project | Architecture and Extension Points | © 2008 by Roy Ganor; made available under the EPL v1.0 LISTEN TO ELEMENTS CHANGE Register by: DLTKCore.addElementChangedListener(IElementChangedListener) Unregister by: DLTKCore.removeElementChangedListener(IElementChangedListener) /** * An element changed listener receives notification of changes to script * elements maintained by the script model. * */ public interface IElementChangedListener { public void elementChanged(ElementChangedEvent event); } /** * An element changed listener receives notification of changes to script * elements maintained by the script model. * */ public interface IElementChangedListener { public void elementChanged(ElementChangedEvent event); }
11
Extending The PDT Project | Architecture and Extension Points | © 2008 by Roy Ganor; made available under the EPL v1.0 LAUNCH CONFIGURATION Based upon org.eclipse.debug Debug session listener should extend org.eclipse.php.debug.core.debugger.IDebugHandler public interface IDebugHandler { public void sessionStarted(String fileName, String uri, String query, String options); public void sessionEnded(); public void connectionTimedout(); public void multipleBindOccured(); public void handleScriptEnded(); public void connectionEstablished(); public void connectionClosed(); public void newOutput(String output); public void newHeaderOutput(String output); public void parsingErrorOccured(DebugError debugError); public void wrongDebugServer(); public void ready(String fileName, int lineNumber); public void debugChanged(); public void debuggerErrorOccured(DebugError debugError); public IRemoteDebugger getRemoteDebugger(); public void setDebugTarget (PHPDebugTarget debugTarget); public PHPDebugTarget getDebugTarget(); } public interface IDebugHandler { public void sessionStarted(String fileName, String uri, String query, String options); public void sessionEnded(); public void connectionTimedout(); public void multipleBindOccured(); public void handleScriptEnded(); public void connectionEstablished(); public void connectionClosed(); public void newOutput(String output); public void newHeaderOutput(String output); public void parsingErrorOccured(DebugError debugError); public void wrongDebugServer(); public void ready(String fileName, int lineNumber); public void debugChanged(); public void debuggerErrorOccured(DebugError debugError); public IRemoteDebugger getRemoteDebugger(); public void setDebugTarget (PHPDebugTarget debugTarget); public PHPDebugTarget getDebugTarget(); }
12
Extending The PDT Project | Architecture and Extension Points | © 2008 by Roy Ganor; made available under the EPL v1.0 KEY EXTENSION POINTS org.eclipse.php.core includePathVariable goalEvaluatorFactory phpBuilderExtensions phpModelExtensions org.eclipse.php.ui phpContentAssistProcessor org.eclipse.php.debug.core phpDebugHandlers phpDebugParametersInitializer More: http://wiki.eclipse.org/images/5/54/API_PDT.pdf
13
Extending The PDT Project | Architecture and Extension Points | © 2008 by Roy Ganor; made available under the EPL v1.0 CONTACT & REFERENCES Wiki: http://wiki.eclipse.org/index.php/PDT Mailing list https://dev.eclipse.org/mailman/listinfo/pdt-dev Newsgroup http://www.eclipse.org/newsportal/thread.php?group=eclipse.tools.pdt Email: roy@zend.com
14
Extending The PDT Project | Architecture and Extension Points | © 2008 by Roy Ganor; made available under the EPL v1.0 Questions?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.