|
Lines 18-30
Link Here
|
| 18 |
import javax.annotation.PreDestroy; |
18 |
import javax.annotation.PreDestroy; |
| 19 |
import org.eclipse.core.commands.AbstractHandler; |
19 |
import org.eclipse.core.commands.AbstractHandler; |
| 20 |
import org.eclipse.core.commands.ExecutionEvent; |
20 |
import org.eclipse.core.commands.ExecutionEvent; |
| 21 |
import org.eclipse.core.commands.ExecutionException; |
|
|
| 22 |
import org.eclipse.core.expressions.EvaluationResult; |
21 |
import org.eclipse.core.expressions.EvaluationResult; |
| 23 |
import org.eclipse.core.expressions.Expression; |
22 |
import org.eclipse.core.expressions.Expression; |
| 24 |
import org.eclipse.core.expressions.ExpressionInfo; |
23 |
import org.eclipse.core.expressions.ExpressionInfo; |
| 25 |
import org.eclipse.core.expressions.IEvaluationContext; |
24 |
import org.eclipse.core.expressions.IEvaluationContext; |
| 26 |
import org.eclipse.core.runtime.Assert; |
25 |
import org.eclipse.core.runtime.Assert; |
| 27 |
import org.eclipse.core.runtime.CoreException; |
|
|
| 28 |
import org.eclipse.e4.core.contexts.IEclipseContext; |
26 |
import org.eclipse.e4.core.contexts.IEclipseContext; |
| 29 |
import org.eclipse.e4.ui.model.application.MApplication; |
27 |
import org.eclipse.e4.ui.model.application.MApplication; |
| 30 |
import org.eclipse.e4.ui.model.application.ui.basic.MWindow; |
28 |
import org.eclipse.e4.ui.model.application.ui.basic.MWindow; |
|
Lines 190-196
Link Here
|
| 190 |
} |
188 |
} |
| 191 |
|
189 |
|
| 192 |
@Override |
190 |
@Override |
| 193 |
public EvaluationResult evaluate(IEvaluationContext context) throws CoreException { |
191 |
public EvaluationResult evaluate(IEvaluationContext context) { |
| 194 |
return EvaluationResult.valueOf(SearchField.class.getName().equals( |
192 |
return EvaluationResult.valueOf(SearchField.class.getName().equals( |
| 195 |
context.getVariable(ISources.ACTIVE_FOCUS_CONTROL_ID_NAME))); |
193 |
context.getVariable(ISources.ACTIVE_FOCUS_CONTROL_ID_NAME))); |
| 196 |
} |
194 |
} |
|
Lines 199-223
Link Here
|
| 199 |
IHandlerService whService = windowContext.get(IHandlerService.class); |
197 |
IHandlerService whService = windowContext.get(IHandlerService.class); |
| 200 |
whService.activateHandler(IWorkbenchCommandConstants.EDIT_SELECT_ALL, |
198 |
whService.activateHandler(IWorkbenchCommandConstants.EDIT_SELECT_ALL, |
| 201 |
new AbstractHandler() { |
199 |
new AbstractHandler() { |
| 202 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
200 |
public Object execute(ExecutionEvent event) { |
| 203 |
text.selectAll(); |
201 |
text.selectAll(); |
| 204 |
return null; |
202 |
return null; |
| 205 |
} |
203 |
} |
| 206 |
}, focusExpr); |
204 |
}, focusExpr); |
| 207 |
whService.activateHandler(IWorkbenchCommandConstants.EDIT_CUT, new AbstractHandler() { |
205 |
whService.activateHandler(IWorkbenchCommandConstants.EDIT_CUT, new AbstractHandler() { |
| 208 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
206 |
public Object execute(ExecutionEvent event) { |
| 209 |
text.cut(); |
207 |
text.cut(); |
| 210 |
return null; |
208 |
return null; |
| 211 |
} |
209 |
} |
| 212 |
}, focusExpr); |
210 |
}, focusExpr); |
| 213 |
whService.activateHandler(IWorkbenchCommandConstants.EDIT_COPY, new AbstractHandler() { |
211 |
whService.activateHandler(IWorkbenchCommandConstants.EDIT_COPY, new AbstractHandler() { |
| 214 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
212 |
public Object execute(ExecutionEvent event) { |
| 215 |
text.copy(); |
213 |
text.copy(); |
| 216 |
return null; |
214 |
return null; |
| 217 |
} |
215 |
} |
| 218 |
}, focusExpr); |
216 |
}, focusExpr); |
| 219 |
whService.activateHandler(IWorkbenchCommandConstants.EDIT_PASTE, new AbstractHandler() { |
217 |
whService.activateHandler(IWorkbenchCommandConstants.EDIT_PASTE, new AbstractHandler() { |
| 220 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
218 |
public Object execute(ExecutionEvent event) { |
| 221 |
text.paste(); |
219 |
text.paste(); |
| 222 |
return null; |
220 |
return null; |
| 223 |
} |
221 |
} |
|
Lines 226-233
Link Here
|
| 226 |
|
224 |
|
| 227 |
/** |
225 |
/** |
| 228 |
* This method was copy/pasted from JFace. |
226 |
* This method was copy/pasted from JFace. |
| 229 |
* |
|
|
| 230 |
* @see org.eclipse.jface.window.Window#getClosestMonitor(Display, Point) |
| 231 |
*/ |
227 |
*/ |
| 232 |
private static Monitor getClosestMonitor(Display toSearch, Point toFind) { |
228 |
private static Monitor getClosestMonitor(Display toSearch, Point toFind) { |
| 233 |
int closest = Integer.MAX_VALUE; |
229 |
int closest = Integer.MAX_VALUE; |
|
Lines 256-264
Link Here
|
| 256 |
|
252 |
|
| 257 |
/** |
253 |
/** |
| 258 |
* This method was copy/pasted from JFace. |
254 |
* This method was copy/pasted from JFace. |
| 259 |
* |
|
|
| 260 |
* @see org.eclipse.jface.window.Window#getConstrainedShellBounds(Display, |
| 261 |
* Rectangle) |
| 262 |
*/ |
255 |
*/ |
| 263 |
private Rectangle getConstrainedShellBounds(Display display, Rectangle preferredSize) { |
256 |
private Rectangle getConstrainedShellBounds(Display display, Rectangle preferredSize) { |
| 264 |
Rectangle result = new Rectangle(preferredSize.x, preferredSize.y, preferredSize.width, |
257 |
Rectangle result = new Rectangle(preferredSize.x, preferredSize.y, preferredSize.width, |