1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-03 07:05:24 +02:00

[186769] Enable Contributions to Drop Down menu of Remote Systems view -> Preferences

This commit is contained in:
Kevin Doyle 2008-07-18 05:26:07 +00:00
parent a43b36bb7f
commit b02b8e46f3
3 changed files with 15 additions and 117 deletions

View file

@ -1,114 +0,0 @@
/*******************************************************************************
* Copyright (c) 2002, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* Martin Oberhuber (Wind River) - [225506] Move Move RSEUIPlugin#getShowPreferencePageActions() to internal
*******************************************************************************/
package org.eclipse.rse.internal.ui.actions;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.rse.internal.ui.SystemResources;
import org.eclipse.rse.ui.ISystemContextMenuConstants;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.actions.SystemBaseAction;
import org.eclipse.rse.ui.actions.SystemBaseSubMenuAction;
import org.eclipse.swt.widgets.Shell;
/**
* A cascading menu action for "Preferences->".
* @see org.eclipse.rse.internal.ui.actions.SystemShowPreferencesPageAction
*/
public class SystemCascadingPreferencesAction
extends SystemBaseSubMenuAction implements IMenuListener
{
private static SystemShowPreferencesPageAction[] showPrefPageActions = null;
/**
* Constructor
*/
public SystemCascadingPreferencesAction(Shell shell)
{
super(SystemResources.ACTION_CASCADING_PREFERENCES_LABEL, SystemResources.ACTION_CASCADING_PREFERENCES_TOOLTIP, shell);
setMenuID(ISystemContextMenuConstants.MENU_PREFERENCES);
setCreateMenuEachTime(false);
setPopulateMenuEachTime(false);
setSelectionSensitive(false);
setHelp(RSEUIPlugin.HELPPREFIX+"actnpref"); //$NON-NLS-1$
}
/**
* Return an array of action objects to show for the "Preferences..."
* submenu of the RSE System View. For contributing a fastpath action to
* jump to your preferences page, from the local pulldown menu of the Remote
* Systems view. This may return null if no such actions are registered.
*
* @deprecated will be moved to using command/hander extension point as per
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=186769
*/
public SystemShowPreferencesPageAction[] getShowPreferencePageActions() {
if (showPrefPageActions == null) {
// add our own preferences page action hardcoded
SystemShowPreferencesPageAction action = new SystemShowPreferencesPageAction();
action.setPreferencePageID("org.eclipse.rse.ui.preferences.RemoteSystemsPreferencePage"); //$NON-NLS-1$
// action.setPreferencePageCategory(preferencePageCategory)
// action.setImageDescriptor(id);
action.setText(SystemResources.ACTION_SHOW_PREFERENCEPAGE_LABEL);
action.setToolTipText(SystemResources.ACTION_SHOW_PREFERENCEPAGE_TOOLTIP);
action.setHelp("org.eclipse.rse.ui.aprefrse"); //$NON-NLS-1$
showPrefPageActions = new SystemShowPreferencesPageAction[1];
showPrefPageActions[0] = action;
}
return showPrefPageActions;
}
/**
* @see SystemBaseSubMenuAction#getSubMenu()
*/
public IMenuManager populateSubMenu(IMenuManager ourSubMenu)
{
// WE DON'T WANT TO FIRE UP ALL PLUGINS THAT USE OUR EXTENSION POINT,
// AT THE TIEM WE ARE CREATING OUR VIEW! SO WE DEFER IT UNTIL THIS CASCADING
// MENU IS FIRST EXPANDED...
ourSubMenu.addMenuListener(this);
ourSubMenu.setRemoveAllWhenShown(true);
//menu.setEnabled(true);
ourSubMenu.add(new SystemBaseAction("dummy",null)); //$NON-NLS-1$
return ourSubMenu;
}
/**
* Called when submenu is about to show
*/
public void menuAboutToShow(IMenuManager ourSubMenu)
{
//System.out.println("In menuAboutToShow!");
setBusyCursor(true);
ourSubMenu.add(new Separator(ISystemContextMenuConstants.GROUP_ADDITIONS)); // user or BP/ISV additions
SystemShowPreferencesPageAction[] prefPageActions = getShowPreferencePageActions();
if (prefPageActions!=null)
{
for (int idx=0; idx<prefPageActions.length; idx++)
{
prefPageActions[idx].setShell(getShell());
ourSubMenu.appendToGroup(ISystemContextMenuConstants.GROUP_ADDITIONS, prefPageActions[idx]);
}
}
setBusyCursor(false);
}
}

