您的位置:首页 > Web前端 > JQuery

在MyEclipse8.6中设置jQuery自动提示

2011-01-14 17:19 633 查看
    MyEclipse8.6是目前J2EE开发中高版本的开发工具,比起一般的Eclipse她有更多的功能!毕竟是商业版本嘛,绝对J2EE是开发神器!

    但是MyEclipse8.6默认是没有开启jQuery提示的,怎样才能开启提示呢?

    我在网上查,发现很多人都是在Eclipse中安装Skept插件作为JQuery的编辑器,但是我按照网上的说法进行安装时却提示我不支持的的Eclipse版本。是不是我的版本太高了?我想MyEclipse8.6毕竟和普通的Eclipse不一样,肯定会有更多的功能。经过查了她的帮助文档,关于她的MyEclipse JavaScript editor有这么样的介绍(在MyEclipse JavaScript Development and Debugging Tutorial 中的介绍):

 

5.2 Editing JavaScript Files

The MyEclipse JavaScript Editor provides advanced language specific editing features such as:

OOP aware

Smart code assist for built-in and custom objects with browser compatibility details

Syntax highlighting

Validation and style checking

Outline view with content filtering and selection synchronization

Quick comment toggling

Setting up Context (Optional)
In order to setup additional context for content assist, in MyEclipse you can use the JavaScript library property page (right click Project > Properties > MyEclipse > JavaScript Libraries) to add libraries to your environment and additionally specify source folders. JavaScript files in these folders will parsed and added to the your JavaScript project's global scope. Objects, fields and methods defined in these files will be provided as options for content assist even when you may be editing another JavaScript file.
Note: Adding files to a source folder is only necessary if you need additional context for content assist. Content assist for elements within a given source file will be provided even if it is not part of the global scope.
In MyEclipse Web projects, the WebRoot folder is automatically setup as a source folder when the project is created, this can be easily changed to suit your needs.



Figure 5a: JavaScript Libraries property page



Figure 5b: Available runtime JavaScript libraries



Figure 6: Specifying a source folder
As can be seen in the above dialog, there are several different ways in which JavaScript resources can be added to your project's scope.
Browsing Code
The Script Explorer view provides a JavaScript centric view of your project. The Project Explorer will now show additional detail for all JavaScript objects contained in source folders.



Figure 7: Script and Project Explorer views
JavaScript Outline View
The outline view depicts a structured view of the functions and variables of a JavaScript Editor. The variables in the list filtered using the Hide Vars action in the view's toolbar.



Figure 8: Outline view
Press Ctrl + O while editing a JavaScript file to open the Quick Outline dialog allowing you to easily navigate through your code.



Figure 9: Quick Outline Dialog
Content Assist
To view JavaScript code-assist proposals place your cursor in a context for which a completion proposal is desired and then press the Ctrl+Space key combination. If code completion proposals are available they will be presented in a popup window.



Figure 10: JavaScript content-assist example
Quick Comment Toggle
To toggle on or off one or more single line comments select the region to comment and enter Ctrl+Shift+C .
 


Figure 11a: Mark region to comment


Figure 11b: Commented region after Ctrl+Shift+C

 

但是我却没在项目的properties中找到所谓的right click Project > Properties > MyEclipse > JavaScript Libraries

 但是,我发现了有一个Myeclipse>JavaScript>Build Path,里面有Libraries的选项卡,点击AddLibrary后,选择列表中的第一项“JavaScriptLibrary”,点击next,我们可以看到MyEclipse里面内置了三个库,是DOJO、JQUery和YUI。如果你要加入JQuery,只需勾选后点击Finish即可成功。如下图:



添加JavaScript库



内置三个库

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息