public class TemplateVariableProposal implements ICompletionProposal {
private TemplateVariableResolver fVariable;
+
private int fOffset;
- private int fLength;
+
+ private int fLength;
+
private ITextViewer fViewer;
-
+
private Point fSelection;
/**
* Creates a template variable proposal.
*
- * @param variable the template variable
- * @param offset the offset to replace
- * @param length the length to replace
- * @param viewer the viewer
+ * @param variable
+ * the template variable
+ * @param offset
+ * the offset to replace
+ * @param length
+ * the length to replace
+ * @param viewer
+ * the viewer
*/
- public TemplateVariableProposal(TemplateVariableResolver variable, int offset, int length, ITextViewer viewer) {
- fVariable= variable;
- fOffset= offset;
- fLength= length;
- fViewer= viewer;
+ public TemplateVariableProposal(TemplateVariableResolver variable,
+ int offset, int length, ITextViewer viewer) {
+ fVariable = variable;
+ fOffset = offset;
+ fLength = length;
+ fViewer = viewer;
}
-
+
/*
* @see ICompletionProposal#apply(IDocument)
*/
public void apply(IDocument document) {
try {
- String variable= fVariable.getType().equals("dollar") ? "$$" : "${" + fVariable.getType() + '}'; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ String variable = fVariable.getType().equals("dollar") ? "$$" : "${" + fVariable.getType() + '}'; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
document.replace(fOffset, fLength, variable);
- fSelection= new Point(fOffset + variable.length(), 0);
+ fSelection = new Point(fOffset + variable.length(), 0);
} catch (BadLocationException e) {
PHPeclipsePlugin.log(e);
- Shell shell= fViewer.getTextWidget().getShell();
- MessageDialog.openError(shell, TemplatePreferencesMessages.getString("TemplateVariableProposal.error.title"), e.getMessage()); //$NON-NLS-1$
+ Shell shell = fViewer.getTextWidget().getShell();
+ MessageDialog
+ .openError(
+ shell,
+ TemplatePreferencesMessages
+ .getString("TemplateVariableProposal.error.title"), e.getMessage()); //$NON-NLS-1$
}
}