|
Link Here
|
| 17 |
import java.util.*; |
17 |
import java.util.*; |
| 18 |
|
18 |
|
| 19 |
import org.eclipse.core.resources.IProject; |
19 |
import org.eclipse.core.resources.IProject; |
|
|
20 |
import org.eclipse.jface.action.Action; |
| 21 |
import org.eclipse.jface.commands.ActionHandler; |
| 20 |
import org.eclipse.jface.dialogs.*; |
22 |
import org.eclipse.jface.dialogs.*; |
| 21 |
import org.eclipse.jface.dialogs.Dialog; |
23 |
import org.eclipse.jface.dialogs.Dialog; |
| 22 |
import org.eclipse.jface.preference.IPreferenceStore; |
24 |
import org.eclipse.jface.preference.IPreferenceStore; |
|
Link Here
|
| 33 |
import org.eclipse.team.internal.ccvs.core.util.Util; |
35 |
import org.eclipse.team.internal.ccvs.core.util.Util; |
| 34 |
import org.eclipse.team.internal.ui.SWTUtils; |
36 |
import org.eclipse.team.internal.ui.SWTUtils; |
| 35 |
import org.eclipse.team.internal.ui.dialogs.DialogArea; |
37 |
import org.eclipse.team.internal.ui.dialogs.DialogArea; |
|
|
38 |
import org.eclipse.ui.*; |
| 36 |
import org.eclipse.ui.dialogs.PreferencesUtil; |
39 |
import org.eclipse.ui.dialogs.PreferencesUtil; |
| 37 |
import org.eclipse.ui.editors.text.EditorsUI; |
40 |
import org.eclipse.ui.editors.text.*; |
| 38 |
import org.eclipse.ui.editors.text.TextSourceViewerConfiguration; |
41 |
import org.eclipse.ui.handlers.*; |
| 39 |
import org.eclipse.ui.texteditor.*; |
42 |
import org.eclipse.ui.texteditor.*; |
| 40 |
|
43 |
|
|
|
44 |
|
| 41 |
/** |
45 |
/** |
| 42 |
* This area provides the widgets for providing the CVS commit comment |
46 |
* This area provides the widgets for providing the CVS commit comment |
| 43 |
*/ |
47 |
*/ |
|
Link Here
|
| 72 |
|
76 |
|
| 73 |
support.install(EditorsUI.getPreferenceStore()); |
77 |
support.install(EditorsUI.getPreferenceStore()); |
| 74 |
|
78 |
|
|
|
79 |
final IHandlerService handlerService= (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class); |
| 80 |
final IHandlerActivation handlerActivation= installQuickFixActionHandler(handlerService, sourceViewer); |
| 81 |
|
| 75 |
sourceViewer.getTextWidget().addDisposeListener(new DisposeListener() { |
82 |
sourceViewer.getTextWidget().addDisposeListener(new DisposeListener() { |
| 76 |
|
83 |
|
| 77 |
public void widgetDisposed(DisposeEvent e) { |
84 |
public void widgetDisposed(DisposeEvent e) { |
| 78 |
support.uninstall(); |
85 |
support.uninstall(); |
|
|
86 |
handlerService.deactivateHandler(handlerActivation); |
| 79 |
} |
87 |
} |
| 80 |
|
88 |
|
| 81 |
}); |
89 |
}); |
|
Link Here
|
| 91 |
fTextField.addTraverseListener(this); |
99 |
fTextField.addTraverseListener(this); |
| 92 |
fTextField.addModifyListener(this); |
100 |
fTextField.addModifyListener(this); |
| 93 |
fTextField.addFocusListener(this); |
101 |
fTextField.addFocusListener(this); |
|
|
102 |
|
| 103 |
} |
| 104 |
|
| 105 |
/** |
| 106 |
* Installs the quick fix action handler |
| 107 |
* and returns the handler activation. |
| 108 |
* |
| 109 |
* @param handlerService the handler service |
| 110 |
* @param sourceViewer the source viewer |
| 111 |
* @return the handler activation |
| 112 |
* @since 3.4 |
| 113 |
*/ |
| 114 |
private IHandlerActivation installQuickFixActionHandler(IHandlerService handlerService, SourceViewer sourceViewer) { |
| 115 |
return handlerService.activateHandler( |
| 116 |
ITextEditorActionDefinitionIds.QUICK_ASSIST, |
| 117 |
createQuickFixActionHandler(sourceViewer), |
| 118 |
new ActiveShellExpression(sourceViewer.getTextWidget().getShell())); |
| 119 |
} |
| 120 |
|
| 121 |
/** |
| 122 |
* Creates and returns a quick fix action handler. |
| 123 |
* |
| 124 |
* @param textOperationTarget the target for text operations |
| 125 |
* @since 3.4 |
| 126 |
*/ |
| 127 |
private ActionHandler createQuickFixActionHandler(final ITextOperationTarget textOperationTarget) { |
| 128 |
Action quickFixAction= new Action() { |
| 129 |
/* (non-Javadoc) |
| 130 |
* @see org.eclipse.jface.action.Action#run() |
| 131 |
*/ |
| 132 |
public void run() { |
| 133 |
textOperationTarget.doOperation(ISourceViewer.QUICK_ASSIST); |
| 134 |
} |
| 135 |
}; |
| 136 |
quickFixAction.setActionDefinitionId(ITextEditorActionDefinitionIds.QUICK_ASSIST); |
| 137 |
return new ActionHandler(quickFixAction); |
| 94 |
} |
138 |
} |
| 95 |
|
139 |
|
| 96 |
public void modifyText(ModifyEvent e) { |
140 |
public void modifyText(ModifyEvent e) { |