Package org.eclipse.jface.viewers

Examples of org.eclipse.jface.viewers.IStructuredSelection.toArray()


      return;
    if (!(selection instanceof IStructuredSelection))
      return;
    try {
      IStructuredSelection strucSel = (IStructuredSelection) selection;
      Object[] sections = strucSel.toArray();
      selectedHeaders = (List) Arrays.asList(sections);
      MarkdownPage.Header first = (Header) sections[0];
      MarkdownPage.Header last = (Header) sections[sections.length - 1];
      int start = fTextEditor.getDocument().getLineOffset(
          first.getLineNumber());
View Full Code Here


  public static IModelElement getSelectedElement(ISelection selection,
      IModelElement contextElement) {
    if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
      IStructuredSelection sSelection = (IStructuredSelection) selection;
      for (Object sElement : sSelection.toArray()) {
        if (sElement instanceof Element) {
          return BeansModelUtils.getModelElement((Element) sElement,
              contextElement);
        }
      }
View Full Code Here

          int startLine = ((ITextSelection) selection).getStartLine() + 1;
          int endLine = ((ITextSelection) selection).getEndLine() + 1;

          IStructuredSelection sel = (IStructuredSelection) selection;
          for (Object obj : sel.toArray()) {
            // Try to resolve to a better node instead of working with text
            if (obj instanceof Text && ((IDOMNode) obj).getOwnerDocument() != null) {
              IDOMNode sibling = (IDOMNode) ((Text) obj).getNextSibling();
              if (sibling != null) {
                int siblingStartLine = ((IDOMDocument) sibling.getOwnerDocument())
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.