use of org.eclipse.swt.layout.RowData in project dbeaver by dbeaver.
the class DataSourceManagementToolbar method createControl.
Control createControl(Composite parent) {
workbenchWindow.addPageListener(pageListener);
IWorkbenchPage activePage = workbenchWindow.getActivePage();
if (activePage != null) {
pageListener.pageOpened(activePage);
}
// Register as datasource listener in all datasources
// We need it because at this moment there could be come already loaded registries (on startup)
DataSourceProviderRegistry.getInstance().addDataSourceRegistryListener(DataSourceManagementToolbar.this);
for (DataSourceRegistry registry : DataSourceRegistry.getAllRegistries()) {
handleRegistryLoad(registry);
}
Composite comboGroup = new Composite(parent, SWT.NONE);
RowLayout layout = new RowLayout(SWT.HORIZONTAL);
layout.marginTop = 0;
layout.marginBottom = 0;
layout.marginWidth = 5;
layout.marginHeight = 0;
comboGroup.setLayout(layout);
final int fontHeight = UIUtils.getFontHeight(parent);
int comboWidth = fontHeight * 20;
connectionCombo = new CSmartSelector<DBPDataSourceContainer>(comboGroup, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER, new ConnectionLabelProvider()) {
@Override
protected void dropDown(boolean drop) {
if (!drop) {
return;
}
showConnectionSelector();
}
};
RowData rd = new RowData();
rd.width = comboWidth;
connectionCombo.setLayoutData(rd);
connectionCombo.setVisibleItemCount(15);
connectionCombo.setWidthHint(comboWidth);
connectionCombo.setToolTipText(CoreMessages.toolbar_datasource_selector_combo_datasource_tooltip);
connectionCombo.addItem(null);
connectionCombo.select(0);
comboWidth = fontHeight * 16;
databaseCombo = new CSmartSelector<DBNDatabaseNode>(comboGroup, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER, new DatabaseLabelProvider()) {
@Override
protected void dropDown(boolean drop) {
if (!drop) {
return;
}
showDatabaseSelector();
}
};
rd = new RowData();
rd.width = comboWidth;
databaseCombo.setLayoutData(rd);
databaseCombo.setVisibleItemCount(15);
databaseCombo.setWidthHint(comboWidth);
databaseCombo.setToolTipText(CoreMessages.toolbar_datasource_selector_combo_database_tooltip);
databaseCombo.addItem(null);
databaseCombo.select(0);
resultSetSize = new Text(comboGroup, SWT.BORDER);
resultSetSize.setTextLimit(10);
rd = new RowData();
rd.width = fontHeight * 4;
resultSetSize.setLayoutData(rd);
resultSetSize.setToolTipText(CoreMessages.toolbar_datasource_selector_resultset_segment_size);
final DBPDataSourceContainer dataSourceContainer = getDataSourceContainer();
if (dataSourceContainer != null) {
resultSetSize.setText(String.valueOf(dataSourceContainer.getPreferenceStore().getInt(DBeaverPreferences.RESULT_SET_MAX_ROWS)));
}
// resultSetSize.setDigits(7);
resultSetSize.addVerifyListener(UIUtils.getIntegerVerifyListener(Locale.getDefault()));
resultSetSize.addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
}
@Override
public void focusLost(FocusEvent e) {
changeResultSetSize();
}
});
comboGroup.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
DataSourceManagementToolbar.this.dispose();
}
});
DBeaverUI.asyncExec(new Runnable() {
@Override
public void run() {
if (workbenchWindow != null && workbenchWindow.getActivePage() != null) {
setActivePart(workbenchWindow.getActivePage().getActivePart());
}
}
});
return comboGroup;
}
use of org.eclipse.swt.layout.RowData in project erlide_eclipse by erlang.
the class TreeViewerView method createButtonsPanel.
private void createButtonsPanel(final Composite parent) {
buttonsPanel = new Composite(parent, SWT.NONE);
buttonsPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
buttonsPanel.setLayout(new RowLayout());
// "Previous" button
previousButton = new Button(buttonsPanel, SWT.PUSH | SWT.CENTER);
previousButton.setToolTipText("Show previous trace set");
previousButton.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_BACK));
previousButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
task = new RunnableWithProgress("Loading trace results...") {
@Override
public void doAction() {
final int limit = Activator.getDefault().getPreferenceStore().getInt(PreferenceNames.TRACES_LOAD_LIMIT);
final long startIndex = Math.max(1L, index - limit);
final long endIndex = startIndex + limit - 1;
TraceBackend.getInstance().loadDataFromFile(startIndex, endIndex);
}
};
executeTask();
}
});
// "Next" button
nextButton = new Button(buttonsPanel, SWT.PUSH | SWT.CENTER);
nextButton.setToolTipText("Show next trace set");
nextButton.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_FORWARD));
nextButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
task = new RunnableWithProgress("Loading trace results...") {
@Override
public void doAction() {
final int limit = Activator.getDefault().getPreferenceStore().getInt(PreferenceNames.TRACES_LOAD_LIMIT);
final long endIndex = Math.min(index + limit * 2 - 1, TraceBackend.getInstance().getActiveResultSet().getSize());
final long startIndex = endIndex - limit + 1;
TraceBackend.getInstance().loadDataFromFile(startIndex, endIndex);
}
};
executeTask();
}
});
// "Show" button
showButton = new Button(buttonsPanel, SWT.PUSH | SWT.CENTER);
showButton.setToolTipText("Show selected trace set");
showButton.setImage(DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_LAUNCH_RUN));
showButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
doSelection();
}
});
// Text field
traceIndexField = new Text(buttonsPanel, SWT.SINGLE | SWT.BORDER);
traceIndexField.setToolTipText("Select index of first trace event to display");
traceIndexField.setLayoutData(new RowData(60, SWT.DEFAULT));
traceIndexField.addListener(SWT.Modify, new Listener() {
@Override
public void handleEvent(final Event event) {
try {
correctInput = false;
final Long value = new Long(traceIndexField.getText());
if (value >= 1 && value <= TraceBackend.getInstance().getActiveResultSet().getSize()) {
index = value;
showButton.setEnabled(nextButton.isEnabled() || previousButton.isEnabled());
correctInput = true;
} else {
showButton.setEnabled(false);
}
} catch (final Exception e) {
showButton.setEnabled(false);
}
}
});
traceIndexField.addKeyListener(new KeyListener() {
@Override
public void keyReleased(final KeyEvent e) {
if (e.keyCode == SWT.CR && correctInput) {
doSelection();
}
}
@Override
public void keyPressed(final KeyEvent e) {
}
});
// label
label = new Label(buttonsPanel, SWT.NONE);
label.setLayoutData(new RowData(200, SWT.DEFAULT));
updateButtonsPanel();
}
use of org.eclipse.swt.layout.RowData in project BiglyBT by BiglySoftware.
the class SBC_SearchResultsView method skinObjectInitialShow.
public Object skinObjectInitialShow(SWTSkinObject skinObject, Object params) {
image_loader = new ImageLoader(null, null);
CoreFactory.addCoreRunningListener(new CoreRunningListener() {
@Override
public void coreRunning(Core core) {
initColumns(core);
}
});
SWTSkinObjectTextbox soFilterBox = (SWTSkinObjectTextbox) getSkinObject("filterbox");
if (soFilterBox != null) {
txtFilter = soFilterBox.getTextControl();
}
if (vitality_images == null) {
ImageLoader loader = ImageLoader.getInstance();
vitality_images = loader.getImages("image.sidebar.vitality.dots");
ok_image = loader.getImage("tick_mark");
fail_image = loader.getImage("progress_cancel");
auth_image = loader.getImage("image.sidebar.vitality.auth");
}
final SWTSkinObject soFilterArea = getSkinObject("filterarea");
if (soFilterArea != null) {
SWTSkinObjectToggle soFilterButton = (SWTSkinObjectToggle) getSkinObject("filter-button");
if (soFilterButton != null) {
boolean toggled = COConfigurationManager.getBooleanParameter("Search View Filter Options Expanded", false);
if (toggled) {
soFilterButton.setToggled(true);
soFilterArea.setVisible(true);
}
soFilterButton.addSelectionListener(new SWTSkinToggleListener() {
@Override
public void toggleChanged(SWTSkinObjectToggle so, boolean toggled) {
COConfigurationManager.setParameter("Search View Filter Options Expanded", toggled);
soFilterArea.setVisible(toggled);
Utils.relayout(soFilterArea.getControl().getParent());
}
});
}
Composite parent = (Composite) soFilterArea.getControl();
Composite filter_area = new Composite(parent, SWT.NONE);
FormData fd = Utils.getFilledFormData();
filter_area.setLayoutData(fd);
GridLayout layout = new GridLayout();
layout.marginBottom = layout.marginTop = layout.marginLeft = layout.marginRight = 0;
filter_area.setLayout(layout);
Label label;
int sepHeight = 20;
Composite cRow = new Composite(filter_area, SWT.NONE);
cRow.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
RowLayout rowLayout = new RowLayout(SWT.HORIZONTAL);
rowLayout.spacing = 5;
rowLayout.marginBottom = rowLayout.marginTop = rowLayout.marginLeft = rowLayout.marginRight = 0;
rowLayout.center = true;
cRow.setLayout(rowLayout);
// with/without keywords
ImageLoader imageLoader = ImageLoader.getInstance();
for (int i = 0; i < 2; i++) {
final boolean with = i == 0;
if (!with) {
label = new Label(cRow, SWT.VERTICAL | SWT.SEPARATOR);
label.setLayoutData(new RowData(-1, sepHeight));
}
Composite cWithKW = new Composite(cRow, SWT.NONE);
layout = new GridLayout(2, false);
layout.marginWidth = 0;
layout.marginBottom = layout.marginTop = layout.marginLeft = layout.marginRight = 0;
cWithKW.setLayout(layout);
// Label lblWithKW = new Label(cWithKW, SWT.NONE);
// lblWithKW.setText(MessageText.getString(with?"SubscriptionResults.filter.with.words":"SubscriptionResults.filter.without.words"));
Label lblWithKWImg = new Label(cWithKW, SWT.NONE);
lblWithKWImg.setImage(imageLoader.getImage(with ? "icon_filter_plus" : "icon_filter_minus"));
final Text textWidget = new Text(cWithKW, SWT.BORDER);
if (with) {
textWithKW = textWidget;
} else {
textWithoutKW = textWidget;
}
textWidget.setMessage(MessageText.getString(with ? "SubscriptionResults.filter.with.words" : "SubscriptionResults.filter.without.words"));
GridData gd = new GridData();
gd.widthHint = Utils.adjustPXForDPI(100);
textWidget.setLayoutData(gd);
textWidget.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
String text = textWidget.getText().toLowerCase(Locale.US);
String[] bits = text.split("\\s+");
Set<String> temp = new HashSet<>();
for (String bit : bits) {
bit = bit.trim();
if (bit.length() > 0) {
temp.add(bit);
}
}
String[] words = temp.toArray(new String[temp.size()]);
synchronized (filter_lock) {
if (with) {
with_keywords = words;
} else {
without_keywords = words;
}
}
refilter_dispatcher.dispatch();
}
});
}
// min size
label = new Label(cRow, SWT.VERTICAL | SWT.SEPARATOR);
label.setLayoutData(new RowData(-1, sepHeight));
Composite cMinSize = new Composite(cRow, SWT.NONE);
layout = new GridLayout(2, false);
layout.marginWidth = 0;
layout.marginBottom = layout.marginTop = layout.marginLeft = layout.marginRight = 0;
cMinSize.setLayout(layout);
Label lblMinSize = new Label(cMinSize, SWT.NONE);
lblMinSize.setText(MessageText.getString("SubscriptionResults.filter.min_size"));
spinMinSize = new Spinner(cMinSize, SWT.BORDER);
spinMinSize.setMinimum(0);
// 100 TB should do...
spinMinSize.setMaximum(100 * 1024 * 1024);
spinMinSize.setSelection(minSize);
spinMinSize.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
minSize = ((Spinner) event.widget).getSelection();
refilter();
}
});
// max size
label = new Label(cRow, SWT.VERTICAL | SWT.SEPARATOR);
label.setLayoutData(new RowData(-1, sepHeight));
Composite cMaxSize = new Composite(cRow, SWT.NONE);
layout = new GridLayout(2, false);
layout.marginWidth = 0;
layout.marginBottom = layout.marginTop = layout.marginLeft = layout.marginRight = 0;
cMaxSize.setLayout(layout);
Label lblMaxSize = new Label(cMaxSize, SWT.NONE);
lblMaxSize.setText(MessageText.getString("SubscriptionResults.filter.max_size"));
spinMaxSize = new Spinner(cMaxSize, SWT.BORDER);
spinMaxSize.setMinimum(0);
// 100 TB should do...
spinMaxSize.setMaximum(100 * 1024 * 1024);
spinMaxSize.setSelection(maxSize);
spinMaxSize.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
maxSize = ((Spinner) event.widget).getSelection();
refilter();
}
});
engine_area = new Composite(filter_area, SWT.NONE);
engine_area.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
buildEngineArea(null);
parent.layout(true);
}
return null;
}
use of org.eclipse.swt.layout.RowData in project mdw-designer by CenturyLinkCloud.
the class ListComposer method createControls.
protected void createControls() {
int buttonWidth = 30;
// create the listener for the bunch of buttons
SelectionListener buttonListener = new ButtonListener();
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = isReadOnly() ? 2 : 3;
gridLayout.marginWidth = 0;
gridLayout.marginTop = 0;
this.setLayout(gridLayout);
GridData gd = new GridData();
gd.horizontalSpan = 2;
if (!isReadOnly()) {
Label srcLabelWidget = new Label(this, SWT.LEFT);
srcLabelWidget.setLayoutData(gd);
if (unselectedTitle != null)
srcLabelWidget.setText(unselectedTitle);
else
srcLabelWidget.setText(isReadOnly() ? "" : "Unselected " + title);
gd = new GridData();
Label destLabelWidget = new Label(this, SWT.LEFT);
destLabelWidget.setLayoutData(gd);
if (selectedTitle != null)
destLabelWidget.setText(selectedTitle);
else
destLabelWidget.setText("Selected " + title);
}
gd = new GridData(SWT.LEFT | GridData.FILL_BOTH);
gd.widthHint = getWidth();
srcViewer = new ListViewer(this);
srcViewer.getList().setLayoutData(gd);
srcViewer.setContentProvider(new IStructuredContentProvider() {
@SuppressWarnings("unchecked")
public Object[] getElements(Object inputElement) {
return ((List<String>) inputElement).toArray();
}
public void dispose() {
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
});
srcViewer.addFilter(new Filter());
if (!isReadOnly()) {
Composite buttons = new Composite(this, SWT.NULL);
buttons.setLayout(new RowLayout(SWT.VERTICAL));
addButton = new Button(buttons, SWT.PUSH);
addButton.setText(">");
Point size = addButton.computeSize(SWT.DEFAULT, SWT.DEFAULT);
RowData rd = new RowData(buttonWidth, size.y);
addButton.setLayoutData(rd);
addButton.addSelectionListener(buttonListener);
remButton = new Button(buttons, SWT.PUSH);
remButton.setText("<");
size = remButton.computeSize(SWT.DEFAULT, SWT.DEFAULT);
rd = new RowData(buttonWidth, size.y);
remButton.setLayoutData(rd);
remButton.addSelectionListener(buttonListener);
gd = new GridData(SWT.LEFT | GridData.FILL_BOTH);
gd.widthHint = getWidth();
destViewer = new ListViewer(this);
destViewer.getList().setLayoutData(gd);
}
}
use of org.eclipse.swt.layout.RowData in project netxms by netxms.
the class CustomSchedule method createContents.
/* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createContents(Composite parent) {
Composite dialogArea = (Composite) super.createContents(parent);
dci = editor.getObject();
GridLayout layout = new GridLayout();
layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
layout.marginWidth = 0;
layout.marginHeight = 0;
dialogArea.setLayout(layout);
final String[] columnNames = { Messages.get().CustomSchedule_Schedule };
final int[] columnWidths = { 300 };
viewer = new SortableTableViewer(dialogArea, columnNames, columnWidths, 0, SWT.UP, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
viewer.setContentProvider(new ArrayContentProvider());
viewer.setComparator(new StringComparator());
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
if (selection != null) {
editButton.setEnabled(selection.size() == 1);
deleteButton.setEnabled(selection.size() > 0);
}
}
});
schedules = new HashSet<String>();
schedules.addAll(dci.getSchedules());
viewer.setInput(schedules.toArray());
GridData gridData = new GridData();
gridData.verticalAlignment = GridData.FILL;
gridData.grabExcessVerticalSpace = true;
gridData.horizontalAlignment = GridData.FILL;
gridData.grabExcessHorizontalSpace = true;
gridData.heightHint = 0;
viewer.getControl().setLayoutData(gridData);
Composite buttons = new Composite(dialogArea, SWT.NONE);
RowLayout buttonLayout = new RowLayout();
buttonLayout.type = SWT.HORIZONTAL;
buttonLayout.marginBottom = 0;
buttonLayout.marginTop = 0;
buttonLayout.marginLeft = 0;
buttonLayout.marginRight = 0;
buttonLayout.spacing = WidgetHelper.OUTER_SPACING;
buttonLayout.fill = true;
buttonLayout.pack = false;
buttons.setLayout(buttonLayout);
gridData = new GridData();
gridData.horizontalAlignment = SWT.RIGHT;
buttons.setLayoutData(gridData);
addButton = new Button(buttons, SWT.PUSH);
addButton.setText(Messages.get().CustomSchedule_Add);
RowData rd = new RowData();
rd.width = WidgetHelper.BUTTON_WIDTH_HINT;
addButton.setLayoutData(rd);
addButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
addSchedule();
}
});
editButton = new Button(buttons, SWT.PUSH);
editButton.setText(Messages.get().CustomSchedule_Edit);
rd = new RowData();
rd.width = WidgetHelper.BUTTON_WIDTH_HINT;
editButton.setLayoutData(rd);
editButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
editSchedule();
}
});
deleteButton = new Button(buttons, SWT.PUSH);
deleteButton.setText(Messages.get().CustomSchedule_Delete);
rd = new RowData();
rd.width = WidgetHelper.BUTTON_WIDTH_HINT;
deleteButton.setLayoutData(rd);
deleteButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
deleteSchedules();
}
});
viewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
editButton.notifyListeners(SWT.Selection, new Event());
}
});
return dialogArea;
}
Aggregations