Skip to main content



      Home
Home » Eclipse Projects » Eclipse 4 » @Focus in Eclipse 4.3 M3
@Focus in Eclipse 4.3 M3 [message #986413] Tue, 20 November 2012 06:00 Go to next message
Eclipse UserFriend
Hi,

today I installed Eclipse 4.3 M3. On trying to run the application I migrated to Eclipse 4 I noticed a different behaviour for @Focus. It seems the call stack has changed and @Focus is called before @PostConstruct. This leads to a NPE if I'm trying to do something like this (got this from some well known tutorials):

private TableViewer viewer;

@PostConstruct
public void createPart(Composite parent) {
	viewer = new TableViewer(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
}

@Focus
public void setFocus() {
	viewer.getTable().setFocus();
}


This code works with 4.2.1. So the question is, is the new behaviour intended or a bug?

Greez,
Dirk
Re: @Focus in Eclipse 4.3 M3 [message #986415 is a reply to message #986413] Tue, 20 November 2012 06:03 Go to previous messageGo to next message
Eclipse UserFriend
https://bugs.eclipse.org/bugs/show_bug.cgi?id=394327
Re: @Focus in Eclipse 4.3 M3 [message #986416 is a reply to message #986415] Tue, 20 November 2012 06:12 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Sopot, that's it. Again I searched with the wrong parameters. Sad
Re: @Focus in Eclipse 4.3 M3 [message #986758 is a reply to message #986416] Wed, 21 November 2012 09:46 Go to previous messageGo to next message
Eclipse UserFriend
Dirk, I just pushed Wims change. Would be great if you could test the fix and perhaps comment on the bug.
Re: @Focus in Eclipse 4.3 M3 [message #986761 is a reply to message #986758] Wed, 21 November 2012 09:59 Go to previous messageGo to next message
Eclipse UserFriend
As far as I understand, the fix is to add the dependency to javax.annotation on creating a new project. So for existing projects, this wouldn't fix anything. There needs to be a documentation on what to do on moving from 4.2 to 4.3.

Or did I missunderstand the fix?
Re: @Focus in Eclipse 4.3 M3 [message #986771 is a reply to message #986761] Wed, 21 November 2012 10:15 Go to previous messageGo to next message
Eclipse UserFriend
Just change your MANIFEST.MF dependency to a package dependency for javax.annotation and re-run.
Re: @Focus in Eclipse 4.3 M3 [message #986774 is a reply to message #986771] Wed, 21 November 2012 10:25 Go to previous messageGo to next message
Eclipse UserFriend
Yes I did that already after Sopot linked to the bug. Smile And yes then it works. Nevertheless this needs to be documented as a migration issue for existing Eclipse 4 applications.
Re: @Focus in Eclipse 4.3 M3 [message #986775 is a reply to message #986774] Wed, 21 November 2012 10:27 Go to previous messageGo to next message
Eclipse UserFriend
Nevertheless this needs to be documented as a migration issue for existing Eclipse 4 applications.

-> Sure, go ahead. Smile
Re: @Focus in Eclipse 4.3 M3 [message #988798 is a reply to message #986413] Mon, 03 December 2012 04:25 Go to previous messageGo to next message
Eclipse UserFriend
I just stumbled upon this problem, and could fix it by adding the proposed @Inject after the @PostConstruct

If I execute the code on 4.3 it at least works, if I execute it on 4.2 now, however, the user interface elements get shown doubled!!

I don't get this, what is now the official solution? I am using the latest 4.3 I and 4.2 and I don't seem to be able to create a version that runs flawless on both?!
Re: @Focus in Eclipse 4.3 M3 [message #988799 is a reply to message #988798] Mon, 03 December 2012 04:35 Go to previous messageGo to next message
Eclipse UserFriend
As Lars explained, you need to add the depencency to javax.annotation package to your MANIFEST.MF. You don't need to have @Inject and @PostConstruct at the same time.
Re: @Focus in Eclipse 4.3 M3 [message #988810 is a reply to message #988799] Mon, 03 December 2012 05:13 Go to previous messageGo to next message
Eclipse UserFriend
Am 03.12.12 10:35, schrieb Dirk Fauth:
> As Lars explained, you need to add the depencency to javax.annotation
> package to your MANIFEST.MF. You don't need to have @Inject and
> @PostConstruct at the same time.

Don't need is the wrong term! MUST NOT is the correct one.

In the end the real problem is that equinox by default exports all the
bootclasspath-packages. If you'd have pure OSGi you'd import each and
every package no matter if it is provided as part of the JDK (=exported
by the system.bundle) or another bundle and PDE replicates this :-(

It would be nice to put PDE into a strict OSGi-mode where it tells you
that you need to import the bits from the JRE as well.

Tom
Re: @Focus in Eclipse 4.3 M3 [message #988823 is a reply to message #988799] Mon, 03 December 2012 05:58 Go to previous messageGo to next message
Eclipse UserFriend
I already have that dependency, it does not help!
Re: @Focus in Eclipse 4.3 M3 [message #988828 is a reply to message #988823] Mon, 03 December 2012 06:08 Go to previous messageGo to next message
Eclipse UserFriend
Please note that it should be a package-import and not a require-bundle.

Tom

Am 03.12.12 11:58, schrieb Marco Descher:
> I already have that dependency, it does not help!
Re: @Focus in Eclipse 4.3 M3 [message #988830 is a reply to message #988828] Mon, 03 December 2012 06:19 Go to previous message
Eclipse UserFriend
That did it, thanks a lot Smile
Previous Topic:Mechanism to provide IAdapterFactory for classes, not instances?
Next Topic:Contacts Demo not working properly
Goto Forum:
  


Current Time: Wed Jul 23 08:39:01 EDT 2025

Powered by FUDForum. Page generated in 0.83265 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top