@Override public String getDisplayString() { return fResolver.getType(); }
public String getType() { return decorated.getType(); }
@Override public String getDisplayString() { return fResolver.getType(); }
public String getDisplayString() { return fResolver.getType(); }
/** * Adds a variable resolver to the context type. If there already is a resolver * for the same type, the previous one gets replaced by <code>resolver</code>. * * @param resolver the resolver to be added under its name */ public void addResolver(TemplateVariableResolver resolver) { Assert.isNotNull(resolver); fResolvers.put(resolver.getType(), resolver); }
/** * Adds a variable resolver to the context type. If there already is a resolver * for the same type, the previous one gets replaced by <code>resolver</code>. * * @param resolver the resolver to be added under its name */ public void addResolver(TemplateVariableResolver resolver) { Assert.isNotNull(resolver); fResolvers.put(resolver.getType(), resolver); }
/** * Removes a template variable from the context type. * * @param resolver the variable to be removed */ public void removeResolver(TemplateVariableResolver resolver) { Assert.isNotNull(resolver); fResolvers.remove(resolver.getType()); }
/** * Removes a template variable from the context type. * * @param resolver the variable to be removed */ public void removeResolver(TemplateVariableResolver resolver) { Assert.isNotNull(resolver); fResolvers.remove(resolver.getType()); }
/** * Returns an instance of the type resolved by the receiver available in <code>context</code>. * To resolve means to provide a binding to a concrete text object (a * <code>String</code>) in the given context. * <p> * The default implementation looks up the type in the context.</p> * * @param context the context in which to resolve the type * @return the name of the text object of this type, or <code>null</code> if it cannot be determined */ protected String resolve(TemplateContext context) { return context.getVariable(getType()); }
@Override public String getDisplayString() { return fVariable.getType() + " - " + fVariable.getDescription(); //$NON-NLS-1$ }
@Override public String getDisplayString() { return fVariable.getType() + " - " + fVariable.getDescription(); //$NON-NLS-1$ }
/** * Returns an instance of the type resolved by the receiver available in <code>context</code>. * To resolve means to provide a binding to a concrete text object (a * <code>String</code>) in the given context. * <p> * The default implementation looks up the type in the context.</p> * * @param context the context in which to resolve the type * @return the name of the text object of this type, or <code>null</code> if it cannot be determined */ protected String resolve(TemplateContext context) { return context.getVariable(getType()); }
public String getDisplayString() { return fVariable.getType() + " - " + fVariable.getDescription(); //$NON-NLS-1$ }
public String getDisplayString() { return fVariable.getType() + " - " + fVariable.getDescription(); //$NON-NLS-1$ }
public IInspectableTemplateVariableResolver toInspectableResolver(TemplateVariableResolver resolver) { if (resolver instanceof IInspectableTemplateVariableResolver) return (IInspectableTemplateVariableResolver) resolver; if (resolver instanceof SimpleTemplateVariableResolver) { return new InspectableSimpleTemplateVariableResolver((SimpleTemplateVariableResolver) resolver); } if ("CrossReference".equals(resolver.getType())) { return new InspectableCrossReferenceVariableResolver((CrossReferenceTemplateVariableResolver) resolver); } if ("Enum".equals(resolver.getType())) { return new InspectableEnumVariableResolver((EnumTemplateVariableResolver) resolver); } return null; }
public void apply(IDocument document) { try { 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); } catch (BadLocationException e) { Shell shell= fViewer.getTextWidget().getShell(); MessageDialog.openError(shell, TextEditorTemplateMessages.TemplateVariableProposal_error_title, e.getMessage()); } }
@Override public void apply(IDocument document) { try { 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); } catch (BadLocationException e) { Shell shell= fViewer.getTextWidget().getShell(); MessageDialog.openError(shell, TemplatesMessages.TemplateVariableProposal_error_title, e.getMessage()); } }
@Override public void apply(IDocument document) { try { 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); } catch (BadLocationException e) { Shell shell= fViewer.getTextWidget().getShell(); MessageDialog.openError(shell, TemplatesMessages.TemplateVariableProposal_error_title, e.getMessage()); } }
public void apply(IDocument document) { try { 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); } catch (BadLocationException e) { Shell shell = fViewer.getTextWidget().getShell(); MessageDialog.openError(shell, TextEditorTemplateMessages.TemplateVariableProposal_error_title, e .getMessage()); } }
@Override public boolean isCandidateMatchingPrefix(String name, String prefix) { return context.getMatcher().isCandidateMatchingPrefix(name, prefix) || context.getMatcher().isCandidateMatchingPrefix("variable:" + resolver.getType(), prefix) || context.getMatcher().isCandidateMatchingPrefix(resolver.getType(), prefix); } };