Introducing the new Web Tools Java Script Features
Introducing the new Web Tools Java. Script™ Features Phil Berkland IBM Software Group berkland@us. ibm. com 9/26/2007 Copyright © IBM Corp. , 2007 -2008.
Agenda • Overview • Brief History • Functions • Design • Demonstrations • Where to get JSDT Copyright © IBM Corp. , 2008. All rights reserved. Source code in this presentation is made available under the EPL, v 1. 0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2. 5 license.
Overview • Java. Script Development Tools (JSDT) is the Java. Script component of Web. Tools § Replaces old Java. Script editor • JSDT provides rich Java. Script editing capability § Based on the Best of Breed Java™ editing functions provided by Eclipse™ • JSDT can be packaged in several different configurations § By itself Only javascript editing for. js files no HTML editing § As part of Web Tools Both Java. Script files and Java. Script regions within HTML/JSP Copyright © IBM Corp. , 2008. All rights reserved. Source code in this presentation is made available under the EPL, v 1. 0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2. 5 license.
Brief History • Eclipse ATF project started to provide AJAX tooling • ATF realized Java. Script is the main component of AJAX, and current Eclipse Java. Script support was very lacking. • Effort launched to create Java. Script editing on the par with Java Editing • Since Web. Tools project owns Java. Script function, a new component (JSDT) was created under Web. Tools (WST) project • JSDT will become the Java. Script Editor for Web. Tools 3. 0 Copyright © IBM Corp. , 2008. All rights reserved. Source code in this presentation is made available under the EPL, v 1. 0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2. 5 license.
Why Use JSDT? • In a Word – Productivity • Detect errors as you Type § Syntax errors, common programming error warnings displayed interactively § Don’t have to wait until Script is run to find errors • Less Typing § Code completion § Templates § Refactoring • Code comprehension § § Tools to help understand script which is being developed Search Call analysis Hover Help Copyright © IBM Corp. , 2008. All rights reserved. Source code in this presentation is made available under the EPL, v 1. 0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2. 5 license.
Functions w Most functions are available in both HTML and Java. Script editors § Some are not available in HTML because popup menu not there w Syntax highlighting (configurable) § Vars, functions, keywords, etc display has configurable color and font w Code folding § Can easily hide functions and block comments w Configurable formatting § Configurable indentation, whitespace, blank lines, new lines for all program elements § Configuration can be shared by multiple users w Code completion § Completion proposals are anything valid at cursor location § Templates (pre-defined or user defined) w Syntax checking/error display (severity level configurable for each error) w Quick fix § For common errors, a list of possible fixes is displayed, and the chosen fix is applied w Hover help/tips (uses JSDoc if available) Copyright © IBM Corp. , 2008. All rights reserved. Source code in this presentation is made available under the EPL, v 1. 0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2. 5 license.
Functions w Occurrences marking § All occurrences of selected function/var in file are highlighted w open selected item § The definition of the selected item is displayed w highlight matching parenthesis/brace/bracket w add/remove/generate comment w Typing helpers: § Automatically close strings, parentheses, brackets, etc as you type § Automatically insert semicolons, braces § automatic formatting Copyright © IBM Corp. , 2008. All rights reserved. Source code in this presentation is made available under the EPL, v 1. 0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2. 5 license.
Functions (continued) • Refactoring w function- rename, move, delete, change signature, extract selected block to function w var - rename, move, delete • Jsdoc support § Used in hover help § Code completion provided or JSDoc tags • Class hierarchy view § Java. Script is analyzed, and class structure is inferred § Shows tree view of class structure, with functions/vars for each class • Call hierarchy view § Displays list of callers of functions § Caller list can in turn be expanded to see who calls them, recursive Copyright © IBM Corp. , 2008. All rights reserved. Source code in this presentation is made available under the EPL, v 1. 0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2. 5 license.
Functions (continued) • Script explorer view • Search references/declarations § Search for references/declarations/read access/write access § Language level search (no matches in text or comments) • Preferences: w Appearance w Templates w Formatting w Validation options w Error/Warning levels w Editor options • APIs for reading/writing Java. Script (language model) § Many Extension points § See Brad Childs talk following this one Copyright © IBM Corp. , 2008. All rights reserved. Source code in this presentation is made available under the EPL, v 1. 0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2. 5 license.
Design Ø Very similar to design of JDT Ø Typical flow Ø Java. Script is parsed into Abstract Syntax Tree (AST) Ø AST is analyzed to infer class structure Ø Default inference based on common coding patterns (. i. e. “. prototype) Ø JSDoc information used if present Ø Extension points to add custom inference Ø All references are resolved (vars, function calls, etc) Ø Code flow is analyzed to determine unreferenced vars, dead code, etc Ø Libraries provided for definition of language and browser DOM functions/classes Ø API libraries for IE, Firefox, and Ecma spec Ø Libraries also provide hover help Copyright © IBM Corp. , 2008. All rights reserved. Source code in this presentation is made available under the EPL, v 1. 0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2. 5 license.
Post 3. 0 possibilities • These are only ideas, not commitments • ECMAScript 4. 0 support w Most of the internal model exists, main work is parser • Interpreter Engine w Internal model is there, just need execution engine/context w Given Rhino, benefits of doing it are questionable Copyright © IBM Corp. , 2008. All rights reserved. Source code in this presentation is made available under the EPL, v 1. 0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2. 5 license.
Where to get JSDT • www. eclipse. org/wtp § from downloads page • Report bugs using the “Web Tools” product, “wst. jsdt” component • Discussion groups: w news: //eclipse. webtools/ w wtp-dev@eclipse. org mailing list Copyright © IBM Corp. , 2008. All rights reserved. Source code in this presentation is made available under the EPL, v 1. 0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2. 5 license.
Where to get JDST Source • CVS Repository Locations w /cvsroot/webtools • As Standalone Java. Script Editor w w sourceediting/plugins/org. eclipse. wst. jsdt. core org. eclipse. wst. jsdt. manipulation org. eclipse. wst. jsdt. ui • Integrated with Web Tools w w w sourceediting/plugins/org. eclipse. wst. jsdt. core org. eclipse. wst. jsdt. web. ui • See Wiki page for more information w http: //wiki. eclipse. org/JSDT Copyright © IBM Corp. , 2008. All rights reserved. Source code in this presentation is made available under the EPL, v 1. 0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2. 5 license.
Legal Notices • • Copyright © IBM Corp. , 2007 -2008. All rights reserved. Source code in this presentation is made available under the EPL, v 1. 0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2. 5 license. Java and all Java-based marks, among others, are trademarks or registered trademarks of Sun Microsystems in the United States, other countries or both. Eclipse and the Eclipse logo are trademarks of Eclipse Foundation, Inc. IBM and the IBM logo are trademarks or registered trademarks of IBM Corporation, in the United States, other countries or both. Other company, product and service names may be trademarks or service marks of others. Mozilla Firefox® is a trademark of the Mozilla Foundation THE INFORMATION DISCUSSED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY. WHILE EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION, IT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, AND IBM SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF THE USE OF, OR OTHERWISE RELATED TO, SUCH INFORMATION. ANY INFORMATION CONCERNING IBM'S PRODUCT PLANS OR STRATEGY IS SUBJECT TO CHANGE BY IBM WITHOUT NOTICE. Copyright © IBM Corp. , 2008. All rights reserved. Source code in this presentation is made available under the EPL, v 1. 0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2. 5 license.
- Slides: 14