org.eclipse.swt.widgets.MenuItem#setText ( )源码实例Demo

下面列出了org.eclipse.swt.widgets.MenuItem#setText ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: gama   文件: EditorMenu.java
/**
 *
 */
private void createBoxToggle(final Menu menu) {
	final MenuItem box = new MenuItem(menu, SWT.CHECK);
	box.setText(" Colorize code sections");
	box.setImage(GamaIcons.create("toggle.box").image());
	box.setSelection(getEditor().isDecorationEnabled());
	box.addSelectionListener(new SelectionAdapter() {

		@Override
		public void widgetSelected(final SelectionEvent e) {
			final boolean selection = box.getSelection();
			getEditor().setDecorationEnabled(selection);
			getEditor().decorate(selection);
		}
	});

}
 
源代码2 项目: tmxeditor8   文件: MenuItemProviders.java
public static IMenuItemProvider clearToggleFilterRowMenuItemProvider(final String menuLabel) {
	return new IMenuItemProvider() {

		public void addMenuItem(final NatTable natTable, final Menu popupMenu) {
			MenuItem menuItem = new MenuItem(popupMenu, SWT.PUSH);
			menuItem.setText(menuLabel);
			menuItem.setImage(GUIHelper.getImage("toggle_filter"));
			menuItem.setEnabled(true);

			menuItem.addSelectionListener(new SelectionAdapter() {
				@Override
				public void widgetSelected(SelectionEvent e) {
					natTable.doCommand(new ToggleFilterRowCommand());
				}
			});
		}
	};
}
 
源代码3 项目: translationstudio8   文件: MenuItemProviders.java
public static IMenuItemProvider ungroupColumnsMenuItemProvider() {
	return new IMenuItemProvider() {

		public void addMenuItem(final NatTable natTable, final Menu popupMenu) {
			MenuItem columnStyleEditor = new MenuItem(popupMenu, SWT.PUSH);
			columnStyleEditor.setText("Ungroup columns");
			columnStyleEditor.setEnabled(true);

			columnStyleEditor.addSelectionListener(new SelectionAdapter() {
				@Override
				public void widgetSelected(SelectionEvent e) {
					natTable.doCommand(new UngroupColumnCommand());
				}
			});
		}
	};
}
 
源代码4 项目: birt   文件: ClassSelectionButton.java
private void populateMenuItems( )
{
	for ( int i = 0; i < menu.getItemCount( ); i++ )
	{
		menu.getItem( i ).dispose( );
		i--;
	}

	String[] types = this.provider.getMenuItems( );
	for ( int i = 0; i < types.length; i++ )
	{
		MenuItem item = new MenuItem( menu, SWT.PUSH );
		item.setText( provider.getMenuItemText( types[i] ) );
		item.setData( types[i] );
		item.setImage( this.provider.getMenuItemImage( types[i] ) );
		item.addSelectionListener( listener );
	}

	if ( menu.getItemCount( ) <= 0 )
	{
		button.setDropDownMenu( null );
	}

	button.setText( provider.getButtonText( ) );
	refresh( );
}
 
源代码5 项目: logbook   文件: AbstractTableDialogEx.java
/**
 * テーブルを追加します
 *
 * @param parent テーブルの親コンポジット
 * @return TableWrapper
 */
protected TableWrapper<T> addTable(Composite parent) {
    // テーブル
    Table table = new Table(parent, SWT.FULL_SELECTION | SWT.MULTI);
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    table.addKeyListener(new TableKeyShortcutAdapter(table));

    // テーブル右クリックメニュー
    Menu tablemenu = new Menu(table);
    table.setMenu(tablemenu);
    MenuItem sendclipbord = new MenuItem(tablemenu, SWT.NONE);
    sendclipbord.addSelectionListener(new TableToClipboardAdapter(table));
    sendclipbord.setText("クリップボードにコピー(&C)");
    MenuItem reloadtable = new MenuItem(tablemenu, SWT.NONE);
    reloadtable.setText("再読み込み(&R)");
    reloadtable.addSelectionListener(new TableReloadAdapter());

    TableWrapper<T> wrapper = new TableWrapper<T>(table, this.clazz)
            .setDialogClass(this.getClass())
            .setDecorator(TableItemDecorator.stripe(SWTResourceManager.getColor(AppConstants.ROW_BACKGROUND)));
    this.tables.add(wrapper);
    return wrapper;
}
 
