Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Cannot see outline and menu(Eclipse Scout, on Onpensuse 11.4 64 bit with KDE )
Cannot see outline and menu [message #717560] Sun, 21 August 2011 07:08 Go to next message
Pietro Bonanno is currently offline Pietro Bonanno
Messages: 13
Registered: July 2009
Junior Member
As you can see in attached images, my app has an outline with a table page, and the default menus. However, when I start the SWT application, I cannot see none of these.
I tried various combination, but nothing changed.
The only warning I see at start of the app is:

!ENTRY org.eclipse.ui 4 4 2011-08-21 12:52:19.477
!MESSAGE Referenced part does not exist yet: frantoio.ui.swt.views.TablePageView.


I updated to the last nightly update, but nothing changed.

Thanks for your help
Re: Cannot see outline and menu [message #717574 is a reply to message #717560] Sun, 21 August 2011 09:15 Go to previous messageGo to next message
Claudio Guglielmo is currently offline Claudio Guglielmo
Messages: 126
Registered: March 2010
Senior Member
Hi Pietro

When creating a new scout application you can choose between some application templates. It seems to me that your application was created with the template "Application with a single form". This template does not include the code for starting the forms used by outline and pages.

To change this behavior you need to add the code to startup the outline forms when opening the desktop:

@Override
protected void execOpened() throws ProcessingException {
  // outline tree
  DefaultOutlineTreeForm treeForm = new DefaultOutlineTreeForm();
  treeForm.startView();

  //outline table
  DefaultOutlineTableForm tableForm = new DefaultOutlineTableForm();
  tableForm.startView();

  if (getAvailableOutlines().length > 0) {
    setOutline(getAvailableOutlines()[0]);
  }

}


This should solve your issue with the outline. To solve the issue with the menus some hand work need to be done because scout does not link the menus defined in the desktop with the eclipse menu bar so far.

Basically you need to declare the eclipse menus in the plugin.xml of the ui.swt plugin, create a command and link its handler with the menu action in the desktop. I suggest to have a look at the org.eclipse.ui.menus extension point and the command/handler concept.

If I have time next week I can provide a howto but do not rely on that.

Hope that helps
Claudio
Re: Cannot see outline and menu [message #717793 is a reply to message #717574] Mon, 22 August 2011 07:39 Go to previous messageGo to next message
Pietro Bonanno is currently offline Pietro Bonanno
Messages: 13
Registered: July 2009
Junior Member
Ok I've now solved the outline problem, following your suggestions. For the menu, I thought they should link to main bar automagically, but I know how to do with standard RCP, so don't worry about it and thanks again Smile
Re: Cannot see outline and menu [message #735314 is a reply to message #717574] Tue, 11 October 2011 10:25 Go to previous messageGo to next message
Bertin Kiekebosch is currently offline Bertin Kiekebosch
Messages: 280
Registered: August 2011
Senior Member
Hi all,

I also struggle with the menu problem.

I created an empty application and there is a File menu with an Exit submenu visible. These are these not in the PlugIn.xml but they still work.

What is the difference between this menu and menus I create myself.

Regards Bertin
Re: Cannot see outline and menu [message #735430 is a reply to message #717560] Tue, 11 October 2011 14:54 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 117
Registered: November 2010
Senior Member
I imagine you have defined menus in your Desktop class (Scout Model). Menus are defined as inner class of other elements that accept them (Desktop in this case, but also Table, Pages, SmartField...).

Something like:
public class Desktop extends AbstractDesktop implements IDesktop {
  private static IScoutLogger logger = ScoutLogManager.getLogger(Desktop.class);

  public Desktop() {
  }

  //...

  @Order(10.0)
  public class FileMenu extends AbstractMenu {

    @Override
    public String getConfiguredText() {
      return Texts.get("FileMenu");
    }

    @Order(10.0)
    public class AddMenu extends AbstractMenu {

      @Override
      protected String getConfiguredText() {
        return Texts.get("Add");
      }

      @Order(10.0)
      public class CollectionMenu extends AbstractMenu {

        @Override
        protected String getConfiguredText() {
          return Texts.get("Collection");
        }

        @Override
        protected void execAction() throws ProcessingException {
          //TODO add logic to add a new collection
        }
      }

      @Order(20.0)
      public class PictureMenu extends AbstractMenu {

        @Override
        protected String getConfiguredText() {
          return Texts.get("Picture");
        }

        @Override
        protected void execAction() throws ProcessingException {
          //TODO add logic to add a new image
        }
      }
    }

    @Order(20.0)
    public class ExitMenu extends AbstractMenu {

      @Override
      public String getConfiguredText() {
        return Texts.get("ExitMenu");
      }

      @Override
      public void execAction() throws ProcessingException {
        ClientSyncJob.getCurrentSession(ClientSession.class).stopSession();
      }
    }
  }
}


Are you using a SWT UI rendering plug in?

If yes, what you point out is a big limitation of the current implementation of the SWT rendering plug-in. Desktop is not correctly supported rendered. (See also: [SWT GUI] switch between outlines attached to the desktop)

This is because of a timing problem. The SWT Rendering plug-in uses the traditional Eclipse RCP Stack (Application ApplicationWorkbenchAdvisor, ApplicationWorkbenchWindowAdvisor, ApplicationActionBarAdvisor...). When the application is started, the Scout Client model isn't instantiated yet.

This could be solved with e4 (considering Scout Client Model as a processor that contribute elements to the application model).

Current solution:
Add the code to add the menu as you would do for any other RCP Application. If you only want a SWT application, you can do this instead of the scout client model. If you want have a single sourced application with multiple UI (multiple renderer like SWT, Swing, RAP...) you need to duplicate in SWT, what you have coded in the Scout Client model.
In SWT, if you want to access something on the scout desktop, you can use the code given here:
ISwtEnvironment env = Activator.getDefault().getEnvironment();
final IDesktop desktop = env.getScoutDesktop();
Runnable t = new Runnable() {
  @Override
  public void run() {
    // your code here, using the scout desktop.
  }
};
env.invokeScoutLater(t, 0);


Other solution: use Swing renderer.
Re: Cannot see outline and menu [message #735433 is a reply to message #735314] Tue, 11 October 2011 14:57 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 117
Registered: November 2010
Senior Member
bertin wrote on Tue, 11 October 2011 16:25
I created an empty application and there is a File menu with an Exit submenu visible. These are these not in the PlugIn.xml but they still work.


The SWT Menus you see are hard-coded in the SWT UI Plug-in:

<your application>.ui.swt.application.ApplicationActionBarAdvisor.fillMenuBar(IMenuManager)
Re: Cannot see outline and menu [message #735956 is a reply to message #735430] Thu, 13 October 2011 04:21 Go to previous message
Bertin Kiekebosch is currently offline Bertin Kiekebosch
Messages: 280
Registered: August 2011
Senior Member
thanks,

it works although I don't quite understand why in the code below the first call MessageBox.showOkMessage() gives an error and the second, inside the run() works well.

Regards Bertin

 @Override
 protected void makeActions(IWorkbenchWindow window) {
    exitAction = ActionFactory.QUIT.create(window);
    register(exitAction);

    vensterClientenAction = new Action("Clienten...") {
      @Override
      public void run() {
        MessageBox.showOkMessage("Clienten", "Toon Clienten", "Deze dialog toont clienten");

        ISwtEnvironment env = Activator.getDefault().getEnvironment();
        final IDesktop desktop = env.getScoutDesktop();
        Runnable t = new Runnable() {
          @Override
          public void run() {
            MessageBox.showOkMessage("Clienten", "Toon Clienten", "Deze dialog toont clienten");
          }
        };
        env.invokeScoutLater(t, 0);

      }
    };

Previous Topic:transaction management
Next Topic:Best practice for large BO's
Goto Forum:
  


Current Time: Sat Apr 19 06:04:30 EDT 2014

Powered by FUDForum. Page generated in 0.01746 seconds