2 * Created on 28.04.2003
5 package net.sourceforge.phpeclipse.phpeditor.php;
9 import org.eclipse.jface.text.*;
12 * A stack for keeping track of the contenttypes for partitions that
13 * contain other partitions.
15 * @author Stefan Langer
16 * @version $Revision: 1.1 $
18 public class PartitionStack
20 private ArrayList fPartitionStack = new ArrayList(5);
21 private int fStackTop = -1;
24 * Pushes the specified contenttype onto the partitionstack.
25 * This will keep track of the last partitions read.
26 * @param contentType The contenttype to push onto the stack.
28 public void pushStack(String contentType)
30 if(fStackTop < fPartitionStack.size())
32 fPartitionStack.add(++fStackTop, contentType);
36 * Returns the contentype of the last partition on the partition stack.
37 * If no partition is currently on the stack this function simply returns
38 * the HTML contenttype as default.
39 * @return The contenttype of the last partition on stack.
41 public String popStack()
45 return (String)fPartitionStack.get(fStackTop--);
48 return IPHPPartitionScannerConstants.HTML;
51 public boolean isEmpty()
53 return (fStackTop < 0);
57 * Initializes this stack from the specified document for the
59 * @param offset The offset to initialize from
60 * @param fDocument The document to initialize from
62 public void initializeStack(int offset, IDocument fDocument)