Package org.eclipse.wst.sse.ui.internal.selection

Examples of org.eclipse.wst.sse.ui.internal.selection.SelectionHistory


public class StructuredSelectHistoryHandler extends AbstractHandler {

  public Object execute(ExecutionEvent event) throws ExecutionException {
    IEditorPart editor = HandlerUtil.getActiveEditor(event);
    SelectionHistory history = (SelectionHistory) editor.getAdapter(SelectionHistory.class);
    if (history != null) {
      IRegion old = history.getLast();
      if (old != null) {
        try {
          history.ignoreSelectionChanges();

          ITextEditor textEditor = null;
          if (editor instanceof ITextEditor)
            textEditor = (ITextEditor) editor;
          else {
            Object o = editor.getAdapter(ITextEditor.class);
            if (o != null)
              textEditor = (ITextEditor) o;
          }
          if (textEditor != null)
            textEditor.selectAndReveal(old.getOffset(), old.getLength());
        }
        finally {
          history.listenToSelectionChanges();
        }
      }
    }
    return null;
  }
View Full Code Here


    else if (IVerticalRuler.class.equals(required)) {
      return getVerticalRuler();
    }
    else if (SelectionHistory.class.equals(required)) {
      if (fSelectionHistory == null)
        fSelectionHistory = new SelectionHistory(this);
      result = fSelectionHistory;
    }
    else if (IResource.class.equals(required)) {
      IEditorInput input = getEditorInput();
      if (input != null) {
View Full Code Here

    else if (IVerticalRuler.class.equals(required)) {
      return getVerticalRuler();
    }
    else if (SelectionHistory.class.equals(required)) {
      if (fSelectionHistory == null)
        fSelectionHistory = new SelectionHistory(this);
      result = fSelectionHistory;
    }
    else if (IResource.class.equals(required)) {
      IEditorInput input = getEditorInput();
      if (input != null) {
View Full Code Here

          // determine new selection based on current indexed region
          Region newSelectionRegion = getNewSelectionRegion(cursorIndexedRegion, textSelection);

          // select new selection
          if (newSelectionRegion != null) {
            SelectionHistory history = (SelectionHistory) editor.getAdapter(SelectionHistory.class);
            if (history != null) {
              history.remember(new Region(textSelection.getOffset(), textSelection.getLength()));
              try {
                history.ignoreSelectionChanges();
                textEditor.selectAndReveal(newSelectionRegion.getOffset(), newSelectionRegion.getLength());
              }
              finally {
                history.listenToSelectionChanges();
              }
            }
          }
        }
      }
View Full Code Here

TOP

Related Classes of org.eclipse.wst.sse.ui.internal.selection.SelectionHistory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.