Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Trouble after updating to nightly Luna build
Trouble after updating to nightly Luna build [message #1268249] Mon, 10 March 2014 04:46 Go to next message
Urs Beeli is currently offline Urs Beeli
Messages: 325
Registered: October 2012
Location: Bern, Switzerland
Senior Member
In order to test various bugs that I have created and that were recently fixed, I have updated both my SDK and my target to the Luna nightly build of 2013-03-10.

This has broken a lot of my code, the most prominent being Class[] -> List<Class> changes, which I have now adjusted. However, there are a few compile errors that I have been unable to easily resolve.

I've checked the following two resources:
- NewAndNoteworthy/4.0
- Bug List
but not found the answers to my problems.

It seems that the package name for the Derby support has been renamed, maybe it would be worthwhile mentioning this in the 4.0 Milestone page linked above.

These are the issues I've so far been unable to resolve:

  • in my SWT client the DesktopMenuBar class has used the following call:
    SwtMenuUtility.getMenuContribution(menus, env);
    it seems that this method is no longer part of the MenuUtility. How do I replace it?
  • in two places I've been creating instances of SwtScoutAction() which seems to have disappeared. How do I replace these?
Re: Trouble after updating to nightly Luna build [message #1268262 is a reply to message #1268249] Mon, 10 March 2014 05:14 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 682
Registered: October 2011
Senior Member
Nice to start a such thread. I had the same idea in mind.

Quote:
in two places I've been creating instances of SwtScoutAction() which seems to have disappeared. How do I replace these?


With bug 424525, I have done some refactorings and bug fixes. I double checked: SwtScoutAction now extends AbstractSwtScoutAction, but the API (constructors, ...) should be the same.

Can you post a code snippet?


Quote:
It seems that the package name for the Derby support has been renamed, maybe it would be worthwhile mentioning this in the 4.0 Milestone page linked above.


Feel free to write something in the wiki.

Quote:
in my SWT client the DesktopMenuBar class has used the following call:
SwtMenuUtility.getMenuContribution(menus, env);
it seems that this method is no longer part of the MenuUtility. How do I replace it?


SwtMenuUtility.getMenuContribution(menus, env) with menus as Array do not exist anymore.

You can fix it with the List method:
SwtMenuUtility.getMenuContribution(List, ISwtEnvironment)

I had this in DesktopMenuBar.
The fix (switch from array to list) is also OK because
env.getClientSession().getDesktop().getMenus() also return a list instead of an array.

This is not a long term solution, because SwtMenuUtility.getMenuContribution(List, ISwtEnvironment) is deprecated.

[Updated on: Mon, 10 March 2014 05:28]

Report message to a moderator

Re: Trouble after updating to nightly Luna build [message #1268298 is a reply to message #1268249] Mon, 10 March 2014 06:10 Go to previous messageGo to next message
Andreas Hoegger is currently offline Andreas Hoegger
Messages: 173
Registered: February 2010
Senior Member
The derby renaming is due to Bug 429542. Support for your menu/action issues I just added to the Migration Guide.

Hope this helps.

-andreas
Re: Trouble after updating to nightly Luna build [message #1268373 is a reply to message #1268298] Mon, 10 March 2014 08:19 Go to previous messageGo to next message
Urs Beeli is currently offline Urs Beeli
Messages: 325
Registered: October 2012
Location: Bern, Switzerland
Senior Member
Thanks Andreas & Jérémie

The suggested change in the migration guide solved the getMenuContribution() issue.

I added a part to the M6 section about the Derby bundle & name change.

However, the SwtScoutAction issue still exists as I didn't really understand Jérémie's comment and the discussion in Bug 424525 didn't really help me either. The only hit I get for "Swt*Action" when I hit Ctrl-Shift-T is SwtScoutToolbarAction. One code snippet where I used the SwtScoutAction is in some code where I am adding toolbuttons to views:

  private IContributionItem getMenuContributionItem(IAction buttonAction, ISwtEnvironment env) {
    if (!buttonAction.isVisible()) {
      return null;
    }

    if (buttonAction.isSeparator()) {
      return new Separator();
    }

    Action swtAction = new SwtScoutAction(buttonAction, env).getSwtAction();
    return new ActionContributionItem(swtAction);
  }


Any help on this last issue would be much appreciated.
Re: Trouble after updating to nightly Luna build [message #1268395 is a reply to message #1268373] Mon, 10 March 2014 08:57 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 682
Registered: October 2011
Senior Member
You are right. The file SwtScoutAction was removed with commit 4e8bfce5858c0a150c8aad09ceeab81747c2ddc7 (SwtScoutAction)

In my project we are currently on Luna-M5-2 (Scout 4.0.0). Sorry for the confusion.
I will have the exact same problem as you when I update to Luna-M6 next week.

[Updated on: Mon, 10 March 2014 09:03]

Report message to a moderator

Re: Trouble after updating to nightly Luna build [message #1268415 is a reply to message #1268395] Mon, 10 March 2014 09:25 Go to previous messageGo to next message
Urs Beeli is currently offline Urs Beeli
Messages: 325
Registered: October 2012
Location: Bern, Switzerland
Senior Member
Thanks for the clarification Jérémie. If anyone has a suggestion how to work around this I'd certainly appreciate it Smile
Re: Trouble after updating to nightly Luna build [message #1270656 is a reply to message #1268415] Thu, 13 March 2014 05:34 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 682
Registered: October 2011
Senior Member
I have still no answer for SwtScoutAction... Sorry.

I wanted to mention that the "Bug List" link you have mentioned in your first post is outdated.

See the link on the wiki page (I just updated it to consider 4.0 Milestones too)

https://wiki.eclipse.org/Scout/NewAndNoteworthy/4.0#Migration_Guidelines
Re: Trouble after updating to nightly Luna build [message #1270857 is a reply to message #1268415] Thu, 13 March 2014 13:02 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 682
Registered: October 2011
Senior Member
Urs Beeli wrote on Mon, 10 March 2014 14:25
If anyone has a suggestion how to work around this I'd certainly appreciate it Smile


The refactoring of SwtScoutAction was included in Bug 422646.

Quote of Andreas Hoegger:
Quote:
Furthermore the SwtScoutAction got replaced with org.eclipse.scout.rt.ui.swt.action.SwtScoutActionContributionItem or org.eclipse.scout.rt.ui.swt.action.SwtScoutToolbarAction depending on the usage


I hope it helps you.
Re: Trouble after updating to nightly Luna build [message #1273119 is a reply to message #1270857] Wed, 19 March 2014 10:46 Go to previous messageGo to next message
Urs Beeli is currently offline Urs Beeli
Messages: 325
Registered: October 2012
Location: Bern, Switzerland
Senior Member
Thanks for all the help, I now have my sandbox project compiling again. However, there are still some errors when running it. My sandbox project is based on the minicrm tutorial. One part that is not working is the "Person to Role" assignment. My ProcessService class contains the following code (excerpt only):

  @Override
  public PersonFormData create(PersonFormData formData) throws ProcessingException {
    if (!ACCESS.check(new CreatePersonPermission())) {
      throw new VetoException(TEXTS.get("AuthorizationFailed"));
    }
    SQL.selectInto("SELECT MAX(PERSON_NR)+1 FROM PERSON INTO :personNr", formData);
    SQL.insert("INSERT INTO PERSON (PERSON_NR, COMPANY_NR, FIRST_NAME, LAST_NAME, USERNAME, EMAIL, PASSWORD_ENCODED) VALUES (:personNr, :companyNr, :firstName, :lastName, :username, :email, ::passwordEncoded)", formData);
    SQL.insert("INSERT INTO USER_ROLE (USER_NR, ROLE_NR) VALUES (:personNr, :{roles})", formData);

    return formData;
  }


Where formData.roles is a member of AbstractValueFieldData<Set<Long>>

When trying to call create() with a new entry, I get the following error:
INSERT INTO USER_ROLE(USER_NR, ROLE_NR)
VALUES (:personNr, :{roles})
IN :personNr => ? [BIGINT 34] java.lang.IllegalArgumentException: no SqlBind mapping for class java.util.HashSet]



A similar problem occurs when trying to read. The code looks as follows:

  @Override
  public PersonFormData load(PersonFormData formData) throws ProcessingException {
    if (!ACCESS.check(new ReadPersonPermission())) {
      throw new VetoException(TEXTS.get("AuthorizationFailed"));
    }
    StringBuilder statement = new StringBuilder();
    statement.append("SELECT FIRST_NAME, LAST_NAME, COMPANY_NR, USERNAME, EMAIL, PASSWORD_ENCODED FROM PERSON WHERE PERSON_NR = :personNr ");
    statement.append("INTO :firstName, :lastName, :companyNr, :username, :email, :passwordEncoded");
    SQL.selectInto(statement.toString(), formData);
    SQL.select("SELECT ROLE_NR FROM USER_ROLE WHERE USER_NR = :personNr INTO :roles", formData); // I've also tried "INTO :{roles}"
    return formData;
  }


When calling this, I get the following error:

SELECT ROLE_NR
FROM USER_ROLE
WHERE USER_NR = :personNr
INTO :roles
IN :personNr => ? [BIGINT 6]
OUT :roles => ? [Set] / expected a single value for ":roles" but got multiple values ]


I've also tried the "INTO :{roles}" notation but the prolem remains unchanged.

Is this something that has changed in the SQL engine? If so, what changes are needed to make this work again? I have the same issue in other places, always in places where I'm reading multiple values.
Re: Trouble after updating to nightly Luna build [message #1277291 is a reply to message #1273119] Tue, 25 March 2014 16:09 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 682
Registered: October 2011
Senior Member
Has your formData changed?
What is the type returned by PersonFormData#getRoles() [and was in the previous version].
What is the Roles field in the form. A ListBox?

I do not think that the SQL layer has changed.
I can only think of Bug 419140, but it was added with 3.10-M3.

What update are you doing? 3.9.x to 4.0.0 ??

Re: Trouble after updating to nightly Luna build [message #1277558 is a reply to message #1277291] Wed, 26 March 2014 02:16 Go to previous messageGo to next message
Urs Beeli is currently offline Urs Beeli
Messages: 325
Registered: October 2012
Location: Bern, Switzerland
Senior Member
The element is a ListBox and the FormData has changed from
public static class Roles extends AbstractValueFieldData<Long[]> {
to
public static class Roles extends AbstractValueFieldData<Set<Long>> {
as part of the migration from Luna-M4 -> Luna-M6.
Re: Trouble after updating to nightly Luna build [message #1277833 is a reply to message #1277558] Wed, 26 March 2014 10:22 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 682
Registered: October 2011
Senior Member
Thanks for analysing your problem!

It is possible that Set never worked.
I will try to have a look.

Can you fill a bug for the usage of Set in SQL bindings?

.
Re: Trouble after updating to nightly Luna build [message #1278288 is a reply to message #1277833] Thu, 27 March 2014 02:09 Go to previous message
Urs Beeli is currently offline Urs Beeli
Messages: 325
Registered: October 2012
Location: Bern, Switzerland
Senior Member
Jérémie, thanks for looking into this. The bug is https://bugs.eclipse.org/bugs/show_bug.cgi?id=431305
Previous Topic:PostgreSQL Default insert for autoincrements and "returning"
Next Topic:Show PDF file on client
Goto Forum:
  


Current Time: Tue Sep 02 13:02:12 EDT 2014

Powered by FUDForum. Page generated in 0.02857 seconds