Eclipseplugins
CollapseHandler.java
1 package com.proalpha.java.oea.plugins.oeaextension.codefoldingutility.handlers;
2 
3 import org.eclipse.core.commands.ExecutionEvent;
4 import org.eclipse.core.commands.ExecutionException;
5 import org.eclipse.jface.text.ITextSelection;
6 import org.eclipse.jface.viewers.ISelection;
7 
8 import com.openedge.pdt.text.editor.OETextEditor;
9 
11 
12  public Object execute(ExecutionEvent event) throws ExecutionException {
13 
14  OETextEditor editor = getOETextEditor();
15 
16  if (editor != null) {
17 
18  ISelection selection = editor.getSelectionProvider().getSelection();
19 
20  if (selection instanceof ITextSelection) {
21 
22  ITextSelection textSelection = (ITextSelection) selection;
23 
24  editor.getOESourceViewer()
25  .getProjectionAnnotationModel()
26  .collapseAll(textSelection.getOffset(),
27  textSelection.getLength());
28 
29  }
30 
31  }
32 
33  return null;
34 
35  }
36 
37 }