use of bndtools.model.repo.LoadingContentElement in project bndtools by bndtools.
the class RunFrameworkPart method createSection.
final void createSection(Section section, FormToolkit tk) {
section.setText("Core Runtime");
Composite composite = tk.createComposite(section);
section.setClient(composite);
Label lblFramework = new Label(composite, SWT.NONE);
tk.adapt(lblFramework, true, true);
lblFramework.setText("OSGi Framework:");
cmbFramework = new Combo(composite, SWT.DROP_DOWN);
tk.adapt(cmbFramework);
tk.paintBordersFor(cmbFramework);
cmbFramework.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
frameworkViewer = new ComboViewer(cmbFramework);
frameworkViewer.setUseHashlookup(true);
frameworkViewer.setContentProvider(fwkContentProvider);
Label lblExecEnv = tk.createLabel(composite, "Execution Env.:");
cmbExecEnv = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
ControlDecoration eeDecor = new ControlDecoration(cmbExecEnv, SWT.LEFT | SWT.TOP, composite);
eeDecor.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
eeDecor.setDescriptionText("The runtime Java Virtual Machine will be required/assumed " + "\nto support this Execution Environment");
eeViewer = new ComboViewer(cmbExecEnv);
eeViewer.setContentProvider(ArrayContentProvider.getInstance());
eeViewer.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
return ((EE) element).getEEName();
}
});
eeViewer.setInput(EE.values());
// Listeners
cmbFramework.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
lock.ifNotModifying(new Runnable() {
@Override
public void run() {
markDirty();
selectedFramework = cmbFramework.getText();
}
});
}
});
frameworkViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
lock.ifNotModifying(new Runnable() {
@Override
public void run() {
Object element = ((IStructuredSelection) frameworkViewer.getSelection()).getFirstElement();
if (element instanceof LoadingContentElement) {
return;
}
markDirty();
if (element == null)
selectedFramework = null;
else
selectedFramework = element.toString();
}
});
}
});
eeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(final SelectionChangedEvent event) {
lock.ifNotModifying(new Runnable() {
@Override
public void run() {
markDirty();
selectedEE = (EE) ((IStructuredSelection) event.getSelection()).getFirstElement();
}
});
}
});
GridLayout layout = new GridLayout(2, false);
layout.horizontalSpacing = 10;
composite.setLayout(layout);
lblFramework.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
GridData gd;
gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
gd.widthHint = 20;
gd.heightHint = 20;
cmbFramework.setLayoutData(gd);
lblExecEnv.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
gd.widthHint = 20;
gd.heightHint = 20;
cmbExecEnv.setLayoutData(gd);
}
Aggregations