Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 283341

Summary: Cannot open editor when using PHP code on <style /> tags
Product: [WebTools] WTP Source Editing Reporter: Erick Wilder <erickwilder>
Component: wst.cssAssignee: Nick Sandonato <nsand.dev>
Status: RESOLVED DUPLICATE QA Contact: Nick Sandonato <nsand.dev>
Severity: normal    
Priority: P3 CC: ganoro, thatnitind
Version: 3.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:

Description Erick Wilder CLA 2009-07-13 17:29:19 EDT
Hi, after trying to edit some projects within PDT, i've found that some files simply cannot be opened by the editor, showing only this message on the main editor area: "Cannot open file: Argument not valid".
After some tries, to figure out the possible reason, I  reproduced this error by doing the following:

1. Create a new PHP file;
2. Define a background, using two (or more) variables to build the path of the linked image:

<style type="text/css">
#element_id_or_selector {
  background:url(<?php echo $path?>/to/a/dynamic/bg-<?php echo $counter; ?>.png) no-repeat 0 0;
}
</style>


Every time i've found this situation and removed those variables or replaced with only one variable, the file open again:

<?php $dynamicBG = "{$path}/to/dynamic/bg-{$counter}.png"; ?>
<style type="text/css">
	body {
		background:url(<?php echo $dinamycBG ?>) no-repeat left top;
	}
</style>


==PDT Installation Details==:
Name: PHP Development Tools (PDT) SDK Feature
Version: 2.1.0.v20090611-0930-51-84QACBIHRiLOmQMX3XhJh39Od
Id: org.eclipse.php.sdk.feature.group

==Error stack trace==:
java.lang.IllegalArgumentException: Argument not valid
	at org.eclipse.swt.SWT.error(SWT.java:3865)
	at org.eclipse.swt.SWT.error(SWT.java:3799)
	at org.eclipse.swt.SWT.error(SWT.java:3770)
	at org.eclipse.swt.custom.StyledText.setStyleRanges(StyledText.java:9031)
	at org.eclipse.swt.custom.StyledText.replaceStyleRanges(StyledText.java:7167)
	at org.eclipse.jface.text.TextViewer.addPresentation(TextViewer.java:4776)
	at org.eclipse.jface.text.TextViewer.changeTextPresentation(TextViewer.java:4855)
	at org.eclipse.wst.sse.ui.internal.provisional.style.StructuredPresentationReconciler.applyTextRegionCollection(StructuredPresentationReconciler.java:891)
	at org.eclipse.wst.sse.ui.internal.provisional.style.StructuredPresentationReconciler.processDamage(StructuredPresentationReconciler.java:866)
	at org.eclipse.wst.sse.ui.internal.provisional.style.StructuredPresentationReconciler$InternalListener.inputDocumentChanged(StructuredPresentationReconciler.java:270)
	at org.eclipse.wst.sse.ui.internal.provisional.style.StructuredPresentationReconciler.install(StructuredPresentationReconciler.java:599)
	at org.eclipse.wst.sse.ui.internal.StructuredTextViewer.updateHighlighter(StructuredTextViewer.java:944)
	at org.eclipse.wst.sse.ui.internal.StructuredTextViewer.setDocument(StructuredTextViewer.java:802)
	at org.eclipse.php.internal.ui.editor.PHPStructuredTextViewer.setDocument(PHPStructuredTextViewer.java:117)
	at org.eclipse.jface.text.source.SourceViewer.setDocument(SourceViewer.java:500)
	at org.eclipse.ui.texteditor.AbstractTextEditor.initializeSourceViewer(AbstractTextEditor.java:3951)
	at org.eclipse.ui.texteditor.AbstractTextEditor.createPartControl(AbstractTextEditor.java:3466)
	at org.eclipse.ui.texteditor.StatusTextEditor.createPartControl(StatusTextEditor.java:53)
	at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.createPartControl(AbstractDecoratedTextEditor.java:427)
	at org.eclipse.wst.sse.ui.StructuredTextEditor.createPartControl(StructuredTextEditor.java:1334)
	at org.eclipse.php.internal.ui.editor.PHPStructuredEditor.createPartControl(PHPStructuredEditor.java:1933)
	at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:662)
	at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:462)
	at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
	at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:286)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2857)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2762)
	at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2754)
	at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2705)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2701)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2685)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2676)
	at org.eclipse.dltk.internal.ui.editor.EditorUtility.openInEditor(EditorUtility.java:408)
	at org.eclipse.dltk.internal.ui.editor.EditorUtility.openInEditor(EditorUtility.java:166)
	at org.eclipse.dltk.internal.ui.actions.OpenActionUtil.open(OpenActionUtil.java:45)
	at org.eclipse.dltk.ui.actions.OpenAction.run(OpenAction.java:256)
	at org.eclipse.dltk.ui.actions.OpenAction.run(OpenAction.java:237)
	at org.eclipse.dltk.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:259)
	at org.eclipse.dltk.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:235)
	at org.eclipse.dltk.internal.ui.scriptview.ScriptExplorerActionGroup.handleOpen(ScriptExplorerActionGroup.java:304)
	at org.eclipse.dltk.internal.ui.scriptview.ScriptExplorerPart$4.open(ScriptExplorerPart.java:662)
	at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:842)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.runtime.Platform.run(Platform.java:888)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
	at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:840)
	at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1101)
	at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1205)
	at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:264)
	at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:258)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:298)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3880)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3473)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
Comment 1 Roy Ganor CLA 2009-07-14 04:11:04 EDT
This bug was reported already to the webtool source editing sub-project.

I also released a patch to fix it (maybe if you vote for this issue they will commit it sooner)

Thanks for reporting,
 
Comment 2 Nick Sandonato CLA 2009-07-17 11:01:06 EDT
Resolving as a duplicate of bug 282218. Thanks.

*** This bug has been marked as a duplicate of bug 282218 ***