import net.sourceforge.phpdt.internal.ui.PHPUiImages;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.text.Position;
import java.util.ArrayList;
/** The outlineable children (those will be in the node array too. */
private ArrayList children = new ArrayList();
+ private Position position;
/**
* Create a class giving starting and ending offset
* @param sourceStart starting offset
this.parent = parent;
this.name = name;
this.superclass = superclass;
+ position = new Position(sourceStart, name.length);
}
/**
public String toString() {
return toStringHeader();
}
+
+ public Position getPosition() {
+ return position;
+ }
}
package net.sourceforge.phpdt.internal.compiler.ast;
/**
- * An empty statement
+ * An empty statement.
* @author Matthieu Casanova
*/
public class EmptyStatement extends Statement {
import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
import net.sourceforge.phpdt.internal.ui.PHPUiImages;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.text.Position;
/**
* A Field declaration.
public VariableDeclaration[] vars;
private Object parent;
+ private Position position;
/**
* Create a new field.
* @param vars the array of variables.
super(sourceStart, sourceEnd);
this.vars = vars;
this.parent = parent;
+ position = new Position(sourceStart, sourceEnd);
}
/**
public Object getParent() {
return parent;
}
+
+ public Position getPosition() {
+ return position;
+ }
}
import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
import net.sourceforge.phpdt.internal.ui.PHPUiImages;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.text.Position;
/**
* A GlobalStatement statement in php.
private Object parent;
+ private Position position;
+
public GlobalStatement(Object parent, String[] variables, int sourceStart, int sourceEnd) {
super(sourceStart, sourceEnd);
this.variables = variables;
this.parent = parent;
+ position = new Position(sourceStart, sourceEnd);
}
public String toString() {
public Object getParent() {
return parent;
}
+
+ public Position getPosition() {
+ return position;
+ }
}
import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
import net.sourceforge.phpdt.internal.ui.PHPUiImages;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.text.Position;
/**
* @author Matthieu Casanova
private Object parent;
+ private Position position;
public InclusionStatement(Object parent,
int keyword,
Expression expression,
this.keyword = keyword;
this.expression = expression;
this.parent = parent;
+ position = new Position(sourceStart, sourceEnd);
}
public String keywordToString() {
public Object getParent() {
return parent;
}
+
+ public Position getPosition() {
+ return position;
+ }
}
import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
import net.sourceforge.phpdt.internal.ui.PHPUiImages;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.text.Position;
import java.util.Hashtable;
import java.util.Enumeration;
/** Tell if the method returns a reference. */
public boolean reference;
+ private Position position;
+
public MethodDeclaration(Object parent,
char[] name,
Hashtable arguments,
this.arguments = arguments;
this.parent = parent;
this.reference = reference;
+ position = new Position(sourceStart, sourceEnd);
}
/**
public String toString() {
return toStringHeader();
}
+
+ public Position getPosition() {
+ return position;
+ }
}
import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
import net.sourceforge.phpdt.internal.ui.PHPUiImages;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.text.Position;
import java.util.ArrayList;
public Object getParent() {
return parent;
}
+
+ public Position getPosition() {
+ //todo : check this
+ return null;
+ }
}
\ No newline at end of file
import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
import net.sourceforge.phpdt.internal.ui.PHPUiImages;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.text.Position;
/**
* A variable declaration.
private Object parent;
private boolean reference;
-
+ private Position position;
/**
* Create a variable.
* @param initialization the initialization
super(name, sourceStart, initialization.sourceEnd);
this.initialization = initialization;
this.parent = parent;
+ position = new Position(sourceStart, sourceEnd);
}
/**
return parent;
}
- /**
- * Get the image of a variable.
- * @return the image that represents a php variable
- */
- public ImageDescriptor getImage() {
- return PHPUiImages.DESC_VAR;
- }
+ /**
+ * Get the image of a variable.
+ * @return the image that represents a php variable
+ */
+ public ImageDescriptor getImage() {
+ return PHPUiImages.DESC_VAR;
+ }
+
+ public Position getPosition() {
+ return position;
+ }
}
package net.sourceforge.phpdt.internal.compiler.parser;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.text.Position;
/**
* Here is an interface that object that can be in the outline view must implement.
ImageDescriptor getImage();
Object getParent();
+
+ Position getPosition();
}
if (selection.isEmpty())
fTextEditor.resetHighlightRange();
else {
- PHPSegment segment = (PHPSegment) ((IStructuredSelection) selection).getFirstElement();
+ Outlineable segment = (Outlineable) ((IStructuredSelection) selection).getFirstElement();
int start = segment.getPosition().getOffset();
int length = segment.getPosition().getLength();
try {
if (errorStart == -1) {
setMarker(fileToParse,
errorMessage,
- jj_input_stream.tokenBegin,
- jj_input_stream.tokenBegin + e.currentToken.image.length(),
+ SimpleCharStream.tokenBegin,
+ SimpleCharStream.tokenBegin + e.currentToken.image.length(),
errorLevel,
"Line " + e.currentToken.beginLine);
} else {
case DOLLAR:
jj_consume_token(DOLLAR);
expr = VariableName();
- {if (true) return expr;}
+ {if (true) return "$" + expr;}
break;
default:
jj_la1[12] = jj_gen;
if (errorStart == -1) {
setMarker(fileToParse,
errorMessage,
- jj_input_stream.tokenBegin,
- jj_input_stream.tokenBegin + e.currentToken.image.length(),
+ SimpleCharStream.tokenBegin,
+ SimpleCharStream.tokenBegin + e.currentToken.image.length(),
errorLevel,
"Line " + e.currentToken.beginLine);
} else {
}
|
<DOLLAR> expr = VariableName()
- {return expr;}
+ {return "$" + expr;}
}
String VariableName():