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

Examples of org.eclipse.wst.sse.ui.internal.contentoutline.IJFaceNodeAdapter


        public Image getColumnImage(Object element, int columnIndex) {
          if (element instanceof INodeNotifier) {
            INodeAdapter adapterFor = ((INodeNotifier) element).getAdapterFor(IJFaceNodeAdapter.class);
            if (columnIndex == 2 && adapterFor != null && adapterFor instanceof IJFaceNodeAdapter) {
              IJFaceNodeAdapter adapter = (IJFaceNodeAdapter) adapterFor;
              return adapter.getLabelImage((element));
            }
          }
          return null;
        }

        public String getColumnText(Object element, int columnIndex) {
          String text = null;
          if (element != null) {
            switch (columnIndex) {
              case 0 : {
                text = String.valueOf(((List) structuredSelectionTable.getInput()).indexOf(element));
              }
                break;
              case 1 : {
                text = element.getClass().getName();
              }
                break;
              case 2 : {
                text = StringUtils.firstLineOf(element.toString());
              }
                break;
              default :
                text = ""; //$NON-NLS-1$
            }
          }
          return text;
        }

        public boolean isLabelProperty(Object element, String property) {
          return false;
        }

        public void removeListener(ILabelProviderListener listener) {
        }
      });

      TableLayout tlayout = new TableLayout();
      tlayout.addColumnData(new ColumnWeightData(7, true));
      tlayout.addColumnData(new ColumnWeightData(28, true));
      tlayout.addColumnData(new ColumnWeightData(50, true));
      structuredSelectionTable.getTable().setLayout(tlayout);

      TableColumn tc = new TableColumn(structuredSelectionTable.getTable(), SWT.NONE);
      tc.setText("Item"); //$NON-NLS-1$
      tc.setResizable(true);
      tc.setWidth(40);

      tc = new TableColumn(structuredSelectionTable.getTable(), SWT.NONE);
      tc.setText("Class"); //$NON-NLS-1$
      tc.setResizable(true);
      tc.setWidth(40);

      tc = new TableColumn(structuredSelectionTable.getTable(), SWT.NONE);
      tc.setText("Value"); //$NON-NLS-1$
      tc.setResizable(true);
      tc.setWidth(40);

      structuredSelectionTable.setContentProvider(new ArrayContentProvider());
      final List input = selection;
      structuredSelectionTable.setInput(input);

      final TreeViewer infoTree = new TreeViewer(structuredSashForm, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
      infoTree.setLabelProvider(new LabelProvider() {
        public Image getImage(Object element) {
          if (element instanceof TreeViewer && infoTree.getInput() instanceof INodeNotifier) {
            INodeAdapter adapterFor = ((INodeNotifier) infoTree.getInput()).getAdapterFor(IJFaceNodeAdapter.class);
            if (adapterFor != null && adapterFor instanceof IJFaceNodeAdapter) {
              IJFaceNodeAdapter adapter = (IJFaceNodeAdapter) adapterFor;
              return adapter.getLabelImage((infoTree.getInput()));
            }
          }
          return super.getImage(element);
        }

        public String getText(Object element) {
          if (element instanceof Class) {
            return "Class: " + ((Class) element).getName(); //$NON-NLS-1$
          }
          if (element instanceof Collection) {
            return "Registered Adapters:"; //$NON-NLS-1$
          }
          if (element instanceof IRegion) {
            return "Indexed Region offset span: [" + ((IRegion) element).getOffset() + "-" + ((IRegion) element).getLength() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
          }
          if (element instanceof TreeViewer && infoTree.getInput() instanceof INodeNotifier) {
            IJFaceNodeAdapter adapter = (IJFaceNodeAdapter) ((INodeNotifier) infoTree.getInput()).getAdapterFor(IJFaceNodeAdapter.class);
            if (adapter != null) {
              return adapter.getLabelText((infoTree.getInput()));
            }
          }
          return super.getText(element);
        }
      });
View Full Code Here


   * (non-Javadoc)
   *
   * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
   */
  public Image getImage(Object element) {
    IJFaceNodeAdapter adapter = getAdapter(element);
    if (adapter != null)
      return adapter.getLabelImage(element);
    return super.getImage(element);
  }
View Full Code Here

   * (non-Javadoc)
   *
   * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
   */
  public String getText(Object element) {
    IJFaceNodeAdapter adapter = getAdapter(element);
    if (adapter != null)
      return adapter.getLabelText(element);
    return super.getText(element);
  }
View Full Code Here

      StringBuffer s = new StringBuffer();
      if (node.getNodeType() != Node.DOCUMENT_NODE) {
        while (node != null && node instanceof INodeNotifier) {
          INodeNotifier notifier = (INodeNotifier) node;
          if (node.getNodeType() != Node.DOCUMENT_NODE) {
            IJFaceNodeAdapter adapter = (IJFaceNodeAdapter) notifier.getAdapterFor(IJFaceNodeAdapter.class);
            if (adapter != null) {
              s.insert(0, adapter.getLabelText(node));
            }
          }
          node = node.getParentNode();
          if (node != null && node.getNodeType() != Node.DOCUMENT_NODE)
            s.insert(0, IPath.SEPARATOR);
View Full Code Here

    }
    return null;
  }

  public Object[] getChildren(Object object) {
    IJFaceNodeAdapter adapter = getAdapter(object);

    if (adapter != null) {
      return adapter.getChildren(object);
    }

    return new Object[0];
  }
View Full Code Here

    Object topNode = object;
    if (object instanceof IDOMModel) {
      topNode = ((IDOMModel) object).getDocument();
    }

    IJFaceNodeAdapter adapter = getAdapter(topNode);

    if (adapter != null) {
      return adapter.getElements(topNode);
    }

    return new Object[0];
  }
View Full Code Here

    return new Object[0];
  }

  public Object getParent(Object object) {
    IJFaceNodeAdapter adapter = getAdapter(object);

    if (adapter != null) {
      return adapter.getParent(object);
    }

    return null;
  }
View Full Code Here

    return null;
  }

  public boolean hasChildren(Object object) {
    IJFaceNodeAdapter adapter = getAdapter(object);

    if (adapter != null) {
      return adapter.hasChildren(object);
    }

    return false;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.wst.sse.ui.internal.contentoutline.IJFaceNodeAdapter

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.