public Control createControl(Composite parent) { control = new Composite(parent, SWT.NONE); control.setLayout(bl); constants.createControl(control); dependency.createControl(control); enableComponent(-1); return control; }
private void enableComponent(int i) { if (i == -1) { bl.centerComposite = null; constants.getControl().setVisible(false); dependency.getControl().setVisible(false); currentEditor = null; } else if (i == 0) { bl.centerComposite = constants.getControl(); constants.getControl().setVisible(true); dependency.getControl().setVisible(false); constants.getControl().update(); } else if (i == 1) { bl.centerComposite = dependency.getControl(); constants.getControl().setVisible(false); dependency.getControl().setVisible(true); dependency.getControl().update(); } }
public void setSelected(FModel fmodel) { if (selectedModel == fmodel) return; selectedModel = fmodel; if (selectedModel instanceof FConstantsModel) { currentEditor = constants; enableComponent(0); constants.setFModel(fmodel); dependency.setFModel(null); } else if (selectedModel instanceof FieldModel) { fmodel = ((FieldModel) fmodel).getDefaultDependency(); dependency.setFModel(fmodel); dependency.getFieldEditor().setEnabled(true); constants.setFModel(null); if (currentEditor != dependency) { currentEditor = dependency; enableComponent(1); } } else if (selectedModel instanceof DependencyModel) { dependency.setFModel(fmodel); dependency.getFieldEditor().setEnabled(false); constants.setFModel(null); if (currentEditor != dependency) { currentEditor = dependency; enableComponent(1); } } else if (currentEditor != null) { currentEditor = null; enableComponent(-1); constants.setFModel(null); constants.setFModel(null); } selectedModel = fmodel; control.getParent().update(); control.update(); control.layout(true); control.redraw(); }
public void update(FModel model) { if (currentEditor == constants) constants.update(); if (currentEditor == dependency) dependency.update(); }