Saving view as text format

SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

Saving view as text format

Postby hyshyshys » Wed Dec 17, 2008 2:35 am

Hi,

Is there a way to save view, or any part of the ui (like menu, dialog, or form) as a text file (like xml). The xml file should contents only visual elements of the view and layout and the java file should contains only a basic ViewPart frame that loads element at run time.

For example, suppose I'm creating a new view in swtbuilder. In the .java file of the view, I would like to have something like this:

Code: Select all

package ...
import ...
public class MyView extends ViewPart {

   public static final String ID = "myview"; //$NON-NLS-1$
        private MyActionSet myActionSet = null;

   public void createPartControl(Composite parent) {
      
      LoadPartControl(parent, "filename.xml", "partControl1")
   
      //
      createActions();
      initializeToolBar();
      initializeMenu();
   }

   private void createActions() {
             myActionSet = CreateMyActionSet();
   }
   
   private void initializeToolBar() {
               LoadToolbar("filename.xml", "toolbar1", myActionSet)
   }

   private void initializeMenu() {
               LoadMenu("filename.xml", "menu1", myActionSet)
   }
}



This feature could help me to generate user interface without having to recompile my application.

Thanks

Vincent
hyshyshys
 
Posts: 37
Joined: Thu Jul 03, 2008 12:27 pm

Re: Saving view as text format

Postby Eric Clayberg » Wed Dec 17, 2008 5:14 am

hyshyshys wrote:Is there a way to save view, or any part of the ui (like menu, dialog, or form) as a text file (like xml).

No.

This is not a feature we intend to support as we don't think it is a good idea in general. If you are using Java to create your UI, the natural representation of that UI is in Java. Using some other representation will only serve to make the app harder to maintain, harder to extend with custom logic, and somewhat slower (since you have to add the additional runtime translation step from XML to Java object).

hyshyshys wrote:This feature could help me to generate user interface without having to recompile my application.

If you are using Eclipse, it will incrementally and instantly recompile any modified classes whenever you save a class.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to SWT Designer

Who is online

Users browsing this forum: No registered users and 2 guests