woproject/projects/wolips/plugins/org.objectstyle.wolips.componenteditor/java/org/objectstyle/wolips/componenteditor/editor ComponentEditor.java,1.7,1.8

[email protected]
Newsgroups gmane.comp.web.webobjects.woproject.cvs
Message-ID <[email protected]>
Update of /cvsroot/woproject/woproject/projects/wolips/plugins/org.objectstyle.wolips.componenteditor/java/org/objectstyle/wolips/componenteditor/editor
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18144/java/org/objectstyle/wolips/componenteditor/editor

Modified Files:
	ComponentEditor.java 
Log Message:
goto marker

Index: ComponentEditor.java
===================================================================
RCS file: /cvsroot/woproject/woproject/projects/wolips/plugins/org.objectstyle.wolips.componenteditor/java/org/objectstyle/wolips/componenteditor/editor/ComponentEditor.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ComponentEditor.java	26 Dec 2005 16:22:07 -0000	1.7
+++ ComponentEditor.java	30 Dec 2005 13:03:28 -0000	1.8
@@ -43,21 +43,85 @@
  */
 package org.objectstyle.wolips.componenteditor.editor;
 
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.ide.IGotoMarker;
+import org.eclipse.ui.ide.ResourceUtil;
+import org.objectstyle.wolips.componenteditor.ComponenteditorPlugin;
+
 
 /**
  * @author uli
  */
-public class ComponentEditor extends ComponentEditorPart {
+public class ComponentEditor extends ComponentEditorPart implements IGotoMarker {
 
 	public ComponentEditor() {
 		super();
 	}
 
 	public Object getAdapter(Class adapter) {
-//		if (adapter.equals(IGotoMarker.class)) {
-//			return null;
-//		}
+		if (adapter.equals(IGotoMarker.class)) {
+			return this;
+		}
 		return super.getAdapter(adapter);
 	}
 
+	public void gotoMarker(IMarker marker) {
+		ComponenteditorPlugin.getDefault().log(marker);
+		IResource resource = marker.getResource();
+		if(resource == null) {
+			return;
+		}
+		IEditorInput[] editorInputArray = componentEditorInput.getInput();
+		for (int i = 0; i < editorInputArray.length; i++) {
+			IFile inputFileFromEditor = ResourceUtil.getFile(editorInputArray[i]);
+			if(inputFileFromEditor == null) {
+				continue;
+			}
+			IPath pathFromInputFile = inputFileFromEditor.getLocation();
+			if(pathFromInputFile == null) {
+				continue;
+			}
+			IPath pathFromResource = resource.getLocation();
+			if(pathFromResource == null) {
+				continue;
+			}
+			if(pathFromInputFile.equals(pathFromResource)) {
+				IEditorPart editorPart = null;
+				if(i == 0) {
+					editorPart = compilationUnitEditor;
+				}
+				if(i == 1) {
+					editorPart = structuredTextEditorHTMLWithWebObjectTags;
+				}
+				if(i == 2) {
+					editorPart = wodEditor;
+				}
+				if(editorPart == null) {
+					continue;
+				}
+				IGotoMarker gotoMarker = (IGotoMarker)editorPart.getAdapter(IGotoMarker.class);
+				if(gotoMarker == null) {
+					return;
+				}
+				if(i == 0) {
+					this.switchToJava();
+				}
+				if(i == 1) {
+					this.switchToHtml();
+				}
+				if(i == 2) {
+					this.switchToWod();
+				}
+				gotoMarker.gotoMarker(marker);
+				return;
+			}
+			
+		}
+	}
+
 }
\ No newline at end of file



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.