Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] AspectJ and RCP

I think you are missing some directives in your MANIFEST.MF.

I would be expecting something like this in your e4.aspectj bundle (or
whatever bundle contains the aspects):

Eclipse-SupplementBundle: e4.test.aspects    # (or whatever bundle the
aspects should be applied to)

There are other ways of specifying which bundles or packages should be
woven with others, but this is the simplest.

On Sun, Aug 5, 2012 at 10:35 AM, Sopot Çela <sopotcela@xxxxxxxxx> wrote:
> Hi,
>
> I installed AJDT version 2.2.0e42x-RELEASE-20120703-2200.
> I created a sample plug-in project, converted it to AspectJ and created this
> aspect:
>
> public aspect MainAspect {
> pointcut handlers() : call (void *.execute(..));
> before() : handlers() {
> System.err.println("Hello aspectJ");
> }
>
> }
>
> Then I created a sample e4 app (which is a rcp app with default osgi bundles
> etc) which has the OpenHandler class with the execute method and exported
> the package. I added the e4 app plugin in the dependencies of the aspectj
> plugin project. I updated the run configurations and launched. THe app works
> fine, the execute method is called but the Hello AspectJ is nowhere to be
> found in the console.
>
> The manifest of the AspectJ project looks like this:
> Manifest-Version: 1.0
> Bundle-ManifestVersion: 2
> Bundle-Name: Aspectj
> Bundle-SymbolicName: e4.aspectj
> Bundle-Version: 1.0.0.qualifier
> Bundle-Activator: e4.aspectj.Activator
> Bundle-ActivationPolicy: lazy
> Bundle-RequiredExecutionEnvironment: JavaSE-1.7
> Import-Package: e4.test.aspects.handlers,
>  org.osgi.framework;version="1.3.0"
> Require-Bundle: org.aspectj.runtime;bundle-version="1.7.0",
>  org.aspectj.weaver;bundle-version="1.7.0",
>  org.eclipse.equinox.weaving.aspectj;bundle-version="1.0.100"
> Export-Package: e4.aspectj
>
> And the e4 project's manifest looks like this:
> Manifest-Version: 1.0
> Bundle-ManifestVersion: 2
> Bundle-Name: Aspects
> Bundle-SymbolicName: e4.test.aspects; singleton:=true
> Bundle-Version: 1.0.0.qualifier
> Bundle-Activator: e4.test.aspects.Activator
> Require-Bundle: javax.inject;bundle-version="1.0.0",
>  org.eclipse.core.runtime;bundle-version="3.8.0",
>  org.eclipse.swt;bundle-version="3.100.0",
>  org.eclipse.core.databinding;bundle-version="1.4.1",
>  org.eclipse.core.databinding.beans;bundle-version="1.2.200",
>  org.eclipse.jface;bundle-version="3.8.0",
>  org.eclipse.jface.databinding;bundle-version="1.6.0",
>  org.eclipse.e4.ui.services;bundle-version="0.10.1",
>  org.eclipse.e4.ui.workbench;bundle-version="0.10.2",
>  org.eclipse.e4.core.services;bundle-version="1.0.0",
>  org.eclipse.e4.core.di;bundle-version="1.1.0",
>  org.eclipse.e4.core.contexts;bundle-version="1.1.0",
>  org.eclipse.e4.ui.workbench.swt;bundle-version="0.10.1",
>  org.eclipse.core.databinding.property;bundle-version="1.4.100",
>  org.eclipse.e4.ui.css.core;bundle-version="0.10.1",
>  org.w3c.css.sac;bundle-version="1.3.1",
>  org.eclipse.e4.core.commands;bundle-version="0.10.1",
>  org.eclipse.e4.ui.bindings;bundle-version="0.10.1"
> Bundle-RequiredExecutionEnvironment: JavaSE-1.7
> Import-Package: org.osgi.framework;version="1.3.0"
> Bundle-ActivationPolicy: lazy
> Export-Package: e4.test.aspects.handlers
>
> OpenHandler class:
>
> package e4.test.aspects.handlers;
> import java.lang.reflect.InvocationTargetException;
> import javax.inject.Named;
> import org.eclipse.e4.core.contexts.IEclipseContext;
> import org.eclipse.e4.core.di.annotations.Execute;
> import org.eclipse.e4.ui.services.IServiceConstants;
> import org.eclipse.swt.widgets.FileDialog;
> import org.eclipse.swt.widgets.Shell;
>
> public class OpenHandler {
>
> @Execute
> public void execute(
> IEclipseContext context,
> @Named(IServiceConstants.ACTIVE_SHELL) Shell shell)
> throws InvocationTargetException, InterruptedException {
> FileDialog dialog = new FileDialog(shell);
> dialog.open();
> }
> }
>
>
> Worth noting that there is a warning "advice defined in e4.aspectj.MyAspect
> has not been applied [Xlint:adviceDidNotMatch]"
>
> What am I doing wrong? Consider I have just 2 hours experience in AspectJ.
>
> Thanks.
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top