diff --git a/rse/plugins/org.eclipse.rse.shells.ui/META-INF/MANIFEST.MF b/rse/plugins/org.eclipse.rse.shells.ui/META-INF/MANIFEST.MF index b680406e3fa..f2d0d71c7a6 100644 --- a/rse/plugins/org.eclipse.rse.shells.ui/META-INF/MANIFEST.MF +++ b/rse/plugins/org.eclipse.rse.shells.ui/META-INF/MANIFEST.MF @@ -19,7 +19,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.rse.subsystems.shells.core;bundle-version="[3.0.0,4.0.0)", org.eclipse.rse.subsystems.files.core;bundle-version="[3.0.0,4.0.0)", org.eclipse.rse.core;bundle-version="[3.0.0,4.0.0)", - org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)" + org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)", + org.eclipse.core.expressions Bundle-ActivationPolicy: lazy Eclipse-LazyStart: true Export-Package: org.eclipse.rse.internal.shells.ui;x-internal:=true, diff --git a/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/ShellResources.properties b/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/ShellResources.properties index b451f625fc5..5939cab34b4 100644 --- a/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/ShellResources.properties +++ b/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/ShellResources.properties @@ -13,6 +13,7 @@ # # Contributors: # David McKnight (IBM) - [216252] [nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible +# Radoslav Gerganov (ProSyst) - [181563] Fix hardcoded Ctrl+Space for remote shell content assist ############################################################################### # NLS_MESSAGEFORMAT_VAR @@ -95,7 +96,4 @@ MSG_UCMD_INVOCATION_EMPTY = The invocation may not be blank MSG_OPERATION_RUNNING = {0} - Running MSG_OPERATION_FINISHED = {0} - Finished -ACTION_CONTENT_ASSIST=Content Assist@Ctrl+SPACE - - - +ACTION_CONTENT_ASSIST=Content Assist diff --git a/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/view/CommandsViewPage.java b/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/view/CommandsViewPage.java index 119da142ba9..13beb84b116 100644 --- a/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/view/CommandsViewPage.java +++ b/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/view/CommandsViewPage.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. + * 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 @@ -18,8 +18,9 @@ * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry - * Kevin Doyle (IBM) - [212940] Duplicate Help Context Identifiers - * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible + * Kevin Doyle (IBM) - [212940] Duplicate Help Context Identifiers + * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible + * Radoslav Gerganov (ProSyst) - [181563] Fix hardcoded Ctrl+Space for remote shell content assist ********************************************************************************/ package org.eclipse.rse.internal.shells.ui.view; @@ -537,6 +538,10 @@ FocusListener { return _viewer; } + + SystemCommandEditor getEditor() { + return _inputEntry; + } public void updateOutput() { diff --git a/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/view/SystemCommandsViewPart.java b/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/view/SystemCommandsViewPart.java index 30e3564b897..edc7b379a1a 100644 --- a/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/view/SystemCommandsViewPart.java +++ b/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/view/SystemCommandsViewPart.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. + * 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 @@ -16,8 +16,9 @@ * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API * Martin Oberhuber (Wind River) - [174945] Remove obsolete icons from rse.shells.ui * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() - * David McKnight (IBM) - [165680] "Show in Remote Shell View" does not work - * Kevin Doyle (IBM) - [198534] Shell Menu Enablement Issue's + * David McKnight (IBM) - [165680] "Show in Remote Shell View" does not work + * Kevin Doyle (IBM) - [198534] Shell Menu Enablement Issue's + * Radoslav Gerganov (ProSyst) - [181563] Fix hardcoded Ctrl+Space for remote shell content assist ********************************************************************************/ package org.eclipse.rse.internal.shells.ui.view; @@ -36,7 +37,9 @@ 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.commands.ActionHandler; import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.SelectionChangedEvent; @@ -54,6 +57,7 @@ import org.eclipse.rse.internal.shells.ui.actions.SystemBaseShellAction; import org.eclipse.rse.internal.ui.SystemResources; import org.eclipse.rse.services.clientserver.messages.SystemMessage; import org.eclipse.rse.shells.ui.RemoteCommandHelpers; +import org.eclipse.rse.shells.ui.view.SystemCommandEditor; import org.eclipse.rse.shells.ui.view.SystemViewRemoteOutputAdapter; import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem; @@ -78,8 +82,10 @@ import org.eclipse.ui.IActionBars; import org.eclipse.ui.ISelectionListener; import org.eclipse.ui.ISelectionService; import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.handlers.IHandlerService; import org.eclipse.ui.part.CellEditorActionHandler; import org.eclipse.ui.part.ViewPart; +import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; /** * This is the desktop view wrapper of the System View viewer. @@ -132,8 +138,22 @@ public class SystemCommandsViewPart } } - - + /** + * Content assist action for all remote shells. It is activated with + * the default key binding for content assistance used in the workbench. + */ + class ContentAssistAction extends Action { + + public void run() { + if (_folder != null) { + CommandsViewPage currentTabItem = _folder.getCurrentTabItem(); + if (currentTabItem != null) { + SystemCommandEditor editor = currentTabItem.getEditor(); + editor.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS); + } + } + } + } public class ShellAction extends BrowseAction { @@ -321,6 +341,11 @@ public class SystemCommandsViewPart ISelectionService selectionService = getSite().getWorkbenchWindow().getSelectionService(); selectionService.addSelectionListener(this); + IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class); + ContentAssistAction caAction = new ContentAssistAction(); + caAction.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); + // the handler is automatically deactivated in the dispose() method of this view + handlerService.activateHandler(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, new ActionHandler(caAction)); SystemWidgetHelpers.setHelp(_folder, RSEUIPlugin.HELPPREFIX + "ucmd0000"); //$NON-NLS-1$ diff --git a/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/shells/ui/view/SystemCommandEditor.java b/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/shells/ui/view/SystemCommandEditor.java index 8edbbf9c877..b3950b1770e 100644 --- a/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/shells/ui/view/SystemCommandEditor.java +++ b/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/shells/ui/view/SystemCommandEditor.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. + * 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 @@ -14,6 +14,7 @@ * Martin Oberhuber (Wind River) - fix 158765: content assist miss disables enter * David Dykstal (IBM) - [186589] move user types, user actions, and compile commands * API to the user actions plugin + * Radoslav Gerganov (ProSyst) - [181563] Fix hardcoded Ctrl+Space for remote shell content assist ********************************************************************************/ package org.eclipse.rse.shells.ui.view; @@ -37,7 +38,6 @@ import org.eclipse.jface.text.ITextOperationTarget; import org.eclipse.jface.text.ITextViewer; import org.eclipse.jface.text.IWidgetTokenKeeper; import org.eclipse.jface.text.TextEvent; -import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.jface.text.source.SourceViewer; import org.eclipse.jface.text.source.SourceViewerConfiguration; import org.eclipse.jface.viewers.ISelectionChangedListener; @@ -46,12 +46,7 @@ import org.eclipse.rse.internal.ui.SystemResources; import org.eclipse.rse.internal.ui.view.SystemViewMenuListener; import org.eclipse.rse.services.clientserver.messages.SystemMessage; import org.eclipse.rse.ui.validators.ISystemValidator; -import org.eclipse.swt.SWT; import org.eclipse.swt.custom.StyledText; -import org.eclipse.swt.custom.VerifyKeyListener; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.VerifyEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -143,44 +138,6 @@ public class SystemCommandEditor extends SourceViewer fireModifyEvents(cmdText, errorMessage); } }); - getTextWidget().addKeyListener(new KeyAdapter() - { - public void keyReleased(KeyEvent e) - { - - if (!e.doit) - return; - - if (e.stateMask == SWT.CTRL) - { - // DKM - using this now since SWT isn't providing statemask with verify key events - switch (e.character) - { - case ' ' : - //bug 158765: enter may be disabled only when the widget is shown, - //not if content assist is requested (since results may be empty) - //setInCodeAssist(true); - doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS); - //e.doit = false; - break; - - case 'z' - 'a' + 1 : - // CTRL-Z - doOperation(ITextOperationTarget.UNDO); - //e.doit = false; - break; - } - } - - } - }); - prependVerifyKeyListener(new VerifyKeyListener() - { - public void verifyKey(VerifyEvent event) - { - handleVerifyKeyPressed(event); - } - }); initializeActions(); } public String getCommandText() @@ -257,8 +214,8 @@ public class SystemCommandEditor extends SourceViewer menu.appendToGroup( ITextEditorActionConstants.GROUP_EDIT, (IAction) fGlobalActions.get(ITextEditorActionConstants.SELECT_ALL)); - menu.add(new Separator("group.generate")); //$NON-NLS-1$ - menu.appendToGroup("group.generate", (IAction) fGlobalActions.get("ContentAssistProposal")); //$NON-NLS-1$ //$NON-NLS-2$ + menu.add(new Separator(ITextEditorActionConstants.GROUP_GENERATE)); + menu.appendToGroup(ITextEditorActionConstants.GROUP_GENERATE, (IAction) fGlobalActions.get("ContentAssistProposal")); //$NON-NLS-1$ } private IActionBars getActionBars() { @@ -303,7 +260,6 @@ public class SystemCommandEditor extends SourceViewer _caAction.setEnabled(true); fGlobalActions.put("ContentAssistProposal", _caAction); //$NON-NLS-1$ - setActionHandlers(); fSelectionActions.add(ITextEditorActionConstants.CUT); @@ -379,32 +335,6 @@ public class SystemCommandEditor extends SourceViewer ((IUpdate) action).update(); } } - private void handleVerifyKeyPressed(VerifyEvent event) - { - if (!event.doit) - return; - - // DKM - moved to key press handler since for some reason SWT doesn't provide statemask anymore - /* - if (event.character == 0 && (event.keyCode & SWT.KEYCODE_BIT) == 0) - { - return; - } - switch (event.character) - { - case ' ' : - doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS); - event.doit = false; - break; - // CTRL-Z - case (int) 'z' - (int) 'a' + 1 : - doOperation(ITextOperationTarget.UNDO); - event.doit = false; - break; - } - */ - } - public void setInCodeAssist(boolean flag) {