View file

@ -12,6 +12,7 @@
*
* Contributors:
* Martin Oberhuber (Wind River) - [185552] Remove remoteSystemsViewPreferencesActions extension point
* Kevin Doyle (IBM) - [186769] Enable Contributions to Drop Down menu of Remote Systems view -> Preferences
********************************************************************************/
package org.eclipse.rse.internal.ui.actions;
@ -127,6 +128,7 @@ public class SystemShowPreferencesPageAction extends SystemBaseAction implements
if (pm != null)
{
shell = RSEUIPlugin.getTheSystemRegistryUI().getShell();
PreferenceDialog d = new WorkbenchPreferenceDialog(shell, pm);
d.create();
// TODO - hack to make this work in 3.1

View file

@ -31,6 +31,7 @@
* David Dykstal (IBM) - [226728] NPE during init with clean workspace
* David McKnight (IBM) - [225747] [dstore] Trying to connect to an "Offline" system throws an NPE
* David Dykstal (IBM) - [216858] Need the ability to Import/Export RSE connections for sharing
* Kevin Doyle (IBM) - [186769] Enable Contributions to Drop Down menu of Remote Systems view -> Preferences
*******************************************************************************/
package org.eclipse.rse.internal.ui.view;
@ -53,6 +54,7 @@ import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.DoubleClickEvent;
@ -84,12 +86,12 @@ import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.internal.core.RSEInitJob;
import org.eclipse.rse.internal.ui.SystemResources;
import org.eclipse.rse.internal.ui.actions.SystemCascadingPreferencesAction;
import org.eclipse.rse.internal.ui.actions.SystemCollapseAllAction;
import org.eclipse.rse.internal.ui.actions.SystemImportConnectionAction;
import org.eclipse.rse.internal.ui.actions.SystemPreferenceQualifyConnectionNamesAction;
import org.eclipse.rse.internal.ui.actions.SystemPreferenceRestoreStateAction;
import org.eclipse.rse.internal.ui.actions.SystemPreferenceShowFilterPoolsAction;
import org.eclipse.rse.internal.ui.actions.SystemShowPreferencesPageAction;
import org.eclipse.rse.internal.ui.actions.SystemWorkWithProfilesAction;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemContextMenuConstants;
@ -679,8 +681,16 @@ public class SystemViewPart
// Now display any contributed action shortcuts for bringing up
// a particular preference page...
SystemCascadingPreferencesAction preferencesAction = new SystemCascadingPreferencesAction(shell);
menuMgr.add(preferencesAction.getSubMenu());
MenuManager subMenu = new MenuManager(SystemResources.ACTION_CASCADING_PREFERENCES_LABEL, ISystemContextMenuConstants.MENU_PREFERENCES);
menuMgr.add(subMenu);
SystemShowPreferencesPageAction action = new SystemShowPreferencesPageAction();
action.setPreferencePageID("org.eclipse.rse.ui.preferences.RemoteSystemsPreferencePage"); //$NON-NLS-1$
action.setText(SystemResources.ACTION_SHOW_PREFERENCEPAGE_LABEL);
action.setToolTipText(SystemResources.ACTION_SHOW_PREFERENCEPAGE_TOOLTIP);
action.setHelp("org.eclipse.rse.ui.aprefrse"); //$NON-NLS-1$
subMenu.add(action);
subMenu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_ADDITIONS));
SystemViewMenuListener menuListener = new SystemViewMenuListener(true); // true says this is a persistent menu
if (viewPart instanceof ISystemMessageLine)