use of org.eclipse.swt.widgets.ToolItem in project azure-tools-for-java by Microsoft.
the class DropDownHandler method pullDropdown.
public void pullDropdown(Event event) {
Widget widget = event.widget;
if (widget instanceof ToolItem) {
ToolItem toolItem = (ToolItem) widget;
Listener[] listeners = toolItem.getListeners(SWT.Selection);
if (listeners.length > 0) {
Listener listener = listeners[0];
Event eve = new Event();
eve.type = SWT.Selection;
eve.widget = toolItem;
eve.detail = SWT.DROP_DOWN;
eve.x = toolItem.getBounds().x;
eve.y = toolItem.getBounds().height;
listener.handleEvent(eve);
}
}
}
use of org.eclipse.swt.widgets.ToolItem in project tdi-studio-se by Talend.
the class DataMapTableView method createComponents.
private void createComponents() {
final Display display = this.getDisplay();
if (WindowSystem.isGTK()) {
Color systemColor = display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
setBackground(new Color(display, systemColor.getRed(), systemColor.getGreen(), systemColor.getBlue()));
setBackgroundMode(SWT.INHERIT_NONE);
} else {
Color listBackground = display.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW);
this.setBackground(listBackground);
}
GridLayout mainLayout = new GridLayout();
int marginMainLayout = 0;
mainLayout.marginLeft = marginMainLayout;
mainLayout.marginRight = marginMainLayout;
mainLayout.marginTop = marginMainLayout;
mainLayout.marginBottom = marginMainLayout;
mainLayout.marginWidth = marginMainLayout;
mainLayout.marginHeight = marginMainLayout;
int spacingMainLayout = 2;
mainLayout.horizontalSpacing = spacingMainLayout;
mainLayout.verticalSpacing = spacingMainLayout;
setLayout(mainLayout);
headerComposite = new Composite(this, SWT.NONE);
GridData headerGridData = new GridData(GridData.FILL_HORIZONTAL);
headerGridData.heightHint = getHeaderHeight();
headerComposite.setLayoutData(headerGridData);
GridLayout headerLayout = new GridLayout();
int margin = 0;
headerLayout.marginLeft = 3;
headerLayout.marginRight = margin;
headerLayout.marginTop = margin;
headerLayout.marginBottom = margin;
headerLayout.marginWidth = margin;
headerLayout.marginHeight = margin;
int spacing = 2;
headerLayout.horizontalSpacing = spacing;
headerLayout.verticalSpacing = spacing;
headerComposite.setLayout(headerLayout);
nameLabel = new Label(headerComposite, SWT.NONE);
nameLabel.setFont(FontProviderMapper.getFont(FontInfo.FONT_SYSTEM_BOLD));
nameLabel.setText(getTitle());
nameLabel.setToolTipText(getTitle());
nameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.GRAB_HORIZONTAL));
int rightStyle = toolbarNeedToHaveRightStyle() ? SWT.RIGHT : SWT.NONE;
toolBarActions = new ToolBar(headerComposite, SWT.FLAT | rightStyle);
toolBarActions.setFont(FontProviderMapper.getFont(FontInfo.FONT_SYSTEM));
if (addToolItems()) {
addToolItemSeparator();
}
minimizeButton = new ToolItem(toolBarActions, SWT.PUSH);
realToolbarSize.x += 45;
Point sizeToolBar = toolBarActions.computeSize(SWT.DEFAULT, SWT.DEFAULT);
GridData gridDataToolbar = new GridData();
if (toolbarNeedToHaveRightStyle() && WindowSystem.isWIN32()) {
if (realToolbarSize != null) {
gridDataToolbar.widthHint = realToolbarSize.x;
}
}
if (WindowSystem.isGTK()) {
gridDataToolbar.heightHint = 26;
} else {
// gridDataToolbar.heightHint = 30; // Win32
}
if (WindowSystem.isGTK()) {
toolBarActions.setLayoutData(gridDataToolbar);
} else {
toolBarActions.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL));
}
headerLayout.numColumns = headerComposite.getChildren().length;
centerComposite = new Composite(this, SWT.NONE);
GridData centerData = new GridData(GridData.FILL_BOTH);
centerComposite.setLayoutData(centerData);
GridLayout centerLayout = new GridLayout();
int marginCenterLayout = 0;
centerLayout.marginLeft = marginCenterLayout;
centerLayout.marginRight = marginCenterLayout;
centerLayout.marginTop = marginCenterLayout;
centerLayout.marginBottom = marginCenterLayout;
centerLayout.marginWidth = marginCenterLayout;
centerLayout.marginHeight = marginCenterLayout;
int spacingCenterLayout = 2;
centerLayout.horizontalSpacing = spacingCenterLayout;
centerLayout.verticalSpacing = spacingCenterLayout;
centerComposite.setLayout(centerLayout);
initTableFilters(centerComposite);
createTableForColumns(centerComposite);
new DragNDrop(mapperManager, tableForEntries, true, true);
Composite footerComposite = new Composite(this, SWT.NONE);
GridData footerGridData = new GridData(10, 2);
footerComposite.setLayoutData(footerGridData);
headerComposite.moveAbove(nameLabel);
if (WindowSystem.isGTK()) {
sizeToolBar = toolBarActions.computeSize(SWT.DEFAULT, SWT.DEFAULT);
gridDataToolbar.widthHint = sizeToolBar.x + 20;
headerComposite.layout();
}
}
use of org.eclipse.swt.widgets.ToolItem in project tdi-studio-se by Talend.
the class DataMapTableView method createFiltersToolItems.
protected void createFiltersToolItems() {
ToolItem addFilterButton = new ToolItem(toolBarActions, SWT.PUSH);
//$NON-NLS-1$
addFilterButton.setToolTipText(Messages.getString("DataMapTableView.buttonTooltip.addFilterRow"));
addFilterButton.setImage(ImageProviderMapper.getImage(ImageInfo.ADD_FILTER_ICON));
// /////////////////////////////////////////////////////////////////
if (addFilterButton != null) {
addFilterButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
@Override
public void widgetSelected(SelectionEvent e) {
onFiltersToolItemsSelected(e, getTableViewerCreatorForWhereFilters(), FilterTableEntry.WHERE_FILTER);
}
});
}
}
use of org.eclipse.swt.widgets.ToolItem in project tdi-studio-se by Talend.
the class InputDataMapTableView method addToolItems.
/*
* (non-Javadoc)
*
* @see org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView#addEntriesActionsComponents()
*/
@Override
protected boolean addToolItems() {
// DROP DOWN
dropDownItem = new ToolItem(toolBarActions, SWT.DROP_DOWN | SWT.BORDER);
if (WindowSystem.isGTK()) {
refreshLabelForJoinDropDown();
}
dropDownItem.addSelectionListener(new DropDownSelectionListener());
return true;
}
use of org.eclipse.swt.widgets.ToolItem in project tdi-studio-se by Talend.
the class MultiSchemasUI method createMenuBar.
private void createMenuBar(final ToolBar menuBar) {
ToolItem pullDownButton = new ToolItem(menuBar, SWT.PUSH);
// Image hoverImage = WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_LCL_RENDERED_VIEW_MENU);
//$NON-NLS-1$
Image hoverImage = PlatformUI.getWorkbench().getSharedImages().getImage("IMG_LCL_RENDERED_VIEW_MENU");
pullDownButton.setDisabledImage(hoverImage);
pullDownButton.setImage(hoverImage);
pullDownButton.setToolTipText("Menu");
pullDownButton.setWidth(5);
//$NON-NLS-1$
MenuManager menuManager = new MenuManager("MultiSchema");
columnAction = new SchameDetailsColumnAction(schemaDetailsViewer);
columnAction.setChecked(!ExternalMultiSchemasUIProperties.isSchemaDetailsModel());
menuManager.add(columnAction);
propertyAction = new SchameDetailsPropertyAction(schemaDetailsViewer);
propertyAction.setChecked(ExternalMultiSchemasUIProperties.isSchemaDetailsModel());
menuManager.add(propertyAction);
final Menu aMenu = menuManager.createContextMenu(menuBar.getParent());
pullDownButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Point toolbarSize = menuBar.getSize();
toolbarSize = menuBar.toDisplay(0, toolbarSize.y);
aMenu.setLocation(toolbarSize);
aMenu.setVisible(true);
}
});
}
Aggregations