Eclipse Forms: Designer Support for SectionPart

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

Eclipse Forms: Designer Support for SectionPart

Postby steves » Wed Oct 19, 2005 6:17 pm

Hi Eric,

I've seen two threads regarding this subject (the most recent at http://www.swt-designer.com/forum/viewtopic.php?t=555). However, I never saw any conclusive answer to the question. So, I'll ask again. :)

Will there (or is there) support for working with SectionPart-derived classes in SWT Designer? I can't give any better use cases than those already stated in the aforementioned threads: I'd prefer to break up my monolithic FormPage classes into a FormPage and several more-manageable SectionParts.

Currently, I've resorted to bastardizing the FormPage. Essentially I'm using SWT Designer to build the GUI in a huge createFormContent() method, and then passing the Designer-created Section (and all relevant child controls) to my SectionPart-derived class (thankfully the Eclipse Forms team provided a SectionPart ctor that takes an existing Section). At least I can implement the section-specific UI logic separately from my FormPage, but I'd really like to be able to create the Section child controls there, as well, to avoid the mess I have in createFormContent().

Regards,

Steve
steves
 
Posts: 4
Joined: Mon Aug 08, 2005 7:49 pm

ManagedForms, SectionPart and SWTDesigner

Postby matthias.luebken » Tue Nov 29, 2005 1:03 am

Hi everyone

I'm currently starting a new project with SWTDesigner an ManagedForms. I can't really add much to the questions asked before:
Will there (or is there) support for working with SectionPart-derived classes in SWT Designer?

My scenario:
I've got a large FormPage with serveral Sections which I want to implement each with it's own class. In addition I want to register these Sections as IFormPart with the FormPage to gain the lifecycle abilities of the ManagedForm. So basicly I want SectionParts.

Greetings
Matt
matthias.luebken
 
Posts: 9
Joined: Tue Nov 29, 2005 12:55 am

Postby matthias.luebken » Tue Nov 29, 2005 3:33 am

A small complement:
If you follow the discussion http://www.swt-designer.com/forum/viewtopic.php?t=661
a sectionpart could be the pendant to a composite you select with "choose composite".
matthias.luebken
 
Posts: 9
Joined: Tue Nov 29, 2005 12:55 am

Re: Eclipse Forms: Designer Support for SectionPart

Postby Eric Clayberg » Thu Dec 01, 2005 1:18 pm

steves wrote:Will there (or is there) support for working with SectionPart-derived classes in SWT Designer?

The latest v4.2.1 build includes support for creating SectionParts.

Image

Image
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

Re: Eclipse Forms: Designer Support for SectionPart

Postby steves » Thu Dec 01, 2005 6:15 pm

Eric Clayberg wrote:The latest v4.2.1 build includes support for creating SectionParts.

A big thank you on this, Eric! Your effort on this feature is very much appreciated. :D
steves
 
Posts: 4
Joined: Mon Aug 08, 2005 7:49 pm

Postby matthias.luebken » Mon Dec 19, 2005 7:40 am

After creating a section part, how do I include in a viewpart?
matthias.luebken
 
Posts: 9
Joined: Tue Nov 29, 2005 12:55 am

Postby Eric Clayberg » Mon Dec 19, 2005 12:38 pm

matthias.luebken wrote:After creating a section part, how do I include in a viewpart?

1) Create a Forms-based ViewPart using the Designer > Forms > ViewPart wizard

2) Use the Choose Bean command to select your SectionPart class and add it to your viewpart.

You should end up with something like this:

Image

Code: Select all
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.part.ViewPart;
import com.swtdesigner.SectionPartTest;
public class FormsViewPart extends ViewPart {
    private SectionPartTest sectionPartTest;
    public void createPartControl(Composite parent)
    {
        FormToolkit toolkit = new FormToolkit(Display.getCurrent());
        Composite container = toolkit.createComposite(parent, SWT.NONE);
        toolkit.paintBordersFor(container);
        container.setLayout(new GridLayout());

        sectionPartTest = new SectionPartTest(container, toolkit, Section.TWISTIE | Section.TITLE_BAR | Section.EXPANDED);
        createActions();
        initializeToolBar();
        initializeMenu();
    }
    private void createActions()
    {
    }
    private void initializeToolBar()
    {
        IToolBarManager tbm = getViewSite().getActionBars().getToolBarManager();
    }
    private void initializeMenu()
    {
        IMenuManager manager = getViewSite().getActionBars().getMenuManager();
    }
    public void setFocus()
    {
    }
}
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

Postby matthias.luebken » Tue Jan 31, 2006 5:56 am

Eric Clayberg wrote:2) Use the Choose Bean command to select your SectionPart class and add it to your viewpart.


For some reason this last step doesn't work. After adding the sectionpart to the viewpart nothing happens. The property editor, source, and preview window stays unchanged.

My SWTDesigner:
Version: 4.2.1
Build id: 2005.12.02
matthias.luebken
 
Posts: 9
Joined: Tue Nov 29, 2005 12:55 am

Postby matthias.luebken » Tue Jan 31, 2006 6:09 am

Copying your source does work, but it still doesn't show in the design window "just" during runtime.
matthias.luebken
 
Posts: 9
Joined: Tue Nov 29, 2005 12:55 am

Postby Eric Clayberg » Tue Jan 31, 2006 7:09 am

matthias.luebken wrote:My SWTDesigner:
Version: 4.2.1
Build id: 2005.12.02

You appear to be using a very old v4.2.1 build from two months ago. Try it again with the most recent v4.2.1 build.

If that does not work, check your Eclipse ".log" file for any exceptions.
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 1 guest