summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Sandonato2012-11-01 17:12:56 (EDT)
committerNitin Dahyabhai2013-01-10 13:31:55 (EST)
commit486824a3921a9cff44ffb404a1dd4c2237fb7271 (patch)
tree09b4513f3e2c8a05f6569d933fae06b64377dc8c
parent68de84ea0401aecf4ef871dc9e46304c63d6305e (diff)
downloadwebtools.sourceediting-486824a3921a9cff44ffb404a1dd4c2237fb7271.zip
webtools.sourceediting-486824a3921a9cff44ffb404a1dd4c2237fb7271.tar.gz
webtools.sourceediting-486824a3921a9cff44ffb404a1dd4c2237fb7271.tar.bz2
[208636] [misc][context launching] incorrect debug launch context after setting focus in outline view
-rw-r--r--bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSNodeImpl.java13
-rw-r--r--bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/internal/DTDNode.java12
-rw-r--r--bundles/org.eclipse.wst.sse.core/plugin.xml8
-rw-r--r--bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/model/ModelResourceFactory.java28
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentoutline/ConfigurableContentOutlinePage.java13
-rw-r--r--bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/NodeImpl.java12
6 files changed, 74 insertions, 12 deletions
diff --git a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSNodeImpl.java b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSNodeImpl.java
index 0f37dac..a9f75a3 100644
--- a/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSNodeImpl.java
+++ b/bundles/org.eclipse.wst.css.core/src/org/eclipse/wst/css/core/internal/document/CSSNodeImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * Copyright (c) 2004, 2012 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
@@ -14,6 +14,8 @@ package org.eclipse.wst.css.core.internal.document;
import java.util.Iterator;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.wst.css.core.internal.formatter.CSSSourceFormatterFactory;
import org.eclipse.wst.css.core.internal.formatter.CSSSourceGenerator;
import org.eclipse.wst.css.core.internal.provisional.document.ICSSDocument;
@@ -24,6 +26,7 @@ import org.eclipse.wst.css.core.internal.provisional.document.ICSSNodeList;
import org.eclipse.wst.css.core.internal.util.ImportRuleCollector;
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.IStructuredModel;
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
import org.w3c.dom.DOMException;
@@ -31,7 +34,7 @@ import org.w3c.dom.DOMException;
/**
*
*/
-public abstract class CSSNodeImpl extends AbstractNotifier implements ICSSNode, IndexedRegion {
+public abstract class CSSNodeImpl extends AbstractNotifier implements ICSSNode, IndexedRegion, IAdaptable {
private CSSDocumentImpl fOwnerDocument = null;
private CSSNodeImpl fParentNode = null;
@@ -60,6 +63,12 @@ public abstract class CSSNodeImpl extends AbstractNotifier implements ICSSNode,
}
}
}
+
+ public Object getAdapter(Class adapter) {
+ final IStructuredModel model = fOwnerDocument != null ? fOwnerDocument.getModel() : null;
+ return model != null ? Platform.getAdapterManager().getAdapter(model, adapter) : null;
+ }
+
/**
* currently public but may be made default access protected in future.
*/
diff --git a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/internal/DTDNode.java b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/internal/DTDNode.java
index 0bc2838..8482b07 100644
--- a/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/internal/DTDNode.java
+++ b/bundles/org.eclipse.wst.dtd.core/src/org/eclipse/wst/dtd/core/internal/DTDNode.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2011 IBM Corporation and others.
+ * Copyright (c) 2001, 2012 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
@@ -16,10 +16,13 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl;
import org.eclipse.wst.dtd.core.internal.parser.DTDRegionTypes;
import org.eclipse.wst.dtd.core.internal.text.RegionIterator;
import org.eclipse.wst.sse.core.internal.model.FactoryRegistry;
+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.IStructuredDocumentRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
@@ -28,7 +31,7 @@ import org.eclipse.wst.xml.core.internal.document.NodeContainer;
import org.w3c.dom.Node;
-public abstract class DTDNode extends NodeContainer implements IndexedRegion {
+public abstract class DTDNode extends NodeContainer implements IndexedRegion, IAdaptable {
// these are characteroffsets
protected DTDFile dtdFile;
@@ -45,6 +48,11 @@ public abstract class DTDNode extends NodeContainer implements IndexedRegion {
this.flatNode = flatNode;
}
+ public Object getAdapter(Class adapter) {
+ final IStructuredModel model = dtdFile != null ? dtdFile.getDTDModel() : null;
+ return model != null ? Platform.getAdapterManager().getAdapter(model, adapter) : null;
+ }
+
public void addRegion(ITextRegion region) {
/*
* if (startRegion == null) { startRegion = region; } endRegion =
diff --git a/bundles/org.eclipse.wst.sse.core/plugin.xml b/bundles/org.eclipse.wst.sse.core/plugin.xml
index 1b9d769..55d8b01 100644
--- a/bundles/org.eclipse.wst.sse.core/plugin.xml
+++ b/bundles/org.eclipse.wst.sse.core/plugin.xml
@@ -56,4 +56,12 @@
type="org.eclipse.core.resources.IFile">
</propertyTester>
</extension>
+ <extension point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.eclipse.wst.sse.core.internal.provisional.IStructuredModel"
+ class="org.eclipse.wst.sse.core.internal.model.ModelResourceFactory">
+ <adapter
+ type="org.eclipse.core.resources.IResource"/>
+ </factory>
+ </extension>
</plugin>
diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/model/ModelResourceFactory.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/model/ModelResourceFactory.java
new file mode 100644
index 0000000..92b4fc0
--- /dev/null
+++ b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/model/ModelResourceFactory.java
@@ -0,0 +1,28 @@
+package org.eclipse.wst.sse.core.internal.model;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+
+public class ModelResourceFactory implements IAdapterFactory {
+
+ private static final Class[] TYPES = new Class[] { IResource.class };
+
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof IStructuredModel && IResource.class.equals(adapterType)) {
+ String baseLocation = ((IStructuredModel) adaptableObject).getBaseLocation();
+ if (baseLocation != null && !IModelManager.DUPLICATED_MODEL.equals(baseLocation) && !IModelManager.UNMANAGED_MODEL.equals(baseLocation)) {
+ return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(baseLocation));
+ }
+ }
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return TYPES;
+ }
+
+}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentoutline/ConfigurableContentOutlinePage.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentoutline/ConfigurableContentOutlinePage.java
index a55306a..8dad434 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentoutline/ConfigurableContentOutlinePage.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentoutline/ConfigurableContentOutlinePage.java
@@ -27,6 +27,7 @@ import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
import org.eclipse.jface.util.DelegatingDragAdapter;
import org.eclipse.jface.util.DelegatingDropAdapter;
import org.eclipse.jface.util.SafeRunnable;
@@ -79,18 +80,18 @@ public class ConfigurableContentOutlinePage extends ContentOutlinePage implement
class AdditionGroupAdder implements IMenuListener {
public void menuAboutToShow(IMenuManager manager) {
IContributionItem[] items = manager.getItems();
+ // add configuration's menu items
+ IMenuListener listener = getConfiguration().getMenuListener(getTreeViewer());
+ if (listener != null) {
+ listener.menuAboutToShow(manager);
+ manager.add(new Separator());
+ }
if (items.length > 0 && items[items.length - 1].getId() != null) {
manager.insertAfter(items[items.length - 1].getId(), new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
}
else {
manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
}
-
- // add configuration's menu items
- IMenuListener listener = getConfiguration().getMenuListener(getTreeViewer());
- if (listener != null) {
- listener.menuAboutToShow(manager);
- }
}
}
diff --git a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/NodeImpl.java b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/NodeImpl.java
index 44e5df5..9fab66c 100644
--- a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/NodeImpl.java
+++ b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/NodeImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2011 IBM Corporation and others.
+ * Copyright (c) 2001, 2012 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
@@ -26,8 +26,11 @@ import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
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.IStructuredModel;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
@@ -48,7 +51,7 @@ import org.w3c.dom.UserDataHandler;
/**
* NodeImpl class
*/
-public abstract class NodeImpl extends AbstractNotifier implements Node, IDOMNode {
+public abstract class NodeImpl extends AbstractNotifier implements Node, IDOMNode, IAdaptable {
// define one empty nodelist, for repeated use
private final static NodeList EMPTY_NODE_LIST = new NodeListImpl();
// DocumentPosition
@@ -89,6 +92,11 @@ public abstract class NodeImpl extends AbstractNotifier implements Node, IDOMNod
}
}
+ public Object getAdapter(Class adapter) {
+ final IStructuredModel model = getModel();
+ return model != null ? Platform.getAdapterManager().getAdapter(model, adapter) : null;
+ }
+
/**
* appendChild method
*