use of net.sourceforge.usbdm.deviceEditor.model.TreeViewModel in project usbdm-eclipse-plugins by podonoghue.
the class TabbedEditor method setModel.
public void setModel(BaseModel model) {
if (fPeripheralPageModel == model) {
return;
}
fPeripheralPageModel = (TabModel) model;
fTabFolder.setToolTipText(fPeripheralPageModel.getToolTip());
for (CTabItem c : fTabFolder.getItems()) {
c.dispose();
}
ArrayList<Object> children = fPeripheralPageModel.getChildren();
if ((children.size() == 1) && (children.get(0) instanceof TreeViewModel)) {
}
for (Object child : fPeripheralPageModel.getChildren()) {
BaseModel pageModel = (BaseModel) child;
CTabItem tabItem = new CTabItem(fTabFolder, SWT.NONE);
tabItem.setText(pageModel.getName());
tabItem.setToolTipText(pageModel.getToolTip());
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", 500, new DescriptionColumnLabelProvider(), new DescriptionColumnEditingSupport(viewer)) };
return fColumnInformation;
}
};
tabItem.setControl(treeEditor.createControl(fTabFolder));
treeEditor.setModel((TreeViewModel) pageModel);
} else if (pageModel instanceof SectionModel) {
SectionEditor sectionEditor = new SectionEditor();
tabItem.setControl(sectionEditor.createControl(fTabFolder));
sectionEditor.setModel(pageModel);
} else {
System.err.println("other");
}
}
fTabFolder.setSelection(0);
}
use of net.sourceforge.usbdm.deviceEditor.model.TreeViewModel 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);
}
}
}
Aggregations