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


Java Decorations类代码示例

本文整理汇总了Java中org.eclipse.swt.widgets.Decorations的典型用法代码示例。如果您正苦于以下问题:Java Decorations类的具体用法?Java Decorations怎么用?Java Decorations使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: open

import org.eclipse.swt.widgets.Decorations; //导入依赖的package包/类
protected void open(final Decorations parent, final SelectionEvent trigger) {
	// final boolean asMenu = trigger.detail == SWT.ARROW;
	final boolean init = mainMenu == null;
	// if (!asMenu) {
	// openView();
	// } else {
	final ToolItem target = (ToolItem) trigger.widget;
	final ToolBar toolBar = target.getParent();

	if (init) {
		mainMenu = new Menu(parent, SWT.POP_UP);
		// AD: again. In the first call, the mainMenu was perhaps not
		// yet initialized
		fillMenu();
		// mainMenu.addMenuListener(tooltipListener);
	}

	final Point point = toolBar.toDisplay(new Point(trigger.x, trigger.y));
	mainMenu.setLocation(point.x, point.y);
	mainMenu.setVisible(true);
	// }
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:23,代码来源:GamlReferenceMenu.java

示例2: createHCM_0_Menu

import org.eclipse.swt.widgets.Decorations; //导入依赖的package包/类
/**
 * Create header context menu which has the action to modify columns
 * 
 * @param composite
 * @param defaultContextMenu
 * @return
 */
private Menu createHCM_0_Menu(final Composite composite, final Menu defaultContextMenu) {

	final Decorations shell = composite.getShell();
	final Menu headerContextMenu = new Menu(shell, SWT.POP_UP);

	/*
	 * IMPORTANT: Dispose the menus (only the current menu, when menu is set with setMenu() it
	 * will be disposed automatically)
	 */
	composite.addListener(SWT.Dispose, new Listener() {
		@Override
		public void handleEvent(final Event event) {

			headerContextMenu.dispose();

			if (defaultContextMenu != null) {
				defaultContextMenu.dispose();
			}
		}
	});

	return headerContextMenu;
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:31,代码来源:ColumnManager.java

示例3: createTrimWidgets

import org.eclipse.swt.widgets.Decorations; //导入依赖的package包/类
/**
 * Creates the trim widgets around the content area.
 * 
 * @param shell
 *            the shell
 * @since 3.0
 */
protected void createTrimWidgets(Shell shell) {
	if (menuBarManager != null) {
		shell.setMenuBar(menuBarManager.createMenuBar((Decorations) shell));
		menuBarManager.updateAll(true);
	}

	if (showTopSeperator()) {
		seperator1 = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
	}

	// will create either a cool bar or a tool bar
	createToolBarControl(shell);
	createCoolBarControl(shell);
	createStatusLine(shell);
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:23,代码来源:ApplicationWindow.java

示例4: open

import org.eclipse.swt.widgets.Decorations; //导入依赖的package包/类
@Override
protected void open(final Decorations parent, final SelectionEvent trigger) {
	if (colorMenu == null) {
		colorMenu = new GamaColorMenu(mainMenu);
	}
	final ToolItem target = (ToolItem) trigger.widget;
	final ToolBar toolBar = target.getParent();
	colorMenu.open(toolBar, trigger, colorInserter, runnable);
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:10,代码来源:ColorReferenceMenu.java

示例5: createPopupMenu

import org.eclipse.swt.widgets.Decorations; //导入依赖的package包/类
protected Menu createPopupMenu(Decorations parent) {
    Menu menu = new Menu(parent.getShell(), SWT.POP_UP);
    MenuItem actionItem = new MenuItem(menu, SWT.PUSH);
    actionItem.setText("Set to default");
    actionItem.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event e) {
            if (! isDefault) {
                setDefault(true);
                notifyChangeListener();
            }
        }
    });
    return menu;
}
 
开发者ID:Elphel,项目名称:vdt-plugin,代码行数:15,代码来源:Component.java

示例6: new_grp

import org.eclipse.swt.widgets.Decorations; //导入依赖的package包/类
private static Swt_popup_grp new_grp(String key, Decorations owner_win) {
	Swt_popup_grp rv = new Swt_popup_grp(key);
	rv.owner_win = owner_win;
	rv.menu = new Menu(owner_win, SWT.DROP_DOWN);
	return rv;
}
 
开发者ID:gnosygnu,项目名称:xowa_android,代码行数:7,代码来源:Swt_popup_grp.java

示例7: TrpMenuBar

import org.eclipse.swt.widgets.Decorations; //导入依赖的package包/类
public TrpMenuBar(Decorations parent) {		
	init(parent);
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:4,代码来源:TrpMenuBar.java

示例8: init

import org.eclipse.swt.widgets.Decorations; //导入依赖的package包/类
private void init(Decorations parent) {
		menuBar = new Menu(parent, SWT.POP_UP);
		
		// DOCUMENTS MENU:
		docsMenu = createCascadeMenu(menuBar, null, "&Document");
		
		openLocalDocItem = createItem(docsMenu.m, SWT.NONE, Images.FOLDER, "Open local document...");	
		uploadItem = createItem(docsMenu.m, SWT.NONE, Images.FOLDER_IMPORT, "Import document(s)...");
		exportItem = createItem(docsMenu.m, SWT.NONE, Images.FOLDER_GO, "Export document...");
		syncXmlItem = createItem(docsMenu.m, SWT.NONE, Images.getOrLoad("/icons/database_refresh.png"), "Sync local transcriptions with doc...");
		createThumbsMenuItem = createItem(docsMenu.m, SWT.CHECK, null, "Create thumbs when opening local folder");
		
		// FILE MENU:
		fileMenu = createCascadeMenu(menuBar, null, "&Page");
		
		saveTranscriptionMenuItem = createItem(fileMenu.m, SWT.NONE, Images.DISK, "Save");
		saveTranscriptionToNewFileMenuItem = createItem(fileMenu.m, SWT.NONE, Images.getOrLoad("/icons/page_save.png"), "Save transcription to new file");
		replaceImageItem = createItem(fileMenu.m, SWT.NONE, Images.IMAGE_EDIT, "Replace image of current page on server...");
		openLocalPageFileItem = createItem(fileMenu.m, 0, null, "Open local page file for current page...");		
		deletePageMenuItem = createItem(fileMenu.m, 0, null, "Delete current page from server");
		addPageMenuItem = createItem(fileMenu.m, 0, null, "Add page to document on server...");
		syncWordsWithLinesMenuItem = createItem(fileMenu.m, SWT.NONE, null, "Sync word transcription with text in lines");
		
		collMenu = createCascadeMenu(menuBar, null, "&Collections");
		manageCollectionsItem = createItem(collMenu.m, SWT.NONE, null, "Manage...");
		userActivityItem = createItem(collMenu.m, SWT.NONE, null, "Show user activity...");
		
		// VIEW menu
		viewMenu = createCascadeMenu(menuBar, null, "&View");
		viewSettingsMenuItem = createItem(viewMenu.m, SWT.PUSH, Images.getOrLoad("/icons/palette.png"), "Change viewing settings");
				
		// SEGMENTATION SUB-MENU:
		segmentationMenu = createCascadeMenu(viewMenu.m, null, "Segmentation");
		
		showAllMenuItem = createItem(segmentationMenu.m, SWT.PUSH, null, "Show all");		
		hideAllMenuItem = createItem(segmentationMenu.m, SWT.PUSH, null, "Hide all");
		
		showRegionsMenuItem = createItem(segmentationMenu.m, SWT.CHECK, null, "Show regions");
		showLinesMenuItem = createItem(segmentationMenu.m, SWT.CHECK, null, "Show lines");
		showBaselinesMenuItem = createItem(segmentationMenu.m, SWT.CHECK, null, "Show baselines");
		showWordsMenuItem = createItem(segmentationMenu.m, SWT.CHECK, null, "Show words");
		showPrintspaceMenuItem = createItem(segmentationMenu.m, SWT.CHECK, null, "Show printspace");
		
		tipsOfTheDayMenuItem = createItem(viewMenu.m, SWT.PUSH, null, "Show tips of the day...");

		// HELP MENU:
//		mntmhelp = new MenuItem(menuBar, SWT.CASCADE);
//		mntmhelp.setText("&Help");
//		
//		helpMenu = new Menu(mntmhelp);
//		mntmhelp.setMenu(helpMenu);

		proxySettingsMenuItem = createItem(menuBar, SWT.PUSH, Images.getOrLoad("/icons/server_connect.png"), "Proxy settings...");
		
		autoSaveSettingsMenuItem = createItem(menuBar, SWT.NONE, Images.DISK, "Autosave settings");
		
		if (false) {
		languageMenu = createCascadeMenu(menuBar, null, "Language (todo)");		
		for (Locale l : Msgs.LOCALES) {
			MenuItem li = new MenuItem(languageMenu.m, SWT.RADIO);
			li.setText(l.getDisplayName());
			li.setData(l);
			if (l.equals(TrpConfig.getTrpSettings().getLocale()))
				li.setSelection(true);
		}
		}

		updateMenuItem = createItem(menuBar, SWT.NONE, Images.getOrLoad("/icons/update_wiz.gif"), "Check for updates");
		
		installMenuItem = createItem(menuBar, SWT.NONE, Images.getOrLoad("/icons/install_wiz.gif"), "Install a specific version...");
		
		bugReportItem = createItem(menuBar, SWT.NONE, Images.BUG, "Send a bug report or feature request");
		
		aboutMenuIItem = createItem(menuBar, SWT.NONE, Images.getOrLoad("/icons/information.png"), "About");
		
		exitItem = createItem(menuBar, SWT.NONE, Images.getOrLoad("/icons/door_out.png"), "Exit");
	}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:78,代码来源:TrpMenuBar.java

示例9: createHeaderContextMenu

import org.eclipse.swt.widgets.Decorations; //导入依赖的package包/类
/**
 * set context menu depending on the position of the mouse
 * 
 * @param tree
 * @param defaultContextMenu
 *            can be <code>null</code>
 */
public void createHeaderContextMenu(final Tree tree, final Menu defaultContextMenu) {

	// remove old listener
	if (_treeMenuDetectListener != null) {
		tree.removeListener(SWT.MenuDetect, _treeMenuDetectListener);
	}

	final Menu headerContextMenu = createHCM_0_Menu(tree, defaultContextMenu);

	// add the context menu to the tree viewer
	_treeMenuDetectListener = new Listener() {
		@Override
		public void handleEvent(final Event event) {

			final Decorations shell = tree.getShell();
			final Display display = shell.getDisplay();

			final Point mousePosition = display.map(null, tree, new Point(event.x, event.y));

			final Rectangle clientArea = tree.getClientArea();

			final int headerHeight = tree.getHeaderHeight();
			final int headerBottom = clientArea.y + headerHeight;

			final boolean isTreeHeaderHit = clientArea.y <= mousePosition.y && mousePosition.y < headerBottom;

			_headerColumn = getHeaderColumn(tree, mousePosition, isTreeHeaderHit);

			final Menu contextMenu = getContextMenu(isTreeHeaderHit, headerContextMenu, defaultContextMenu);

			tree.setMenu(contextMenu);

			/*
			 * Set context menu position to the right border of the column
			 */
			if (_headerColumn != null) {

				int posX = _headerColumn.columnRightBorder;
				int xOffset = 0;

				final ScrollBar hBar = tree.getHorizontalBar();

				if (hBar != null) {
					xOffset = hBar.getSelection();
				}

				/*
				 * It is possible that the context menu is outside of the tree, this occures
				 * when the column is very wide and horizonal scrolled.
				 */
				if (posX - xOffset > clientArea.width) {
					posX = xOffset + clientArea.width;
				}

				final Point displayPosition = tree.toDisplay(posX, headerBottom);

				event.x = displayPosition.x - 1;
				event.y = displayPosition.y - 2;
			}
		}
	};

	tree.addListener(SWT.MenuDetect, _treeMenuDetectListener);
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:72,代码来源:ColumnManager.java

示例10: computeTrim

import org.eclipse.swt.widgets.Decorations; //导入依赖的package包/类
public static Rectangle computeTrim( Decorations decorations, Rectangle bounds ) {
  return decorations.computeTrim( bounds.x, bounds.y, bounds.width, bounds.height );
}
 
开发者ID:fappel,项目名称:xiliary,代码行数:4,代码来源:ShellHelper.java

示例11: createMenuBar

import org.eclipse.swt.widgets.Decorations; //导入依赖的package包/类
/**
 * Creates and returns an SWT menu bar control for this menu, for use in the
 * given <code>Decorations</code>, and installs all registered
 * contributions. Does not create a new control if one already exists.
 * 
 * @param parent
 *            the parent decorations
 * @return the menu control
 * @since 2.1
 */
public Menu createMenuBar(Decorations parent) {
	if (!menuExist()) {
		menu = new Menu(parent, SWT.BAR);
		menu.setData(MANAGER_KEY, this);
		update(false);
	}
	return menu;
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:19,代码来源:MenuManager.java

示例12: createMenuBar

import org.eclipse.swt.widgets.Decorations; //导入依赖的package包/类
/**
 * Creates and returns an SWT menu bar control for this menu, for use in the
 * given <code>Decorations</code>, and installs all registered contributions.
 * Does not create a new control if one already exists.
 *
 * @param parent
 *          the parent decorations
 * @return the menu control
 * @since 2.1
 */
public Menu createMenuBar(Decorations parent) {
  if (! menuExist()) {
    menu = new Menu(parent, SWT.BAR);
    menu.setData(MANAGER_KEY, this);
    update(false);
  }
  return menu;
}
 
开发者ID:Haixing-Hu,项目名称:swt-widgets,代码行数:19,代码来源:MenuManagerEx.java

示例13: createMenuBar

import org.eclipse.swt.widgets.Decorations; //导入依赖的package包/类
/**
 * Creates and returns an SWT menu bar control for this menu,
 * for use in the given <code>Decorations</code>, and installs all registered
 * contributions. Does not create a new control if one already exists.
 *
 * @param parent the parent decorations
 * @return the menu control
 * @since 2.1
 */
public Menu createMenuBar(Decorations parent) {
    if (!menuExist()) {
        menu = new Menu(parent, SWT.BAR);
        update(false);
    }
    return menu;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:17,代码来源:MenuManagerCopiedToAddCreateMenuWithMenuParent.java


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