Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline')
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/IJavaWebNode.java34
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/JFaceNodeAdapterFactoryForJSDT.java55
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/JFaceNodeAdapterForJs.java398
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/JsJfaceNode.java280
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/Messages.java46
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/messages.properties11
6 files changed, 0 insertions, 824 deletions
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/IJavaWebNode.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/IJavaWebNode.java
deleted file mode 100644
index b69918f873..0000000000
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/IJavaWebNode.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/**
- *
- */
-package org.eclipse.wst.jsdt.web.ui.views.contentoutline;
-
-import org.eclipse.wst.jsdt.core.IJavaScriptElement;
-import org.w3c.dom.Node;
-/**
-*
-
-* Provisional API: This class/interface is part of an interim API that is still under development and expected to
-* change significantly before reaching stability. It is being made available at this early stage to solicit feedback
-* from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
-* (repeatedly) as the API evolves.
-*/
-public interface IJavaWebNode {
- public IJavaScriptElement getJavaElement();
-
- public Node getParentNode();
-
- public boolean hasChildren();
-
-
-}
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/JFaceNodeAdapterFactoryForJSDT.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/JFaceNodeAdapterFactoryForJSDT.java
deleted file mode 100644
index 9afa9561e6..0000000000
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/JFaceNodeAdapterFactoryForJSDT.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.web.ui.views.contentoutline;
-
-import org.eclipse.wst.jsdt.web.ui.views.provisional.contentoutline.JsContentOutlineConfig;
-import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
-import org.eclipse.wst.sse.core.internal.provisional.INodeAdapterFactory;
-import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
-import org.eclipse.wst.sse.ui.internal.contentoutline.IJFaceNodeAdapter;
-import org.eclipse.wst.xml.ui.internal.contentoutline.JFaceNodeAdapterFactory;
-/**
-*
-
-* Provisional API: This class/interface is part of an interim API that is still under development and expected to
-* change significantly before reaching stability. It is being made available at this early stage to solicit feedback
-* from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
-* (repeatedly) as the API evolves.
-*/
-public class JFaceNodeAdapterFactoryForJSDT extends JFaceNodeAdapterFactory {
- public JFaceNodeAdapterFactoryForJSDT() {
- this(IJFaceNodeAdapter.class, true);
- }
-
- public JFaceNodeAdapterFactoryForJSDT(Object adapterKey, boolean registerAdapters) {
- super(adapterKey, registerAdapters);
- }
-
-
- public INodeAdapterFactory copy() {
- return new JFaceNodeAdapterFactoryForJSDT(getAdapterKey(), isShouldRegisterAdapter());
- }
-
-
- protected INodeAdapter createAdapter(INodeNotifier node) {
- if (singletonAdapter == null) {
- // create the JFaceNodeAdapter
- // singletonAdapter = new JFaceNodeAdapterForJSDT(this);
- if (JsContentOutlineConfig.USE_ADVANCED) {
- singletonAdapter = new org.eclipse.wst.jsdt.web.ui.views.provisional.contentoutline.JFaceNodeAdapterForJs(this);
- } else {
- singletonAdapter = new org.eclipse.wst.jsdt.web.ui.views.contentoutline.JFaceNodeAdapterForJs(this);
- }
- initAdapter(singletonAdapter, node);
- }
- return singletonAdapter;
- }
-}
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/JFaceNodeAdapterForJs.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/JFaceNodeAdapterForJs.java
deleted file mode 100644
index 456ef6f5ac..0000000000
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/JFaceNodeAdapterForJs.java
+++ /dev/null
@@ -1,398 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * bug:244839 - eugene@genuitec.com
- *******************************************************************************/
-package org.eclipse.wst.jsdt.web.ui.views.contentoutline;
-
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.text.Position;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.html.ui.internal.contentoutline.JFaceNodeAdapterForHTML;
-import org.eclipse.wst.jsdt.core.IJavaScriptElement;
-import org.eclipse.wst.jsdt.core.IJavaScriptUnit;
-import org.eclipse.wst.jsdt.core.IMember;
-import org.eclipse.wst.jsdt.core.ISourceRange;
-import org.eclipse.wst.jsdt.core.ISourceReference;
-import org.eclipse.wst.jsdt.core.IType;
-import org.eclipse.wst.jsdt.core.JavaScriptModelException;
-import org.eclipse.wst.jsdt.internal.core.JavaElement;
-import org.eclipse.wst.jsdt.internal.core.Member;
-import org.eclipse.wst.jsdt.internal.core.SourceRefElement;
-import org.eclipse.wst.jsdt.ui.JavaScriptElementLabelProvider;
-import org.eclipse.wst.jsdt.ui.StandardJavaScriptElementContentProvider;
-import org.eclipse.wst.jsdt.web.core.internal.Logger;
-import org.eclipse.wst.jsdt.web.core.javascript.IJsTranslation;
-import org.eclipse.wst.jsdt.web.core.javascript.JsTranslationAdapter;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.sse.ui.internal.contentoutline.IJFaceNodeAdapter;
-import org.eclipse.wst.xml.core.internal.document.NodeImpl;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.eclipse.wst.xml.ui.internal.contentoutline.JFaceNodeAdapterFactory;
-import org.w3c.dom.Node;
-/**
-*
-
-* Provisional API: This class/interface is part of an interim API that is still under development and expected to
-* change significantly before reaching stability. It is being made available at this early stage to solicit feedback
-* from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
-* (repeatedly) as the API evolves.
-*/
-public class JFaceNodeAdapterForJs extends JFaceNodeAdapterForHTML {
-
- public JFaceNodeAdapterForJs(JFaceNodeAdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
- private IJavaScriptUnit lazyCu;
- private IProgressMonitor monitor;
- private JavaScriptElementLabelProvider javaElementLabelProvider;
-
- public Object[] getChildren(Object object) {
- if (object instanceof IJavaScriptElement) {
- return getJavaElementProvider().getChildren(object);
- }
- if (object instanceof IJavaWebNode) {
- JavaElement enclosedElement = (JavaElement) ((IJavaWebNode) object).getJavaElement();
- if (enclosedElement != null) {
- try {
- IJavaScriptElement[] children = enclosedElement.getChildren();
- if (children == null) {
- return new IJavaScriptElement[0];
- }
- Object[] nodes = new Object[children.length];
- Node parent = ((IJavaWebNode) object).getParentNode();
-
- for (int i = 0; i < children.length; i++) {
- // int htmllength = ((SourceRefElement) (children[i])).getSourceRange().getLength();
- // int htmloffset = ((SourceRefElement) (children[i])).getSourceRange().getOffset();
- IJavaScriptElement javaElement = children[i];
- ISourceRange range = null;
- if (javaElement instanceof Member) {
- range = ((IMember) javaElement).getNameRange();
- } else {
- range = ((ISourceReference) javaElement).getSourceRange();
- }
- int htmllength = range.getLength();
- int htmloffset = range.getOffset();
-
-
- Position position = new Position(htmloffset, htmllength);
- nodes[i] = getJsNode(parent, javaElement, position);
- }
- return nodes;
- } catch (JavaScriptModelException ex) {
- }
- }
- }
- Node node = (Node) object;
- if (isJSElementParent(node)) {
- Object[] results = getJSElementsFromNode(node.getFirstChild(), true);
-
-
- return filter( results );
- }
- return super.getChildren(object);
- }
-
- /*
- * @GINO: Anonymous -- matches anonymous types on the top level
- */
- protected boolean matches(Object elementObj) {
-
- if( elementObj instanceof IJavaWebNode ){
- IJavaScriptElement element = ((IJavaWebNode)elementObj).getJavaElement();
- if (element.getElementType() == IJavaScriptElement.TYPE && element.getParent().getElementType() == IJavaScriptElement.JAVASCRIPT_UNIT ) {
-
- IType type = (IType)element;
- try {
- return type.isAnonymous();
- } catch (JavaScriptModelException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
-
- return false;
- }
-
- /*
- * @GINO: Anonymous Filter from top level
- *
- */
- protected Object[] filter(Object[] children) {
- boolean initializers= false;
- for (int i= 0; i < children.length; i++) {
- if (matches(children[i])) {
- initializers= true;
- break;
- }
- }
-
- if (!initializers)
- return children;
-
- Vector v= new Vector();
- for (int i= 0; i < children.length; i++) {
- if (matches(children[i]))
- continue;
- v.addElement(children[i]);
- }
-
- Object[] result= new Object[v.size()];
- v.copyInto(result);
- return result;
- }
-
- public Object[] getElements(Object object) {
- if (object instanceof IJavaScriptElement) {
- return getJavaElementProvider().getElements(object);
- }
- return super.getElements(object);
- }
-
- private JavaScriptElementLabelProvider getJavaElementLabelProvider() {
- if(javaElementLabelProvider==null) {
- javaElementLabelProvider = new JavaScriptElementLabelProvider();
- }
- return javaElementLabelProvider;
- }
-
- private StandardJavaScriptElementContentProvider getJavaElementProvider() {
- return new StandardJavaScriptElementContentProvider(true);
- }
-
- private Object[] filterChildrenForRange(IJavaScriptElement[] allChildren, Node node) {
- // int javaPositionStart = ((NodeImpl) node).getStartOffset();
- // int javaPositionEnd = ((NodeImpl) node).getEndOffset();
-
- // Object[] result =new Object[0];
-
- int javaPositionEnd = ((NodeImpl) node).getEndOffset();
- int javaPositionStart = ((NodeImpl) node).getStartOffset();
-
- Vector validChildren = new Vector();
- for (int i = 0; i < allChildren.length; i++) {
- if (allChildren[i] instanceof IJavaScriptElement) {
- ISourceRange range = null;
- if (allChildren[i] instanceof Member) {
- try {
- range = ((Member) allChildren[i]).getNameRange();
- } catch (JavaScriptModelException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- } else if (allChildren[i] instanceof SourceRefElement) {
- try {
- range = ((SourceRefElement)allChildren[i] ).getSourceRange();
- } catch (JavaScriptModelException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- if (allChildren[i].getElementType() == IJavaScriptElement.TYPE || (javaPositionStart <= range.getOffset() && range.getLength() + range.getOffset() <= (javaPositionEnd))) {
-
-
- int htmllength = range == null ? 0 : range.getLength();
- int htmloffset = range == null ? 0 : range.getOffset();
- if (htmllength < 0 || htmloffset < 0) {
- continue;
- }
- Position position = new Position(htmloffset, htmllength);
- validChildren.add(getJsNode(node.getParentNode(), allChildren[i], position));
-
-
- }
- }
- }
- Object[] result = new Object[0];
-
-
- if (validChildren.size() > 0) {
- result = validChildren.toArray();
- }
- if (result == null || result.length == 0) {
- return new IJavaScriptElement[0];
- }
- return result;
- }
-
- private synchronized Object[] getJSElementsFromNode(Node node, boolean ensureConsistant) {
-
-// int startOffset = 0;
-// int endOffset = 0;
-// int type = node.getNodeType();
- Object[] result = null;
- //JsTranslation translation = null;
- if (node.getNodeType() == Node.TEXT_NODE && (node instanceof NodeImpl)) {
-// startOffset = ((NodeImpl) node).getStartOffset();
-// endOffset = ((NodeImpl) node).getEndOffset();
- IJavaScriptUnit unit = getLazyCu(node);
- // Genuitec Begin Fix 6149: Exception opening external HTML file
- if (unit == null) {
- return new Object[0];
- }
- // Genuitec End Fix 6149: Exception opening external HTML file
- try {
- if(ensureConsistant) unit.makeConsistent(getProgressMonitor());
- } catch (JavaScriptModelException ex1) {
- // TODO Auto-generated catch block
- ex1.printStackTrace();
- }
- try {
- result = filterChildrenForRange(unit.getChildren(),node);
- } catch (JavaScriptModelException ex) {
- // TODO Auto-generated catch block
- ex.printStackTrace();
- result = new Object[0];
- lazyCu=null;
- }
-
- //translation = getTranslation(node);
- //result = translation.getAllElementsInJsRange(startOffset, endOffset);
- }
- return result;
- }
-
- private IProgressMonitor getProgressMonitor() {
- if(monitor==null) {
- monitor = new NullProgressMonitor();
- }
-
- return monitor;
-
- }
-
- private Object getJsNode(Node parent, IJavaScriptElement root, Position position) {
- JsJfaceNode instance = null;
- if (root.getElementType() == IJavaScriptElement.TYPE) {
- instance = new JsJfaceNode(parent, root, position, ((SourceRefElement) root).getElementName());
- } else if (root.getElementType() == IJavaScriptElement.FIELD) {
- /* Field refrence, possibly to a type may need to implement later */
- instance = new JsJfaceNode(parent, root, position);
- } else {
- instance = new JsJfaceNode(parent, root, position);
- }
- String name = getJavaElementLabelProvider().getText(root);
- instance.setName(name);
- // ((JsJfaceNode)instance).setAdapterRegistry(registry);
- INodeAdapter adapter = (instance).getAdapterFor(IJFaceNodeAdapter.class);
- if (!(adapter instanceof JFaceNodeAdapterForJs)) {
- (instance).removeAdapter(adapter);
- (instance).addAdapter(this);
- }
- return instance;
- }
-
-
- public Image getLabelImage(Object node) {
- if (node instanceof JsJfaceNode) {
- return ((JsJfaceNode) node).getImage();
- }
- if (node instanceof IJavaScriptElement) {
- return getJavaElementLabelProvider().getImage(node);
- }
- return super.getLabelImage(node);
- }
-
-
- public String getLabelText(Object node) {
-// if (node instanceof JsJfaceNode) {
-// return ((JsJfaceNode) node).getName();
-// }
- if (node instanceof IJavaScriptElement) {
- return getJavaElementLabelProvider().getText(node);
- }
- return super.getLabelText(node);
- }
-
-
- public Object getParent(Object element) {
- if (element instanceof IJavaScriptElement) {
- return getJavaElementProvider().getParent(element);
- }
- return super.getParent(element);
- }
-
- private IJavaScriptUnit getLazyCu(Node node) {
- if(lazyCu==null) {
- IJsTranslation tran = getTranslation(node);
- if(tran== null) return null;
- lazyCu = tran.getCompilationUnit();
- if(lazyCu==null) return null;
-
- try {
- lazyCu.makeConsistent( new NullProgressMonitor() );
- } catch (JavaScriptModelException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- return lazyCu;
- }
-
- private IJsTranslation getTranslation(Node node) {
- IStructuredModel model = null;
- IModelManager modelManager = StructuredModelManager.getModelManager();
- IDOMDocument xmlDoc = null;
- try {
- if (modelManager != null) {
- IStructuredDocument doc = ((NodeImpl) node).getStructuredDocument();
- model = modelManager.getExistingModelForRead(doc);
- // model = modelManager.getModelForRead(doc);
- }
- IDOMModel domModel = (IDOMModel) model;
- if(domModel == null) return null;
- xmlDoc = domModel.getDocument();
- } catch (Exception e) {
- Logger.logException(e);
- } finally {
- if (model != null) {
- // model.changedModel();
- model.releaseFromRead();
- }
- }
- if (xmlDoc == null) {
- return null;
- }
- JsTranslationAdapter translationAdapter = (JsTranslationAdapter) xmlDoc.getAdapterFor(IJsTranslation.class);
- return translationAdapter.getJsTranslation(true);
- }
-
-
- public boolean hasChildren(Object object) {
- if (object instanceof IJavaScriptElement) {
- return getJavaElementProvider().hasChildren(object);
- }
- Node node = (Node) object;
- if (node instanceof IJavaWebNode) {
- return ((IJavaWebNode) object).hasChildren();
-
- }
- if (isJSElementParent(node)) {
- Object[] nodes = getJSElementsFromNode(node.getFirstChild(),false);
- boolean hasElements = (nodes != null && nodes.length > 0);
- return hasElements;
- }
- return super.hasChildren(object);
- }
-
- private boolean isJSElementParent(Node node) {
- return (node.hasChildNodes() && node.getNodeName().equalsIgnoreCase("script")); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/JsJfaceNode.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/JsJfaceNode.java
deleted file mode 100644
index 0f5b3410d1..0000000000
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/JsJfaceNode.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.web.ui.views.contentoutline;
-
-import java.util.Collection;
-
-import org.eclipse.jface.text.Position;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.jsdt.core.IJavaScriptElement;
-import org.eclipse.wst.jsdt.core.JavaScriptModelException;
-import org.eclipse.wst.jsdt.internal.core.JavaElement;
-import org.eclipse.wst.jsdt.ui.JavaScriptElementLabelProvider;
-import org.eclipse.wst.jsdt.web.core.internal.Logger;
-import org.eclipse.wst.jsdt.web.core.javascript.IJsTranslation;
-import org.eclipse.wst.jsdt.web.core.javascript.JsTranslationAdapter;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.model.FactoryRegistry;
-import org.eclipse.wst.sse.core.internal.provisional.AbstractNotifier;
-import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
-import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.xml.core.internal.document.ElementImpl;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.w3c.dom.Node;
-/**
-*
-
-* Provisional API: This class/interface is part of an interim API that is still under development and expected to
-* change significantly before reaching stability. It is being made available at this early stage to solicit feedback
-* from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
-* (repeatedly) as the API evolves.
-*/
-public class JsJfaceNode extends ElementImpl implements IndexedRegion, INodeNotifier, Node, IJavaWebNode {
- private class JsAdaptableNode extends AbstractNotifier {
-
- public FactoryRegistry getFactoryRegistry() {
- return adapterRegistry;
- }
- }
- private JsAdaptableNode adaptableDomNode = new JsAdaptableNode();
- private FactoryRegistry adapterRegistry;
- private Position fDocPosition;
-// private Node parent;
- private String typeName;
- //private IJavaScriptElement dirtyElement;
- private boolean hasChildren;
- //private String name;
- private Image me;
-
- public JsJfaceNode(Node parent, IJavaScriptElement originalElement, Position structureDocLocation) {
- this(parent, originalElement, structureDocLocation, null);
- }
-
- public JsJfaceNode(Node parent, IJavaScriptElement originalElement, Position structureDocLocation, String typeName) {
- //super();
- super(((ElementImpl)parent));
- // super(parentObject, parentObject.getElementName());
- fDocPosition = structureDocLocation;
- //this.parent = parent;
- this.typeName = typeName;
- try {
- hasChildren=((JavaElement)originalElement).hasChildren();
- } catch (JavaScriptModelException ex) {
- hasChildren=false;
- }
- removeAttributes();
- me = (new JavaScriptElementLabelProvider(JavaScriptElementLabelProvider.SHOW_DEFAULT|JavaScriptElementLabelProvider.SHOW_SMALL_ICONS)).getImage(originalElement);
- }
-
- public Image getImage() {
- return me;
- }
-
- public boolean hasChildren() {
-// try {
-// return ((JavaElement)this.dirtyElement).hasChildren();
-// } catch (JavaScriptModelException ex) {
-// // TODO Auto-generated catch block
-// ex.printStackTrace();
-// }
- return hasChildren;
- }
-
-
- public void setName(String name) {
- super.setTagName(name);
- }
-
- public void addAdapter(INodeAdapter adapter) {
- adaptableDomNode.addAdapter(adapter);
- }
-
-
- public boolean contains(int testPosition) {
- return false;
- }
-
-
- public boolean equals(Object o) {
- return (o != null && o instanceof JsJfaceNode && ((JsJfaceNode) o).fDocPosition == this.fDocPosition);
- }
-
-// public static Object getInstance(Object parent, Position structureDocLocation
-// ){
-// //return new JsJfaceNode((JavaElement)parent.getParent(),
-// parent.getElementName(),structureDocLocation);
-// Vector interfaces = new Vector();
-// interfaces.addAll(Arrays.asList(parent.getClass().getInterfaces()));
-// JsJfaceNode me = new JsJfaceNode(parent,structureDocLocation);
-// interfaces.addAll(Arrays.asList(me.getClass().getInterfaces()));
-// Object proxy = null;
-// try {
-// proxy= Proxy.newProxyInstance(
-// parent.getClass().getClassLoader(),
-// (Class[])interfaces.toArray(new Class[]{}),me);
-// } catch (Exception e) {
-// // TODO Auto-generated catch block
-// System.out.println(e);
-// }
-// return proxy;
-// }
-//
-
- public INodeAdapter getAdapterFor(Object type) {
- return adaptableDomNode.getAdapterFor(type);
- }
-
-
- public Collection getAdapters() {
- return adaptableDomNode.getAdapters();
- }
-
-
- public int getEndOffset() {
- return fDocPosition.getOffset() + fDocPosition.getLength();
- }
-
-
- public INodeAdapter getExistingAdapter(Object type) {
- // TODO Auto-generated method stub
- return adaptableDomNode.getExistingAdapter(type);
- }
-
- public synchronized IJavaScriptElement getJavaElement() {
- /*
- * since this may become 'stale' we need to rediscover our element every
- * time we're asked
- */
- IJsTranslation tran = getTranslation();
- int startOffset = getStartOffset();
- int endOffset = getLength();
- if (typeName != null) {
- IJavaScriptElement myType = tran.getCompilationUnit().getType(typeName);
- return myType;
- }
- IJavaScriptElement elements[] = tran.getAllElementsInJsRange(startOffset, startOffset + endOffset);
- if (elements != null) {
- return elements[0];
- } else {
- System.out.println(Messages.getString("JsJfaceNode.1")); //$NON-NLS-1$
- return null;
- }
- }
-
-
- public int getLength() {
- return fDocPosition.getLength();
- }
-
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.xml.core.internal.document.NodeImpl#getOwnerDocument()
- */
-
-
-
-
-
-
-
- public int getStartOffset() {
- return fDocPosition.getOffset();
- }
-
-// private Method[] getMethods(){
-// // returns the methods this class supports (as declared in interfaces)
-// Class[] interfaces = getClass().getInterfaces();
-// Vector vMethods = new Vector();
-// for(int i = 0;i<interfaces.length;i++){
-// Method methods[] = interfaces[i].getDeclaredMethods();
-// vMethods.addAll(Arrays.asList(methods));
-// }
-//
-// return (Method[])vMethods.toArray();
-// }
-// public Object invoke(Object proxy, Method method, Object[] args) throws
-// Throwable {
-// Object result;
-// Method[] myMethods = getMethods();
-//
-// try {
-// for(int i = 0;i<myMethods.length;i++){
-// if(myMethods[i]==method){
-// return method.invoke(this, args);
-// }
-// }
-// result = method.invoke(parentType, args);
-// } catch (InvocationTargetException e) {
-// throw e.getTargetException();
-// } catch (Exception e) {
-// throw new RuntimeException("unexpected invocation exception: " +
-// e.getMessage());
-// }
-//
-// return result;
-// }
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.xml.core.internal.document.NodeImpl#getStructuredDocument()
- */
-
-
-
- public IJsTranslation getTranslation() {
- IStructuredModel model = null;
- IModelManager modelManager = StructuredModelManager.getModelManager();
- IDOMDocument xmlDoc = null;
- try {
- if (modelManager != null) {
- IStructuredDocument doc = getStructuredDocument();
- model = modelManager.getExistingModelForRead(doc);
- // model = modelManager.getModelForRead(doc);
- }
- IDOMModel domModel = (IDOMModel) model;
- xmlDoc = domModel.getDocument();
- } catch (Exception e) {
- Logger.logException(e);
- } finally {
- if (model != null) {
- // model.changedModel();
- model.releaseFromRead();
- }
- }
- if (xmlDoc == null) {
- return null;
- }
- JsTranslationAdapter translationAdapter = (JsTranslationAdapter) xmlDoc.getAdapterFor(IJsTranslation.class);
- return translationAdapter.getJsTranslation(true);
- }
-
-
- public void notify(int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
- adaptableDomNode.notify(eventType, changedFeature, oldValue, newValue, pos);
- }
-
-
- public void removeAdapter(INodeAdapter adapter) {
- adaptableDomNode.removeAdapter(adapter);
- }
-
- public void setAdapterRegistry(FactoryRegistry registry) {
- this.adapterRegistry = registry;
- }
-}
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/Messages.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/Messages.java
deleted file mode 100644
index 8a4481361e..0000000000
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/Messages.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/**
- *
- */
-package org.eclipse.wst.jsdt.web.ui.views.contentoutline;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
-*
-
-* Provisional API: This class/interface is part of an interim API that is still under development and expected to
-* change significantly before reaching stability. It is being made available at this early stage to solicit feedback
-* from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
-* (repeatedly) as the API evolves.
-*
- * @author childsb
- *
- */
-public class Messages {
- private static final String BUNDLE_NAME = "org.eclipse.wst.jsdt.web.ui.views.contentoutline.messages"; //$NON-NLS-1$
-
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
-
- private Messages() {
- }
-
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- }
- catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/messages.properties b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/messages.properties
deleted file mode 100644
index b36e5bef71..0000000000
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/messages.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-###############################################################################
-# Copyright (c) 2007, 2008 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-JsJfaceNode.1=error in JsJfaceNode... I couldn't retrieve my java element from the original page

Back to the top