Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 63991 Details for
Bug 182506
The pde and ant bridges should be contributed by fragments...
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch for the remaining impact on other plugins
mylar-ant-pde-patches.txt (text/plain), 81.35 KB, created by
Philippe Ombredanne
on 2007-04-17 01:17:20 EDT
(
hide
)
Description:
Patch for the remaining impact on other plugins
Filename:
MIME Type:
Creator:
Philippe Ombredanne
Created:
2007-04-17 01:17:20 EDT
Size:
81.35 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylar.java.tests >Index: src/org/eclipse/mylar/java/tests/xml/XmlSearchPluginTest.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.java.tests/src/org/eclipse/mylar/java/tests/xml/XmlSearchPluginTest.java,v >retrieving revision 1.4 >diff -u -r1.4 XmlSearchPluginTest.java >--- src/org/eclipse/mylar/java/tests/xml/XmlSearchPluginTest.java 9 Apr 2007 20:30:19 -0000 1.4 >+++ src/org/eclipse/mylar/java/tests/xml/XmlSearchPluginTest.java 17 Apr 2007 05:09:36 -0000 >@@ -25,9 +25,9 @@ > import org.eclipse.mylar.internal.context.core.CompositeContext; > import org.eclipse.mylar.internal.context.core.IMylarSearchOperation; > import org.eclipse.mylar.internal.context.core.MylarContext; >-import org.eclipse.mylar.internal.ide.xml.pde.PdeStructureBridge; > import org.eclipse.mylar.internal.java.JavaStructureBridge; > import org.eclipse.mylar.internal.java.search.XmlJavaRelationProvider; >+import org.eclipse.mylar.internal.pde.PdeStructureBridge; > import org.eclipse.mylar.internal.resources.ResourceStructureBridge; > import org.eclipse.mylar.java.tests.search.ActiveSearchNotifier; > import org.eclipse.mylar.java.tests.search.SearchPluginTestHelper; >Index: src/org/eclipse/mylar/java/tests/xml/XmlTestActiveSearchListener.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.java.tests/src/org/eclipse/mylar/java/tests/xml/XmlTestActiveSearchListener.java,v >retrieving revision 1.3 >diff -u -r1.3 XmlTestActiveSearchListener.java >--- src/org/eclipse/mylar/java/tests/xml/XmlTestActiveSearchListener.java 25 Nov 2006 00:46:04 -0000 1.3 >+++ src/org/eclipse/mylar/java/tests/xml/XmlTestActiveSearchListener.java 17 Apr 2007 05:09:36 -0000 >@@ -14,9 +14,9 @@ > import java.util.List; > > import org.eclipse.core.internal.resources.File; >+import org.eclipse.mylar.context.core.AbstractContextStructureBridge; > import org.eclipse.mylar.context.core.AbstractRelationProvider; > import org.eclipse.mylar.context.core.ContextCorePlugin; >-import org.eclipse.mylar.context.core.AbstractContextStructureBridge; > import org.eclipse.mylar.context.tests.support.search.TestActiveSearchListener; > import org.eclipse.mylar.internal.ide.xml.XmlNodeHelper; > import org.eclipse.search.internal.ui.text.FileSearchResult; >Index: src/org/eclipse/mylar/java/tests/xml/XmlResultUpdaterSearchListener.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.java.tests/src/org/eclipse/mylar/java/tests/xml/XmlResultUpdaterSearchListener.java,v >retrieving revision 1.6 >diff -u -r1.6 XmlResultUpdaterSearchListener.java >--- src/org/eclipse/mylar/java/tests/xml/XmlResultUpdaterSearchListener.java 9 Apr 2007 20:30:19 -0000 1.6 >+++ src/org/eclipse/mylar/java/tests/xml/XmlResultUpdaterSearchListener.java 17 Apr 2007 05:09:35 -0000 >@@ -16,14 +16,14 @@ > import java.util.Map; > > import org.eclipse.core.internal.resources.File; >+import org.eclipse.mylar.context.core.AbstractContextStructureBridge; > import org.eclipse.mylar.context.core.AbstractRelationProvider; > import org.eclipse.mylar.context.core.ContextCorePlugin; > import org.eclipse.mylar.context.core.IMylarElement; >-import org.eclipse.mylar.context.core.AbstractContextStructureBridge; > import org.eclipse.mylar.context.tests.support.search.TestActiveSearchListener; > import org.eclipse.mylar.internal.ide.xml.XmlNodeHelper; >-import org.eclipse.mylar.internal.ide.xml.pde.PdeStructureBridge; > import org.eclipse.mylar.internal.java.search.XmlJavaRelationProvider; >+import org.eclipse.mylar.internal.pde.PdeStructureBridge; > import org.eclipse.mylar.monitor.core.InteractionEvent; > import org.eclipse.search.internal.ui.text.FileSearchResult; > import org.eclipse.search.ui.text.Match; >Index: src/org/eclipse/mylar/java/tests/search/JavaReferencesSearchTest.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.java.tests/src/org/eclipse/mylar/java/tests/search/JavaReferencesSearchTest.java,v >retrieving revision 1.17 >diff -u -r1.17 JavaReferencesSearchTest.java >--- src/org/eclipse/mylar/java/tests/search/JavaReferencesSearchTest.java 7 Sep 2006 17:42:42 -0000 1.17 >+++ src/org/eclipse/mylar/java/tests/search/JavaReferencesSearchTest.java 17 Apr 2007 05:09:35 -0000 >@@ -27,9 +27,9 @@ > import org.eclipse.mylar.internal.context.core.CompositeContext; > import org.eclipse.mylar.internal.context.core.IMylarSearchOperation; > import org.eclipse.mylar.internal.context.core.MylarContext; >-import org.eclipse.mylar.internal.ide.xml.pde.PdeStructureBridge; > import org.eclipse.mylar.internal.java.JavaStructureBridge; > import org.eclipse.mylar.internal.java.search.JavaReferencesProvider; >+import org.eclipse.mylar.internal.pde.PdeStructureBridge; > > /** > * @author Shawn Minto >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.java.tests/META-INF/MANIFEST.MF,v >retrieving revision 1.20 >diff -u -r1.20 MANIFEST.MF >--- META-INF/MANIFEST.MF 3 Feb 2007 03:28:36 -0000 1.20 >+++ META-INF/MANIFEST.MF 17 Apr 2007 05:09:35 -0000 >@@ -34,7 +34,9 @@ > org.eclipse.mylar.monitor.ui, > org.eclipse.search, > org.eclipse.mylar.resources.tests, >- org.eclipse.mylar.monitor.core >+ org.eclipse.mylar.monitor.core, >+ org.eclipse.mylar.pde, >+ org.eclipse.mylar.ant > Eclipse-AutoStart: true > Bundle-ClassPath: mylar-java-tests.jar > Export-Package: org.eclipse.mylar.java.tests, >#P org.eclipse.mylar.ide >Index: src/org/eclipse/mylar/internal/ide/xml/pde/PdeStructureBridge.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/ide/xml/pde/PdeStructureBridge.java >diff -N src/org/eclipse/mylar/internal/ide/xml/pde/PdeStructureBridge.java >--- src/org/eclipse/mylar/internal/ide/xml/pde/PdeStructureBridge.java 9 Apr 2007 20:30:34 -0000 1.6 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,340 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004 - 2006 University Of British Columbia 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: >- * University Of British Columbia - initial API and implementation >- *******************************************************************************/ >- >-package org.eclipse.mylar.internal.ide.xml.pde; >- >-import java.util.Collections; >-import java.util.List; >- >-import org.eclipse.core.internal.resources.File; >-import org.eclipse.core.internal.resources.Workspace; >-import org.eclipse.core.resources.IFile; >-import org.eclipse.core.resources.IResource; >-import org.eclipse.core.resources.ResourcesPlugin; >-import org.eclipse.core.runtime.IPath; >-import org.eclipse.core.runtime.Path; >-import org.eclipse.jface.text.Document; >-import org.eclipse.jface.text.IDocument; >-import org.eclipse.mylar.context.core.AbstractContextStructureBridge; >-import org.eclipse.mylar.context.core.ContextCorePlugin; >-import org.eclipse.mylar.context.core.IMylarElement; >-import org.eclipse.mylar.core.MylarStatusHandler; >-import org.eclipse.mylar.internal.ide.xml.XmlNodeHelper; >-import org.eclipse.pde.internal.core.text.build.BuildEntry; >-import org.eclipse.pde.internal.core.text.plugin.PluginNode; >-import org.eclipse.pde.internal.core.text.plugin.PluginObjectNode; >-import org.eclipse.pde.internal.ui.editor.PDEFormPage; >-import org.eclipse.pde.internal.ui.editor.plugin.ManifestEditor; >-import org.eclipse.ui.IEditorPart; >-import org.eclipse.ui.PlatformUI; >-import org.eclipse.ui.views.markers.internal.ProblemMarker; >- >-/** >- * @author Mik Kersten >- * >- */ >-public class PdeStructureBridge extends AbstractContextStructureBridge { >- >- public final static String CONTENT_TYPE = "plugin.xml"; >- >- @Override >- public String getContentType() { >- return CONTENT_TYPE; >- } >- >- @Override >- public String getContentType(String elementHandle) { >- if (elementHandle.endsWith(".xml")) { >- return parentContentType; >-// return parentBridge.getContentType(); >- } else { >- return CONTENT_TYPE; >- } >- } >- >- @Override >- public List<String> getChildHandles(String handle) { >- return Collections.emptyList(); >- } >- >- @Override >- public String getParentHandle(String handle) { >- // we can only get the parent if we have a PluginObjectNode >- >- Object object = getObjectForHandle(handle); >- if (object instanceof PluginObjectNode) { >- PluginObjectNode parent = (PluginObjectNode) ((PluginObjectNode) object).getParentNode(); >- if (parent != null) { >- return getHandleIdentifier(parent); >- } else { >- // the parent is the plugin.xml file, so return that handle >- int delimeterIndex = handle.indexOf(";"); >- if (delimeterIndex != -1) { >- String parentHandle = handle.substring(0, delimeterIndex); >- return parentHandle; >- } else { >- return null; >- } >- } >- } else if (object instanceof PluginNode) { >- PluginNode parent = (PluginNode) ((PluginNode) object).getParentNode(); >- if (parent != null) { >- return getHandleIdentifier(parent); >- } else { >- // the parent is the plugin.xml file, so return that handle >- int delimeterIndex = handle.indexOf(";"); >- if (delimeterIndex != -1) { >- String parentHandle = handle.substring(0, delimeterIndex); >- return parentHandle; >- } else { >- return null; >- } >- } >- } else if (object instanceof IFile) { >- // String fileHandle = parentBridge.getParentHandle(handle); >- AbstractContextStructureBridge parentBridge = ContextCorePlugin.getDefault().getStructureBridge(parentContentType); >- return parentBridge.getParentHandle(handle); >- } else { >- return null; >- } >- } >- >- /** >- * @see org.eclipse.mylar.context.core.AbstractContextStructureBridge#getObjectForHandle(java.lang.String) >- */ >- @Override >- public Object getObjectForHandle(String handle) { >- if (handle == null) >- return null; >- int first = handle.indexOf(";"); >- String filename = ""; >- if (first == -1) { >- AbstractContextStructureBridge parentBridge = ContextCorePlugin.getDefault().getStructureBridge(parentContentType); >- return parentBridge.getObjectForHandle(handle); >- } else { >- // extract the filename from the handle since it represents a node >- filename = handle.substring(0, first); >- } >- >- try { >- // get the file and create a FileEditorInput >- IPath path = new Path(filename); >- IFile f = (IFile) ((Workspace) ResourcesPlugin.getWorkspace()).newResource(path, IResource.FILE); >- >- // get the start line for the element >- int start = Integer.parseInt(handle.substring(first + 1)); >- >- // // get the content and the document so that we can get the offset >- // String content = XmlNodeHelper.getContents(f.getContents()); >- // IDocument d = new Document(content); >- >- // get the offsets for the element >- // make sure that we are on a character and not whitespace >- // int offset = d.getLineOffset(start); >- // while(d.getChar(offset) == ' ') >- // offset++; >- >- // get the current editor which should be the ManifestEditor so that >- // we can get the element that we want >- IEditorPart editorPart = null; >- try { >- editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); >- } catch (NullPointerException e) { >- // do nothing, this just means that there is no active page >- } >- if (editorPart != null && editorPart instanceof ManifestEditor) { >- PluginObjectNode node = PdeEditingMonitor.getNode((ManifestEditor) editorPart, start, true); >- // get the element based on the offset >- return node; >- } else { >- String content = XmlNodeHelper.getContents(f.getContents()); >- IDocument d = new Document(content); >- PluginObjectNode node = PdeEditingMonitor.getNode(d, f, start, true); >- return node; >- } >- } catch (Exception e) { >- // ignore, means file doesn't exist >- // ContextCorePlugin.log(e, "handle failed"); >- } >- return null; >- } >- >- /** >- * Handle is filename;hashcodeOfElementAndAttributes >- * >- * @see org.eclipse.mylar.context.core.AbstractContextStructureBridge#getHandleIdentifier(java.lang.Object) >- */ >- @Override >- public String getHandleIdentifier(Object object) { >- // we can only create handles for PluginObjectNodes and plugin.xml files >- if (object instanceof XmlNodeHelper) { >- return ((XmlNodeHelper) object).getHandle(); >- } else if (object instanceof PluginObjectNode) { >- PluginObjectNode node = (PluginObjectNode) object; >- try { >- // get the handle for the PluginObjectNode >- if (node.getModel() == null || node.getModel().getUnderlyingResource() == null >- || node.getModel().getUnderlyingResource().getFullPath() == null) { >- // ContextCorePlugin.log("PDE xml node's resource or model is >- // null: " + node.getName(), this); >- return null; >- } >- IPath path = new Path(node.getModel().getUnderlyingResource().getFullPath().toString()); >- IFile file = (IFile) ((Workspace) ResourcesPlugin.getWorkspace()).newResource(path, IResource.FILE); >- String handle = new XmlNodeHelper(file.getFullPath().toString(), PdeEditingMonitor >- .getStringOfNode(node).hashCode()).getHandle(); >- return handle; >- } catch (Exception e) { >- MylarStatusHandler.log(e, "pde handle failed"); >- } >- } else if (object instanceof PluginNode) { >- PluginNode node = (PluginNode) object; >- try { >- if (node.getModel() == null || node.getModel().getUnderlyingResource() == null >- || node.getModel().getUnderlyingResource().getFullPath() == null) { >- // ContextCorePlugin.log("PDE xml node's resource or model is >- // null: " + node.getName(), this); >- return null; >- } >- IPath path = new Path(node.getModel().getUnderlyingResource().getFullPath().toString()); >- IFile file = (IFile) ((Workspace) ResourcesPlugin.getWorkspace()).newResource(path, IResource.FILE); >- String handle = new XmlNodeHelper(file.getFullPath().toString(), PdeEditingMonitor >- .getStringOfNode(node).hashCode()).getHandle(); >- return handle; >- } catch (Exception e) { >- MylarStatusHandler.log(e, "pde handle failed"); >- } >- >- } else if (object instanceof File) { >- // get the handle for the file if it is plugin.xml >- File file = (File) object; >- if (file.getFullPath().toString().endsWith("plugin.xml")) >- return file.getFullPath().toString(); >- } >- return null; >- } >- >- @Override >- public String getName(Object object) { >- if (object instanceof PluginObjectNode) { >- PluginObjectNode node = (PluginObjectNode) object; >- String name = node.getXMLAttributeValue("name"); >- if (name == null) >- name = node.getXMLTagName(); >- name = node.getModel().getUnderlyingResource().getName() + ": " + name; >- return name; >- } else if (object instanceof File) { >- File file = (File) object; >- if (file.getFullPath().toString().endsWith("plugin.xml")) >- return "plugin.xml"; >- } >- return ""; >- } >- >- /** >- * TODO: make a non-handle based test >- */ >- @Override >- public boolean canBeLandmark(String handle) { >- if (handle == null) { >- return false; >- } else { >- return handle.indexOf(';') == -1; >- } >- } >- >- @Override >- public boolean acceptsObject(Object object) { >- // we only accept PluginObjectNodes and plugin.xml Files >- if (object instanceof PluginNode || object instanceof PluginObjectNode || object instanceof BuildEntry || object instanceof PDEFormPage) { >- return true; >- } else if (object instanceof XmlNodeHelper) { >- if (((XmlNodeHelper) object).getFilename().endsWith("plugin.xml")) >- return true; >- } else if (object instanceof File) { >- File file = (File) object; >- if (file.getFullPath().toString().endsWith("plugin.xml")) >- return true; >- } >- return false; >- } >- >- @Override >- public boolean canFilter(Object element) { >- return true; >- } >- >- @Override >- public boolean isDocument(String handle) { >- return handle.indexOf(';') == -1; >- } >- >- @Override >- public String getHandleForOffsetInObject(Object resource, int offset) { >- if (resource == null) >- return null; >- if (resource instanceof ProblemMarker) { >- ProblemMarker marker = (ProblemMarker) resource; >- >- // we can only get a handle for a marker with the resource >- // plugin.xml >- try { >- IResource res = marker.getResource(); >- >- if (res instanceof IFile) { >- IFile file = (IFile) res; >- if (file.getFullPath().toString().endsWith("plugin.xml")) { >- return file.getFullPath().toString(); >- } else { >- return null; >- } >- } >- return null; >- } catch (Throwable t) { >- MylarStatusHandler.log(t, "Could not find element for: " + marker); >- return null; >- } >- } else if (resource instanceof IFile) { >- try { >- IFile file = (IFile) resource; >- if (file.getFullPath().toString().endsWith("plugin.xml")) { >- String content = XmlNodeHelper.getContents(file.getContents()); >- IDocument d = new Document(content); >- PluginObjectNode node = PdeEditingMonitor.getNode(d, file, offset, false); >- String handle = new XmlNodeHelper(file.getFullPath().toString(), PdeEditingMonitor.getStringOfNode( >- node).hashCode()).getHandle(); >- return handle; >- } >- } catch (Exception e) { >- MylarStatusHandler.log(e, "Unable to get handle for offset in object"); >- } >- } >- return null; >- } >- >-// public IProject getProjectForObject(Object object) { >-// while (!(object instanceof IFile)) { >-// String handle = getParentHandle(getHandleIdentifier(object)); >-// if (handle == null) >-// break; >-// object = getObjectForHandle(handle); >-// } >-// if (object instanceof IFile && acceptsObject(object)) { >-// return ((IFile) object).getProject(); >-// } >-// return null; >-// } >- >- public boolean containsProblem(IMylarElement node) { >- // TODO Auto-generated method stub >- return false; >- } >-} >Index: src/org/eclipse/mylar/internal/ide/xml/pde/PdeContextLabelProvider.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/ide/xml/pde/PdeContextLabelProvider.java >diff -N src/org/eclipse/mylar/internal/ide/xml/pde/PdeContextLabelProvider.java >--- src/org/eclipse/mylar/internal/ide/xml/pde/PdeContextLabelProvider.java 9 Apr 2007 20:30:34 -0000 1.5 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,61 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004 - 2006 University Of British Columbia 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: >- * University Of British Columbia - initial API and implementation >- *******************************************************************************/ >- >-package org.eclipse.mylar.internal.ide.xml.pde; >- >-import org.eclipse.mylar.context.core.AbstractContextStructureBridge; >-import org.eclipse.mylar.context.core.ContextCorePlugin; >-import org.eclipse.mylar.context.core.IMylarElement; >-import org.eclipse.mylar.context.core.IMylarRelation; >-import org.eclipse.mylar.internal.context.ui.AbstractContextLabelProvider; >-import org.eclipse.mylar.internal.context.ui.ContextUiImages; >-import org.eclipse.mylar.internal.ide.MylarIdePlugin; >-import org.eclipse.swt.graphics.Image; >- >-/** >- * @author Mik Kersten >- */ >-public class PdeContextLabelProvider extends AbstractContextLabelProvider { >- >- public static final String LABEL_RELATION = "referenced by"; >- >- @Override >- protected Image getImage(IMylarElement node) { >- return ContextUiImages.getImage(ContextUiImages.FILE_XML); >- } >- >- @Override >- protected Image getImage(IMylarRelation edge) { >- return ContextUiImages.getImage(MylarIdePlugin.EDGE_REF_XML); >- } >- >- @Override >- protected String getText(IMylarElement node) { >- AbstractContextStructureBridge bridge = ContextCorePlugin.getDefault().getStructureBridge(PdeStructureBridge.CONTENT_TYPE); >- return bridge.getName(bridge.getObjectForHandle(node.getHandleIdentifier())); >- } >- >- @Override >- protected String getText(IMylarRelation edge) { >- return LABEL_RELATION; >- } >- >- @Override >- protected Image getImageForObject(Object object) { >- return ContextUiImages.getImage(ContextUiImages.FILE_XML); >- } >- >- @Override >- protected String getTextForObject(Object object) { >- AbstractContextStructureBridge bridge = ContextCorePlugin.getDefault().getStructureBridge(PdeStructureBridge.CONTENT_TYPE); >- return bridge.getName(object); >- } >-} >Index: src/org/eclipse/mylar/internal/ide/xml/pde/PdeEditingMonitor.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/ide/xml/pde/PdeEditingMonitor.java >diff -N src/org/eclipse/mylar/internal/ide/xml/pde/PdeEditingMonitor.java >--- src/org/eclipse/mylar/internal/ide/xml/pde/PdeEditingMonitor.java 7 Feb 2007 15:16:55 -0000 1.5 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,267 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004 - 2006 University Of British Columbia 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: >- * University Of British Columbia - initial API and implementation >- *******************************************************************************/ >-/* >- * Created on Apr 1, 2005 >- */ >-package org.eclipse.mylar.internal.ide.xml.pde; >- >-import java.util.Locale; >- >-import org.eclipse.core.resources.IFile; >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.jface.text.IDocument; >-import org.eclipse.jface.text.TextSelection; >-import org.eclipse.jface.viewers.ISelection; >-import org.eclipse.jface.viewers.StructuredSelection; >-import org.eclipse.mylar.core.MylarStatusHandler; >-import org.eclipse.mylar.internal.ide.xml.XmlNodeHelper; >-import org.eclipse.mylar.monitor.ui.AbstractUserInteractionMonitor; >-import org.eclipse.pde.core.plugin.IPluginModelBase; >-import org.eclipse.pde.core.plugin.IPluginObject; >-import org.eclipse.pde.internal.core.plugin.ImportObject; >-import org.eclipse.pde.internal.core.text.IDocumentAttribute; >-import org.eclipse.pde.internal.core.text.IDocumentNode; >-import org.eclipse.pde.internal.core.text.plugin.PluginModel; >-import org.eclipse.pde.internal.core.text.plugin.PluginObjectNode; >-import org.eclipse.pde.internal.ui.editor.plugin.ManifestEditor; >-import org.eclipse.pde.internal.ui.editor.plugin.ManifestSourcePage; >-import org.eclipse.ui.IEditorInput; >-import org.eclipse.ui.IWorkbenchPart; >-import org.eclipse.ui.part.FileEditorInput; >- >-public class PdeEditingMonitor extends AbstractUserInteractionMonitor { >- >- public PdeEditingMonitor() { >- super(); >- } >- >- @Override >- protected void handleWorkbenchPartSelection(IWorkbenchPart part, ISelection selection, boolean contributeToContext) { >- if (part instanceof ManifestEditor) { >- TextSelection textSelection = null; >- IEditorInput in = null; >- >- // assume that we are editing an xml file due to the editor used >- // this is the plugin.xml editor >- >- ManifestEditor editor = (ManifestEditor) part; >- >- // fix bug when user is looking in the cvs repository since the >- // input >- // is not a FileEditorInput >- if (!(editor.getEditorInput() instanceof FileEditorInput)) >- return; >- >- // make sure that the selection is a text selection >- if (!(editor.getSelection() instanceof TextSelection || editor.getSelection() instanceof StructuredSelection)) { >- return; >- } else if (editor.getSelection() instanceof StructuredSelection) { >- StructuredSelection s = (StructuredSelection) editor.getSelection(); >- if (s.getFirstElement() instanceof PluginObjectNode) { >- PluginObjectNode n = (PluginObjectNode) s.getFirstElement(); >- textSelection = new TextSelection(n.getOffset(), n.getLength()); >- } else if (s.getFirstElement() instanceof ImportObject) { >- ImportObject io = (ImportObject) s.getFirstElement(); >- if (io.getImport() instanceof PluginObjectNode) { >- PluginObjectNode n = (PluginObjectNode) io.getImport(); >- textSelection = new TextSelection(n.getOffset(), n.getLength()); >- } >- } else { >- return; >- } >- } else { >- // get the selection and the editor input >- textSelection = (TextSelection) editor.getSelection(); >- } >- in = editor.getEditorInput(); >- >- // check if we have a text selection >- if (textSelection != null) { >- try { >- >- // get the node for the selection >- int offset = textSelection.getOffset(); >- PluginObjectNode node = getNode(editor, offset, false); >- >- if (node != null) { >- FileEditorInput fei = (FileEditorInput) in; >- >- // fix a bug when there is a selection and the editor >- // input is the manifest.mf file >- // not the plugin.xml >- if (fei.getFile().getFullPath().toString().toLowerCase(Locale.ENGLISH).endsWith("/manifest.mf")) { >- return; >- } >- >- String nodeString = getStringOfNode(node); >- if (nodeString == null) >- return; >- >- // create the helper to get the handle for the node >- XmlNodeHelper xnode = new XmlNodeHelper(fei.getFile().getFullPath().toString(), nodeString >- .hashCode()); >- >- // get the name for the node >-// String name = node.getXMLAttributeValue("name"); >-// if (name == null) >-// name = node.getXMLTagName(); >- super.handleElementSelection(part, xnode, contributeToContext); >- } >- } catch (Exception e) { >- MylarStatusHandler.log(e, "couldn't resolve selection"); >- } >- } >- } >- } >- >- public static String getStringOfNode(IDocumentNode node) { >- if (node == null) >- return null; >- String s = node.getXMLTagName(); >- for (IDocumentAttribute a : node.getNodeAttributes()) { >- s += a.getAttributeName() + "=" + a.getAttributeValue(); >- } >- return s; >- } >- >- /** >- * COPIED FROM ManifestSourcePage - from a getRangeElement body >- */ >- public static PluginObjectNode getNode(ManifestEditor editor, int offset, boolean hashCode) { >- ManifestSourcePage page = (ManifestSourcePage) editor.findPage("plugin-context"); >- if (page != null) { >- IPluginModelBase model = (IPluginModelBase) page.getInputContext().getModel(); >- PluginObjectNode node = (PluginObjectNode) PdeEditingMonitor.findNode(model.getPluginBase().getLibraries(), >- offset, hashCode); >- if (node == null) >- node = (PluginObjectNode) PdeEditingMonitor.findNode(model.getPluginBase().getImports(), offset, >- hashCode); >- if (node == null) >- node = (PluginObjectNode) PdeEditingMonitor.findNode(model.getPluginBase().getExtensionPoints(), >- offset, hashCode); >- if (node == null) >- node = (PluginObjectNode) PdeEditingMonitor.findNode(model.getPluginBase().getExtensions(), offset, >- hashCode); >- if (node == null) { >- node = (PluginObjectNode) PdeEditingMonitor.findNode(new IPluginObject[] { model.getPluginBase() }, >- offset, hashCode); >- } >- return node; >- } >- return null; >- } >- >- public static PluginObjectNode getNode(IDocument d, IFile f, int num, boolean hashCode) throws CoreException { >- PluginModel model = new PluginModel(d, true); >- model.setUnderlyingResource(f); >- if (!model.isLoaded()) { >- model.load(); >- model.setEnabled(true); >- } >- >- PluginObjectNode node = (PluginObjectNode) PdeEditingMonitor.findNode(model.getPluginBase().getLibraries(), >- num, hashCode); >- if (node == null) >- node = (PluginObjectNode) PdeEditingMonitor.findNode(model.getPluginBase().getImports(), num, hashCode); >- if (node == null) >- node = (PluginObjectNode) PdeEditingMonitor.findNode(model.getPluginBase().getExtensionPoints(), num, >- hashCode); >- if (node == null) >- node = (PluginObjectNode) PdeEditingMonitor.findNode(model.getPluginBase().getExtensions(), num, hashCode); >- if (node == null) { >- node = (PluginObjectNode) PdeEditingMonitor.findNode(new IPluginObject[] { model.getPluginBase() }, num, >- hashCode); >- } >- return node; >- } >- >- /** >- * COPIED FROM ManifestSourcePage >- */ >- private static IDocumentNode findNode(IPluginObject[] nodes, int offset, boolean hashCode) { >- for (int i = 0; i < nodes.length; i++) { >- IDocumentNode node = (IDocumentNode) nodes[i]; >- IDocumentNode[] children = node.getChildNodes(); >- >- // changed region - added to check the children to make it work >- // properly >- IDocumentNode node2 = null; >- if (children.length > 0) >- node2 = PdeEditingMonitor.findNode(children, offset, hashCode); >- // end changed region >- >- if (node2 != null && node2 instanceof IPluginObject) >- return node2; >- >- if (!hashCode) { >- if (offset >= node.getOffset() && offset < node.getOffset() + node.getLength()) { >- return node; >- } >- } else { >- if (getStringOfNode(node).hashCode() == offset) >- return node; >- } >- } >- return null; >- } >- >- /** >- * Copy of previous, taking different arguments >- */ >- private static IDocumentNode findNode(IDocumentNode[] nodes, int offset, boolean hashCode) { >- for (int i = 0; i < nodes.length; i++) { >- IDocumentNode node = nodes[i]; >- IDocumentNode[] children = node.getChildNodes(); >- IDocumentNode node2 = null; >- if (children.length > 0) >- node2 = PdeEditingMonitor.findNode(children, offset, hashCode); >- if (node2 != null) >- return node2; >- >- if (!hashCode) { >- if (offset >= node.getOffset() && offset < node.getOffset() + node.getLength()) { >- return node; >- } >- } else { >- if (getStringOfNode(node).hashCode() == offset) >- return node; >- } >- } >- return null; >- } >-} >- >-// XXX used if we support the xmen editor >-// if (part instanceof XMLTextEditor) { >-// XMLTextEditor editor = (XMLTextEditor)part; >-// TextSelection textSelection = >-// (TextSelection)editor.getSelectionProvider().getSelection(); >-// if (textSelection != null) { >-// >-// try{ >-// // get the model for the xml elements >-// XMLReconciler rec = editor.getModel(); >-// >-// int start = textSelection.getStartLine(); >-// int end = textSelection.getEndLine(); >-// >-// // get the node that was selected >-// XMLNode node = rec.getNodeFromLine(start); >-// >-// ContextCorePlugin.getTaskscapeManager().handleElementSelected( >-// node.getHandle(), node.getCanName(), >-// IDegreeOfInterest.Value.Selections, >-// ITaskscapeNode.Kind.XML); >-// >-// }catch(Exception e){ >-// //handle properly >-// } >-// } >Index: src/org/eclipse/mylar/internal/ide/xml/pde/PdeUiBridge.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/ide/xml/pde/PdeUiBridge.java >diff -N src/org/eclipse/mylar/internal/ide/xml/pde/PdeUiBridge.java >--- src/org/eclipse/mylar/internal/ide/xml/pde/PdeUiBridge.java 7 Feb 2007 15:16:55 -0000 1.4 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,328 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004 - 2006 University Of British Columbia 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: >- * University Of British Columbia - initial API and implementation >- *******************************************************************************/ >-/* >- * Created on Apr 6, 2005 >- */ >-package org.eclipse.mylar.internal.ide.xml.pde; >- >-import java.lang.reflect.Field; >-import java.util.ArrayList; >-import java.util.Collections; >-import java.util.List; >- >-import org.eclipse.core.internal.resources.Workspace; >-import org.eclipse.core.resources.IFile; >-import org.eclipse.core.resources.IResource; >-import org.eclipse.core.resources.ResourcesPlugin; >-import org.eclipse.core.runtime.IPath; >-import org.eclipse.core.runtime.Path; >-import org.eclipse.jface.text.TextSelection; >-import org.eclipse.jface.viewers.ISelectionChangedListener; >-import org.eclipse.jface.viewers.ITreeViewerListener; >-import org.eclipse.jface.viewers.SelectionChangedEvent; >-import org.eclipse.jface.viewers.TreeExpansionEvent; >-import org.eclipse.jface.viewers.TreeViewer; >-import org.eclipse.mylar.context.core.IMylarElement; >-import org.eclipse.mylar.context.ui.AbstractContextUiBridge; >-import org.eclipse.mylar.core.MylarStatusHandler; >-import org.eclipse.mylar.resources.MylarResourcesPlugin; >-import org.eclipse.pde.internal.core.text.plugin.PluginObjectNode; >-import org.eclipse.pde.internal.ui.editor.FormOutlinePage; >-import org.eclipse.pde.internal.ui.editor.ISortableContentOutlinePage; >-import org.eclipse.pde.internal.ui.editor.PDEFormEditor; >-import org.eclipse.pde.internal.ui.editor.PDESourcePage; >-import org.eclipse.pde.internal.ui.editor.SourceOutlinePage; >-import org.eclipse.pde.internal.ui.editor.plugin.ManifestEditor; >-import org.eclipse.pde.internal.ui.editor.plugin.PluginInputContext; >-import org.eclipse.ui.IEditorInput; >-import org.eclipse.ui.IEditorPart; >-import org.eclipse.ui.IEditorReference; >-import org.eclipse.ui.IWorkbenchPage; >-import org.eclipse.ui.PartInitException; >-import org.eclipse.ui.PlatformUI; >-import org.eclipse.ui.forms.editor.FormEditor; >-import org.eclipse.ui.ide.IDE; >-import org.eclipse.ui.texteditor.AbstractTextEditor; >- >-/** >- * @author Mik Kersten >- * @author Shawn Minto >- */ >-public class PdeUiBridge extends AbstractContextUiBridge { >- >- private TreeViewerListener treeSelectionChangedListener; >- >- public PdeUiBridge() { >- treeSelectionChangedListener = new TreeViewerListener(); >- } >- >- /** >- * @see org.eclipse.mylar.context.ui.AbstractContextUiBridge#open(org.eclipse.mylar.context.core.IMylarElement) >- */ >- @Override >- public void open(IMylarElement node) { >- // get the handle of the node >- String handle = node.getHandleIdentifier(); >- >- int first = handle.indexOf(";"); >- String filename = ""; >- if (first == -1) >- filename = handle; >- else >- filename = handle.substring(0, first); >- >- try { >- // get the file >- IPath path = new Path(filename); >- IFile f = (IFile) ((Workspace) ResourcesPlugin.getWorkspace()).newResource(path, IResource.FILE); >- >- // open the xml file looking at the proper line >- IEditorPart editor = openInEditor(f, true); >- >- // if the editor is null, we had a problem and should return >- if (editor == null) { >- MylarStatusHandler.log("Unable to open editor for file: " + filename, this); >- return; >- } >- >- // get the contents and create a new document so that we can get >- // the offsets to highlight >- // String content = XmlNodeHelper.getContents(f.getContents()); >- // >- // IDocument d = new Document(content); >- >- // if(first != -1){ >- // int start = Integer.parseInt(handle.substring(first + 1)); >- // >- // // get the offsets for the element >- // int startOffset = d.getLineOffset(start); >- // int length = 0; >- // >- // // set the selection if the selection provider is not null >- // ISelectionProvider selectionProvider = >- // editor.getEditorSite().getSelectionProvider(); >- // if(selectionProvider != null) >- // selectionProvider.setSelection(new TextSelection(startOffset, >- // length)); >- // } >- >- } catch (Exception e) { >- // ContextCorePlugin.log(e, "ERROR OPENING XML EDITOR\n" + >- // e.getMessage()); >- } >- } >- >- /** >- * Open a file in the appropriate editor >- * >- * @param file >- * The IFile to open >- * @param activate >- * Whether to activate the editor or not >- * @return The IEditorPart that the file opened in >- * @throws PartInitException >- */ >- private IEditorPart openInEditor(IFile file, boolean activate) throws PartInitException { >- if (file != null) { >- IWorkbenchPage p = MylarResourcesPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage(); >- if (p != null && file.exists()) { >- IEditorPart editorPart = IDE.openEditor(p, file, activate); >- // initializeHighlightRange(editorPart); >- return editorPart; >- } >- } >- return null; >- } >- >- @Override >- public void close(IMylarElement node) { >- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); >- if (page != null) { >- IEditorReference[] references = page.getEditorReferences(); >- for (int i = 0; i < references.length; i++) { >- IEditorPart part = references[i].getEditor(false); >- if (part != null) { >- // HACK find better way to get the filename other than the >- // tooltip >- if (("/" + part.getTitleToolTip()).equals(node.getHandleIdentifier())) { >- if (part instanceof FormEditor) { >- ((FormEditor) part).close(true); >- } else if (part instanceof AbstractTextEditor) { >- ((AbstractTextEditor) part).close(true); >- } >- } >- // if (part.getEditorInput() instanceof IFileEditorInput) { >- // IFileEditorInput input = >- // (IFileEditorInput)part.getEditorInput(); >- // if (input.getFile().getName().endsWith(".xml")) { >- // if (part instanceof FormEditor) { >- // ((FormEditor)part).close(true); >- // } else if (part instanceof AbstractTextEditor) { >- // ((AbstractTextEditor)part).close(true); >- // } >- // } >- // } >- } >- } >- } >- } >- >- @Override >- public boolean acceptsEditor(IEditorPart editorPart) { >- return editorPart instanceof ManifestEditor; >- } >- >- /** >- * HACK: use a lot of reflection to get the TreeViewer >- */ >- @Override >- public List<TreeViewer> getContentOutlineViewers(IEditorPart editor) { >- if (editor instanceof PDEFormEditor) { >- PDESourcePage sp = null; >- List<TreeViewer> viewers = new ArrayList<TreeViewer>(2); >- if ((sp = (PDESourcePage) ((PDEFormEditor) editor).findPage(PluginInputContext.CONTEXT_ID)) != null) { >- ISortableContentOutlinePage p = sp.getContentOutline(); >- if (p != null && p.getControl() != null) { >- try { >- if (p != null && p instanceof SourceOutlinePage) { >- // get the tree viewer for the outline >- Class<?> clazz2 = p.getClass(); >- Field field2 = clazz2.getDeclaredField("viewer"); >- field2.setAccessible(true); >- Object f2 = field2.get(p); >- if (f2 != null && f2 instanceof TreeViewer) { >- viewers.add((TreeViewer) f2); >- } >- } >- } catch (Exception e) { >- MylarStatusHandler.log(e, "failed to get tree viewers"); >- return null; >- } >- } >- } >- >- try { >- // get the current page of the outline >- Class<?> clazz = PDEFormEditor.class; >- Field field = null; >- try { >- field = clazz.getDeclaredField("formOutline"); >- } catch (NoSuchFieldException e) { >- field = clazz.getDeclaredField("fFormOutline"); >- } >- field.setAccessible(true); >- Object f = field.get(editor); >- if (f != null && f instanceof FormOutlinePage) { >- // get the tree viewer for the outline >- Class<?> clazz2 = FormOutlinePage.class; >- Field field2 = null; >- try { >- field2 = clazz2.getDeclaredField("treeViewer"); >- } catch (NoSuchFieldException e) { >- field2 = clazz2.getDeclaredField("fTreeViewer"); >- } >- field2.setAccessible(true); >- Object f2 = field2.get(f); >- if (f2 != null && f2 instanceof TreeViewer) { >- TreeViewer treeViewer = (TreeViewer) f2; >- viewers.add(treeViewer); >- } >- } >- } catch (Exception e) { >- MylarStatusHandler.fail(e, "could not get PDE outline", false); >- return Collections.emptyList(); >- } >- >- // add a listener so that when the selection changes, the view is >- // refreshed to attempt to keep the ui model the same as the >- // taskscape one >- for (TreeViewer viewer : viewers) { >- viewer.addSelectionChangedListener(treeSelectionChangedListener); >- viewer.addTreeListener(treeSelectionChangedListener); >- } >- >- return viewers; >- } >- return Collections.emptyList(); >- } >- >- public void refreshOutline(Object element, boolean updateLabels, boolean setSelection) { >- IEditorPart editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); >- List<TreeViewer> treeViewers = getContentOutlineViewers(editorPart); >- for (TreeViewer treeViewer : treeViewers) { >- if (treeViewer != null) { >- if (element == null) { >- treeViewer.getControl().setRedraw(false); >- treeViewer.refresh(true); >- treeViewer.getControl().setRedraw(true); >- treeViewer.expandAll(); >- } else if (element instanceof PluginObjectNode) { >- treeViewer.getControl().setRedraw(false); >- treeViewer.refresh(element, true); >- treeViewer.getControl().setRedraw(true); >- treeViewer.expandAll(); >- } >- } >- } >- >- } >- >- /** >- * Class to listen to the tree views to attempt to refresh them more >- * frequently to keep the ui model consistant with the user selections >- * >- * @author Shawn Minto >- */ >- private class TreeViewerListener implements ISelectionChangedListener, ITreeViewerListener { >- public void selectionChanged(SelectionChangedEvent event) { >- Object o = event.getSource(); >- if (o instanceof TreeViewer) { >- ((TreeViewer) o).refresh(); >- ((TreeViewer) o).expandAll(); >- } >- } >- >- public void treeCollapsed(TreeExpansionEvent event) { >- Object o = event.getSource(); >- if (o instanceof TreeViewer) { >- ((TreeViewer) o).refresh(); >- } >- >- } >- >- public void treeExpanded(TreeExpansionEvent event) { >- Object o = event.getSource(); >- if (o instanceof TreeViewer) { >- ((TreeViewer) o).refresh(); >- } >- } >- } >- >- @Override >- public Object getObjectForTextSelection(TextSelection selection, IEditorPart editor) { >- return null; >- } >- >- @Override >- public void restoreEditor(IMylarElement document) { >- open(document); >- } >- >- @Override >- public IMylarElement getElement(IEditorInput input) { >- return null; >- } >- >- @Override >- public String getContentType() { >- return PdeStructureBridge.CONTENT_TYPE; >- } >-} >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.ide/META-INF/MANIFEST.MF,v >retrieving revision 1.274 >diff -u -r1.274 MANIFEST.MF >--- META-INF/MANIFEST.MF 14 Apr 2007 00:11:09 -0000 1.274 >+++ META-INF/MANIFEST.MF 17 Apr 2007 05:09:38 -0000 >@@ -30,7 +30,5 @@ > Export-Package: org.eclipse.mylar.internal.ide, > org.eclipse.mylar.internal.ide.ui, > org.eclipse.mylar.internal.ide.ui.actions, >- org.eclipse.mylar.internal.ide.xml, >- org.eclipse.mylar.internal.ide.xml.ant, >- org.eclipse.mylar.internal.ide.xml.pde >+ org.eclipse.mylar.internal.ide.xml > Bundle-RequiredExecutionEnvironment: J2SE-1.5 >Index: src/org/eclipse/mylar/internal/ide/xml/ant/AntEditingMonitor.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/ide/xml/ant/AntEditingMonitor.java >diff -N src/org/eclipse/mylar/internal/ide/xml/ant/AntEditingMonitor.java >--- src/org/eclipse/mylar/internal/ide/xml/ant/AntEditingMonitor.java 8 Feb 2007 02:10:05 -0000 1.5 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,130 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004 - 2006 University Of British Columbia 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: >- * University Of British Columbia - initial API and implementation >- *******************************************************************************/ >-/* >- * Created on Apr 1, 2005 >- */ >-package org.eclipse.mylar.internal.ide.xml.ant; >- >-//import java.lang.reflect.InvocationTargetException; >-//import java.lang.reflect.Method; >- >-import org.eclipse.ant.internal.ui.editor.AntEditor; >-import org.eclipse.ant.internal.ui.model.AntElementNode; >-import org.eclipse.ant.internal.ui.model.AntModel; >-import org.eclipse.ant.internal.ui.model.AntProjectNode; >-import org.eclipse.jface.text.TextSelection; >-import org.eclipse.jface.viewers.ISelection; >-import org.eclipse.mylar.core.MylarStatusHandler; >-import org.eclipse.mylar.internal.ide.xml.XmlNodeHelper; >-import org.eclipse.mylar.monitor.ui.AbstractUserInteractionMonitor; >-import org.eclipse.ui.IEditorInput; >-import org.eclipse.ui.IWorkbenchPart; >-import org.eclipse.ui.part.FileEditorInput; >- >-/** >- * @author Mik Kersten >- */ >-public class AntEditingMonitor extends AbstractUserInteractionMonitor { >- >- public AntEditingMonitor() { >- super(); >- } >- >- @Override >- protected void handleWorkbenchPartSelection(IWorkbenchPart part, ISelection selection, boolean contributeToContext) { >- if (part instanceof AntEditor) { >- >- TextSelection textSelection = null; >- IEditorInput in = null; >- >- // assume that we are editing an xml file due to the editor used >- // this is the build.xml and other ant file editor >- AntEditor editor = (AntEditor) part; >- >- if (!(editor.getSelectionProvider().getSelection() instanceof TextSelection)) >- return; >- >- textSelection = (TextSelection) editor.getSelectionProvider().getSelection(); >- in = editor.getEditorInput(); >- >- // check if we have a text selection >- if (textSelection != null && editor != null && editor.getAntModel() != null) { >- try { >- AntElementNode node = editor.getAntModel().getNode(textSelection.getOffset(), false); >- if (node == null) { >- return; >- } >- >- FileEditorInput fei = (FileEditorInput) in; >-// Method method = AntElementNode.class.getDeclaredMethod("getElementPath", new Class[] {}); >-// method.setAccessible(true); >-// String path = (String) method.invoke(node, new Object[] {}); >- String path = node.getElementPath(); >- if (path == null) { >- return; >- } >- XmlNodeHelper xnode = new XmlNodeHelper(fei.getFile().getFullPath().toString(), path); >- super.handleElementSelection(part, xnode, contributeToContext); >- } catch (Exception e) { >- MylarStatusHandler.log(e, "selection resolve failed"); >- } >- } >- } >- return; >- } >- >- public static AntElementNode getNode(AntModel antModel, String elementPath) throws SecurityException, >- NoSuchMethodException { >- AntProjectNode topNode; >- try { >- topNode = antModel.getProjectNode(); >- return getNode(topNode, elementPath); >- } catch (Exception e) { >- return null; >- } >- } >- >- /** >- * HACK: using reflection to gain accessibility >- */ >- private static AntElementNode getNode(AntElementNode topNode, String elementPath) throws NoSuchMethodException, >- IllegalAccessException { >- if (topNode == null) >- return null; >- >-// Method method = AntElementNode.class.getDeclaredMethod("getElementPath", new Class[] {}); >-// method.setAccessible(true); >-// String path = (String) method.invoke(topNode, new Object[] {}); >- String path = topNode.getElementPath(); >- if (path.compareTo(elementPath) == 0) { >- return topNode; >- } >- >- if (topNode.getChildNodes() == null) >- return null; >- >- for (Object obj : topNode.getChildNodes()) { >- if (obj instanceof AntElementNode) { >- AntElementNode node = (AntElementNode) obj; >-// path = (String) method.invoke(node, new Object[] {}); >- path = node.getElementPath(); >- if (path.compareTo(elementPath) == 0) { >- return node; >- } else { >- AntElementNode node2 = getNode(node, elementPath); >- if (node2 != null) >- return node2; >- } >- } >- } >- return null; >- } >-} >Index: src/org/eclipse/mylar/internal/ide/xml/ant/AntUiBridge.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/ide/xml/ant/AntUiBridge.java >diff -N src/org/eclipse/mylar/internal/ide/xml/ant/AntUiBridge.java >--- src/org/eclipse/mylar/internal/ide/xml/ant/AntUiBridge.java 7 Feb 2007 15:16:54 -0000 1.4 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,202 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004 - 2006 University Of British Columbia 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: >- * University Of British Columbia - initial API and implementation >- *******************************************************************************/ >-/* >- * Created on Apr 6, 2005 >- */ >-package org.eclipse.mylar.internal.ide.xml.ant; >- >-import java.lang.reflect.Method; >-import java.util.ArrayList; >-import java.util.List; >- >-import org.eclipse.ant.internal.ui.editor.AntEditor; >-import org.eclipse.ant.internal.ui.editor.outline.AntEditorContentOutlinePage; >-import org.eclipse.core.internal.resources.Workspace; >-import org.eclipse.core.resources.IFile; >-import org.eclipse.core.resources.IResource; >-import org.eclipse.core.resources.ResourcesPlugin; >-import org.eclipse.core.runtime.IPath; >-import org.eclipse.core.runtime.Path; >-import org.eclipse.jface.text.TextSelection; >-import org.eclipse.jface.viewers.TreeViewer; >-import org.eclipse.mylar.context.core.IMylarElement; >-import org.eclipse.mylar.context.ui.AbstractContextUiBridge; >-import org.eclipse.mylar.core.MylarStatusHandler; >-import org.eclipse.mylar.internal.ide.MylarIdePlugin; >-import org.eclipse.ui.IEditorInput; >-import org.eclipse.ui.IEditorPart; >-import org.eclipse.ui.IEditorReference; >-import org.eclipse.ui.IFileEditorInput; >-import org.eclipse.ui.IWorkbenchPage; >-import org.eclipse.ui.PartInitException; >-import org.eclipse.ui.PlatformUI; >-import org.eclipse.ui.forms.editor.FormEditor; >-import org.eclipse.ui.ide.IDE; >-import org.eclipse.ui.texteditor.AbstractTextEditor; >-import org.eclipse.ui.views.contentoutline.ContentOutlinePage; >-import org.eclipse.ui.views.contentoutline.IContentOutlinePage; >- >-/** >- * @author Mik Kersten >- */ >-public class AntUiBridge extends AbstractContextUiBridge { >- >- /** >- * @see org.eclipse.mylar.context.ui.AbstractContextUiBridge#open(org.eclipse.mylar.context.core.IMylarElement) >- */ >- @Override >- public void open(IMylarElement node) { >- // get the handle of the node >- String handle = node.getHandleIdentifier(); >- >- int first = handle.indexOf(";"); >- String filename = ""; >- if (first == -1) >- filename = handle; >- else >- filename = handle.substring(0, first); >- >- try { >- // get the file >- IPath path = new Path(filename); >- IFile f = (IFile) ((Workspace) ResourcesPlugin.getWorkspace()).newResource(path, IResource.FILE); >- >- // open the xml file looking at the proper line >- IEditorPart editor = openInEditor(f, true); >- >- // if the editor is null, we had a problem and should return >- if (editor == null) { >- MylarStatusHandler.log("Unable to open editor for file: " + filename, this); >- return; >- } >- >- // get the contents and create a new document so that we can get >- // the offsets to highlight >- // String content = XmlNodeHelper.getContents(f.getContents()); >- >- // IDocument d = new Document(content); >- >- // if(first != -1){ >- // int start = Integer.parseInt(handle.substring(first + 1)); >- // >- // // get the offsets for the element >- // int startOffset = d.getLineOffset(start); >- // int length = 0; >- // >- // // set the selection if the selection provider is not null >- // ISelectionProvider selectionProvider = >- // editor.getEditorSite().getSelectionProvider(); >- // if(selectionProvider != null) >- // selectionProvider.setSelection(new TextSelection(startOffset, >- // length)); >- // } >- >- } catch (Exception e) { >- MylarStatusHandler.fail(e, "ERROR OPENING XML EDITOR\n" + e.getMessage(), false); >- } >- } >- >- /** >- * Open a file in the appropriate editor >- * >- * @param file >- * The IFile to open >- * @param activate >- * Whether to activate the editor or not >- * @return The IEditorPart that the file opened in >- * @throws PartInitException >- */ >- private IEditorPart openInEditor(IFile file, boolean activate) throws PartInitException { >- if (file != null) { >- IWorkbenchPage p = MylarIdePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage(); >- if (p != null && file.exists()) { >- try { >- IEditorPart editorPart = IDE.openEditor(p, file, activate); >- return editorPart; >- } catch (Exception e) { >- // ignore this >- } >- // initializeHighlightRange(editorPart); >- } >- } >- return null; >- } >- >- @Override >- public void close(IMylarElement node) { >- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); >- if (page != null) { >- IEditorReference[] references = page.getEditorReferences(); >- for (int i = 0; i < references.length; i++) { >- IEditorPart part = references[i].getEditor(false); >- if (part != null) { >- if (part.getEditorInput() instanceof IFileEditorInput) { >- IFileEditorInput input = (IFileEditorInput) part.getEditorInput(); >- if ((input.getFile().getFullPath().toString()).equals(node.getHandleIdentifier())) { >- if (part instanceof FormEditor) { >- ((FormEditor) part).close(true); >- } else if (part instanceof AbstractTextEditor) { >- ((AbstractTextEditor) part).close(true); >- } >- } >- } >- } >- } >- } >- } >- >- @Override >- public boolean acceptsEditor(IEditorPart editorPart) { >- return editorPart instanceof AntEditor; >- } >- >- /** >- * HACK: use reflection to get the TreeViewer >- */ >- @Override >- public List<TreeViewer> getContentOutlineViewers(IEditorPart editor) { >- List<TreeViewer> viewers = new ArrayList<TreeViewer>(); >- if (editor instanceof AntEditor) { >- try { >- AntEditor ae = (AntEditor) editor; >- AntEditorContentOutlinePage outline = (AntEditorContentOutlinePage) ae >- .getAdapter(IContentOutlinePage.class); >- Class<?> clazz = ContentOutlinePage.class; >- Method method = clazz.getDeclaredMethod("getTreeViewer", new Class[] {}); >- method.setAccessible(true); >- viewers.add((TreeViewer) method.invoke(outline, new Object[] {})); >- } catch (Exception e) { >- MylarStatusHandler.log(e, "couldn't get outline"); >- } >- } >- return viewers; >- } >- >- @Override >- public Object getObjectForTextSelection(TextSelection selection, IEditorPart editor) { >- return null; >- } >- >- @Override >- public void restoreEditor(IMylarElement document) { >- open(document); >- } >- >- @Override >- public IMylarElement getElement(IEditorInput input) { >- return null; >- } >- >- @Override >- public String getContentType() { >- return AntStructureBridge.CONTENT_TYPE; >- } >-} >Index: src/org/eclipse/mylar/internal/ide/xml/ant/AntContextLabelProvider.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/ide/xml/ant/AntContextLabelProvider.java >diff -N src/org/eclipse/mylar/internal/ide/xml/ant/AntContextLabelProvider.java >--- src/org/eclipse/mylar/internal/ide/xml/ant/AntContextLabelProvider.java 9 Apr 2007 20:30:34 -0000 1.5 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,62 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004 - 2006 University Of British Columbia 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: >- * University Of British Columbia - initial API and implementation >- *******************************************************************************/ >- >-package org.eclipse.mylar.internal.ide.xml.ant; >- >-import org.eclipse.mylar.context.core.AbstractContextStructureBridge; >-import org.eclipse.mylar.context.core.ContextCorePlugin; >-import org.eclipse.mylar.context.core.IMylarElement; >-import org.eclipse.mylar.context.core.IMylarRelation; >-import org.eclipse.mylar.internal.context.ui.AbstractContextLabelProvider; >-import org.eclipse.mylar.internal.context.ui.ContextUiImages; >-import org.eclipse.mylar.internal.ide.MylarIdePlugin; >-import org.eclipse.swt.graphics.Image; >- >-/** >- * @author Mik Kersten >- */ >-public class AntContextLabelProvider extends AbstractContextLabelProvider { >- >- public static final String LABEL_RELATION = "referenced by"; >- >- @Override >- protected Image getImage(IMylarElement node) { >- return ContextUiImages.getImage(ContextUiImages.FILE_XML); >- } >- >- @Override >- protected Image getImage(IMylarRelation edge) { >- return ContextUiImages.getImage(MylarIdePlugin.EDGE_REF_XML); >- } >- >- @Override >- protected String getText(IMylarElement node) { >- AbstractContextStructureBridge bridge = ContextCorePlugin.getDefault().getStructureBridge(AntStructureBridge.CONTENT_TYPE); >- return bridge.getName(bridge.getObjectForHandle(node.getHandleIdentifier())); >- } >- >- @Override >- protected String getText(IMylarRelation edge) { >- return LABEL_RELATION; >- } >- >- @Override >- protected Image getImageForObject(Object object) { >- return ContextUiImages.getImage(ContextUiImages.FILE_XML); >- } >- >- @Override >- protected String getTextForObject(Object object) { >- AbstractContextStructureBridge bridge = ContextCorePlugin.getDefault().getStructureBridge(AntStructureBridge.CONTENT_TYPE); >- return bridge.getName(object); >- } >- >-} >Index: src/org/eclipse/mylar/internal/ide/xml/ant/AntStructureBridge.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/ide/xml/ant/AntStructureBridge.java >diff -N src/org/eclipse/mylar/internal/ide/xml/ant/AntStructureBridge.java >--- src/org/eclipse/mylar/internal/ide/xml/ant/AntStructureBridge.java 9 Apr 2007 20:30:34 -0000 1.5 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,334 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2004 - 2006 University Of British Columbia 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: >- * University Of British Columbia - initial API and implementation >- *******************************************************************************/ >-/* >- * Created on Apr 20, 2005 >- */ >-package org.eclipse.mylar.internal.ide.xml.ant; >- >-//import java.lang.reflect.Method; >-import java.util.Collections; >-import java.util.List; >- >-import org.eclipse.ant.internal.ui.editor.AntEditor; >-import org.eclipse.ant.internal.ui.editor.text.AntAnnotationModel; >-import org.eclipse.ant.internal.ui.model.AntElementNode; >-import org.eclipse.ant.internal.ui.model.AntModel; >-import org.eclipse.ant.internal.ui.model.IProblemRequestor; >-import org.eclipse.ant.internal.ui.model.LocationProvider; >-import org.eclipse.core.internal.resources.File; >-import org.eclipse.core.internal.resources.Workspace; >-import org.eclipse.core.resources.IFile; >-import org.eclipse.core.resources.IResource; >-import org.eclipse.core.resources.ResourcesPlugin; >-import org.eclipse.core.runtime.IPath; >-import org.eclipse.core.runtime.Path; >-import org.eclipse.jface.text.Document; >-import org.eclipse.jface.text.IDocument; >-import org.eclipse.mylar.context.core.AbstractContextStructureBridge; >-import org.eclipse.mylar.context.core.ContextCorePlugin; >-import org.eclipse.mylar.core.MylarStatusHandler; >-import org.eclipse.mylar.internal.ide.xml.XmlNodeHelper; >-import org.eclipse.ui.IEditorPart; >-import org.eclipse.ui.PlatformUI; >-import org.eclipse.ui.part.FileEditorInput; >-import org.eclipse.ui.views.markers.internal.ProblemMarker; >- >-/** >- * @author Mik Kersten >- */ >-public class AntStructureBridge extends AbstractContextStructureBridge { >- >- public final static String CONTENT_TYPE = "build.xml"; >- >- private static final char HANDLE_PATH_SEPARATOR = ';'; >- >- /** >- * @see org.eclipse.mylar.context.core.AbstractContextStructureBridge#getContentType() >- */ >- @Override >- public String getContentType() { >- return CONTENT_TYPE; >- } >- >- @Override >- public String getContentType(String elementHandle) { >- if (elementHandle.endsWith(".xml")) { >- return parentContentType; >- } else { >- return CONTENT_TYPE; >- } >- } >- >- @Override >- public List<String> getChildHandles(String handle) { >- return Collections.emptyList(); >- } >- >- /** >- * @see org.eclipse.mylar.context.core.AbstractContextStructureBridge#getParentHandle(java.lang.String) >- */ >- @Override >- public String getParentHandle(String handle) { >- Object o = getObjectForHandle(handle); >- >- // we can only get the parent if the element is an AntElementNode >- if (o instanceof AntElementNode) { >- >- // try to get the parent node >- AntElementNode parent = ((AntElementNode) o).getParentNode(); >- >- if (parent != null) { >- // get the handle for the parent node >- return getHandleIdentifier(parent); >- } else { >- // if the parent is null, we just need to return the handle for >- // the file >- int delimeterIndex = handle.indexOf(";"); >- if (delimeterIndex != -1) { >- String parentHandle = handle.substring(0, delimeterIndex); >- return parentHandle; >- } else { >- return null; >- } >- } >- } else if (o instanceof IFile) { >- AbstractContextStructureBridge parentBridge = ContextCorePlugin.getDefault().getStructureBridge(parentContentType); >- return parentBridge.getParentHandle(handle); >- } else { >- // return null if we can't get a parents >- return null; >- } >- } >- >- /** >- * TODO: performance issue? >- */ >- @Override >- public Object getObjectForHandle(String handle) { >- try { >- if (handle == null) >- return null; >- int first = handle.indexOf(HANDLE_PATH_SEPARATOR); >- String filename = ""; >- if (first == -1) { >- // we have just the filename, so return the IFile for this >- // filename >- filename = handle; >- IPath path = new Path(filename); >- IFile f = (IFile) ((Workspace) ResourcesPlugin.getWorkspace()).newResource(path, IResource.FILE); >- return f; >- } else { >- // we have an element since there is a line number >- // get the filename from the handle >- filename = handle.substring(0, first); >- } >- >- // get the file and create a new FileEditorInput >- IPath path = new Path(filename); >- IFile file = (IFile) ((Workspace) ResourcesPlugin.getWorkspace()).newResource(path, IResource.FILE); >- FileEditorInput fei = new FileEditorInput(file); >- >- // get the line number that the element is on >- String elementPath = handle.substring(first + 1); >- if (elementPath.equals("")) { >- return file; >- } else { >- // XXX needed if the editor is the only way to get the model >- // get the active editor, which should be the ant editor so we >- // can get the AntModel >- IEditorPart editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() >- .getActiveEditor(); >- if (editorPart instanceof AntEditor) { >- AntModel antModel = ((AntEditor) editorPart).getAntModel(); >- if (antModel != null) >- return AntEditingMonitor.getNode(antModel, elementPath); >- } else { >- String content = XmlNodeHelper.getContents(file.getContents()); >- IDocument d = new Document(content); >- // create the ant model and get the element from it >- IProblemRequestor p = new AntAnnotationModel(file); >- AntModel am = new AntModel(d, p, new LocationProvider(fei)); >- am.reconcile(); >- return AntEditingMonitor.getNode(am, elementPath); >- } >- } >- } catch (Throwable t) { >- // ignore this, means that the file or node doesn't exist >- } >- return null; >- } >- >- /** >- * Handle is filename;XPath >- * >- * @see org.eclipse.mylar.context.core.AbstractContextStructureBridge#getHandleIdentifier(java.lang.Object) >- */ >- @Override >- public String getHandleIdentifier(Object object) { >- // we can only create handles for AntElementNodes and build.xml Files >- if (object instanceof XmlNodeHelper) { >- return ((XmlNodeHelper) object).getHandle(); >- } else if (object instanceof AntElementNode) { >- AntElementNode node = (AntElementNode) object; >- String path = node.getElementPath(); >- if (path == null || node == null || node.getIFile() == null) { >- return null; >- } >- XmlNodeHelper helper = new XmlNodeHelper(node.getIFile().getFullPath().toString(), path); >- if (helper != null) { >- return helper.getHandle(); >- } >- } else if (object instanceof File) { >- File file = (File) object; >- // get the handle for the build.xml file >- if (file.getFullPath().toString().endsWith("build.xml")) >- return file.getFullPath().toString(); >- } >- return null; >- } >- >- /** >- * @see org.eclipse.mylar.context.core.AbstractContextStructureBridge#getName(java.lang.Object) >- */ >- @Override >- public String getName(Object object) { >- if (object instanceof AntElementNode) { >- AntElementNode n = (AntElementNode) object; >- String name = n.getIFile().getName() + ": " + n.getName(); >- return name; >- } else if (object instanceof File) { >- File file = (File) object; >- if (file.getFullPath().toString().endsWith("build.xml")) >- return "build.xml"; >- } >- return ""; >- } >- >- /** >- * @see org.eclipse.mylar.context.core.AbstractContextStructureBridge#canBeLandmark(Object) >- * >- * TODO: make a non-handle based test >- */ >- @Override >- public boolean canBeLandmark(String handle) { >- if (handle != null) { >- return handle.indexOf(';') == -1; >- } else { >- return false; >- } >- } >- >- /** >- * @see org.eclipse.mylar.context.core.AbstractContextStructureBridge#acceptsObject(java.lang.Object) >- */ >- @Override >- public boolean acceptsObject(Object object) { >- // we accept AntElementNode and build.xml File objects >- if (object instanceof AntElementNode) { >- return true; >- } else if (object instanceof XmlNodeHelper) { >- if (((XmlNodeHelper) object).getFilename().endsWith("build.xml")) >- return true; >- } else if (object instanceof File) { >- File file = (File) object; >- if (file.getFullPath().toString().endsWith("build.xml")) >- return true; >- } >- return false; >- } >- >- /** >- * @see org.eclipse.mylar.context.core.AbstractContextStructureBridge#canFilter(java.lang.Object) >- */ >- @Override >- public boolean canFilter(Object element) { >- return true; >- } >- >- /** >- * @see org.eclipse.mylar.context.core.AbstractContextStructureBridge#isDocument(java.lang.String) >- */ >- @Override >- public boolean isDocument(String handle) { >- return handle.indexOf(';') == -1; >- } >- >- /** >- * @see org.eclipse.mylar.context.core.AbstractContextStructureBridge#getHandleForOffsetInObject(Object, >- * int) >- */ >- @Override >- public String getHandleForOffsetInObject(Object resource, int offset) { >- if (resource == null) >- return null; >- if (resource instanceof ProblemMarker) { >- ProblemMarker marker = (ProblemMarker) resource; >- >- // we can only return a handle if the resource is build.xml >- try { >- IResource res = marker.getResource(); >- >- if (res instanceof IFile) { >- IFile file = (IFile) res; >- if (file.getFullPath().toString().endsWith("build.xml")) { >- return file.getFullPath().toString(); >- } else { >- return null; >- } >- } >- return null; >- } catch (Throwable t) { >- MylarStatusHandler.fail(t, "Could not find element for: " + marker, false); >- return null; >- } >- } else if (resource instanceof IFile) { >- try { >- IFile file = (IFile) resource; >- if (file.getFullPath().toString().endsWith("build.xml")) { >- FileEditorInput fei = new FileEditorInput(file); >- String content = XmlNodeHelper.getContents(file.getContents()); >- IDocument d = new Document(content); >- // create the ant model and get the element from it >- IProblemRequestor p = new AntAnnotationModel(file); >- AntModel am = new AntModel(d, p, new LocationProvider(fei)); >- am.reconcile(); >- >- AntElementNode node = am.getNode(offset, false); >-// Method method = AntElementNode.class.getDeclaredMethod("getElementPath", new Class[] {}); >-// method.setAccessible(true); >-// String path = (String) method.invoke(node, new Object[] {}); >- String path = node.getElementPath(); >- if (path == null) { >- return null; >- } >- String handle = new XmlNodeHelper(file.getFullPath().toString(), path).getHandle(); >- return handle; >- } >- } catch (Exception e) { >- MylarStatusHandler.log(e, "Unable to get handle for offset in object"); >- } >- } >- return null; >- } >- >-// public IProject getProjectForObject(Object object) { >-// while (!(object instanceof IFile)) { >-// String handle = getParentHandle(getHandleIdentifier(object)); >-// if (handle == null) >-// break; >-// object = getObjectForHandle(handle); >-// } >-// if (object instanceof IFile && acceptsObject(object)) { >-// return ((IFile) object).getProject(); >-// } >-// return null; >-// } >-} >Index: src/org/eclipse/mylar/internal/ide/MylarIdePlugin.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.ide/src/org/eclipse/mylar/internal/ide/MylarIdePlugin.java,v >retrieving revision 1.25 >diff -u -r1.25 MylarIdePlugin.java >--- src/org/eclipse/mylar/internal/ide/MylarIdePlugin.java 7 Feb 2007 15:16:55 -0000 1.25 >+++ src/org/eclipse/mylar/internal/ide/MylarIdePlugin.java 17 Apr 2007 05:09:38 -0000 >@@ -12,8 +12,6 @@ > > import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.mylar.core.MylarStatusHandler; >-import org.eclipse.mylar.internal.ide.xml.ant.AntEditingMonitor; >-import org.eclipse.mylar.internal.ide.xml.pde.PdeEditingMonitor; > import org.eclipse.mylar.monitor.ui.MylarMonitorUiPlugin; > import org.eclipse.ui.plugin.AbstractUIPlugin; > import org.osgi.framework.BundleContext; >@@ -22,17 +20,13 @@ > * @author Mik Kersten > */ > public class MylarIdePlugin extends AbstractUIPlugin { >- >+ > public static final String PLUGIN_ID = "org.eclipse.mylar.ide"; >- >+ > private static MylarIdePlugin INSTANCE; > > public static final ImageDescriptor EDGE_REF_XML = getImageDescriptor("icons/elcl16/edge-ref-xml.gif"); > >- private PdeEditingMonitor pdeEditingMonitor; >- >- private AntEditingMonitor antEditingMonitor; >- > public MylarIdePlugin() { > INSTANCE = this; > } >@@ -40,27 +34,21 @@ > @Override > public void start(BundleContext context) throws Exception { > super.start(context); >- >- pdeEditingMonitor = new PdeEditingMonitor(); >- MylarMonitorUiPlugin.getDefault().getSelectionMonitors().add(pdeEditingMonitor); >- >- antEditingMonitor = new AntEditingMonitor(); >- MylarMonitorUiPlugin.getDefault().getSelectionMonitors().add(antEditingMonitor); >- >-// final IWorkbench workbench = PlatformUI.getWorkbench(); >-// workbench.getDisplay().asyncExec(new Runnable() { >-// public void run() { >-// try { >-// pdeEditingMonitor = new PdeEditingMonitor(); >-// MylarMonitorPlugin.getDefault().getSelectionMonitors().add(pdeEditingMonitor); >-// >-// antEditingMonitor = new AntEditingMonitor(); >-// MylarMonitorPlugin.getDefault().getSelectionMonitors().add(antEditingMonitor); >-// } catch (Exception e) { >-// MylarStatusHandler.fail(e, "Mylar IDE initialization failed", false); >-// } >-// } >-// }); >+ >+ // final IWorkbench workbench = PlatformUI.getWorkbench(); >+ // workbench.getDisplay().asyncExec(new Runnable() { >+ // public void run() { >+ // try { >+ // pdeEditingMonitor = new PdeEditingMonitor(); >+ // MylarMonitorPlugin.getDefault().getSelectionMonitors().add(pdeEditingMonitor); >+ // >+ // antEditingMonitor = new AntEditingMonitor(); >+ // MylarMonitorPlugin.getDefault().getSelectionMonitors().add(antEditingMonitor); >+ // } catch (Exception e) { >+ // MylarStatusHandler.fail(e, "Mylar IDE initialization failed", false); >+ // } >+ // } >+ // }); > } > > @Override >@@ -68,8 +56,6 @@ > try { > super.stop(context); > INSTANCE = null; >- MylarMonitorUiPlugin.getDefault().getSelectionMonitors().remove(pdeEditingMonitor); >- MylarMonitorUiPlugin.getDefault().getSelectionMonitors().remove(antEditingMonitor); > } catch (Exception e) { > MylarStatusHandler.fail(e, > "Mylar IDE stop failed, Mylar may not have started properly (ensure correct Eclipse version)", >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.ide/plugin.xml,v >retrieving revision 1.50 >diff -u -r1.50 plugin.xml >--- plugin.xml 6 Jan 2007 06:31:33 -0000 1.50 >+++ plugin.xml 17 Apr 2007 05:09:38 -0000 >@@ -1,37 +1,8 @@ > <?xml version="1.0" encoding="UTF-8"?> > <?eclipse version="3.0"?> >-<?eclipse version="3.0"?> > <plugin> > >- <extension point="org.eclipse.mylar.context.core.bridges"> >- <structureBridge >- class="org.eclipse.mylar.internal.ide.xml.ant.AntStructureBridge" >- name="Ant Structure Bridge" >- parentContentType="*"/> >- <structureBridge >- class="org.eclipse.mylar.internal.ide.xml.pde.PdeStructureBridge" >- name="PDE Structure Bridge" >- parentContentType="*"/> >- </extension> > >- <extension point="org.eclipse.mylar.context.ui.bridges"> >- <uiBridge >- class="org.eclipse.mylar.internal.ide.xml.pde.PdeUiBridge" >- contentType="plugin.xml" >- activeSearchIcon="icons/elcl16/edge-ref-xml.gif" >- activeSearchLabel="XML Search"/> >- <labelProvider >- class="org.eclipse.mylar.internal.ide.xml.pde.PdeContextLabelProvider" >- contentType="plugin.xml"/> >- <uiBridge >- class="org.eclipse.mylar.internal.ide.xml.ant.AntUiBridge" >- contentType="build.xml" >- activeSearchIcon="icons/elcl16/edge-ref-xml.gif" >- activeSearchLabel="XML Search"/> >- <labelProvider >- class="org.eclipse.mylar.internal.ide.xml.ant.AntContextLabelProvider" >- contentType="build.xml"/> >- </extension> > > <extension point="org.eclipse.ui.preferencePages"> > <page >Index: .refactorings/2007/4/16/refactorings.index >=================================================================== >RCS file: .refactorings/2007/4/16/refactorings.index >diff -N .refactorings/2007/4/16/refactorings.index >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .refactorings/2007/4/16/refactorings.index 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,2 @@ >+1176782571643 Delete element >+1176783488221 Delete element >Index: .refactorings/2007/4/16/refactorings.history >=================================================================== >RCS file: .refactorings/2007/4/16/refactorings.history >diff -N .refactorings/2007/4/16/refactorings.history >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ .refactorings/2007/4/16/refactorings.history 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,5 @@ >+<?xml version="1.0" encoding="utf-8"?> >+<session version="1.0"> >+<refactoring accessors="true" comment="Delete 1 element(s) from project 'org.eclipse.mylar.ide' - Original project: 'org.eclipse.mylar.ide' - Original element: 'org.eclipse.mylar.ide/src/org.eclipse.mylar.internal.ide.xml.ant'" description="Delete element" element1="/src<org.eclipse.mylar.internal.ide.xml.ant" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1176782571643" subPackages="false" version="1.0"/> >+<refactoring accessors="true" comment="Delete 1 element(s) from project 'org.eclipse.mylar.ide' - Original project: 'org.eclipse.mylar.ide' - Original element: 'org.eclipse.mylar.ide/src/org.eclipse.mylar.internal.ide.xml.pde'" description="Delete element" element1="/src<org.eclipse.mylar.internal.ide.xml.pde" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1176783488221" subPackages="false" version="1.0"/> >+</session> >#P org.eclipse.mylar.java >Index: src/org/eclipse/mylar/internal/java/search/XmlJavaRelationProvider.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.java/src/org/eclipse/mylar/internal/java/search/XmlJavaRelationProvider.java,v >retrieving revision 1.1 >diff -u -r1.1 XmlJavaRelationProvider.java >--- src/org/eclipse/mylar/internal/java/search/XmlJavaRelationProvider.java 9 Apr 2007 20:30:29 -0000 1.1 >+++ src/org/eclipse/mylar/internal/java/search/XmlJavaRelationProvider.java 17 Apr 2007 05:09:39 -0000 >@@ -37,17 +37,16 @@ > import org.eclipse.jdt.core.IMember; > import org.eclipse.jdt.core.IType; > import org.eclipse.jdt.core.JavaCore; >+import org.eclipse.mylar.context.core.AbstractContextStructureBridge; > import org.eclipse.mylar.context.core.AbstractRelationProvider; > import org.eclipse.mylar.context.core.ContextCorePlugin; > import org.eclipse.mylar.context.core.IDegreeOfSeparation; > import org.eclipse.mylar.context.core.IMylarElement; >-import org.eclipse.mylar.context.core.AbstractContextStructureBridge; > import org.eclipse.mylar.core.MylarStatusHandler; > import org.eclipse.mylar.internal.context.core.DegreeOfSeparation; > import org.eclipse.mylar.internal.context.core.IActiveSearchListener; > import org.eclipse.mylar.internal.context.core.IMylarSearchOperation; > import org.eclipse.mylar.internal.ide.xml.XmlNodeHelper; >-import org.eclipse.mylar.internal.ide.xml.pde.PdeStructureBridge; > import org.eclipse.mylar.resources.MylarResourcesPlugin; > import org.eclipse.search.core.text.TextSearchScope; > import org.eclipse.search.internal.ui.text.FileSearchQuery; >@@ -72,9 +71,12 @@ > > public static final Map<Match, XmlNodeHelper> nodeMap = new HashMap<Match, XmlNodeHelper>(); > >+ //TODO: copied from PdeStructure bridge: Pde has a dep on Java but Java should not have a dep on PDE >+ protected static final String PDE_CONTENT_TYPE = "plugin.xml"; >+ > public XmlJavaRelationProvider() { > // TODO: should this be a generic XML extension? >- super(PdeStructureBridge.CONTENT_TYPE, SOURCE_ID); >+ super(PDE_CONTENT_TYPE, SOURCE_ID); > } > > @Override >@@ -113,7 +115,7 @@ > // create a search scope for the projects of landmarks > Set<IResource> l = new HashSet<IResource>(); > for (IMylarElement landmark : landmarks) { >- if (landmark.getContentType().equals(PdeStructureBridge.CONTENT_TYPE)) { >+ if (landmark.getContentType().equals(PDE_CONTENT_TYPE)) { > // || > // landmark.getContentType().equals(AntStructureBridge.CONTENT_TYPE)) > // { >@@ -136,7 +138,7 @@ > > IResource[] res = new IResource[l.size()]; > res = l.toArray(res); >- TextSearchScope doiScope = FileTextSearchScope.newSearchScope(res, new String[] {PdeStructureBridge.CONTENT_TYPE}, false); >+ TextSearchScope doiScope = FileTextSearchScope.newSearchScope(res, new String[] {PDE_CONTENT_TYPE}, false); > return l.isEmpty() ? null : doiScope; > case 2: > // create a search scope for the projects of landmarks >@@ -160,15 +162,15 @@ > > res = new IProject[projectsToSearch.size()]; > res = projectsToSearch.toArray(res); >- TextSearchScope projScope = FileTextSearchScope.newSearchScope(res, new String[] {PdeStructureBridge.CONTENT_TYPE}, false); >+ TextSearchScope projScope = FileTextSearchScope.newSearchScope(res, new String[] {PDE_CONTENT_TYPE}, false); > > return projectsToSearch.isEmpty() ? null : projScope; > case 3: > // create a search scope for the workspace >- return FileTextSearchScope.newSearchScope(new IResource[] { ResourcesPlugin.getWorkspace().getRoot() }, new String[] {PdeStructureBridge.CONTENT_TYPE}, false); >+ return FileTextSearchScope.newSearchScope(new IResource[] { ResourcesPlugin.getWorkspace().getRoot() }, new String[] {PDE_CONTENT_TYPE}, false); > case 4: > // create a search scope for the workspace >- return FileTextSearchScope.newSearchScope(new IResource[] { ResourcesPlugin.getWorkspace().getRoot() }, new String[] {PdeStructureBridge.CONTENT_TYPE}, false); >+ return FileTextSearchScope.newSearchScope(new IResource[] { ResourcesPlugin.getWorkspace().getRoot() }, new String[] {PDE_CONTENT_TYPE}, false); > default: > return null; > } >@@ -243,7 +245,7 @@ > > for (String handle : nodes.keySet()) { > >- incrementInterest(node, PdeStructureBridge.CONTENT_TYPE, handle, degreeOfSeparation); >+ incrementInterest(node, PDE_CONTENT_TYPE, handle, degreeOfSeparation); > } > gathered = true; > XmlJavaRelationProvider.this.searchCompleted(node);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 182506
:
63990
| 63991 |
70755