* Created on 05.03.2003
*
* @author Stefan Langer (musk)
- * @version $Revision: 1.16 $
+ * @version $Revision: 1.17 $
*/
package net.sourceforge.phpeclipse.phpeditor.php;
private int fOffset = -1;
private String fContentType = IPHPPartitionScannerConstants.HTML;
private String fPrevContentType = IPHPPartitionScannerConstants.HTML;
-
private boolean partitionBorder = false;
private int fTokenOffset;
private int fEnd = -1;
}
}
catch (BadLocationException e)
- {
- // TODO Auto-generated catch block
+ { // should never happen
+ // TODO Write stacktrace to log
e.printStackTrace();
}
}
// sometimes we get a wrong partition so we retrieve the partition
// directly from the document
fContentType = fDocument.getContentType(partitionOffset);
- //TODO determine the previouse contenttypes as a stack
- //if(partitionOffset > 1)
- // fPrevContentType = fDocument.getContentType(partitionOffset-1);
}
else
this.setRange(document, offset, length);
fEnd = fOffset + length;
fInString = false;
fInDoubString = false;
- //partitionBorder = false;
+ fContentType = IPHPPartitionScannerConstants.HTML;
+// String[] prev = getPartitionStack(offset);
}
private int read()
else
return false;
}
-
+
+ /**
+ * Returns the previouse partition stack for the given offset.
+ *
+ * @param offset The offset to return the previouse partitionstack for.
+ *
+ * @return The stack as a string array.
+ */
+ private String[] getPartitionStack(int offset)
+ {
+ ArrayList types = new ArrayList();
+ int tmpOffset = 0;
+ try
+ {
+ ITypedRegion region = fDocument.getPartition(offset);
+ tmpOffset = region.getOffset();
+ while(tmpOffset-1 > 0)
+ {
+ region = fDocument.getPartition(tmpOffset-1);
+ tmpOffset = region.getOffset();
+ types.add(0, region.getType());
+ }
+ }
+ catch (BadLocationException e)
+ {
+ if(DEBUG)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ String[] retVal = new String[types.size()];
+
+ retVal = (String[])types.toArray(retVal);
+ return retVal;
+ }
+
}