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


Java MenuItem.setEnabled方法代码示例

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


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

示例1: showCompareMenu

import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
private void showCompareMenu(final Point location, final ConflictDescription conflict) {
    final ConflictComparisonOption[] comparisons =
        ConflictComparisonFactory.getConflictComparison(conflict).getOptions();

    final Menu compareMenu = new Menu(getSite().getShell(), SWT.POP_UP);

    for (final ConflictComparisonOption comparison : comparisons) {
        final Object originalNode = comparison.getOriginalNode();
        final Object modifiedNode = comparison.getModifiedNode();

        final MenuItem compareItem = new MenuItem(compareMenu, SWT.NONE);

        final String messageFormat = Messages.getString("ConflictResolutionEditor.CompareActionTextFormat"); //$NON-NLS-1$
        final String message =
            MessageFormat.format(messageFormat, comparison.getModifiedTitle(), comparison.getOriginalTitle());

        compareItem.setText(message);
        compareItem.setEnabled(modifiedNode != null && originalNode != null);

        compareItem.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(final SelectionEvent e) {
                openComparison(conflict, originalNode, modifiedNode);
            }
        });
    }

    getSite().getShell().setMenu(compareMenu);

    compareMenu.setLocation(location);
    compareMenu.setVisible(true);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:33,代码来源:ConflictResolutionEditor.java

示例2: createMenu

import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
public void createMenu(TGToolBar toolBar, ToolItem item) {
	TGLayout layout = toolBar.getTablature().getViewLayout();
	int style = layout.getStyle();
	
	Menu menu = new Menu(item.getParent().getShell());
	
	MenuItem pageLayout = new MenuItem(menu, SWT.PUSH);
	pageLayout.addSelectionListener(toolBar.createActionProcessor(TGSetPageLayoutAction.NAME));
	pageLayout.setText(toolBar.getText("view.layout.page", (layout instanceof TGLayoutVertical)));
	pageLayout.setImage(toolBar.getIconManager().getLayoutPage());
	
	MenuItem linearLayout = new MenuItem(menu, SWT.PUSH);
	linearLayout.addSelectionListener(toolBar.createActionProcessor(TGSetLinearLayoutAction.NAME));
	linearLayout.setText(toolBar.getText("view.layout.linear", (layout instanceof TGLayoutHorizontal)));
	linearLayout.setImage(toolBar.getIconManager().getLayoutLinear());
	
	MenuItem multitrack = new MenuItem(menu, SWT.PUSH);
	multitrack.addSelectionListener(toolBar.createActionProcessor(TGSetMultitrackViewAction.NAME));
	multitrack.setText(toolBar.getText("view.layout.multitrack", ( (style & TGLayout.DISPLAY_MULTITRACK) != 0 )));
	multitrack.setImage(toolBar.getIconManager().getLayoutMultitrack());
	
	MenuItem scoreEnabled = new MenuItem(menu, SWT.PUSH);
	scoreEnabled.addSelectionListener(toolBar.createActionProcessor(TGSetScoreEnabledAction.NAME));
	scoreEnabled.setText(toolBar.getText("view.layout.score-enabled", ( (style & TGLayout.DISPLAY_SCORE) != 0 )));
	scoreEnabled.setImage(toolBar.getIconManager().getLayoutScore());
	
	MenuItem compact = new MenuItem(menu, SWT.PUSH);
	compact.addSelectionListener(toolBar.createActionProcessor(TGSetCompactViewAction.NAME));
	compact.setText(toolBar.getText("view.layout.compact", ( (style & TGLayout.DISPLAY_COMPACT) != 0 )));
	compact.setImage(toolBar.getIconManager().getLayoutCompact());
	compact.setEnabled((style & TGLayout.DISPLAY_MULTITRACK) == 0 || toolBar.getSong().countTracks() == 1);
	
	Rectangle rect = item.getBounds();
	Point pt = item.getParent().toDisplay(new Point(rect.x, rect.y));
	
	menu.setLocation(pt.x, pt.y + rect.height);
	menu.setVisible(true);
}
 
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:39,代码来源:TGToolBarSectionLayout.java

示例3: createMenuItem

