| Summary: | Switching between PHP versions php4<->php5 does not refreshes opened files | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Moty Keret <moty> |
| Component: | PDT | Assignee: | moshe <moshe> |
| Status: | CLOSED FIXED | QA Contact: | Yossi Luson <yossi.l> |
| Severity: | normal | ||
| Priority: | P1 | CC: | gadi, jackie |
| Version: | unspecified | Keywords: | plan |
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
|
Description
Moty Keret
*** Bug 146516 has been marked as a duplicate of this bug. *** *** Bug 162201 has been marked as a duplicate of this bug. *** 1. Enter any php code, using <? tags 2. Verify all code is colored correctly 3. Change start and tags to <% 4. Save - all code is black 5. Change PHP interpreter to support ASP tags, click apply - click ok to rebuild 6. The code is still black - until you close and open the file , or make a change and save Change the method in PHPStructuredEditor (line 406) with the following lines:
private IPreferencesPropagatorListener phpVersionListener = new IPreferencesPropagatorListener() {
public void preferencesEventOccured(PreferencesPropagatorEvent event) {
try {
// get the structured document and go over its regions
// in case of PhpScriptRegion reparse the region text
IDocument doc = getDocumentProvider().getDocument(getEditorInput());
if (doc instanceof IStructuredDocument) {
IStructuredDocumentRegion[] sdRegions = ((IStructuredDocument) doc).getStructuredDocumentRegions();
for (int i = 0; i < sdRegions.length; i++) {
Iterator regionsIt = sdRegions[i].getRegions().iterator();
reparseRegion(doc, regionsIt, sdRegions[i].getStartOffset());
}
}
} catch (BadLocationException e) {
}
}
public IProject getProject() {
return getFile().getProject();
}
};
/**
* iterate over regions
* in case of PhpScriptRegion reparse the region.
* in case of region contaioner iterate over the container regions.
* @param doc structured document
* @param regionsIt regions iterator
* @param offset the container region start offset
* @throws BadLocationException
*/
private void reparseRegion(IDocument doc, Iterator regionsIt, int offset) throws BadLocationException {
while (regionsIt.hasNext()) {
ITextRegion region = (ITextRegion) regionsIt.next();
if (region instanceof ITextRegionContainer) {
reparseRegion(doc, ((ITextRegionContainer)region).getRegions().iterator(), offset + region.getStart());
}
if (region instanceof PhpScriptRegion) {
int length = region.getLength();
String newText = doc.get(offset + region.getStart(), length);
((PhpScriptRegion) region).completeReparse(newText);
}
}
}
fixed, thanks Moshe. closed by Yosi.l (checked with interface) |