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

[187058] Incorrect Right Click Menu in Remote System Details View with no selection

This commit is contained in:
David McKnight 2008-05-20 16:54:25 +00:00
parent 4f6ac96a13
commit 5234f4a896

View file

@ -21,6 +21,7 @@
* David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading * Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
* Martin Oberhuber (Wind River) - [227516] [regression] Fix ArrayIndexOutOfBoundsException in TableView * Martin Oberhuber (Wind River) - [227516] [regression] Fix ArrayIndexOutOfBoundsException in TableView
* David McKnight (IBM) - [187058] Incorrect Right Click Menu in Remote System Details View with no selection
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui.view; package org.eclipse.rse.ui.view;
@ -38,6 +39,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IContributionItem; import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuListener;
@ -73,6 +75,7 @@ import org.eclipse.rse.internal.ui.SystemResources;
import org.eclipse.rse.internal.ui.actions.SystemCommonDeleteAction; import org.eclipse.rse.internal.ui.actions.SystemCommonDeleteAction;
import org.eclipse.rse.internal.ui.actions.SystemCommonRenameAction; import org.eclipse.rse.internal.ui.actions.SystemCommonRenameAction;
import org.eclipse.rse.internal.ui.actions.SystemCommonSelectAllAction; import org.eclipse.rse.internal.ui.actions.SystemCommonSelectAllAction;
import org.eclipse.rse.internal.ui.actions.SystemImportConnectionAction;
import org.eclipse.rse.internal.ui.actions.SystemOpenExplorerPerspectiveAction; import org.eclipse.rse.internal.ui.actions.SystemOpenExplorerPerspectiveAction;
import org.eclipse.rse.internal.ui.actions.SystemShowInTableAction; import org.eclipse.rse.internal.ui.actions.SystemShowInTableAction;
import org.eclipse.rse.internal.ui.actions.SystemSubMenuManager; import org.eclipse.rse.internal.ui.actions.SystemSubMenuManager;
@ -97,6 +100,7 @@ import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemBasePlugin; import org.eclipse.rse.ui.SystemBasePlugin;
import org.eclipse.rse.ui.SystemMenuManager; import org.eclipse.rse.ui.SystemMenuManager;
import org.eclipse.rse.ui.actions.ISystemAction; import org.eclipse.rse.ui.actions.ISystemAction;
import org.eclipse.rse.ui.actions.SystemNewConnectionAction;
import org.eclipse.rse.ui.actions.SystemRefreshAction; import org.eclipse.rse.ui.actions.SystemRefreshAction;
import org.eclipse.rse.ui.messages.ISystemMessageLine; import org.eclipse.rse.ui.messages.ISystemMessageLine;
import org.eclipse.rse.ui.messages.SystemMessageDialog; import org.eclipse.rse.ui.messages.SystemMessageDialog;
@ -257,6 +261,8 @@ public class SystemTableView
// these variables were copied from SystemView to allow for limited support // these variables were copied from SystemView to allow for limited support
// of actions. I say limited because somethings don't yet work properly. // of actions. I say limited because somethings don't yet work properly.
private SystemNewConnectionAction _newConnectionAction;
private SystemImportConnectionAction _importConnectionAction;
protected SystemRefreshAction _refreshAction; protected SystemRefreshAction _refreshAction;
protected PropertyDialogAction _propertyDialogAction; protected PropertyDialogAction _propertyDialogAction;
private SystemOpenExplorerPerspectiveAction _openToPerspectiveAction; private SystemOpenExplorerPerspectiveAction _openToPerspectiveAction;
@ -1406,6 +1412,30 @@ public class SystemTableView
_refreshAction = new SystemRefreshAction(getShell()); _refreshAction = new SystemRefreshAction(getShell());
return _refreshAction; return _refreshAction;
} }
/**
* Rather than pre-defining this common action we wait until it is first needed,
* for performance reasons.
*/
public IAction getNewConnectionAction() {
if (_newConnectionAction == null) _newConnectionAction = new SystemNewConnectionAction(getShell(), true, this); // true=>from popup menu
return _newConnectionAction;
}
/**
* Rather than pre-defining this common action we wait until it is first needed,
* for performance reasons.
*/
private IAction getImportConnectionAction() {
if (_importConnectionAction == null) {
_importConnectionAction = new SystemImportConnectionAction(); // true=>from popup menu
_importConnectionAction.setShell(getShell());
_importConnectionAction.setText(SystemResources.RESID_IMPORT_CONNECTION_LABEL_LONG);
}
return _importConnectionAction;
}
/* /*
* Get the common "Open to->" action for opening a new Remote System Explorer view, * Get the common "Open to->" action for opening a new Remote System Explorer view,
* scoped to the currently selected object. * scoped to the currently selected object.
@ -1752,8 +1782,6 @@ public class SystemTableView
public void menuAboutToShow(IMenuManager manager) public void menuAboutToShow(IMenuManager manager)
{ {
SystemView.createStandardGroups(manager);
fillContextMenu(manager); fillContextMenu(manager);
if (!menuListenerAdded) if (!menuListenerAdded)
@ -1794,9 +1822,16 @@ public class SystemTableView
public void fillContextMenu(IMenuManager menu) public void fillContextMenu(IMenuManager menu)
{ {
IStructuredSelection selection = (IStructuredSelection) getSelection(); IStructuredSelection selection = (IStructuredSelection) getSelection();
Object firstIn = selection.getFirstElement();
if (firstIn instanceof ISystemRegistry)
{ {
menu.add(getNewConnectionAction());
menu.add(getImportConnectionAction());
menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_ADDITIONS)); // user or BP/ISV additions
}
else
{
SystemView.createStandardGroups(menu);
// ADD COMMON ACTIONS... // ADD COMMON ACTIONS...
// no need for refresh of object in table // no need for refresh of object in table
menu.appendToGroup(ISystemContextMenuConstants.GROUP_BUILD, getRefreshAction()); menu.appendToGroup(ISystemContextMenuConstants.GROUP_BUILD, getRefreshAction());