Package org.eclipse.wst.sse.core.internal.provisional

Examples of org.eclipse.wst.sse.core.internal.provisional.INodeAdapter


      return null;

    Node node = (Node) notifier;
    short nodeType = node.getNodeType();
    if (nodeType == Node.DOCUMENT_NODE) {
      INodeAdapter adapter = notifier.getExistingAdapter(IStyleSheetListAdapter.class);
      if (adapter != null)
        return adapter;
      HTMLDocumentAdapter newAdapter = new HTMLDocumentAdapter();
      newAdapter.setDocument((Document) node);
      notifier.addAdapter(newAdapter);
      return newAdapter;
    }
    if (nodeType != Node.ELEMENT_NODE)
      return null;

    Element element = (Element) node;
    String tagName = element.getTagName();
    if (tagName.equalsIgnoreCase(HTML40Namespace.ElementName.STYLE)) {
      if (!isTagAvailable(element.getOwnerDocument(), HTML40Namespace.ElementName.STYLE)) {
        return null;
      }
      //    String type = element.getAttribute(HTML40Namespace.ATTR_NAME_TYPE);
      //    if (type != null && ! type.equalsIgnoreCase(CSS_CONTENT_TYPE)) {
      //      return null;
      //    }
      INodeAdapter adapter = notifier.getExistingAdapter(IStyleSheetAdapter.class);
      if (adapter != null)
        return adapter;
      StyleElementAdapter newAdapter = new StyleElementAdapter();
      newAdapter.setElement(element);
      notifier.addAdapter(newAdapter);
      return newAdapter;
    }
    else if (tagName.equalsIgnoreCase(HTML40Namespace.ElementName.LINK)) {
      if (!isTagAvailable(element.getOwnerDocument(), HTML40Namespace.ElementName.LINK)) {
        return null;
      }
      INodeAdapter adapter = notifier.getExistingAdapter(IStyleSheetAdapter.class);
      if (adapter != null)
        return adapter;
      LinkElementAdapter newAdapter = new LinkElementAdapter();
      newAdapter.setElement(element);
      notifier.addAdapter(newAdapter);
      return newAdapter;
    }

    INodeAdapter adapter = notifier.getExistingAdapter(IStyleDeclarationAdapter.class);
    if (adapter != null)
      return adapter;

    if (!isAttributeAvailable(element, HTML40Namespace.ATTR_NAME_STYLE)) {
      return null;
View Full Code Here


    if (attr == null)
      return null;
    INodeNotifier notifier = (INodeNotifier) attr.getOwnerElement();
    if (notifier == null)
      return null;
    INodeAdapter adapter = notifier.getAdapterFor(IStyleDeclarationAdapter.class);
    if (adapter == null)
      return null;
    if (!(adapter instanceof IStyleDeclarationAdapter))
      return null;
    IStyleDeclarationAdapter styleAdapter = (IStyleDeclarationAdapter) adapter;
View Full Code Here

  /**
   * @see PageDirectiveAdapter#adapt(INodeNotifier, Object)
   */
  public INodeAdapter adapt(INodeNotifier notifier, Object type) {
    INodeAdapter result = null;
    // if embeddedContentType hasn't been set,
    // then we can not adapt it.
    if (embeddedTypeHandler != null) {
      if (embeddedFactoryRegistry != null) {
        Iterator iterator = embeddedFactoryRegistry.iterator();
View Full Code Here

        public void dispose() {
        }

        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()));
            }
          }
View Full Code Here

    if (attr == null)
      return null;
    INodeNotifier notifier = (INodeNotifier) attr.getOwnerElement();
    if (notifier == null)
      return null;
    INodeAdapter adapter = notifier.getAdapterFor(IStyleDeclarationAdapter.class);
    if (adapter == null)
      return null;
    if (!(adapter instanceof IStyleDeclarationAdapter))
      return null;
    IStyleDeclarationAdapter styleAdapter = (IStyleDeclarationAdapter) adapter;
View Full Code Here

  /**
   * @see PageDirectiveAdapter#adapt(INodeNotifier, Object)
   */
  public INodeAdapter adapt(INodeNotifier notifier, Object type) {
    INodeAdapter result = null;
    // if embeddedContentType hasn't been set,
    // then we can not adapt it.
    if (embeddedTypeHandler != null) {
      if (embeddedFactoryRegistry != null) {
        Iterator iterator = embeddedFactoryRegistry.iterator();
View Full Code Here

      return;
    Iterator it = adapters.iterator();
    if (it == null)
      return;
    while (it.hasNext()) {
      INodeAdapter adapter = (INodeAdapter) it.next();
      if (adapter instanceof StyleListener) {
        StyleListener listener = (StyleListener) adapter;
        listener.styleChanged();
      }
    }
View Full Code Here

      // and getAdapterFor() is slow, so add a check on the tagName to
      // filter
      // those stylesheet stuff first.
      if (IHTMLConstants.TAG_LINK.equalsIgnoreCase(tagName)
          || IHTMLConstants.TAG_STYLE.equalsIgnoreCase(tagName)) {
        INodeAdapter adapter = notifier
            .getAdapterFor(IStyleSheetAdapter.class);
        if (adapter instanceof IStyleSheetAdapter) {
          StyleSheet sheet = ((IStyleSheetAdapter) adapter).getSheet();
                    if (sheet != null)
                    {
View Full Code Here

    //return (EMF2DOMSSEAdapter) xNode.getAdapterFor(EMF2DOMAdapter.ADAPTER_CLASS);

    INodeNotifier sseNode = (INodeNotifier) node;
    Collection adapters = sseNode.getAdapters();
    for (Iterator iterator = adapters.iterator(); iterator.hasNext();) {
      INodeAdapter adapter = (INodeAdapter) iterator.next();
      // First Check if it's an EMF2DOMAdapter
      if (adapter != null && adapter.isAdapterForType(EMF2DOMAdapter.ADAPTER_CLASS)) {
        // Cast to EMF2DOMSSEAdapter
        EMF2DOMSSEAdapter e2DAdapter = (EMF2DOMSSEAdapter) adapter;
        //Handle the cases where either adapter's target is null
        //Use the resourceClass to make sure the resource type is identical
        if (getResource() == null || e2DAdapter.getTarget() == null)
View Full Code Here

        cmDocumentManager.setPropertyEnabled(CMDocumentManager.PROPERTY_AUTO_LOAD, false);
      }
     
      // attach a dom observer adapter to the document so others have access to
      // domobserver if needed
      INodeAdapter domObserverAdapter = ((INodeNotifier)fDocument).getExistingAdapter(DOMObserverAdapter.class);
      if (domObserverAdapter == null) {
        domObserverAdapter = new DOMObserverAdapter();
        ((INodeNotifier)fDocument).addAdapter(domObserverAdapter);
      }
      ((DOMObserverAdapter)domObserverAdapter).setDOMObserver(this);
View Full Code Here

TOP

Related Classes of org.eclipse.wst.sse.core.internal.provisional.INodeAdapter

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.