use of org.eclipse.swt.custom.ScrolledComposite in project linuxtools by eclipse.
the class PerfOptionsTab method createControl.
@Override
public void createControl(Composite parent) {
scrollTop = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
scrollTop.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
scrollTop.setExpandVertical(true);
scrollTop.setExpandHorizontal(true);
setControl(scrollTop);
top = new Composite(scrollTop, SWT.NONE);
top.setLayout(new GridLayout());
createVerticalSpacer(top, 1);
GridData data;
// Kernel Selection
Composite kernelComp = new Composite(top, SWT.NONE);
GridLayout parallelLayout = new GridLayout(2, false);
data = new GridData(GridData.FILL_HORIZONTAL);
parallelLayout.marginHeight = 0;
parallelLayout.marginWidth = 0;
kernelComp.setLayout(parallelLayout);
kernelComp.setLayoutData(data);
Label kernelLabel = new Label(kernelComp, SWT.NONE);
kernelLabel.setText(PerfPlugin.STRINGS_Kernel_Location);
data = new GridData();
data.horizontalSpan = 2;
kernelLabel.setLayoutData(data);
txtKernelLocation = new Text(kernelComp, SWT.SINGLE | SWT.BORDER);
data = new GridData(GridData.FILL_HORIZONTAL);
txtKernelLocation.setLayoutData(data);
txtKernelLocation.addModifyListener(mev -> handleKernelImageFileTextModify(txtKernelLocation));
Button button = createPushButton(kernelComp, Messages.PerfOptionsTab_Browse, null);
final Shell shell = top.getShell();
button.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> showFileDialog(shell)));
createVerticalSpacer(top, 1);
// Create checkbox options container
Composite chkBoxComp = new Composite(top, SWT.NONE);
GridLayout chkBoxLayout = new GridLayout();
chkBoxLayout.marginHeight = 0;
chkBoxLayout.marginWidth = 0;
chkBoxComp.setLayout(chkBoxLayout);
chkRecordVerbose = createCheckButtonHelper(chkBoxComp, PerfPlugin.STRINGS_Record_Verbose);
chkModuleSymbols = createCheckButtonHelper(chkBoxComp, PerfPlugin.STRINGS_ModuleSymbols);
chkHideUnresolvedSymbols = createCheckButtonHelper(chkBoxComp, PerfPlugin.STRINGS_HideUnresolvedSymbols);
chkSourceLineNumbers = createCheckButtonHelper(chkBoxComp, PerfPlugin.STRINGS_SourceLineNumbers);
chkShowSourceDisassembly = createCheckButtonHelper(chkBoxComp, PerfPlugin.STRINGS_ShowSourceDisassembly);
Composite showStatComp = new Composite(top, SWT.NONE);
showStatComp.setLayout(parallelLayout);
chkShowStat = createCheckButtonHelper(showStatComp, PerfPlugin.STRINGS_ShowStat);
chkShowStat.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> handleShowStatSelection()));
statRunCount = new Spinner(showStatComp, SWT.BORDER);
statRunCount.setEnabled(false);
statRunCount.setMinimum(1);
statRunCount.addModifyListener(e -> updateLaunchConfigurationDialog());
chkSourceLineNumbers.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
if ((chkKernelSourceLineNumbers != null) && (!chkSourceLineNumbers.getSelection())) {
chkKernelSourceLineNumbers.setEnabled(false);
} else {
chkKernelSourceLineNumbers.setEnabled(true);
}
}));
chkKernelSourceLineNumbers = createCheckButtonHelper(chkBoxComp, PerfPlugin.STRINGS_Kernel_SourceLineNumbers);
Composite realtimeComp = new Composite(top, SWT.NONE);
realtimeComp.setLayout(parallelLayout);
chkRecordRealtime = createCheckButtonHelper(realtimeComp, PerfPlugin.STRINGS_Record_Realtime);
chkRecordRealtime.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
rtPriority.setEnabled(chkRecordRealtime.getSelection());
}));
rtPriority = new Spinner(realtimeComp, SWT.BORDER);
rtPriority.setEnabled(chkRecordRealtime.getSelection());
rtPriority.setMinimum(1);
rtPriority.addModifyListener(e -> updateLaunchConfigurationDialog());
// A disabled button does not respond to mouse events so use a composite.
final Composite multiplexEventsComp = new Composite(chkBoxComp, SWT.NONE);
multiplexEventsComp.setLayout(chkBoxLayout);
multiplexEventsComp.addListener(SWT.MouseHover, event -> multiplexEventsComp.setToolTipText(Messages.PerfOptionsTab_Requires_LTE + multiplexEventsVersion));
chkMultiplexEvents = createCheckButtonHelper(multiplexEventsComp, PerfPlugin.STRINGS_Multiplex);
scrollTop.setContent(top);
recomputeSize();
updateLaunchConfigurationDialog();
}
use of org.eclipse.swt.custom.ScrolledComposite in project linuxtools by eclipse.
the class ValgrindOptionsTab method createControl.
@Override
public void createControl(Composite parent) {
// Check for exception
if (ex != null) {
setErrorMessage(ex.getLocalizedMessage());
}
scrollTop = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
scrollTop.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
scrollTop.setExpandVertical(true);
scrollTop.setExpandHorizontal(true);
setControl(scrollTop);
top = new Composite(scrollTop, SWT.NONE);
top.setLayout(new GridLayout());
createVerticalSpacer(top, 1);
// provide the tool combo if it is not excluded
if (!noToolCombo)
createToolCombo(top);
createVerticalSpacer(top, 1);
optionsFolder = new TabFolder(top, SWT.BORDER);
optionsFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
// "general" tab
TabItem generalTab = new TabItem(optionsFolder, SWT.NONE);
// $NON-NLS-1$
generalTab.setText(Messages.getString("ValgrindOptionsTab.General"));
Composite generalTop = new Composite(optionsFolder, SWT.NONE);
generalTop.setLayout(new GridLayout());
generalTop.setLayoutData(new GridData(GridData.FILL_BOTH));
createBasicOptions(generalTop);
createVerticalSpacer(generalTop, 1);
createErrorOptions(generalTop);
createVerticalSpacer(generalTop, 1);
createOtherOptions(generalTop);
generalTab.setControl(generalTop);
TabItem suppTab = new TabItem(optionsFolder, SWT.NONE);
// $NON-NLS-1$
suppTab.setText(Messages.getString("ValgrindOptionsTab.Suppressions"));
Composite suppTop = new Composite(optionsFolder, SWT.NONE);
suppTop.setLayout(new GridLayout());
suppTop.setLayoutData(new GridData(GridData.FILL_BOTH));
createSuppressionsOption(suppTop);
suppTab.setControl(suppTop);
toolTab = new TabItem(optionsFolder, SWT.NONE);
// $NON-NLS-1$
toolTab.setText(Messages.getString("ValgrindOptionsTab.Tool"));
dynamicTabHolder = new Composite(optionsFolder, SWT.NONE);
dynamicTabHolder.setLayout(new GridLayout());
dynamicTabHolder.setLayoutData(new GridData(GridData.FILL_BOTH));
toolTab.setControl(dynamicTabHolder);
scrollTop.setContent(top);
recomputeSize();
updateLaunchConfigurationDialog();
}
use of org.eclipse.swt.custom.ScrolledComposite in project knime-core by knime.
the class SubnodeLayoutJSONEditorPage method createBasicComposite.
private Composite createBasicComposite(final Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout(1, true));
GridData gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL);
composite.setLayoutData(gridData);
ScrolledComposite scrollPane = new ScrolledComposite(composite, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
scrollPane.setExpandHorizontal(true);
scrollPane.setExpandVertical(true);
m_basicComposite = new Composite(scrollPane, SWT.NONE);
scrollPane.setContent(m_basicComposite);
scrollPane.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
fillBasicComposite();
scrollPane.setMinSize(m_basicComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
return composite;
}
use of org.eclipse.swt.custom.ScrolledComposite in project knime-core by knime.
the class SubnodeLayoutPage method createControl.
/**
* {@inheritDoc}
*/
@Override
public void createControl(final Composite parent) {
ScrolledComposite scrollPane = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
scrollPane.setExpandHorizontal(true);
scrollPane.setExpandVertical(true);
Composite composite = new Composite(scrollPane, SWT.NONE);
scrollPane.setContent(composite);
scrollPane.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
composite.setLayout(new GridLayout(4, false));
composite.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
Label titleLabel = new Label(composite, SWT.LEFT);
FontData fontData = titleLabel.getFont().getFontData()[0];
Font boldFont = new Font(Display.getCurrent(), new FontData(fontData.getName(), fontData.getHeight(), SWT.BOLD));
titleLabel.setText("Node");
titleLabel.setFont(boldFont);
Label xLabel = new Label(composite, SWT.LEFT);
xLabel.setText("X");
xLabel.setFont(boldFont);
Label yLabel = new Label(composite, SWT.LEFT);
yLabel.setText("Y");
yLabel.setFont(boldFont);
Label paddingLabel = new Label(composite, SWT.LEFT);
paddingLabel.setText("Padding");
paddingLabel.setFont(boldFont);
for (final NodeID nodeID : m_viewNodes) {
NodeContainer nodeContainer = m_wfManager.getNodeContainer(nodeID);
WizardNodeLayoutInfo layoutInfo = null;
if (m_subNodeContainer != null && m_subNodeContainer.getLayoutInfo() != null) {
layoutInfo = m_subNodeContainer.getLayoutInfo().get(nodeID.getIndex());
if (layoutInfo != null) {
m_layoutMap.put(nodeID.getIndex(), layoutInfo);
}
}
Composite labelComposite = new Composite(composite, SWT.NONE);
labelComposite.setLayout(new GridLayout(2, false));
labelComposite.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
Label iconLabel = new Label(labelComposite, SWT.CENTER);
iconLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
try (InputStream iconURLStream = FileLocator.resolve(nodeContainer.getIcon()).openStream()) {
iconLabel.setImage(new Image(Display.getCurrent(), iconURLStream));
} catch (IOException e) {
/* do nothing */
}
Label nodeLabel = new Label(labelComposite, SWT.LEFT);
nodeLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
String nodeName = nodeContainer.getName();
String annotation = nodeContainer.getNodeAnnotation().getText();
nodeLabel.setText(nodeName + "\nID: " + nodeID.getIndex() + "\n" + annotation);
GridData gridData = new GridData(SWT.LEFT, SWT.CENTER, false, false);
gridData.widthHint = 80;
final Text xText = new Text(composite, SWT.SINGLE | SWT.BORDER);
xText.setLayoutData(gridData);
xText.setText(layoutInfo == null ? "" : layoutInfo.getX());
xText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
editX(nodeID, xText);
}
});
final Text yText = new Text(composite, SWT.SINGLE | SWT.BORDER);
yText.setLayoutData(gridData);
yText.setText(layoutInfo == null ? "" : layoutInfo.getY());
yText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
editY(nodeID, yText);
}
});
final Text paddingText = new Text(composite, SWT.SINGLE | SWT.BORDER);
paddingText.setLayoutData(gridData);
paddingText.setText(layoutInfo == null || layoutInfo.getPadding() == null ? "" : layoutInfo.getPadding());
paddingText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
editPadding(nodeID, paddingText);
}
});
}
scrollPane.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
setControl(scrollPane);
}
Aggregations