Search in sources :

Example 1 with ToolTip

use of org.eclipse.swt.widgets.ToolTip in project tesb-studio-se by Talend.

the class RESTRequestReconnectionValidation method canConnectToSource.

@Override
public boolean canConnectToSource(INode oldSource, INode newSource, INode target, EConnectionType lineStyle, String connectorName, String connectionName) {
    if (oldSource != null && newSource != null && (T_REST_REQUEST.equals(newSource.getComponent().getName()) || T_REST_REQUEST.equals(oldSource.getComponent().getName()))) {
        ToolTip tooltip = new ToolTip(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.ICON_WARNING);
        tooltip.setText(Messages.RESTRequestReconnectionValidation_WarningMsg);
        // tooltip.setMessage("It's not allowed to reconnect to or from a tRESTRequest component");
        tooltip.setAutoHide(true);
        tooltip.setVisible(true);
        return false;
    }
    return true;
}
Also used : ToolTip(org.eclipse.swt.widgets.ToolTip)

Example 2 with ToolTip

use of org.eclipse.swt.widgets.ToolTip in project cubrid-manager by CUBRID.

the class EditVirtualTableDialog method createDialogArea.

/**
	 * Create the dialog area
	 *
	 * @param parent The parent composite to contain the dialog area
	 * @return the dialog area control
	 */
protected Control createDialogArea(Composite parent) {
    Composite parentComp = (Composite) super.createDialogArea(parent);
    Composite composite = new Composite(parentComp, SWT.NONE);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.heightHint = 400;
    gd.widthHint = 710;
    composite.setLayoutData(gd);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    composite.setLayout(layout);
    tabFolder = new TabFolder(composite, SWT.NONE);
    {
        final GridData tgd = new GridData(SWT.FILL, SWT.FILL, true, true);
        tgd.heightHint = 469;
        tgd.widthHint = 621;
        tabFolder.setLayoutData(tgd);
    }
    collationList = erSchema.getCollections();
    createGeneralTabItem(tabFolder);
    createFkIndexTabItem(tabFolder);
    toolTip = new ToolTip(columnsTable.getShell(), SWT.NONE);
    toolTip.setAutoHide(true);
    errorBaloon = new ToolTip(tabFolder.getShell(), SWT.NONE);
    errorBaloon.setAutoHide(true);
    init();
    if (isNewTableFlag) {
        tableNameText.setFocus();
    }
    addNewColumn();
    if (showDefaultType == EditTableAction.MODE_INDEX_EDIT || showDefaultType == EditTableAction.MODE_FK_EDIT) {
        tabFolder.setSelection(1);
    }
    return composite;
}
Also used : ToolTip(org.eclipse.swt.widgets.ToolTip) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) TabFolder(org.eclipse.swt.widgets.TabFolder)

Example 3 with ToolTip

use of org.eclipse.swt.widgets.ToolTip in project cubrid-manager by CUBRID.

the class TuneModeResultComposite method showToolTip.

public void showToolTip(Control control, String title, String message) {
    if (tooltip == null) {
        tooltip = new ToolTip(container.getShell(), SWT.None);
        tooltip.setAutoHide(true);
    }
    Point pt = control.toDisplay(container.getLocation());
    pt.x += 10;
    pt.y -= 5;
    tooltip.setText(title);
    tooltip.setMessage(message);
    tooltip.setLocation(pt);
    tooltip.setVisible(true);
}
Also used : ToolTip(org.eclipse.swt.widgets.ToolTip) Point(org.eclipse.swt.graphics.Point)

Example 4 with ToolTip

use of org.eclipse.swt.widgets.ToolTip in project cubrid-manager by CUBRID.

the class CubridNavigatorView method createPartControl.

/**
	 * Create the part control
	 *
	 * @param parent Composite
	 */
