Lines 1-5
Link Here
|
1 |
/******************************************************************************** |
1 |
/******************************************************************************** |
2 |
* Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. |
2 |
* Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved. |
3 |
* This program and the accompanying materials are made available under the terms |
3 |
* This program and the accompanying materials are made available under the terms |
4 |
* of the Eclipse Public License v1.0 which accompanies this distribution, and is |
4 |
* of the Eclipse Public License v1.0 which accompanies this distribution, and is |
5 |
* available at http://www.eclipse.org/legal/epl-v10.html |
5 |
* available at http://www.eclipse.org/legal/epl-v10.html |
Lines 14-19
Link Here
|
14 |
* Martin Oberhuber (Wind River) - fix 158765: content assist miss disables enter |
14 |
* Martin Oberhuber (Wind River) - fix 158765: content assist miss disables enter |
15 |
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands |
15 |
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands |
16 |
* API to the user actions plugin |
16 |
* API to the user actions plugin |
|
|
17 |
* Radoslav Gerganov (ProSyst) - [181563] DBCS3.3: Hardcoded "Ctrl + Space" for content assist function of remote shell |
17 |
********************************************************************************/ |
18 |
********************************************************************************/ |
18 |
|
19 |
|
19 |
package org.eclipse.rse.shells.ui.view; |
20 |
package org.eclipse.rse.shells.ui.view; |
Lines 37-43
Link Here
|
37 |
import org.eclipse.jface.text.ITextViewer; |
38 |
import org.eclipse.jface.text.ITextViewer; |
38 |
import org.eclipse.jface.text.IWidgetTokenKeeper; |
39 |
import org.eclipse.jface.text.IWidgetTokenKeeper; |
39 |
import org.eclipse.jface.text.TextEvent; |
40 |
import org.eclipse.jface.text.TextEvent; |
40 |
import org.eclipse.jface.text.source.ISourceViewer; |
|
|
41 |
import org.eclipse.jface.text.source.SourceViewer; |
41 |
import org.eclipse.jface.text.source.SourceViewer; |
42 |
import org.eclipse.jface.text.source.SourceViewerConfiguration; |
42 |
import org.eclipse.jface.text.source.SourceViewerConfiguration; |
43 |
import org.eclipse.jface.viewers.ISelectionChangedListener; |
43 |
import org.eclipse.jface.viewers.ISelectionChangedListener; |
Lines 46-57
Link Here
|
46 |
import org.eclipse.rse.internal.ui.view.SystemViewMenuListener; |
46 |
import org.eclipse.rse.internal.ui.view.SystemViewMenuListener; |
47 |
import org.eclipse.rse.services.clientserver.messages.SystemMessage; |
47 |
import org.eclipse.rse.services.clientserver.messages.SystemMessage; |
48 |
import org.eclipse.rse.ui.validators.ISystemValidator; |
48 |
import org.eclipse.rse.ui.validators.ISystemValidator; |
49 |
import org.eclipse.swt.SWT; |
|
|
50 |
import org.eclipse.swt.custom.StyledText; |
49 |
import org.eclipse.swt.custom.StyledText; |
51 |
import org.eclipse.swt.custom.VerifyKeyListener; |
|
|
52 |
import org.eclipse.swt.events.KeyAdapter; |
53 |
import org.eclipse.swt.events.KeyEvent; |
54 |
import org.eclipse.swt.events.VerifyEvent; |
55 |
import org.eclipse.swt.layout.GridData; |
50 |
import org.eclipse.swt.layout.GridData; |
56 |
import org.eclipse.swt.widgets.Composite; |
51 |
import org.eclipse.swt.widgets.Composite; |
57 |
import org.eclipse.swt.widgets.Control; |
52 |
import org.eclipse.swt.widgets.Control; |
Lines 143-186
Link Here
|
143 |
fireModifyEvents(cmdText, errorMessage); |
138 |
fireModifyEvents(cmdText, errorMessage); |
144 |
} |
139 |
} |
145 |
}); |
140 |
}); |
146 |
getTextWidget().addKeyListener(new KeyAdapter() |
|
|
147 |
{ |
148 |
public void keyReleased(KeyEvent e) |
149 |
{ |
150 |
|
151 |
if (!e.doit) |
152 |
return; |
153 |
|
154 |
if (e.stateMask == SWT.CTRL) |
155 |
{ |
156 |
// DKM - using this now since SWT isn't providing statemask with verify key events |
157 |
switch (e.character) |
158 |
{ |
159 |
case ' ' : |
160 |
//bug 158765: enter may be disabled only when the widget is shown, |
161 |
//not if content assist is requested (since results may be empty) |
162 |
//setInCodeAssist(true); |
163 |
doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS); |
164 |
//e.doit = false; |
165 |
break; |
166 |
|
167 |
case 'z' - 'a' + 1 : |
168 |
// CTRL-Z |
169 |
doOperation(ITextOperationTarget.UNDO); |
170 |
//e.doit = false; |
171 |
break; |
172 |
} |
173 |
} |
174 |
|
175 |
} |
176 |
}); |
177 |
prependVerifyKeyListener(new VerifyKeyListener() |
178 |
{ |
179 |
public void verifyKey(VerifyEvent event) |
180 |
{ |
181 |
handleVerifyKeyPressed(event); |
182 |
} |
183 |
}); |
184 |
initializeActions(); |
141 |
initializeActions(); |
185 |
} |
142 |
} |
186 |
public String getCommandText() |
143 |
public String getCommandText() |
Lines 257-264
Link Here
|
257 |
menu.appendToGroup( |
214 |
menu.appendToGroup( |
258 |
ITextEditorActionConstants.GROUP_EDIT, |
215 |
ITextEditorActionConstants.GROUP_EDIT, |
259 |
(IAction) fGlobalActions.get(ITextEditorActionConstants.SELECT_ALL)); |
216 |
(IAction) fGlobalActions.get(ITextEditorActionConstants.SELECT_ALL)); |
260 |
menu.add(new Separator("group.generate")); //$NON-NLS-1$ |
217 |
menu.add(new Separator(ITextEditorActionConstants.GROUP_GENERATE)); |
261 |
menu.appendToGroup("group.generate", (IAction) fGlobalActions.get("ContentAssistProposal")); //$NON-NLS-1$ //$NON-NLS-2$ |
218 |
menu.appendToGroup(ITextEditorActionConstants.GROUP_GENERATE, (IAction) fGlobalActions.get("ContentAssistProposal")); //$NON-NLS-1$ |
262 |
} |
219 |
} |
263 |
private IActionBars getActionBars() |
220 |
private IActionBars getActionBars() |
264 |
{ |
221 |
{ |
Lines 303-309
Link Here
|
303 |
_caAction.setEnabled(true); |
260 |
_caAction.setEnabled(true); |
304 |
fGlobalActions.put("ContentAssistProposal", _caAction); //$NON-NLS-1$ |
261 |
fGlobalActions.put("ContentAssistProposal", _caAction); //$NON-NLS-1$ |
305 |
|
262 |
|
306 |
|
|
|
307 |
setActionHandlers(); |
263 |
setActionHandlers(); |
308 |
|
264 |
|
309 |
fSelectionActions.add(ITextEditorActionConstants.CUT); |
265 |
fSelectionActions.add(ITextEditorActionConstants.CUT); |
Lines 379-410
Link Here
|
379 |
((IUpdate) action).update(); |
335 |
((IUpdate) action).update(); |
380 |
} |
336 |
} |
381 |
} |
337 |
} |
382 |
private void handleVerifyKeyPressed(VerifyEvent event) |
|
|
383 |
{ |
384 |
if (!event.doit) |
385 |
return; |
386 |
|
387 |
// DKM - moved to key press handler since for some reason SWT doesn't provide statemask anymore |
388 |
/* |
389 |
if (event.character == 0 && (event.keyCode & SWT.KEYCODE_BIT) == 0) |
390 |
{ |
391 |
return; |
392 |
} |
393 |
switch (event.character) |
394 |
{ |
395 |
case ' ' : |
396 |
doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS); |
397 |
event.doit = false; |
398 |
break; |
399 |
// CTRL-Z |
400 |
case (int) 'z' - (int) 'a' + 1 : |
401 |
doOperation(ITextOperationTarget.UNDO); |
402 |
event.doit = false; |
403 |
break; |
404 |
} |
405 |
*/ |
406 |
} |
407 |
|
408 |
|
338 |
|
409 |
public void setInCodeAssist(boolean flag) |
339 |
public void setInCodeAssist(boolean flag) |
410 |
{ |
340 |
{ |