Search in sources :

Example 1 with TabModel

use of net.sourceforge.usbdm.deviceEditor.model.TabModel in project usbdm-eclipse-plugins by podonoghue.

the class SectionEditor method setModel.

public void setModel(BaseModel model) {
    if (fSectionModel == model) {
        return;
    }
    fSectionModel = (SectionModel) model;
    for (Object child : fSectionModel.getChildren()) {
        BaseModel pageModel = (BaseModel) child;
        if (pageModel instanceof TreeViewModel) {
            TreeEditor treeEditor = new TreeEditor() {

                @Override
                protected TreeColumnInformation[] getColumnInformation(TreeViewer viewer) {
                    final TreeColumnInformation[] fColumnInformation = { new TreeColumnInformation("Property", 350, new NameColumnLabelProvider(), null), new TreeColumnInformation("Value", 450, new ValueColumnLabelProvider(), new ValueColumnEditingSupport(viewer)), new TreeColumnInformation("Description", 550, new DescriptionColumnLabelProvider(), new DescriptionColumnEditingSupport(viewer)) };
                    return fColumnInformation;
                }
            };
            Control treeControl = treeEditor.createControl(tabArea);
            treeControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
            treeEditor.setModel((TreeViewModel) pageModel);
        } else if (pageModel instanceof TabModel) {
            TabbedEditor tabEditor = new TabbedEditor();
            Control treeControl = tabEditor.createControl(tabArea);
            treeControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
            tabEditor.setModel(pageModel);
        }
    }
}
Also used : TreeViewer(org.eclipse.jface.viewers.TreeViewer) Control(org.eclipse.swt.widgets.Control) BaseModel(net.sourceforge.usbdm.deviceEditor.model.BaseModel) GridData(org.eclipse.swt.layout.GridData) TreeViewModel(net.sourceforge.usbdm.deviceEditor.model.TreeViewModel) TabModel(net.sourceforge.usbdm.deviceEditor.model.TabModel)

Aggregations

BaseModel (net.sourceforge.usbdm.deviceEditor.model.BaseModel)1 TabModel (net.sourceforge.usbdm.deviceEditor.model.TabModel)1 TreeViewModel (net.sourceforge.usbdm.deviceEditor.model.TreeViewModel)1 TreeViewer (org.eclipse.jface.viewers.TreeViewer)1 GridData (org.eclipse.swt.layout.GridData)1 Control (org.eclipse.swt.widgets.Control)1