public void createPartControl(Composite parent) {
    ViewForm viewForm = new ViewForm(parent, SWT.NONE);
    viewForm.setLayout(new GridLayout());
    tv = new TreeViewer(viewForm, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    tv.setFilters(NodeFilterManager.getInstance().getViewerFilter());
    //create the navigator
    createNavigator();
    //get the isShowGroup configuration
    isShowGroup = savedIsShowGroup();
    //set the tree view's input.
    setTreeInput();
    toolTip = new ToolTip(tv.getTree().getShell(), SWT.BALLOON);
    toolTip.setAutoHide(true);
    //Create the context menu
    MenuManager contextMenuManager = new MenuManager("#PopupMenu", "navigatorContextMenu");
    contextMenuManager.setRemoveAllWhenShown(true);
    contextMenuManager.addMenuListener(new IMenuListener() {

        public void menuAboutToShow(IMenuManager manager) {
            buildPopupMenu(manager);
        }
    });
    Menu contextMenu = contextMenuManager.createContextMenu(tv.getControl());
    tv.getControl().setMenu(contextMenu);
    // register the context menu for providing extension by extension point
    IWorkbenchPartSite site = getSite();
    site.registerContextMenu(contextMenuManager, tv);
    site.setSelectionProvider(tv);
    //add the select the object text composite to top left of toolbar
    ToolBar toolBar = new ToolBar(viewForm, SWT.FLAT);
    ToolBarManager toolBarManager = new ToolBarManager(toolBar);
    SelectTreeObjContrItem textContrItem = new SelectTreeObjContrItem(tv);
    toolBarManager.add(textContrItem);
    toolBarManager.update(true);
    viewForm.setContent(tv.getControl());
    viewForm.setTopLeft(toolBar);
    //add the other actions to the top right of toolbar
    toolBar = new ToolBar(viewForm, SWT.FLAT | SWT.CENTER);
    toolBarManager = new ToolBarManager(toolBar);
    buildToolBar(toolBarManager);
    toolBarManager.update(true);
    viewForm.setTopRight(toolBar);
    //Add the actions to view menu bar, you can add them by extension point or code define
    IActionBars actionBar = getViewSite().getActionBars();
    final IMenuManager menuManager = actionBar.getMenuManager();
    menuManager.addMenuListener(new IMenuListener2() {

        //reserve these actions by code define,these codes rebuild every time.
        //hence when hide, remove them not including these actions by extension point
        private IMenuManager lastMenuManager = new MenuManager();

        public void menuAboutToShow(IMenuManager manager) {
            lastMenuManager.removeAll();
            //build the code defined actions
            buildViewMenu(lastMenuManager);
            for (IContributionItem item : lastMenuManager.getItems()) {
                manager.add(item);
            }
        }

        public void menuAboutToHide(IMenuManager manager) {
            for (IContributionItem item : lastMenuManager.getItems()) {
                manager.remove(item);
            }
        }
    });
    menuManager.add(new Separator());
    activeContext();
    addListener();
    setFocus();
}
Also used : ToolTip(org.eclipse.swt.widgets.ToolTip) TreeViewer(org.eclipse.jface.viewers.TreeViewer) IContributionItem(org.eclipse.jface.action.IContributionItem) IMenuListener(org.eclipse.jface.action.IMenuListener) IToolBarManager(org.eclipse.jface.action.IToolBarManager) ToolBarManager(org.eclipse.jface.action.ToolBarManager) IWorkbenchPartSite(org.eclipse.ui.IWorkbenchPartSite) ViewForm(org.eclipse.swt.custom.ViewForm) GridLayout(org.eclipse.swt.layout.GridLayout) IMenuListener2(org.eclipse.jface.action.IMenuListener2) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) ToolBar(org.eclipse.swt.widgets.ToolBar) IMenuManager(org.eclipse.jface.action.IMenuManager) Menu(org.eclipse.swt.widgets.Menu) IActionBars(org.eclipse.ui.IActionBars) Separator(org.eclipse.jface.action.Separator)

Example 5 with ToolTip

use of org.eclipse.swt.widgets.ToolTip in project cubrid-manager by CUBRID.

the class QueryEditorPart method showToolTip.

public void showToolTip(Control baseControl, ToolItem toolItem, String title, String message, int timeoutSec) {
    if (tooltip == null) {
        tooltip = new ToolTip(Display.getCurrent().getActiveShell(), SWT.None);
        tooltip.setAutoHide(true);
    } else {
        tooltip.setVisible(false);
    }
    Point pt = baseControl.toDisplay(topComposite.getLocation());
    pt.x += toolItem.getBounds().x;
    pt.y += toolItem.getBounds().height;
    tooltip.setText(title);
    tooltip.setMessage(message);
    tooltip.setLocation(pt);
    tooltip.setVisible(true);
    if (timeoutSec > 0) {
        final Long eventTime = new Long(System.currentTimeMillis());
        tooltip.setData(eventTime);
        tooltip.getDisplay().timerExec(timeoutSec * 1000, new Runnable() {

            public void run() {
                if (tooltip != null && tooltip.getData() instanceof Long) {
                    Long eventTimeTmp = (Long) tooltip.getData();
                    if (eventTimeTmp.longValue() == eventTime.longValue()) {
                        tooltip.setVisible(false);
                    }
                }
            }
        });
    }
}
Also used : ToolTip(org.eclipse.swt.widgets.ToolTip) Point(org.eclipse.swt.graphics.Point)

Aggregations

ToolTip (org.eclipse.swt.widgets.ToolTip)6 GridLayout (org.eclipse.swt.layout.GridLayout)3 Point (org.eclipse.swt.graphics.Point)2 GridData (org.eclipse.swt.layout.GridData)2 Composite (org.eclipse.swt.widgets.Composite)2 TabFolder (org.eclipse.swt.widgets.TabFolder)2 TableEditorAdaptor (com.cubrid.common.ui.cubrid.table.TableEditorAdaptor)1 IContributionItem (org.eclipse.jface.action.IContributionItem)1 IMenuListener (org.eclipse.jface.action.IMenuListener)1 IMenuListener2 (org.eclipse.jface.action.IMenuListener2)1 IMenuManager (org.eclipse.jface.action.IMenuManager)1 IToolBarManager (org.eclipse.jface.action.IToolBarManager)1 MenuManager (org.eclipse.jface.action.MenuManager)1 Separator (org.eclipse.jface.action.Separator)1 ToolBarManager (org.eclipse.jface.action.ToolBarManager)1 TreeViewer (org.eclipse.jface.viewers.TreeViewer)1 ViewForm (org.eclipse.swt.custom.ViewForm)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Button (org.eclipse.swt.widgets.Button)1