源代码6 项目: uima-uimaj   文件: ModeMenu.java
@Override
protected void insertAction(final Type type, Menu parentMenu) {
  MenuItem actionItem = new MenuItem(parentMenu, SWT.CHECK);
  actionItem.setText(type.getName());
  
  if (type.equals(editor.getAnnotationMode()))
      actionItem.setSelection(true);
  
  actionItem.addListener(SWT.Selection, new Listener() {
    @Override
    public void handleEvent(Event e) {

  	for (IModeMenuListener listener : listeners) {
  		listener.modeChanged(type);
  	}
    }
  });
}
 
源代码7 项目: tmxeditor8   文件: MenuItemProviders.java
public static IMenuItemProvider createColumnGroupMenuItemProvider() {
	return new IMenuItemProvider() {

		public void addMenuItem(final NatTable natTable, final Menu popupMenu) {
			MenuItem columnStyleEditor = new MenuItem(popupMenu, SWT.PUSH);
			columnStyleEditor.setText("Create column group");
			columnStyleEditor.setEnabled(true);

			columnStyleEditor.addSelectionListener(new SelectionAdapter() {
				@Override
				public void widgetSelected(SelectionEvent e) {
					natTable.doCommand(new OpenCreateColumnGroupDialog(natTable.getShell()));
				}
			});
		}
	};
}
 
/**
 * @param parent a widget which will be the parent of the new instance (cannot
 *               be null)
 * @param style  the style of widget to construct
 */
public GitRepositoryPreferencePageView(Composite parent, int style) {
	super(parent, style);
	final TableColumnLayout tableColumnLayout = new TableColumnLayout();
	setLayout(tableColumnLayout);

	tableViewer = new TableViewer(this, SWT.BORDER | SWT.FULL_SELECTION);
	final Table table = tableViewer.getTable();
	table.setHeaderVisible(true);
	table.setLinesVisible(true);

	columnRepository = new TableViewerColumn(tableViewer, SWT.NONE);
	TableColumn colRepository = columnRepository.getColumn();
	tableColumnLayout.setColumnData(colRepository, new ColumnWeightData(1));
	colRepository.setText("Repository");

	columnLocalPath = new TableViewerColumn(tableViewer, SWT.NONE);
	TableColumn colLocalPath = columnLocalPath.getColumn();
	tableColumnLayout.setColumnData(colLocalPath, new ColumnWeightData(1));
	colLocalPath.setText("Local Path");

	columnMemory = new TableViewerColumn(tableViewer, SWT.RIGHT);
	TableColumn colMemory = columnMemory.getColumn();
	tableColumnLayout.setColumnData(colMemory, new ColumnPixelData(80, true, true));
	colMemory.setText("Memory");

	final Menu menu = new Menu(tableViewer.getTable());
	menuItemGoToRepository = new MenuItem(menu, SWT.NONE);
	menuItemGoToRepository.setText("Go to Repository");
	tableViewer.getTable().setMenu(menu);
}
 
源代码9 项目: BiglyBT   文件: PingGraphic.java
@Override
 protected void
 addMenuItems(
Menu	menu )
 {
  new MenuItem( menu, SWT.SEPARATOR );
  
  MenuItem mi_reset = new MenuItem( menu, SWT.PUSH );

  mi_reset.setText(  MessageText.getString( "label.clear.history" ));

  mi_reset.addListener(SWT.Selection, new Listener() {
	  @Override
	  public void handleEvent(Event e) {
		  try{
		   	this_mon.enter();
		   	
		   	nbValues		= 0;
		   	currentPosition	= 0;
		   		
		   	for ( int i=0;i<all_values.length;i++ ){
		   		all_values[i] = new int[all_values[i].length];
		   	}
		  }finally{
			  
			this_mon.exit();
		  }
		  
		  refresh( true );
	  }
  });
 }
 
