Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "JDT weaving features"

(Installation)
(Installing JDT Weaving in a non-default location)
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
Starting with version 1.6.2, AJDT will be shipped with the '''JDT weaving plugin'''.  This plugin uses [http://www.eclipse.org/equinox/incubator/aspects/index.php Equinox Aspects] to weave into JDT (more specifically, the org.eclipse.jdt.core, org.eclipse.jdt.ui, and org.eclipse.jdt.debug.core plugins).
+
Starting with version 1.6.2, AJDT will be shipped with the '''JDT weaving plugin'''.  This plugin implements the '''weaving service''' that uses [http://www.eclipse.org/equinox/incubator/aspects/index.php Equinox Aspects] to weave into JDT.  Upon installing or upgrading AJDT, the weaving service is initially ''off''. You are asked if the service should be enabled the first time an AspectJ project is opened or created.
  
This provides an opportunity for deep integration with Eclipse in ways that were not possible before.  This release introduces the following features:  
+
Through this weaving, AJDT is able to integrate with Eclipse more deeply and in ways that were not possible before.  This release introduces the following features:  
  
 
*ITD-aware reconciling/eager parsing (in both Java and AJ editors, this means that red squiggles will ''not'' appear when referencing ITDs)
 
*ITD-aware reconciling/eager parsing (in both Java and AJ editors, this means that red squiggles will ''not'' appear when referencing ITDs)
Line 7: Line 7:
 
*ITD-aware type hierarchies (for now only super-type hierarchies can be calculated with ITD-awareness)
 
*ITD-aware type hierarchies (for now only super-type hierarchies can be calculated with ITD-awareness)
 
*Ability to search for aspect elements using standard ''Java search'' and ''Open Java type''
 
*Ability to search for aspect elements using standard ''Java search'' and ''Open Java type''
 +
 +
With the service enabled, Eclipse may require more resources.  If you encounter any sluggishness or memory problems, it is recommended that you increase your Xmx and PermGen sizes to at least 512 and 128 respectively, using something like the following vmargs when launching eclipse:
 +
 +
-vmargs -Xmx512M -XX:MaxPermSize=128M
 +
  
 
For information on how to use the JDT weaving plugin to provide deep integration with plugins and editors for other Java-like languages, see [[JDT weaving implementation]].
 
For information on how to use the JDT weaving plugin to provide deep integration with plugins and editors for other Java-like languages, see [[JDT weaving implementation]].
 +
 +
'''Due to [https://bugs.eclipse.org/bugs/show_bug.cgi?id=257178 Bug 257178], it is necessary to have the org.eclipse.equinox.weaing.hook bundle installed in the same directory as org.eclipse.osgi.''' For a work around, see below.
 +
 +
==Turning on JDT Weaving manually==
 +
 +
If automated enabling of JDT Weaving is not working for you, it is possible to manually enable it.  Here are three ways to do it.
 +
 +
Simple way (try this first):
 +
 +
# In Eclipse open up the plug-in registry view.
 +
# Look for org.eclipse.equinox.weaving.aspectj
 +
# Right click and select "Show Advanced operations"
 +
# Right click again and select start (if not already started)
 +
# Restart
 +
 +
If JDT Weaving still does not start, then try the following:
 +
# Find the eclipse/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info file and open it in a text editor
 +
# Find the line that says:
 +
org.eclipse.equinox.weaving.aspectj
 +
# Change false to true
 +
# Save and start Eclipse
 +
 +
Or you can try this:
 +
# Find the eclipse/configuration/config.ini file and open in a text editor
 +
# Ensure that the line: osgi.framework.extensions=org.eclipse.equinox.weaving.hook is present
 +
# On the line that starts osgi.bundles= after the '=', insert the text
 +
    org.eclipse.equinox.weaving.aspectj@2\:start,
 +
# Save and start eclipse
  
 
==Installation==
 
==Installation==
  
Weaving AJDT is only available for Eclipse 3.4.  Use the standard AJDT 1.6 update site:
+
AJDT with JDT weaving is only available for Eclipse 3.4 and 3.5The easiest way to install is through the standard AJDT 1.6 update site:
  
  http://download.eclipse.org/tools/ajdt/34/dev/update
+
  http://download.eclipse.org/tools/ajdt/34/update
 +
 
 +
Or through the dev AJDT 1.7 update site (for Eclipse 3.5):
 +
 
 +
http://download.eclipse.org/tools/ajdt/dev/35/update
  
 
Installing from this update site will automatically install Equinox Aspects from a separate update site.  Additionally, the install will update your config.ini file to allow the weaving service to be enabled at startup.
 
Installing from this update site will automatically install Equinox Aspects from a separate update site.  Additionally, the install will update your config.ini file to allow the weaving service to be enabled at startup.
  
Due to [https://bugs.eclipse.org/bugs/show_bug.cgi?id=257178 Bug 257178], it is currently only possible to install Weaving AJDT in the same directory that Eclipse itself is installed in (actually, this only applies to Equinox Aspects, see below).
+
Due to [https://bugs.eclipse.org/bugs/show_bug.cgi?id=257178 Bug 257178], it is currently only possible to install AJDT with JDT weaving in the same directory that Eclipse itself is installed in.
  
 
===Manual Install===
 
===Manual Install===
  
It is possible to install weaving AJDT manually (i.e., not through an update site).  Simply download the appropriate zip file of AJDT from the [http://eclipse.org/ajdt/downloads downloads page] and unzip into your eclipse ''dropins'' folder.
+
To do a manual install, first download the desired zip file of AJDT from the [http://eclipse.org/ajdt/downloads downloads page] and unzip into your eclipse ''plugins'' or ''dropins'' folder.
  
These zips do not include Equinox Aspects, which is required for the weaving to be installed.  There are two ways to install Equinox Aspects: from the update site, or manually.
+
'''Important:''' the org.eclipse.equinox.weaving.hook bundle must be installed in the same directory as the org.eclipse.osgi bundleSo, if you unzipped AJDT into your dropins directory, you must move org.eclipse.equinox.weaving.hook to plugins.
  
====Installing Equinox Aspects from the update site====
+
Next, restart Eclipse.  If you already have AspectJ projects in your workspace, you will be prompted to enable JDT Weaving. If not, then you can enable in preferences (see below).
  
Currently, Equinox Aspects is available from an update site in the AJDT namespace.  We are waiting for an appropriate update site in the Equinox namespace.  Here is the url:
+
===Installing JDT Weaving in a non-default location===
  
  http://download.eclipse.org/tools/ajdt/34/dev/equinox-aspects
+
It may be possible to install org.eclipse.equinox.weaving.hook in a location different from org.eclipse.osgi. 
  
====Installing Equinox Aspects manually====
+
# Edit eclipse/configuration/config.ini
 
+
# Find the line that begins "osgi.framework=".  
#Download the latest release from http://www.eclipse.org/equinox/incubator/aspects/equinox-aspects-downloads.php
+
# Change the line that starts with "osgi.framework" to:
#Unzip into your Eclipse plugins directory (must be ''plugins'' and not ''dropins'' because of [https://bugs.eclipse.org/bugs/show_bug.cgi?id=257178 Bug 257178])
+
osgi.frameworkClassPath=file\:<full path to org.eclipse.osgi>,file\:<full path to org.eclipse.equinox.weaving.hook>
#Edit your config.ini file in your Eclipse configuration directory:
+
# Add the line:
#*Add the following lines (first one is required, last three are only if you want weaving information displayed (recommended)):
+
 
  osgi.framework.extensions=org.eclipse.equinox.weaving.hook
 
  osgi.framework.extensions=org.eclipse.equinox.weaving.hook
 +
# On the line that starts "osgi.bundles", after the '=', add this:
 +
org.eclipse.equinox.weaving.aspectj@2\:start,
 +
# Optionally add the following for verbose output of weaving:
 
  aj.weaving.verbose=true
 
  aj.weaving.verbose=true
 
  org.aspectj.weaver.showWeaveInfo=true
 
  org.aspectj.weaver.showWeaveInfo=true
 
  org.aspectj.osgi.verbose=true
 
  org.aspectj.osgi.verbose=true
#*Look for the line that looks something like:
+
# Save and start Eclipse
  osgi.bundles=reference\:file\:org.eclipse.equinox.simpleconfigurator_1.0.0.v20080604.jar@1\:start
+
# Follow prompt to enable JDT Weaving if asked
and add
+
 
 +
In the end, your config.ini should look something like this:
 +
 
 +
...
 +
  osgi.frameworkClassPath=file\:/Users/ajdt/eclipse/plugins/org.eclipse.osgi_3.4.3.R34x_v20081215-1030.jar,file\:/Users/ajdt/eclipse/dropins/plugins
 
  osgi.bundles=org.eclipse.equinox.weaving.aspectj@2\:start,reference\:file\:org.eclipse.equinox.simpleconfigurator_1.0.0.v20080604.jar@1\:start
 
  osgi.bundles=org.eclipse.equinox.weaving.aspectj@2\:start,reference\:file\:org.eclipse.equinox.simpleconfigurator_1.0.0.v20080604.jar@1\:start
 +
osgi.framework.extensions=org.eclipse.equinox.weaving.hook
 +
aj.weaving.verbose=true
 +
org.aspectj.weaver.showWeaveInfo=true
 +
org.aspectj.osgi.verbose=true
 +
...
  
 
==Runtime==
 
==Runtime==
Line 53: Line 101:
 
  Preferences -> JDT Weaving
 
  Preferences -> JDT Weaving
  
 
+
This page will notify you of the state of the weaving serviceIt will also allow you to enable/disable the service.
Alternatively:
+
 
+
#Create a new aspect in an AspectJ project and save.
+
#Open the ''Open Types'' dialog (Ctrl-Shift-t on Windows).
+
#Type the name of the new aspect.
+
#If it appears, rejoice! The JDT weaving plugin is now working.
+
  
 
==Uninstalling==
 
==Uninstalling==
  
Uninstall Weaving AJDT in the same way you uninstall any other Eclipse feature:
+
If AJDT was installed through the update site, then you can uninstall it in the same way you uninstall any other Eclipse feature:
  
 
  Help -> Software Updates -> Installed Software
 
  Help -> Software Updates -> Installed Software
  
Select AJDT, and click ''Uninstall...''.  This will also uninstall Equinox Aspects and reset your config.ini to its previous state.
+
Select AJDT, and click ''Uninstall...''.  This will also uninstall Equinox Aspects and undo the changes to your config.ini.
  
 +
If either Equinox Aspects or AJDT were installed manually, then they must be uninstalled manually as well by deleting the appropriate plugins from the filesystem.
  
==Running Weaving AJDT without JDT Weaving==
+
If you had originally installed Equinox Aspects manually, then you must also manually back out all the changes to the config.ini.
  
It is possible to disable the weaving service and still run AJDT 1.6.2.  However, all the advanced features will be disabled.
+
==Running AJDT without JDT Weaving==
  
Go to  
+
It is possible to disable the weaving service and still run AJDT. Basic features, such as the AJBuilder, navigation, and cross references will be available, but advanced features will be disabled.
  Preferences -> JDT Weaving
+
  
Click the button and restart the workbench. The weaving service can be restarted in the same way.
+
To disable JDT Weaving, go to
 +
  Preferences -> JDT Weaving
  
 +
Click the button ''Disable JDT Weaving'' button and restart the workbench.  Similarly, to re-enable the weaving service go back to the preference page and click ''Enable JDT Weaving''.
  
 
Alternatively, to disable manually, you can edit the file eclipse/configuration/config.ini.  Delete the line that looks something like this:
 
Alternatively, to disable manually, you can edit the file eclipse/configuration/config.ini.  Delete the line that looks something like this:

Latest revision as of 17:31, 4 March 2009

Starting with version 1.6.2, AJDT will be shipped with the JDT weaving plugin. This plugin implements the weaving service that uses Equinox Aspects to weave into JDT. Upon installing or upgrading AJDT, the weaving service is initially off. You are asked if the service should be enabled the first time an AspectJ project is opened or created.

Through this weaving, AJDT is able to integrate with Eclipse more deeply and in ways that were not possible before. This release introduces the following features:

  • ITD-aware reconciling/eager parsing (in both Java and AJ editors, this means that red squiggles will not appear when referencing ITDs)
  • ITD-aware content assist (for now only in *.aj files in AJ editors)
  • ITD-aware type hierarchies (for now only super-type hierarchies can be calculated with ITD-awareness)
  • Ability to search for aspect elements using standard Java search and Open Java type

With the service enabled, Eclipse may require more resources. If you encounter any sluggishness or memory problems, it is recommended that you increase your Xmx and PermGen sizes to at least 512 and 128 respectively, using something like the following vmargs when launching eclipse:

-vmargs -Xmx512M -XX:MaxPermSize=128M


For information on how to use the JDT weaving plugin to provide deep integration with plugins and editors for other Java-like languages, see JDT weaving implementation.

Due to Bug 257178, it is necessary to have the org.eclipse.equinox.weaing.hook bundle installed in the same directory as org.eclipse.osgi. For a work around, see below.

Turning on JDT Weaving manually

If automated enabling of JDT Weaving is not working for you, it is possible to manually enable it. Here are three ways to do it.

Simple way (try this first):

  1. In Eclipse open up the plug-in registry view.
  2. Look for org.eclipse.equinox.weaving.aspectj
  3. Right click and select "Show Advanced operations"
  4. Right click again and select start (if not already started)
  5. Restart

If JDT Weaving still does not start, then try the following:

  1. Find the eclipse/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info file and open it in a text editor
  2. Find the line that says:
org.eclipse.equinox.weaving.aspectj
  1. Change false to true
  2. Save and start Eclipse

Or you can try this:

  1. Find the eclipse/configuration/config.ini file and open in a text editor
  2. Ensure that the line: osgi.framework.extensions=org.eclipse.equinox.weaving.hook is present
  3. On the line that starts osgi.bundles= after the '=', insert the text
   org.eclipse.equinox.weaving.aspectj@2\:start,
  1. Save and start eclipse

Installation

AJDT with JDT weaving is only available for Eclipse 3.4 and 3.5. The easiest way to install is through the standard AJDT 1.6 update site:

http://download.eclipse.org/tools/ajdt/34/update

Or through the dev AJDT 1.7 update site (for Eclipse 3.5):

http://download.eclipse.org/tools/ajdt/dev/35/update

Installing from this update site will automatically install Equinox Aspects from a separate update site. Additionally, the install will update your config.ini file to allow the weaving service to be enabled at startup.

Due to Bug 257178, it is currently only possible to install AJDT with JDT weaving in the same directory that Eclipse itself is installed in.

Manual Install

To do a manual install, first download the desired zip file of AJDT from the downloads page and unzip into your eclipse plugins or dropins folder.

Important: the org.eclipse.equinox.weaving.hook bundle must be installed in the same directory as the org.eclipse.osgi bundle. So, if you unzipped AJDT into your dropins directory, you must move org.eclipse.equinox.weaving.hook to plugins.

Next, restart Eclipse. If you already have AspectJ projects in your workspace, you will be prompted to enable JDT Weaving. If not, then you can enable in preferences (see below).

Installing JDT Weaving in a non-default location

It may be possible to install org.eclipse.equinox.weaving.hook in a location different from org.eclipse.osgi.

  1. Edit eclipse/configuration/config.ini
  2. Find the line that begins "osgi.framework=".
  3. Change the line that starts with "osgi.framework" to:
osgi.frameworkClassPath=file\:<full path to org.eclipse.osgi>,file\:<full path to org.eclipse.equinox.weaving.hook>
  1. Add the line:
osgi.framework.extensions=org.eclipse.equinox.weaving.hook
  1. On the line that starts "osgi.bundles", after the '=', add this:
org.eclipse.equinox.weaving.aspectj@2\:start,
  1. Optionally add the following for verbose output of weaving:
aj.weaving.verbose=true
org.aspectj.weaver.showWeaveInfo=true
org.aspectj.osgi.verbose=true
  1. Save and start Eclipse
  2. Follow prompt to enable JDT Weaving if asked

In the end, your config.ini should look something like this:

...
osgi.frameworkClassPath=file\:/Users/ajdt/eclipse/plugins/org.eclipse.osgi_3.4.3.R34x_v20081215-1030.jar,file\:/Users/ajdt/eclipse/dropins/plugins
osgi.bundles=org.eclipse.equinox.weaving.aspectj@2\:start,reference\:file\:org.eclipse.equinox.simpleconfigurator_1.0.0.v20080604.jar@1\:start
osgi.framework.extensions=org.eclipse.equinox.weaving.hook
aj.weaving.verbose=true
org.aspectj.weaver.showWeaveInfo=true
org.aspectj.osgi.verbose=true
...

Runtime

To see if the JDT Weaving plugin is properly configured, go to

Preferences -> JDT Weaving

This page will notify you of the state of the weaving service. It will also allow you to enable/disable the service.

Uninstalling

If AJDT was installed through the update site, then you can uninstall it in the same way you uninstall any other Eclipse feature:

Help -> Software Updates -> Installed Software

Select AJDT, and click Uninstall.... This will also uninstall Equinox Aspects and undo the changes to your config.ini.

If either Equinox Aspects or AJDT were installed manually, then they must be uninstalled manually as well by deleting the appropriate plugins from the filesystem.

If you had originally installed Equinox Aspects manually, then you must also manually back out all the changes to the config.ini.

Running AJDT without JDT Weaving

It is possible to disable the weaving service and still run AJDT. Basic features, such as the AJBuilder, navigation, and cross references will be available, but advanced features will be disabled.

To disable JDT Weaving, go to

Preferences -> JDT Weaving

Click the button Disable JDT Weaving button and restart the workbench. Similarly, to re-enable the weaving service go back to the preference page and click Enable JDT Weaving.

Alternatively, to disable manually, you can edit the file eclipse/configuration/config.ini. Delete the line that looks something like this:

osgi.framework.extensions=org.eclipse.equinox.weaving.hook

Copyright © Eclipse Foundation, Inc. All Rights Reserved.