woproject/projects/wolips/plugins/org.objectstyle.wolips.components/java/org/objectstyle/wolips/components/input ComponentEditorFileEditorInput.java,NONE,1.1 ComponentEditorInputFactory.java,1.1,1.2 ComponentEditorInput.java,1.4,1.5

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

Modified Files:
	ComponentEditorInputFactory.java ComponentEditorInput.java 
Added Files:
	ComponentEditorFileEditorInput.java 
Log Message:
some dirty hacks

--- NEW FILE: ComponentEditorFileEditorInput.java ---
package org.objectstyle.wolips.components.input;

import org.eclipse.core.resources.IFile;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPersistableElement;
import org.eclipse.ui.part.FileEditorInput;

public class ComponentEditorFileEditorInput extends FileEditorInput implements
		IPersistableElement {

	private ComponentEditorInput componentEditorInput;

	public ComponentEditorFileEditorInput(IFile file) {
		super(file);
	}

	public ComponentEditorInput getComponentEditorInput() {
		return componentEditorInput;
	}

	public void setComponentEditorInput(
			ComponentEditorInput componentEditorInput) {
		this.componentEditorInput = componentEditorInput;
	}

	public String getFactoryId() {
		return this.componentEditorInput.getFactoryId();
	}
	

	public void saveState(IMemento memento) {
		this.componentEditorInput.saveState(memento);
	}

	public IPersistableElement getPersistable() {
		return this.componentEditorInput.getPersistable();
	}
}

Index: ComponentEditorInputFactory.java
===================================================================
RCS file: /cvsroot/woproject/woproject/projects/wolips/plugins/org.objectstyle.wolips.components/java/org/objectstyle/wolips/components/input/ComponentEditorInputFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ComponentEditorInputFactory.java	8 Oct 2005 11:51:50 -0000	1.1
+++ ComponentEditorInputFactory.java	6 Jan 2006 12:42:30 -0000	1.2
@@ -49,7 +49,6 @@
 import org.eclipse.core.runtime.Path;
 import org.eclipse.ui.IElementFactory;
 import org.eclipse.ui.IMemento;
-import org.eclipse.ui.part.FileEditorInput;
 
 public class ComponentEditorInputFactory implements IElementFactory {
 
@@ -83,14 +82,14 @@
 		}
 		int count = Integer.parseInt(countString);
 		String[] editors = new String[count];
-		FileEditorInput[] input = new FileEditorInput[count];
+		ComponentEditorFileEditorInput[] input = new ComponentEditorFileEditorInput[count];
 
 		for (int i = 0; i < count; i++) {
 			editors[i] = memento.getString(TAG_EDITOR + i);
 			String fileName = memento.getString(TAG_INPUT + i);
 			IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(
 					new Path(fileName));
-			input[i] = new FileEditorInput(file);
+			input[i] = new ComponentEditorFileEditorInput(file);
 		}
 
 		ComponentEditorInput componentEditorInput = new ComponentEditorInput(
@@ -98,6 +97,9 @@
 		if (componentEditorInput == null) {
 			return null;
 		}
+		for(int i = 0; i < input.length; i++) {
+			input[i].setComponentEditorInput(componentEditorInput);
+		}
 		if (memento.getString(TAG_DISPLAY_API_PART_ON_REVEAL) != null) {
 			componentEditorInput.setDisplayApiPartOnReveal(true);
 		} else if (memento.getString(TAG_DISPLAY_HTML_PART_ON_REVEAL) != null) {
@@ -119,7 +121,7 @@
 		memento.putString(TAG_COUNT, count);
 		for (int i = 0; i < input.getEditors().length; i++) {
 			memento.putString(TAG_EDITOR + i, input.getEditors()[i]);
-			IFile file = ((FileEditorInput) input.getInput()[i]).getFile();
+			IFile file = ((ComponentEditorFileEditorInput) input.getInput()[i]).getFile();
 			memento.putString(TAG_INPUT + i, file.getFullPath().toString());
 		}
 		if (input.isDisplayApiPartOnReveal()) {

Index: ComponentEditorInput.java
===================================================================
RCS file: /cvsroot/woproject/woproject/projects/wolips/plugins/org.objectstyle.wolips.components/java/org/objectstyle/wolips/components/input/ComponentEditorInput.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- ComponentEditorInput.java	8 Oct 2005 11:51:50 -0000	1.4
+++ ComponentEditorInput.java	6 Jan 2006 12:42:30 -0000	1.5
@@ -51,7 +51,6 @@
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IMemento;
 import org.eclipse.ui.IPersistableElement;
-import org.eclipse.ui.part.FileEditorInput;
 import org.eclipse.ui.part.MultiEditorInput;
 import org.objectstyle.wolips.components.ComponentsPlugin;
 import org.objectstyle.wolips.editors.EditorsPlugin;
@@ -83,31 +82,34 @@
 			LocalizedComponentsLocateResult localizedComponentsLocateResult)
 			throws CoreException {
 		String ids[] = null;
-		IEditorInput allInput[] = null;
+		ComponentEditorFileEditorInput allInput[] = null;
 		if (localizedComponentsLocateResult.getDotApi() == null) {
 			ids = new String[3];
-			allInput = new IEditorInput[3];
+			allInput = new ComponentEditorFileEditorInput[3];
 		} else {
 			ids = new String[4];
-			allInput = new IEditorInput[4];
+			allInput = new ComponentEditorFileEditorInput[4];
 		}
 		ids[0] = JavaUI.ID_CU_EDITOR;
-		allInput[0] = new FileEditorInput(localizedComponentsLocateResult
+		allInput[0] = new ComponentEditorFileEditorInput(localizedComponentsLocateResult
 				.getDotJava());
 		ids[1] = EditorsPlugin.HTMLEditorID;
 		IFolder folder = localizedComponentsLocateResult.getComponents()[0];
 		IFile htmlFile = LocalizedComponentsLocateResult.getHtml(folder);
 		IFile wodFile = LocalizedComponentsLocateResult.getWod(folder);
-		allInput[1] = new FileEditorInput(htmlFile);
+		allInput[1] = new ComponentEditorFileEditorInput(htmlFile);
 		ids[2] = EditorsPlugin.WodEditorID;
-		allInput[2] = new FileEditorInput(wodFile);
+		allInput[2] = new ComponentEditorFileEditorInput(wodFile);
 		if (localizedComponentsLocateResult.getDotApi() != null) {
 			ids[3] = EditorsPlugin.ApiEditorID;
-			allInput[3] = new FileEditorInput(localizedComponentsLocateResult
+			allInput[3] = new ComponentEditorFileEditorInput(localizedComponentsLocateResult
 					.getDotApi());
 		}
 		ComponentEditorInput input = new ComponentEditorInput(ids, allInput);
 		input.localizedComponentsLocateResult = localizedComponentsLocateResult;
+		for(int i = 0; i < allInput.length; i++) {
+			allInput[i].setComponentEditorInput(input);
+		}
 		return input;
 	}
 



-------------------------------------------------------
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.