import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
private void createMenuItem(TGToolBar toolBar, Menu menu, int velocity, int selection, boolean running) {
	MenuItem menuItem = new MenuItem(menu, SWT.PUSH);
	menuItem.setEnabled(!running);
	menuItem.addSelectionListener(this.createChangeVelocityAction(toolBar, velocity));
	
	String nameKey = getNameKey(velocity);
	if( nameKey != null ) {
		menuItem.setText(toolBar.getText(nameKey, (velocity == selection)));
	}
	Image icon = this.getDynamicIcon(toolBar, velocity);
	if( icon != null ) {
		menuItem.setImage(icon);
	}
}
 
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:15,代码来源:TGToolBarSectionDynamic.java

示例4: createDurationMenuItem

import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
private void createDurationMenuItem(TGToolBar toolBar, Menu menu, int value, int selection, boolean running) {
	Image icon = this.findDurationIcon(toolBar, value);
	String action = this.findDurationAction(value);
	String nameKey = this.findDurationNameKey(value);
	if( icon != null && action != null && nameKey != null ) {
		MenuItem menuItem = new MenuItem(menu, SWT.PUSH);
		menuItem.setEnabled(!running);
		menuItem.addSelectionListener(toolBar.createActionProcessor(action));
		menuItem.setText(toolBar.getText(nameKey, (value == selection)));
		menuItem.setImage(icon);
	}
}
 
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:13,代码来源:TGToolBarSectionDuration.java

示例5: setFindEnabled

import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
public void setFindEnabled(boolean b) {
	for (MenuItem item : findDependent)
		if (!item.isDisposed())
			item.setEnabled(b);
}
 
开发者ID:juanerasmoe,项目名称:pmTrans,代码行数:6,代码来源:MenuManager.java

示例6: fillMenu

