import net.sourceforge.phpeclipse.PHPeclipsePlugin;
import net.sourceforge.phpeclipse.builder.PHPIdentifierLocation;
+import org.eclipse.core.resources.IProject;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
* A PHP identifier proposal.
*/
public class DeclarationProposal extends AbstractProposal { //implements IPHPCompletionProposal {
+ private IProject fProject;
private final TemplateContext fContext;
private final PHPIdentifierLocation fLocation;
* @param image the icon of the proposal.
*/
public DeclarationProposal(
+ IProject project,
String identifierName,
PHPIdentifierLocation location,
TemplateContext context,
super(viewer);
// Image image_fun,
// Image image_var) {
+ fProject = project;
fIdentifierName = identifierName;
fLocation = location;
fContext = context;
*/
public String getAdditionalProposalInfo() {
StringBuffer hoverInfoBuffer = new StringBuffer();
- String workspaceLocation = PHPeclipsePlugin.getWorkspace().getRoot().getLocation().toString();
+// String workspaceLocation = PHPeclipsePlugin.getWorkspace().getRoot().getLocation().toString();
+ String workspaceLocation;
+ if (fProject!=null) {
+ workspaceLocation = fProject.getLocation().toString()+'/';
+ } else {
+ // should never happen?
+ workspaceLocation = PHPeclipsePlugin.getWorkspace()
+ .getRoot().getLocation().toString();
+ }
String filename = workspaceLocation + fLocation.getFilename();
PHPDocUtil.appendPHPDoc(hoverInfoBuffer, filename, fLocation);
- return textToHTML(hoverInfoBuffer.toString());
+ return hoverInfoBuffer.toString();
}
/*
* @see ICompletionProposal#getDisplayString()
*/
public String getDisplayString() {
- String workspaceLocation = PHPeclipsePlugin.getWorkspace().getRoot().getLocation().toString();
+// String workspaceLocation = PHPeclipsePlugin.getWorkspace().getRoot().getLocation().toString();
+ String workspaceLocation;
+ if (fProject!=null) {
+ workspaceLocation = fProject.getLocation().toString()+'/';
+ } else {
+ // should never happen?
+ workspaceLocation = PHPeclipsePlugin.getWorkspace()
+ .getRoot().getLocation().toString();
+ }
String filename = workspaceLocation + fLocation.getFilename();
return fIdentifierName + TemplateMessages.getString("TemplateProposal.delimiter") + PHPDocUtil.getUsage(filename, fLocation) + TemplateMessages.getString("TemplateProposal.delimiter") + filename; // $NON-NLS-1$ //$NON-NLS-1$
}