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


Java Action.setId方法代码示例

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


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

示例1: registerToolbarAction

import org.eclipse.jface.action.Action; //导入方法依赖的package包/类
/**
 * Create on the table manger the toolbar actions for the outline. The actions are created 
 * only if the toolbar manager dosen't contains them already. Actually the added action are 
 * the one the show the standard outline and the one to show the thumbnail of the report.
 * 
 * @param tbm the toolbar manager for the outline.
 */
public void registerToolbarAction(IToolBarManager tbm){
	IContributionItem items[] = tbm.getItems();
	HashSet<String> existingItems = new HashSet<String>();
	for(IContributionItem item : items){
		existingItems.add(item.getId());
	}
	
	showOutlineAction = new Action(){
		@Override
		public void run() {
			showPage(ID_ACTION_OUTLINE);
		}
	};
	showOutlineAction.setId(ID_ACTION_OUTLINE);
	showOutlineAction.setImageDescriptor(JaspersoftStudioPlugin.getInstance().getImageDescriptor("icons/outline.gif")); //$NON-NLS-1$
	showOutlineAction.setToolTipText(Messages.JDReportOutlineView_show_outline_tool_tip);
	if (!existingItems.contains(ID_ACTION_OUTLINE)){
		ActionContributionItem showOutlineItem = new ActionContributionItem(showOutlineAction);
		showOutlineItem.setVisible(true);
		tbm.add(showOutlineItem);
	}
	
	showOverviewAction = new Action() {
		@Override
		public void run() {
			showPage(ID_ACTION_OVERVIEW);
		}
	};
	showOverviewAction.setId(ID_ACTION_OVERVIEW);
	showOverviewAction.setImageDescriptor(JaspersoftStudioPlugin.getInstance().getImageDescriptor("icons/overview.gif")); //$NON-NLS-1$
	showOverviewAction.setToolTipText(Messages.JDReportOutlineView_show_overview_tool_tip);
	if (!existingItems.contains(ID_ACTION_OVERVIEW)){
		ActionContributionItem showOverviewItem = new ActionContributionItem(showOverviewAction);
		showOverviewItem.setVisible(true);
		tbm.add(showOverviewItem);
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:45,代码来源:JDReportOutlineView.java

示例2: toAction

import org.eclipse.jface.action.Action; //导入方法依赖的package包/类
public Action toAction() {
	final Action result = new Action(text) {

		@Override
		public void runWithEvent(final Event e) {
			selector.widgetSelected(new SelectionEvent(e));
		}
	};

	result.setImageDescriptor(GamaIcons.create(image).descriptor());
	result.setToolTipText(tooltip);
	result.setId(image);
	return result;

}
 
开发者ID:gama-platform,项目名称:gama,代码行数:16,代码来源:GamaCommand.java

示例3: toCheckAction

import org.eclipse.jface.action.Action; //导入方法依赖的package包/类
public Action toCheckAction() {
	final Action result = new Action(text, Action.AS_CHECK_BOX) {

		@Override
		public void runWithEvent(final Event e) {
			selector.widgetSelected(new SelectionEvent(e));
		}
	};

	result.setImageDescriptor(GamaIcons.create(image).descriptor());
	result.setToolTipText(tooltip);
	result.setId(image);
	return result;

}
 
开发者ID:gama-platform,项目名称:gama,代码行数:16,代码来源:GamaCommand.java

示例4: menuAboutToShow

import org.eclipse.jface.action.Action; //导入方法依赖的package包/类
@Override
public void menuAboutToShow(final IMenuManager menuManager) {
    // add the navigate to HOME page command.
    final TeamExplorerNavigationItemConfig homeNavItem = configuration.getHomeNavigationItem();

    final Action homeAction = new Action(configuration.getHomeNavigationItem().getTitle()) {
        @Override
        public void run() {
            navigator.navigateToItem(configuration.getHomeNavigationItem());
        }
    };

    homeAction.setId(homeNavItem.getID());
    menuManager.add(homeAction);

    // Add navigate commands for each visible page except Settings (it
    // goes at the end)
    for (final TeamExplorerNavigationItemConfig navItem : configuration.getNavigationItems()) {
        // Determine if the navigation item is visible in the current
        // context and and create an action item if it is.
        final ITeamExplorerNavigationItem instance = navItem.createInstance();
        if (instance.isVisible(context)) {
            final Action action = new Action(navItem.getTitle()) {
                @Override
                public void run() {
                    final String viewID = navItem.getViewID();

                    // do specific if targetPageID is null
                    if (navItem.getTargetPageID() == null) {
                        instance.clicked(context);
                    }
                    // viewID not null -> check undocked views
                    else if (viewID != null && TeamExplorerHelpers.isViewUndocked(viewID)) {
                        TeamExplorerHelpers.showView(viewID);
                    }
                    // other cases -> navigate in Team Explorer view
                    else {
                        navigator.navigateToItem(navItem);
                    }
                }
            };

            /*
             * The navigation item ID is used to determine which action
             * matches the currently shown navigation item so that the
             * menu listener can properly set the check mark on the
             * currently displayed navigation item.
             */
            action.setId(navItem.getID());

            // Add the action to the context menu.
            menuManager.add(action);
        }
    }

    menuManager.add(new Separator());

    // create the project/team fly out menu. "Connect to server" is
    // always
    // present so the menu won't be empty and omitted when disconnected.
    String subMenuTitle;
    if (TeamExplorerHelpers.supportsTeam(context)) {
        subMenuTitle = Messages.getString("TeamExplorerControl.ProjectsAndMyTeamsSubMenuText"); //$NON-NLS-1$
    } else {
        subMenuTitle = Messages.getString("TeamExplorerControl.ProjectsSubMenuText"); //$NON-NLS-1$
    }

    final IMenuManager subMenu = new MenuManager(subMenuTitle);
    subMenu.setRemoveAllWhenShown(true);
    subMenu.addMenuListener(projectsMenuListener);
    subMenu.add(new ConnectToServerAction());
    menuManager.add(subMenu);

    setCheckedItem(menuManager);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:76,代码来源:TeamExplorerControl.java


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