源代码10 项目: gama   文件: AgentsMenu.java
private static MenuItem actionAgentMenuItem(final Menu parent, final IAgent agent, final IStatement command,
		final String prefix) {
	final MenuItem result = new MenuItem(parent, SWT.PUSH);
	result.setText(prefix + " " + command.getName());
	result.setImage(GamaIcons.create(IGamaIcons.MENU_RUN_ACTION).image());
	result.addSelectionListener(runner);
	result.setData("agent", agent);
	result.setData("command", command);
	return result;
}
 
源代码11 项目: arx   文件: ClipboardHandlerTable.java
/**
 * Creates a pop up menu for this handler.
 *
 * @return
 */
public Menu getMenu() {
    Menu menu = new Menu(table);
    MenuItem itemCopy = new MenuItem(menu, SWT.NONE);
    itemCopy.setText(Resources.getMessage("ClipboardHandlerTable.0")); //$NON-NLS-1$
    itemCopy.addSelectionListener(new SelectionAdapter(){
        public void widgetSelected(SelectionEvent arg0) {
            copy();
        }
    });
    return menu;
}
 
源代码12 项目: BiglyBT   文件: ClipboardCopy.java
public static void
 addCopyToClipMenu(
final Menu					menu,
final copyToClipProvider	provider )
 {
  for ( MenuItem e: menu.getItems()){
	  
	  if ( e.getData( MENU_ITEM_KEY ) != null ){
		  
		  e.dispose();
	  }
  }
  
  MenuItem   item = new MenuItem( menu,SWT.NONE );

  item.setData( MENU_ITEM_KEY, "" );
  
  String	msg_text_id= "label.copy.to.clipboard";

  item.setText( MessageText.getString( msg_text_id ));

  item.addSelectionListener(
	  new SelectionAdapter()
	  {
		  @Override
		  public void
		  widgetSelected(
				  SelectionEvent arg0)
		  {
			  new Clipboard(menu.getDisplay()).setContents(new Object[] { provider.getText()}, new Transfer[] {TextTransfer.getInstance()});
		  }
	  });
 }
 
源代码13 项目: saros   文件: StartSessionWithContacts.java
/** Creates a menu entry which indicates that no contacts with Saros are online. */
private MenuItem createInvalidContactsMenuItem(Menu parentMenu, int index) {
  MenuItem menuItem = new MenuItem(parentMenu, SWT.NONE, index);
  menuItem.setText(Messages.SessionWithContacts_menuItem_no_contacts_available_text);
  menuItem.setEnabled(false);
  return menuItem;
}
 
源代码14 项目: logbook   文件: QuestTable.java
@Override
protected void createContents() {
    this.addTable(this.shell)
            .setContentSupplier(CreateReportLogic::getQuestContent)
            .reload()
            .update();

    // 任務をリセット
    final MenuItem reset = new MenuItem(this.opemenu, SWT.NONE);
    reset.setText("任務をリセット");
    reset.addSelectionListener((SelectedListener) e -> {
        GlobalContext.getQuest().clear();
        this.getSelectionTable().reload().update();
    });
}
 
源代码15 项目: BiglyBT   文件: MultiPlotGraphic.java
@Override
 protected void
 addMenuItems(
Menu	menu )
 {
  new MenuItem( menu, SWT.SEPARATOR );
  
  MenuItem mi_reset = new MenuItem( menu, SWT.PUSH );

  mi_reset.setText(  MessageText.getString( "label.clear.history" ));

  mi_reset.addListener(SWT.Selection, new Listener() {
	  @Override
	  public void handleEvent(Event e) {
		  try{
		   	this_mon.enter();
		   	
		   	nbValues		= 0;
		   	currentPosition	= 0;
	 		
		   	for ( int i=0;i<all_values.length;i++ ){
		   		all_values[i] = new int[all_values[i].length];
		   	}		
		  }finally{
			  
			this_mon.exit();
		  }
		  
		  refresh( true );
	  }
  });
 }
 
