本文整理汇总了Java中org.eclipse.jface.action.ActionContributionItem.setVisible方法的典型用法代码示例。如果您正苦于以下问题:Java ActionContributionItem.setVisible方法的具体用法?Java ActionContributionItem.setVisible怎么用?Java ActionContributionItem.setVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.action.ActionContributionItem
的用法示例。
在下文中一共展示了ActionContributionItem.setVisible方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createWindowMenu
import org.eclipse.jface.action.ActionContributionItem; //导入方法依赖的package包/类
/**
* Creates and returns the Window menu.
*/
private MenuManager createWindowMenu() {
MenuManager menu = new MenuManager(
IDEWorkbenchMessages.Workbench_window,
IWorkbenchActionConstants.M_WINDOW);
menu.add(newWindowAction);
menu.add(newEditorAction);
menu.add(new Separator());
addPerspectiveActions(menu);
menu.add(new Separator());
addKeyboardShortcuts(menu);
Separator sep = new Separator(IWorkbenchActionConstants.MB_ADDITIONS);
sep.setVisible(!Util.isMac());
menu.add(sep);
// See the comment for quit in createFileMenu
ActionContributionItem openPreferencesItem = new ActionContributionItem(
openPreferencesAction);
openPreferencesItem.setVisible(!Util.isMac());
menu.add(openPreferencesItem);
menu.add(ContributionItemFactory.OPEN_WINDOWS.create(getWindow()));
return menu;
}
示例2: createHelpMenu
import org.eclipse.jface.action.ActionContributionItem; //导入方法依赖的package包/类
/**
* Creates and returns the Help menu.
*/
private MenuManager createHelpMenu() {
final MenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_help, IWorkbenchActionConstants.M_HELP);
addSeparatorOrGroupMarker(menu, "group.intro"); //$NON-NLS-1$
menu.add(new GroupMarker("group.intro.ext")); //$NON-NLS-1$
addSeparatorOrGroupMarker(menu, "group.main"); //$NON-NLS-1$
menu.add(helpContentsAction);
addSeparatorOrGroupMarker(menu, "group.assist"); //$NON-NLS-1$
menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));
menu.add(new GroupMarker("group.main.ext")); //$NON-NLS-1$
addSeparatorOrGroupMarker(menu, "group.tutorials"); //$NON-NLS-1$
addSeparatorOrGroupMarker(menu, "group.tools"); //$NON-NLS-1$
addSeparatorOrGroupMarker(menu, "group.updates"); //$NON-NLS-1$
menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
addSeparatorOrGroupMarker(menu, IWorkbenchActionConstants.MB_ADDITIONS);
// about should always be at the bottom
menu.add(new Separator("group.about")); //$NON-NLS-1$
final ActionContributionItem aboutItem = new ActionContributionItem(aboutAction);
aboutItem.setVisible(!Util.isMac());
menu.add(aboutItem);
menu.add(new GroupMarker("group.about.ext")); //$NON-NLS-1$
menu.add(openPreferencesAction);
return menu;
}
示例3: createHelpMenu
import org.eclipse.jface.action.ActionContributionItem; //导入方法依赖的package包/类
/**
* Create the "Help" menu.
*
* @param window
* @return the help MenuManager
*/
protected IMenuManager createHelpMenu() {
IMenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_help, IWorkbenchActionConstants.M_HELP);
menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));
menu.add(new Separator());
menu.add(getGlobalAction(ActionFactory.DYNAMIC_HELP));
menu.add(getGlobalAction(ActionFactory.HELP_CONTENTS));
menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
menu.add(new Separator());
IWorkbenchAction about = getGlobalAction(ActionFactory.ABOUT);
ActionContributionItem aboutItem = new ActionContributionItem(about);
menu.add(aboutItem);
if (Platform.OS_MACOSX.equals(Platform.getOS())) {
aboutItem.setVisible(false);
}
return menu;
}
示例4: createHelpMenu
import org.eclipse.jface.action.ActionContributionItem; //导入方法依赖的package包/类
/**
* Creates and returns the Help menu.
*/
private MenuManager createHelpMenu() {
MenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_help,
IWorkbenchActionConstants.M_HELP);
addSeparatorOrGroupMarker(menu, "group.intro"); //$NON-NLS-1$
// See if a welcome or intro page is specified
if (introAction != null) {
menu.add(introAction);
} else if (quickStartAction != null) {
menu.add(quickStartAction);
}
menu.add(new GroupMarker("group.intro.ext")); //$NON-NLS-1$
addSeparatorOrGroupMarker(menu, "group.main"); //$NON-NLS-1$
menu.add(helpContentsAction);
menu.add(helpSearchAction);
menu.add(dynamicHelpAction);
addSeparatorOrGroupMarker(menu, "group.assist"); //$NON-NLS-1$
// See if a tips and tricks page is specified
if (tipsAndTricksAction != null) {
menu.add(tipsAndTricksAction);
}
// HELP_START should really be the first item, but it was after
// quickStartAction and tipsAndTricksAction in 2.1.
menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));
menu.add(new GroupMarker("group.main.ext")); //$NON-NLS-1$
addSeparatorOrGroupMarker(menu, "group.tutorials"); //$NON-NLS-1$
addSeparatorOrGroupMarker(menu, "group.tools"); //$NON-NLS-1$
addSeparatorOrGroupMarker(menu, "group.updates"); //$NON-NLS-1$
menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
addSeparatorOrGroupMarker(menu, IWorkbenchActionConstants.MB_ADDITIONS);
// about should always be at the bottom
menu.add(new Separator("group.about")); //$NON-NLS-1$
ActionContributionItem aboutItem = new ActionContributionItem(
aboutAction);
aboutItem.setVisible(!Util.isMac());
menu.add(aboutItem);
menu.add(new GroupMarker("group.about.ext")); //$NON-NLS-1$
return menu;
}
示例5: registerToolbarAction
import org.eclipse.jface.action.ActionContributionItem; //导入方法依赖的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);
}
}
示例6: createWindowMenu
import org.eclipse.jface.action.ActionContributionItem; //导入方法依赖的package包/类
/**
* Create the "Window" menu.
* file/new
* @return
*/
protected IMenuManager createWindowMenu() {
IWorkbenchWindow window = getWindow();
MenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_window, IWorkbenchActionConstants.M_WINDOW);
menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS+"2"));
menu.add(new Separator());
MenuManager perspectiveMenu = new MenuManager("Open Perspective", "openPerspective");
IContributionItem perspectiveList = ContributionItemFactory.PERSPECTIVES_SHORTLIST.create(window);
perspectiveMenu.add(perspectiveList);
menu.add(perspectiveMenu);
MenuManager viewMenu = new MenuManager("Show View", "showView");
IContributionItem viewList = ContributionItemFactory.VIEWS_SHORTLIST.create(window);
viewMenu.add(viewList);
menu.add(viewMenu);
menu.add(ActionFactory.RESET_PERSPECTIVE.create(window));
menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
IWorkbenchAction newWindowAction = ActionFactory.OPEN_NEW_WINDOW.create(window);
newWindowAction.setText("New Window");
menu.add(newWindowAction);
IWorkbenchAction preferences = ActionFactory.PREFERENCES.create(window);
String oldText = preferences.getText();
if (!oldText.contains("...")) {
preferences.setText(oldText+"...");
}
ActionContributionItem preferenceItem = new ActionContributionItem(preferences);
menu.add(preferenceItem);
if (Platform.OS_MACOSX.equals(Platform.getOS())) {
preferenceItem.setVisible(false);
}
menu.add(ContributionItemFactory.OPEN_WINDOWS.create(window));
return menu;
}
示例7: createToolItems
import org.eclipse.jface.action.ActionContributionItem; //导入方法依赖的package包/类
/**
* Overriden to create a "smart" button in the viewer's pane control bar.
* <p>
* Clients can override this method and are free to decide whether they want to call
* the inherited method.
*
* @param toolBarManager the toolbar manager for which to add the buttons
*/
@Override
protected void createToolItems(ToolBarManager toolBarManager) {
super.createToolItems(toolBarManager);
IAction a= new ChangePropertyAction(getBundle(), getCompareConfiguration(), "action.Smart.", SMART); //$NON-NLS-1$
fSmartActionItem= new ActionContributionItem(a);
fSmartActionItem.setVisible(fThreeWay);
toolBarManager.appendToGroup("modes", fSmartActionItem); //$NON-NLS-1$
}
示例8: createFileMenu
import org.eclipse.jface.action.ActionContributionItem; //导入方法依赖的package包/类
/**
* Creates and returns the File menu.
*/
private MenuManager createFileMenu() {
MenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_file,
IWorkbenchActionConstants.M_FILE);
menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START));
{
// create the New submenu, using the same id for it as the New
// action
String newText = IDEWorkbenchMessages.Workbench_new;
String newId = ActionFactory.NEW.getId();
MenuManager newMenu = new MenuManager(newText, newId);
newMenu.setActionDefinitionId("org.eclipse.ui.file.newQuickMenu"); //$NON-NLS-1$
newMenu.add(new Separator(newId));
this.newWizardMenu = new NewWizardMenu(getWindow());
newMenu.add(this.newWizardMenu);
newMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
menu.add(newMenu);
}
menu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));
menu.add(new Separator());
menu.add(closeAction);
menu.add(closeAllAction);
// menu.add(closeAllSavedAction);
menu.add(new GroupMarker(IWorkbenchActionConstants.CLOSE_EXT));
menu.add(new Separator());
menu.add(saveAction);
menu.add(saveAsAction);
menu.add(saveAllAction);
menu.add(getRevertItem());
menu.add(new Separator());
menu.add(getMoveItem());
menu.add(getRenameItem());
menu.add(getRefreshItem());
menu.add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT));
menu.add(new Separator());
menu.add(getPrintItem());
menu.add(new GroupMarker(IWorkbenchActionConstants.PRINT_EXT));
menu.add(new Separator());
menu.add(switchWorkspaceAction);
menu.add(new GroupMarker(IWorkbenchActionConstants.OPEN_EXT));
menu.add(new Separator());
menu.add(importResourcesAction);
menu.add(exportResourcesAction);
menu.add(new GroupMarker(IWorkbenchActionConstants.IMPORT_EXT));
menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
menu.add(new Separator());
menu.add(getPropertiesItem());
menu.add(ContributionItemFactory.REOPEN_EDITORS.create(getWindow()));
menu.add(new GroupMarker(IWorkbenchActionConstants.MRU));
menu.add(new Separator());
// If we're on OS X we shouldn't show this command in the File menu. It
// should be invisible to the user. However, we should not remove it -
// the carbon UI code will do a search through our menu structure
// looking for it when Cmd-Q is invoked (or Quit is chosen from the
// application menu.
ActionContributionItem quitItem = new ActionContributionItem(quitAction);
quitItem.setVisible(!Util.isMac());
menu.add(quitItem);
menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));
return menu;
}
示例9: createFileMenu
import org.eclipse.jface.action.ActionContributionItem; //导入方法依赖的package包/类
/**
* Creates and returns the File menu.
*/
private MenuManager createFileMenu() {
final MenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_file, IWorkbenchActionConstants.M_FILE);
menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START));
{
// create the New submenu, using the same id for it as the New action
final String newText = IDEWorkbenchMessages.Workbench_new;
final String newId = ActionFactory.NEW.getId();
final MenuManager newMenu = new MenuManager(newText, newId);
newMenu.setActionDefinitionId("org.eclipse.ui.file.newQuickMenu"); //$NON-NLS-1$
newMenu.setImageDescriptor(icons.desc("navigator/navigator.new2"));
newMenu.add(new Separator(newId));
this.newWizardMenu = new BaseNewWizardMenu(getWindow(), null) {
@Override
protected void addItems(final List list) {
addShortcuts(list);
}
};
newMenu.add(this.newWizardMenu);
newMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
menu.add(newMenu);
}
menu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));
menu.add(new Separator());
menu.add(closeAction);
menu.add(closeAllAction);
menu.add(new GroupMarker(IWorkbenchActionConstants.CLOSE_EXT));
menu.add(new Separator());
menu.add(saveAction);
menu.add(saveAsAction);
menu.add(saveAllAction);
// menu.add(getRevertItem());
menu.add(new Separator());
menu.add(getMoveItem());
menu.add(getRenameItem());
menu.add(getRefreshItem());
menu.add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT));
menu.add(new Separator());
menu.add(getPrintItem());
menu.add(new GroupMarker(IWorkbenchActionConstants.PRINT_EXT));
menu.add(new Separator());
menu.add(openWorkspaceAction);
menu.add(new GroupMarker(IWorkbenchActionConstants.OPEN_EXT));
menu.add(new GroupMarker(IWorkbenchActionConstants.IMPORT_EXT));
menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
menu.add(new Separator());
menu.add(getPropertiesItem());
menu.add(ContributionItemFactory.REOPEN_EDITORS.create(getWindow()));
menu.add(new GroupMarker(IWorkbenchActionConstants.MRU));
menu.add(new Separator());
// If we're on OS X we shouldn't show this command in the File menu. It
// should be invisible to the user. However, we should not remove it -
// the carbon UI code will do a search through our menu structure
// looking for it when Cmd-Q is invoked (or Quit is chosen from the
// application menu.
final ActionContributionItem quitItem = new ActionContributionItem(quitAction);
quitItem.setVisible(!Util.isMac());
menu.add(quitItem);
menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));
return menu;
}
示例10: createFileMenu
import org.eclipse.jface.action.ActionContributionItem; //导入方法依赖的package包/类
/**
* Creates and returns the File menu.
*/
private MenuManager createFileMenu()
{
MenuManager menu =
new MenuManager(IDEWorkbenchMessages.Workbench_file,
IWorkbenchActionConstants.M_FILE);
menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START));
// create the New submenu, using the same id for it as the New action
String newText = IDEWorkbenchMessages.Workbench_new;
String newId = ActionFactory.NEW.getId();
MenuManager newMenu = new MenuManager(newText, newId);
newMenu.setActionDefinitionId("org.eclipse.ui.file.newQuickMenu"); //$NON-NLS-1$
newMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
menu.add(newMenu);
menu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));
menu.add(new Separator());
menu.add(closeAction);
menu.add(closeAllAction);
// menu.add(closeAllSavedAction);
menu.add(new GroupMarker(IWorkbenchActionConstants.CLOSE_EXT));
menu.add(new Separator());
menu.add(saveAction);
menu.add(saveAsAction);
menu.add(saveAllAction);
menu.add(getRevertItem());
menu.add(new Separator());
menu.add(getMoveItem());
menu.add(getRenameItem());
menu.add(getRefreshItem());
menu.add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT));
menu.add(new Separator());
menu.add(getPrintItem());
menu.add(new GroupMarker(IWorkbenchActionConstants.PRINT_EXT));
menu.add(new Separator());
menu.add(openWorkspaceAction);
menu.add(new GroupMarker(IWorkbenchActionConstants.OPEN_EXT));
menu.add(new Separator());
menu.add(getPropertiesItem());
menu.add(ContributionItemFactory.REOPEN_EDITORS.create(getWindow()));
menu.add(new GroupMarker(IWorkbenchActionConstants.MRU));
menu.add(new Separator());
// If we're on OS X we shouldn't show this command in the File menu. It
// should be invisible to the user. However, we should not remove it -
// the carbon UI code will do a search through our menu structure
// looking for it when Cmd-Q is invoked (or Quit is chosen from the
// application menu.
ActionContributionItem quitItem = new ActionContributionItem(quitAction);
quitItem.setVisible(!Util.isMac());
menu.add(quitItem);
menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));
return menu;
}
示例11: createHelpMenu
import org.eclipse.jface.action.ActionContributionItem; //导入方法依赖的package包/类
/**
* Creates and returns the Help menu.
*/
private MenuManager createHelpMenu()
{
MenuManager menu =
new MenuManager(IDEWorkbenchMessages.Workbench_help,
IWorkbenchActionConstants.M_HELP);
addSeparatorOrGroupMarker(menu, "group.intro"); //$NON-NLS-1$
// See if a welcome or intro page is specified
if (introAction != null)
{
menu.add(introAction);
}
else if (quickStartAction != null)
{
menu.add(quickStartAction);
}
menu.add(new GroupMarker("group.intro.ext")); //$NON-NLS-1$
addSeparatorOrGroupMarker(menu, "group.main"); //$NON-NLS-1$
menu.add(helpContentsAction);
menu.add(helpSearchAction);
menu.add(dynamicHelpAction);
addSeparatorOrGroupMarker(menu, "group.assist"); //$NON-NLS-1$
// See if a tips and tricks page is specified
if (tipsAndTricksAction != null)
{
menu.add(tipsAndTricksAction);
}
// HELP_START should really be the first item, but it was after
// quickStartAction and tipsAndTricksAction in 2.1.
menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));
menu.add(new GroupMarker("group.main.ext")); //$NON-NLS-1$
addSeparatorOrGroupMarker(menu, "group.tutorials"); //$NON-NLS-1$
addSeparatorOrGroupMarker(menu, "group.tools"); //$NON-NLS-1$
addSeparatorOrGroupMarker(menu, "group.updates"); //$NON-NLS-1$
menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
addSeparatorOrGroupMarker(menu, IWorkbenchActionConstants.MB_ADDITIONS);
// about should always be at the bottom
menu.add(new Separator("group.about")); //$NON-NLS-1$
ActionContributionItem aboutItem = new ActionContributionItem(aboutAction);
aboutItem.setVisible(!Util.isMac());
menu.add(aboutItem);
menu.add(new GroupMarker("group.about.ext")); //$NON-NLS-1$
return menu;
}
示例12: makeActions
import org.eclipse.jface.action.ActionContributionItem; //导入方法依赖的package包/类
@Override
protected void makeActions(final IWorkbenchWindow window) {
final boolean isOSX = "carbon".equals(SWT.getPlatform());//$NON-NLS-1$
_window = window;
_personContribItem = new PersonContributionItem();
_actionTourFilter = new ActionTourFilter();
_tourTypeContribItem = new TourTypeContributionItem();
_measurementContribItem = new MeasurementSystemContributionItem();
_actionQuit = ActionFactory.QUIT.create(window);
register(_actionQuit);
_actionAbout = ActionFactory.ABOUT.create(window);
_actionAbout.setText(Messages.App_Action_About);
register(_actionAbout);
_actionPreferences = ActionFactory.PREFERENCES.create(window);
_actionPreferences.setText(Messages.App_Action_open_preferences);
_actionPreferences.setImageDescriptor(TourbookPlugin.getImageDescriptor(Messages.Image__options));
register(_actionPreferences);
_actionOtherViews = new ActionOtherViews(window);
// _actionEditActionSets = ActionFactory.EDIT_ACTION_SETS.create(window);
_actionSavePerspective = ActionFactory.SAVE_PERSPECTIVE.create(window);
_actionResetPerspective = ActionFactory.RESET_PERSPECTIVE.create(window);
_actionClosePerspective = ActionFactory.CLOSE_PERSPECTIVE.create(window);
_actionCloseAllPerspective = ActionFactory.CLOSE_ALL_PERSPECTIVES.create(window);
// register(_actionEditActionSets);
register(_actionSavePerspective);
register(_actionResetPerspective);
register(_actionClosePerspective);
register(_actionCloseAllPerspective);
/*
* If we're on OS X we shouldn't show this command in the File menu. It should be invisible
* to the user. However, we should not remove it - the carbon UI code will do a search
* through our menu structure looking for it when Cmd-Q is invoked (or Quit is chosen from
* the application menu.
*/
_quitItem = new ActionContributionItem(_actionQuit);
_quitItem.setVisible(!isOSX);
_prefItem = new ActionContributionItem(_actionPreferences);
_prefItem.setVisible(!isOSX);
}