import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Shell;
-// import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionManager;
-// import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionUI;
-// import net.sourceforge.phpdt.internal.ui.util.ExceptionHandler;
/**
* A PHP identifier proposal.
}
protected void handleException(CoreException e) {
- Shell shell = fViewer.getTextWidget().getShell();
PHPeclipsePlugin.log(e);
- // ExceptionHandler.handle(e, shell,
- // ObfuscatorMessages.getString("TemplateEvaluator.error.title"), null);
- // //$NON-NLS-1$
}
protected void openErrorDialog(BadLocationException e) {
private final Image fImage_var;
- // private TemplateBuffer fTemplateBuffer;
- private String fOldText;
-
private final IRegion fRegion;
- // private IRegion fSelectedRegion; // initialized by apply()
private final String fTemplate;
public IdentifierProposal(String template, TemplateContext context,
fTemplate = template;
fContext = context;
- // fViewer = viewer;
fImage_fun = image_fun;
fImage_var = image_var;
fRegion = region;
LinkedPositionUI editor = new LinkedPositionUI(fViewer, manager);
editor.setFinalCaretOffset(fTemplate.length() + start);
- // editor.setFinalCaretOffset(getCaretOffset(fTemplateBuffer) +
- // start);
editor.enter();
fSelectedRegion = editor.getSelectedRegion();
} catch (BadLocationException e) {
}
public String getAdditionalProposalInfo() {
- return textToHTML(fTemplate); // fTemplateBuffer.getString());
+ return textToHTML(fTemplate);
}
public String getDisplayString() {
/**
* A PHP identifier proposal.
*/
-public class SQLProposal extends AbstractProposal { // implements
- // IPHPCompletionProposal
- // {
+public class SQLProposal extends AbstractProposal {
private final TemplateContext fContext;
private final Image fImage_var;
*/
public void apply(IDocument document) {
try {
- // if (fTemplateBuffer == null)
- // fTemplateBuffer= fContext.evaluate(fTemplate);
int start = fRegion.getOffset();
int end = fRegion.getOffset() + fRegion.getLength();
String resultString = fTableName;
resultString = fColumnName;
}
// insert template string
- // String templateString = fTemplate; //
- // fTemplateBuffer.getString();
document.replace(start, end - start, resultString);
// translate positions
LinkedPositionManager manager = new LinkedPositionManager(document);
- // TemplatePosition[] variables= fTemplateBuffer.getVariables();
- // for (int i= 0; i != variables.length; i++) {
- // TemplatePosition variable= variables[i];
- //
- // if (variable.isResolved())
- // continue;
- //
- // int[] offsets= variable.getOffsets();
- // int length= variable.getLength();
- //
- // for (int j= 0; j != offsets.length; j++)
- // manager.addPosition(offsets[j] + start, length);
- // }
LinkedPositionUI editor = new LinkedPositionUI(fViewer, manager);
editor.setFinalCaretOffset(resultString.length() + start);
- // editor.setFinalCaretOffset(getCaretOffset(fTemplateBuffer) +
- // start);
editor.enter();
fSelectedRegion = editor.getSelectedRegion();
} catch (BadLocationException e) {
PHPeclipsePlugin.log(e);
openErrorDialog(e);
}
- // catch (CoreException e) {
- // handleException(e);
- // }
}
/*