import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
@Override
public void
fillMenu(
	String sColumnName, Menu menu)
{
	List<Object>	ds = tv.getSelectedDataSources();

	final List<DownloadStubFile> files = new ArrayList<>();

	for ( Object o: ds ){

		files.add((DownloadStubFile)o);
	}

	boolean	hasSelection = files.size() > 0;

		// Explore (or open containing folder)

	final boolean use_open_containing_folder = COConfigurationManager.getBooleanParameter("MyTorrentsView.menu.show_parent_folder_enabled");

	final MenuItem itemExplore = new MenuItem(menu, SWT.PUSH);

	Messages.setLanguageText(itemExplore, "MyTorrentsView.menu."
			+ (use_open_containing_folder ? "open_parent_folder" : "explore"));

	itemExplore.addListener(SWT.Selection, new Listener() {
		@Override
		public void
		handleEvent(
			Event event)
		{
			for ( DownloadStubFile file: files ){

				ManagerUtils.open( new File( file.getFile().getAbsolutePath()), use_open_containing_folder);
			}
		}
	});

	itemExplore.setEnabled(hasSelection);

	new MenuItem( menu, SWT.SEPARATOR );
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:43,代码来源:ArchivedFilesView.java

示例7: update

import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
@Override
public void update(MenuItem m) {
    m.setEnabled(isEnabled(m));
    if (isCheckable())
        m.setSelection(isChecked(m));
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:7,代码来源:MenuCommand.java

示例8: createMenu

import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
public void createMenu(TGToolBar toolBar, ToolItem item) {
	TablatureEditor editor = TablatureEditor.getInstance(toolBar.getContext());
	EditorKit editorKit = editor.getTablature().getEditorKit();
	
	boolean running = TuxGuitar.getInstance().getPlayer().isRunning();
	
	Menu menu = new Menu(item.getParent().getShell());
	
	MenuItem voice1 = new MenuItem(menu, SWT.PUSH);
	voice1.addSelectionListener(toolBar.createActionProcessor(TGSetVoice1Action.NAME));
	voice1.setText(toolBar.getText("edit.voice-1", (editor.getTablature().getCaret().getVoice() == 0)));
	voice1.setImage(toolBar.getIconManager().getEditVoice1());
	voice1.setEnabled(!running);
	
	MenuItem voice2 = new MenuItem(menu, SWT.PUSH);
	voice2.addSelectionListener(toolBar.createActionProcessor(TGSetVoice2Action.NAME));
	voice2.setText(toolBar.getText("edit.voice-2", (editor.getTablature().getCaret().getVoice() == 1)));
	voice2.setImage(toolBar.getIconManager().getEditVoice2());
	voice2.setEnabled(!running);
	
	new MenuItem(menu, SWT.SEPARATOR);
	
	MenuItem modeSelection = new MenuItem(menu, SWT.PUSH);
	modeSelection.addSelectionListener(toolBar.createActionProcessor(TGSetMouseModeSelectionAction.NAME));
	modeSelection.setText(toolBar.getText("edit.mouse-mode-selection", (editorKit.getMouseMode() == EditorKit.MOUSE_MODE_SELECTION)));
	modeSelection.setImage(toolBar.getIconManager().getEditModeSelection());
	modeSelection.setEnabled(!running);
	
	MenuItem modeEdition = new MenuItem(menu, SWT.PUSH);
	modeEdition.addSelectionListener(toolBar.createActionProcessor(TGSetMouseModeEditionAction.NAME));
	modeEdition.setText(toolBar.getText("edit.mouse-mode-edition", (editorKit.getMouseMode() == EditorKit.MOUSE_MODE_EDITION)));
	modeEdition.setImage(toolBar.getIconManager().getEditModeEdition());
	modeEdition.setEnabled(!running);
	
	MenuItem notNaturalKey = new MenuItem(menu, SWT.PUSH);
	notNaturalKey.addSelectionListener(toolBar.createActionProcessor(TGSetNaturalKeyAction.NAME));
	notNaturalKey.setText(toolBar.getText("edit.not-natural-key", (!editorKit.isNatural())));
	notNaturalKey.setImage(toolBar.getIconManager().getEditModeEditionNotNatural());
	notNaturalKey.setEnabled(!running && editorKit.getMouseMode() == EditorKit.MOUSE_MODE_EDITION);
	
	Rectangle rect = item.getBounds();
	Point pt = item.getParent().toDisplay(new Point(rect.x, rect.y));
	
	menu.setLocation(pt.x, pt.y + rect.height);
	menu.setVisible(true);
}
 
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:47,代码来源:TGToolBarSectionEdit.java

示例9: createMenu

import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
public void createMenu(TGToolBar toolBar, ToolItem item) {
	boolean running = TuxGuitar.getInstance().getPlayer().isRunning();
	TGMeasure measure = toolBar.getTablature().getCaret().getMeasure();
	
	Menu menu = new Menu(item.getParent().getShell());
	
	MenuItem tempo = new MenuItem(menu, SWT.PUSH);
	tempo.addSelectionListener(toolBar.createActionProcessor(TGOpenTempoDialogAction.NAME));
	tempo.setEnabled(!running);
	tempo.setText(toolBar.getText("composition.tempo"));
	tempo.setImage(toolBar.getIconManager().getCompositionTempo());

	MenuItem timeSignature = new MenuItem(menu, SWT.PUSH);
	timeSignature.addSelectionListener(toolBar.createActionProcessor(TGOpenTimeSignatureDialogAction.NAME));
	timeSignature.setEnabled(!running);
	timeSignature.setText(toolBar.getText("composition.timesignature"));
	timeSignature.setImage(toolBar.getIconManager().getCompositionTimeSignature());

	new MenuItem(menu, SWT.SEPARATOR);
	
	MenuItem repeatOpen = new MenuItem(menu, SWT.PUSH);
	repeatOpen.addSelectionListener(toolBar.createActionProcessor(TGRepeatOpenAction.NAME));
	repeatOpen.setEnabled( !running );
	repeatOpen.setText(toolBar.getText("repeat.open", (measure != null && measure.isRepeatOpen())));
	repeatOpen.setImage(toolBar.getIconManager().getCompositionRepeatOpen());

	MenuItem repeatClose = new MenuItem(menu, SWT.PUSH);
	repeatClose.addSelectionListener(toolBar.createActionProcessor(TGOpenRepeatCloseDialogAction.NAME));
	repeatClose.setEnabled( !running );
	repeatClose.setText(toolBar.getText("repeat.close", (measure != null && measure.getRepeatClose() > 0)));
	repeatClose.setImage(toolBar.getIconManager().getCompositionRepeatClose());
	
	MenuItem repeatAlternative = new MenuItem(menu, SWT.PUSH);
	repeatAlternative.addSelectionListener(toolBar.createActionProcessor(TGOpenRepeatAlternativeDialogAction.NAME));
	repeatAlternative.setEnabled( !running );
	repeatAlternative.setText(toolBar.getText("repeat.alternative", (measure != null && measure.getHeader().getRepeatAlternative() > 0)));
	repeatAlternative.setImage(toolBar.getIconManager().getCompositionRepeatAlternative());
	
	Rectangle rect = item.getBounds();
	Point pt = item.getParent().toDisplay(new Point(rect.x, rect.y));
	
	menu.setLocation(pt.x, pt.y + rect.height);
	menu.setVisible(true);
}
 
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:45,代码来源:TGToolBarSectionComposition.java


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