Bug 318869 - [editor] org.eclipse.wst.sse.ui.StructuredTextEditor incorrectly says that file content type is not set.
Summary: [editor] org.eclipse.wst.sse.ui.StructuredTextEditor incorrectly says that fi...
Status: RESOLVED WORKSFORME
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.sse (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: wst.sse CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2010-07-05 06:43 EDT by Jacek Jaroczynski CLA
Modified: 2012-02-22 17:09 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jacek Jaroczynski CLA 2010-07-05 06:43:58 EDT
Build Identifier: Eclipse 3.6 for PHP

I used following code to open local PHP file (with .php extention) located outside the workspace:

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(
new MyIEditorInputImplementation(), "org.eclipse.php.editor");

and I got dialog box saying that content type was not set (wile it was).

It appeared that solution for my case was that MyIEditorInputImplementation should be adaptable to ILocationProvider (the easiest way was to extend FileStoreEditorInput).

Nevertheless dialog box was strongly misleading and should be fixed.

Here is the stacktrace of the place where the dialog is shown:

Thread [main] (Suspended)	
	PHPStructuredEditor(StructuredTextEditor).doSetInput(IEditorInput) line: 1858	
	PHPStructuredEditor.doSetInput(IEditorInput) line: 2337	
	AbstractTextEditor$19.run(IProgressMonitor) line: 3037	
	ModalContext.runInCurrentThread(IRunnableWithProgress, IProgressMonitor) line: 464	
	ModalContext.run(IRunnableWithProgress, boolean, IProgressMonitor, Display) line: 372	
	ApplicationWindow$1.run() line: 759	
	BusyIndicator.showWhile(Display, Runnable) line: 70	
	WorkbenchWindow(ApplicationWindow).run(boolean, boolean, IRunnableWithProgress) line: 756	
	WorkbenchWindow.run(boolean, boolean, IRunnableWithProgress) line: 2600	
	PHPStructuredEditor(AbstractTextEditor).internalInit(IWorkbenchWindow, IEditorSite, IEditorInput) line: 3055	
	PHPStructuredEditor(AbstractTextEditor).init(IEditorSite, IEditorInput) line: 3082	
	PHPStructuredEditor(StructuredTextEditor).init(IEditorSite, IEditorInput) line: 2492	
	PHPStructuredEditor.init(IEditorSite, IEditorInput) line: 1194	
	EditorManager.createSite(IEditorReference, IEditorPart, EditorDescriptor, IEditorInput) line: 798	
	EditorReference.createPartHelper() line: 647	
	EditorReference.createPart() line: 465	
	EditorReference(WorkbenchPartReference).getPart(boolean) line: 595	
	EditorReference.getEditor(boolean) line: 289	
	WorkbenchPage.busyOpenEditorBatched(IEditorInput, String, boolean, int, IMemento) line: 2863	
	WorkbenchPage.busyOpenEditor(IEditorInput, String, boolean, int, IMemento) line: 2768	
	WorkbenchPage.access$11(WorkbenchPage, IEditorInput, String, boolean, int, IMemento) line: 2760	
	WorkbenchPage$10.run() line: 2711	
	BusyIndicator.showWhile(Display, Runnable) line: 70	
	WorkbenchPage.openEditor(IEditorInput, String, boolean, int, IMemento) line: 2707	
	WorkbenchPage.openEditor(IEditorInput, String, boolean, int) line: 2691	
	WorkbenchPage.openEditor(IEditorInput, String) line: 2674	
	OpenVirtualFileJob$FileContentFetchingFromCrucibleOperation$1.run() line: 293	
	RunnableLock.run() line: 35	
	UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 134	
	Display.runAsyncMessages(boolean) line: 4041	
	Display.readAndDispatch() line: 3660	
	Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2629	
	Workbench.runUI() line: 2593	
	Workbench.access$4(Workbench) line: 2427	
	Workbench$7.run() line: 670	
	Realm.runWithDefault(Realm, Runnable) line: 332	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 663	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149	
	IDEApplication.start(IApplicationContext) line: 115	
	EclipseAppHandle.run(Object) line: 196	
	EclipseAppLauncher.runApplication(Object) line: 110	
	EclipseAppLauncher.start(Object) line: 79	
	EclipseStarter.run(Object) line: 369	
	EclipseStarter.run(String[], Runnable) line: 179	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available	
	Method.invoke(Object, Object...) line: not available	
	Main.invokeFramework(String[], URL[]) line: 619	
	Main.basicRun(String[]) line: 574	
	Main.run(String[]) line: 1407	
	Main.main(String[]) line: 1383	



Reproducible: Always

Steps to Reproduce:
It is quite hard but here you are

1. Install Eclipse 3.6 for PHP
2. Install Atlassian Connector for Eclipse 2.2
3. Create review for any PHP file.
4. Change the file (workspace should contain different file from Crucible repo)
5. Try to open the file from ReviewExplorer in Eclipse (you will get mentioned dialog box)
Comment 1 Jacek Jaroczynski CLA 2010-07-05 06:46:39 EDT
Feel free to move the ticket if this is not the right place for org.eclipse.wst.sse bug.
Comment 2 Nitin Dahyabhai CLA 2010-07-07 13:42:47 EDT
The message actually says "Unsupported content type in editor."  It should have worked without implementing ILocationProvider.  What were you returning for the editor input's name?  Was the input implementing IStorageEditorInput?
Comment 3 Jacek Jaroczynski CLA 2010-07-19 02:32:44 EDT
I returned file name with php extention e.g. file.php but I believe it should not rely on the file extention but editorID which I pass to the openEditor method.
Yes, the editor input is implementing IStorageEditorInput.
Comment 4 Nitin Dahyabhai CLA 2010-07-19 10:47:32 EDT
It's not based solely on the filename.  We're calling into the platform's content type manager and IContentTypeMatcher#findContentTypeFor(InputStream, String) with the first 8k of input to determine what the content type is.  You might want to step through org.eclipse.wst.sse.ui.internal.StorageModelProvider#loadModel(IStorageEditorInput, boolean) or org.eclipse.core.internal.content.ContentTypeMatcher#findContentTypeFor(InputStream, String) to find out what's going on.  I suspect the content type being detected is defaulting to plain text.
Comment 5 Nitin Dahyabhai CLA 2011-05-17 17:52:57 EDT
(In reply to comment #4)
>I suspect the content type being detected is defaulting to plain text.

Is it?
Comment 6 Nick Sandonato CLA 2011-11-18 13:46:44 EST
pinging to see if this is still an issue.
Comment 7 Nick Sandonato CLA 2012-02-22 17:09:01 EST
I know it's been awhile, but if this is still an issue, please reopen. And if you have an answer to Nitin's question in comment 5, please let us know. Thanks.