当前位置: 首页>>代码示例>>Java>>正文


Java SWT.POP_UP属性代码示例

本文整理汇总了Java中org.eclipse.swt.SWT.POP_UP属性的典型用法代码示例。如果您正苦于以下问题:Java SWT.POP_UP属性的具体用法?Java SWT.POP_UP怎么用?Java SWT.POP_UP使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.swt.SWT的用法示例。


在下文中一共展示了SWT.POP_UP属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createWildCardMenu

/**
 * Apply a wildcard popup menu to the text. Wildcards a displayed as "[TEXT]" and represent replaceable parameters.
 *
 * @param text      The control to append the menu
 * @param wildcards The wildcards to add to the menu
 * @param labels    The labels for the menuitems
 */
private static void createWildCardMenu(final Text text, String[] wildcards, String[] labels) {

    /* Both arrays need to have the same size */
    if (wildcards.length != labels.length)
        return;

    Menu wildCardMenu = new Menu(text);

    /* Foreach wildcards */
    for (int a = 0; a < wildcards.length; a++) {
        final String wildcard = wildcards[a];
        MenuItem menuItem = new MenuItem(wildCardMenu, SWT.POP_UP);
        menuItem.setText(labels[a]);
        if (!GUI.isMac())
            //	menuItem.setImage(PaintShop.iconBackward);
            menuItem.addSelectionListener(new SelectionAdapter() {
                public void widgetSelected(SelectionEvent e) {
                    text.insert(wildcard);
                }
            });
    }
    text.setMenu(wildCardMenu);
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:30,代码来源:WidgetShop.java

示例2: initTray

private void initTray() {
    tray = display.getSystemTray();
    if (tray != null) {
        TrayItem trayItem = new TrayItem(tray, SWT.NONE);
        trayItem.setImage(ImageUtils.getImage(Images.UNBLOCKED));
        trayItem.setToolTipText(APP_NAME);
        final Menu trayMenu = new Menu(getShell(), SWT.POP_UP);
        MenuItem trayMenuItem = new MenuItem(trayMenu, SWT.PUSH);
        trayMenuItem.setText(resourceBundle.getString("exit"));
        trayMenuItem.addListener(SWT.Selection, event -> {
            if (settings.isConfirmExit()) {
                getShell().forceActive();
            }
            getShell().close();
        });
        trayItem.addListener(SWT.MenuDetect, event -> trayMenu.setVisible(true));

        ToolTip tip = new ToolTip(getShell(), SWT.BALLOON | SWT.ICON_WARNING);
        tip.setText(APP_NAME);
        tip.setAutoHide(true);
        tip.setVisible(false);
        trayItem.setToolTip(tip);
    }
}
 
开发者ID:technology16,项目名称:pgsqlblocks,代码行数:24,代码来源:ApplicationView.java

示例3: openPopupMenu

protected void openPopupMenu(NodeType[] availableTypes, final AvroNode targetNode, final AvroContext context) {
	
	Shell shell = Display.getCurrent().getActiveShell();
	final Menu menu = new Menu(shell, SWT.POP_UP);
	for (NodeType availableType : availableTypes) {
		final NodeType type = availableType;
		MenuItem item = new MenuItem(menu, SWT.PUSH);
		item.setText(type.getDisplayLabel());
		item.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event e) {
				menu.dispose();
				IEditCommand cmd = context.getService(IEditCommandFactory.class)
						.createAddElementCommand(targetNode, type, getNotifications());
				context.getService(ICommandExecutor.class).execute(cmd);
			}
		});
	}
       
	Point location = MouseInfo.getPointerInfo().getLocation();
	int x = location.x;
	int y = location.y;
       menu.setLocation(x, y);
       menu.setVisible(true);
       
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:25,代码来源:AddElementAction.java

示例4: newMItem

private MenuItem newMItem(Menu parent, Command cmd, int style) {
    MenuItem item = installSystemMenu(cmd);
    if (item != null)
        return item; // is a special Mac OS menu

    item = new MenuItem(parent, style);
    item.setData(cmd);
    char equivalent = cmd.getKeyEquiv();
    String name = cmd.getMenuName();

    if (equivalent != 0 && style != SWT.POP_UP) {
        if (!Application.isMac()) {
            item.setAccelerator(SWT.CTRL + equivalent);
            name += " \tCtrl+" + equivalent;
        } else {
            item.setAccelerator(SWT.COMMAND + equivalent);
        }
        // updateAccelerator(item, name, equivalent, false);
        item.setText(name);
    } else {
        item.setText(name);
    }

    item.addSelectionListener(this);
    if (!isMac && cmd.getImage() != null) {
        Image img = PaintShop.getImage(cmd.getImage());
        if (img != null)
            item.setImage(img);
    }

    registerMenuItem(item);

    return item;
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:34,代码来源:AppMenu.java

示例5: createSortMenu

protected void createSortMenu(String menuNames[]) {
    if (table == null)
        return;
    sortMenu = new Menu(table.getShell(), SWT.POP_UP);
    for (int x = 0; x < menuNames.length; x++) {
        MenuItem item = new MenuItem(sortMenu, SWT.PUSH);
        Integer ID = x;
        item.setData(ID);
        item.setText(menuNames[x]);
        item.addSelectionListener(this);
    }
    table.setMenu(sortMenu);
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:13,代码来源:SuperTable.java

示例6: openPopupMenu

protected void openPopupMenu(List<DragAndDropPolicy.Action> availableActions,
		final AvroNode sourceNode, final AvroNode targetNode, final TargetPosition position) {
	
	Shell shell = Display.getCurrent().getActiveShell();
	final Menu menu = new Menu(shell, SWT.POP_UP);
	
	for (DragAndDropPolicy.Action availableAction : availableActions) {
		final DragAndDropPolicy.Action action = availableAction;
		MenuItem item = new MenuItem(menu, SWT.PUSH);
		item.setText(action.getLabel());
		item.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event e) {
				menu.dispose();
				IEditCommand cmd = context.getService(IEditCommandFactory.class)
						.createDnDElementCommand(action, sourceNode, targetNode, position, Notifications.NOT_REF);					
				if (cmd != null) {	
					context.getService(ICommandExecutor.class).execute(cmd);
				}
			}
		});
	}
       
	java.awt.Point location = MouseInfo.getPointerInfo().getLocation();
	int x = location.x;
	int y = location.y;
       menu.setLocation(x, y);
       menu.setVisible(true);
       
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:29,代码来源:AvroSchemaViewerDropPolicy.java


注:本文中的org.eclipse.swt.SWT.POP_UP属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。