源代码16 项目: gama   文件: OutputsMenu.java
private static MenuItem menuItem(final Menu parent, final ISelecter listener, final Image image,
		final String prefix) {
	final MenuItem result = new MenuItem(parent, SWT.PUSH);
	result.setText(prefix);
	if (listener != null)
		result.addSelectionListener(listener);
	if (image != null)
		result.setImage(image);
	return result;
}
 
源代码17 项目: bonita-studio   文件: NewCoolbarItem.java
public boolean add(String commandId, String label) {
    Command command = commandService.getCommand(commandId);
    if (command != null && command.isDefined() && command.isHandled()) {
        final MenuItem menuItem = new MenuItem(menu, SWT.PUSH);
        try {
            menuItem.setText(label != null ? label : command.getName());
            getCommandImage(commandId).ifPresent(menuItem::setImage);
        } catch (NotDefinedException e1) {
            BonitaStudioLog.error(e1);
            menuItem.setText("unknown command: " + commandId);
        }
        menuItem.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(final SelectionEvent event) {
                try {
                    handlerService.executeCommand(command.getId(), null);
                } catch (final Exception e) {
                    BonitaStudioLog.error(e);
                }
            }

        });
        return true;
    }
    return false;
}
 
@Override
public void fill(Menu menu, int index)
{
	MenuItem menuItem = new MenuItem(menu, SWT.PUSH, index);
	menuItem.setText(branchName);
	menuItem.setEnabled(!branchName.equals(manager.getCurrentTheme().getName()));
	menuItem.addSelectionListener(new SelectionAdapter()
	{
		public void widgetSelected(SelectionEvent e)
		{
			// what to do when menu is subsequently selected.
			switchTheme(manager, branchName);
		}
	});
}
 
源代码19 项目: Rel   文件: OSSpecific.java
public static void addHelpMenuItems(Menu menu) {
	MenuItem about = new MenuItem(menu, SWT.PUSH);
	about.setText("About " + appName);
	about.addListener(SWT.Selection, aboutListener);
}
 
源代码20 项目: offspring   文件: AskOrdersPart.java
@PostConstruct
public void postConstruct(final Composite parent, final INxtService nxt,
    final IUserService userService, IStylingEngine engine, UISynchronize sync) {
  mainComposite = new Composite(parent, SWT.NONE);
  GridLayoutFactory.fillDefaults().numColumns(1).spacing(5, 2).margins(0, 0)
      .applyTo(mainComposite);
  GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true)
      .applyTo(mainComposite);

  paginationContainer = new PaginationContainer(mainComposite, SWT.NONE);
  GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true)
      .applyTo(paginationContainer);

  ordersViewer = new AskOrdersViewer(paginationContainer.getViewerParent(),
      nxt, ContactsService.getInstance(), engine, userService, sync);
  ordersViewer.getTable().setToolTipText("Right click for Quick Buy");
  paginationContainer.setTableViewer(ordersViewer, 100);

  // add context menu for quick buy
  Menu contextMenu = new Menu(ordersViewer.getTable());
  ordersViewer.getTable().setMenu(contextMenu);
  MenuItem itemQuickBuy = new MenuItem(contextMenu, SWT.PUSH);
  itemQuickBuy.setText("Quick Buy");
  itemQuickBuy.addSelectionListener(new SelectionAdapter() {

    @Override
    public void widgetSelected(SelectionEvent e) {
      IStructuredSelection selection = (IStructuredSelection) ordersViewer
          .getSelection();
      Object order = selection.getFirstElement();
      if (order instanceof Order.Ask) {
        Shell shell = parent.getShell();
        Long assetId = ((Order.Ask) order).getAssetId();
        int quantity = ((Order.Ask) order).getQuantity();
        long price = ((Order.Ask) order).getPrice();

        new WizardDialog(shell, new PlaceBidOrderWizard(userService, nxt,
            assetId, quantity, price)).open();
      }
    }
  });

}