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 "Scout/HowTo/3.8/Storing window size & position and view configuration in SWT"

< Scout‎ | HowTo‎ | 3.8
(New page)
 
(New page)
Line 1: Line 1:
 
{{ScoutPage|cat=HowTo 3.8}}  
 
{{ScoutPage|cat=HowTo 3.8}}  
  
The Swing client already stores the window size and position as well as the relative size of the various views when closing the client and restores these settings when next starting it. This how-to describes how to do this for the SWT client as well.  
+
The Swing client already stores the window size and position as well as the relative size of the various views when closing the client and restores these settings when next starting it.. This how-to describes how to add this functionality to SWT clients.  
  
 
= Steps  =
 
= Steps  =
  
In order to do this with SWT the following method needs to be added to org.eclipse.minicrm.ui.swt.application.'''ApplicationWorkbenchAdvisor'''
+
In order to do this with SWT the following method needs to be added to org.eclipse.minicrm.ui.swt.application.ApplicationWorkbenchAdvisor  
  
 
   @Override
 
   @Override
 
  public void initialize(IWorkbenchConfigurer configurer) {
 
  public void initialize(IWorkbenchConfigurer configurer) {
  super.initialize(configurer);
+
  super.initialize(configurer);
  configurer.setSaveAndRestore(true);
+
  configurer.setSaveAndRestore(true);
 
  }
 
  }
  
 
This has the added benefit that it also stores which form is shown in which view.  
 
This has the added benefit that it also stores which form is shown in which view.  
  
'''Caveat:''' If you have added a toolbar to your SWT client as described in [http://wiki.eclipse.org/Scout/HowTo/3.8/Changing_outlines_with_the_SWT_client#Adding_a_toolbar_to_the_SWT_application wiki.eclipse.org/Scout/HowTo/3.8/Changing_outlines_with_the_SWT_client#Adding_a_toolbar_to_the_SWT_application], enabling the SaveAndRestore feature will break your toolbar (only the first button will be shown after starting the client). It is currently unclear if this is a problem in the implementation of the toolbar described in the linked how-to or if it is a bug in either Scout or Eclipse.
+
=== Caveat ===
 +
 
 +
If you have added a Toolbar to your SWT client as described in the how-to [http://wiki.eclipse.org/Scout/HowTo/3.8/Changing_outlines_with_the_SWT_client#Adding_a_toolbar_to_the_SWT_application wiki.eclipse.org/Scout/HowTo/3.8/Changing_outlines_with_the_SWT_client#Adding_a_toolbar_to_the_SWT_application], enabling the '''SaveAndRestore''' feature will break the toolbar. It is not yet clear if this is a problem with the toolbar implementation as described in the linked how-to, or if it is a bug in either Scout or Eclipse.<br>

Revision as of 03:36, 6 March 2013

The Scout documentation has been moved to https://eclipsescout.github.io/.

The Swing client already stores the window size and position as well as the relative size of the various views when closing the client and restores these settings when next starting it.. This how-to describes how to add this functionality to SWT clients.

Steps

In order to do this with SWT the following method needs to be added to org.eclipse.minicrm.ui.swt.application.ApplicationWorkbenchAdvisor

 @Override
public void initialize(IWorkbenchConfigurer configurer) {
 super.initialize(configurer);
 configurer.setSaveAndRestore(true);
}

This has the added benefit that it also stores which form is shown in which view.

Caveat

If you have added a Toolbar to your SWT client as described in the how-to wiki.eclipse.org/Scout/HowTo/3.8/Changing_outlines_with_the_SWT_client#Adding_a_toolbar_to_the_SWT_application, enabling the SaveAndRestore feature will break the toolbar. It is not yet clear if this is a problem with the toolbar implementation as described in the linked how-to, or if it is a bug in either Scout or Eclipse.

Back to the top