private void fail(String message) throws TemplateException { fErrorMessage= message; throw new TemplateException(message); }
private void doSourceChanged(IDocument document) { String text= document.get(); fValidationStatus.setOK(); TemplateContextType contextType= fContextTypeRegistry.getContextType(getContextId()); if (contextType != null) { try { contextType.validate(text); } catch (TemplateException e) { fValidationStatus.setError(e.getLocalizedMessage()); } } updateAction(ITextEditorActionConstants.UNDO); updateButtons(); }
protected String validateTemplate(Template template) { TemplateContextType type= fRegistry.getContextType(template.getContextTypeId()); if (type == null) { return "Unknown context type: " + template.getContextTypeId(); //$NON-NLS-1$ } try { type.validate(template.getPattern()); return null; } catch (TemplateException e) { return e.getMessage(); } }
protected void doSourceChanged(IDocument document) { String text= document.get(); fValidationStatus.setOK(); TemplateContextType contextType= fContextTypeRegistry.getContextType(getContextId()); if (contextType != null) { try { contextType.validate(text); } catch (TemplateException e) { fValidationStatus.setError(e.getLocalizedMessage()); } } updateAction(ITextEditorActionConstants.UNDO); updateStatusAndButtons(); }
protected String validateTemplate(Template template) { TemplateContextType type= fRegistry.getContextType(template.getContextTypeId()); if (type == null) { return "Unknown context type: " + template.getContextTypeId(); //$NON-NLS-1$ } try { type.validate(template.getPattern()); return null; } catch (TemplateException e) { return e.getMessage(); } }
private void fail(String message) throws TemplateException { fErrorMessage= message; throw new TemplateException(message); }
private void doSourceChanged(IDocument document) { String text= document.get(); fValidationStatus.setOK(); TemplateContextType contextType= fContextTypeRegistry.getContextType(getContextId()); if (contextType != null) { try { contextType.validate(text); } catch (TemplateException e) { fValidationStatus.setError(e.getLocalizedMessage()); } } updateUndoAction(); updateButtons(); }
protected String validateTemplate(Template template) { TemplateContextType type= fRegistry.getContextType(template.getContextTypeId()); if (type == null) { return "Unknown context type: " + template.getContextTypeId(); //$NON-NLS-1$ } try { type.validate(template.getPattern()); return null; } catch (TemplateException e) { return e.getMessage(); } }
@Override protected void validateVariables(TemplateVariable[] variables) throws TemplateException { // check for multiple cursor variables for (int i= 0; i < variables.length; i++) { TemplateVariable var= variables[i]; if (var.getType().equals(GlobalTemplateVariables.Cursor.NAME)) { if (var.getOffsets().length > 1) { throw new TemplateException(JavaTemplateMessages.ContextType_error_multiple_cursor_variables); } } } }
protected void doSourceChanged(IDocument document) { String text= document.get(); fValidationStatus.setOK(); TemplateContextType contextType= fContextTypeRegistry.getContextType(getContextId()); if (contextType != null) { try { contextType.validate(text); } catch (TemplateException e) { fValidationStatus.setError(e.getLocalizedMessage()); } } updateUndoAction(); updateStatusAndButtons(); }
protected void validateVariables(TemplateVariable[] variables) throws TemplateException { // check for multiple cursor variables for (int i= 0; i < variables.length; i++) { TemplateVariable var= variables[i]; if (var.getType().equals(GlobalTemplateVariables.Cursor.NAME)) { if (var.getOffsets().length > 1) { throw new TemplateException(JavaTemplateMessages.ContextType_error_multiple_cursor_variables); } } } }
private void doSourceChanged(IDocument document) { String text= document.get(); fValidationStatus.setOK(); TemplateContextType contextType= fContextTypeRegistry.getContextType(getContextId()); if (contextType != null) { try { contextType.validate(text); } catch (TemplateException e) { fValidationStatus.setError(e.getLocalizedMessage()); } } updateAction(ITextEditorActionConstants.UNDO); updateButtons(); }
@Override protected void validateVariables(TemplateVariable[] variables) throws TemplateException { // check for multiple cursor variables for (int i= 0; i < variables.length; i++) { TemplateVariable var= variables[i]; if (var.getType().equals(GlobalTemplateVariables.Cursor.NAME)) { if (var.getOffsets().length > 1) { throw new TemplateException(JavaTemplateMessages.ContextType_error_multiple_cursor_variables); } } } }
protected void doSourceChanged(IDocument document) { String text= document.get(); fValidationStatus.setOK(); TemplateContextType contextType= fContextTypeRegistry.getContextType(getContextId()); if (contextType != null) { try { contextType.validate(text); } catch (TemplateException e) { fValidationStatus.setError(e.getLocalizedMessage()); } } updateAction(ITextEditorActionConstants.UNDO); updateStatusAndButtons(); }
public void validate(String pattern) throws TemplateException { super.validate(pattern); if (fIsComment) { if (!isValidComment(pattern)) { throw new TemplateException(JavaTemplateMessages.CodeTemplateContextType_validate_invalidcomment); } } }
private void doSourceChanged(IDocument document) { String text = document.get(); _fTemplate.setPattern(text); _fValidationStatus.setOK(); TemplateContextType contextType = _fContextTypeRegistry.getContextType(_fTemplate.getContextTypeId()); if (contextType != null) { try { contextType.validate(text); } catch (TemplateException e) { _fValidationStatus.setError(e.getLocalizedMessage()); } } updateUndoAction(); updateButtons(); }
@Override public void validate(String pattern) throws TemplateException { super.validate(pattern); if (fIsComment) { if (!isValidComment(pattern)) { throw new TemplateException(JavaTemplateMessages.CodeTemplateContextType_validate_invalidcomment); } } }
@Override public void validate(String pattern) throws TemplateException { super.validate(pattern); if (fIsComment) { if (!isValidComment(pattern)) { throw new TemplateException(JavaManipulationMessages.CodeTemplateContextType_validate_invalidcomment); } } }
protected void validateVariables(TemplateVariable[] variables) throws TemplateException { ArrayList required= new ArrayList(5); String contextName= getId(); if (NEWTYPE_CONTEXTTYPE.equals(contextName)) { required.add(PACKAGE_DECLARATION); required.add(TYPE_DECLARATION); } for (int i= 0; i < variables.length; i++) { String type= variables[i].getType(); if (getResolver(type) == null) { throw new TemplateException(Messages.format(JavaTemplateMessages.CodeTemplateContextType_validate_unknownvariable, type)); } required.remove(type); } if (!required.isEmpty()) { String missing= (String) required.get(0); throw new TemplateException(Messages.format(JavaTemplateMessages.CodeTemplateContextType_validate_missingvariable, missing)); } super.validateVariables(variables); }
@Override protected void validateVariables(TemplateVariable[] variables) throws TemplateException { ArrayList<String> required= new ArrayList<>(5); String contextName= getId(); if (NEWTYPE_CONTEXTTYPE.equals(contextName)) { required.add(PACKAGE_DECLARATION); required.add(TYPE_DECLARATION); } for (int i= 0; i < variables.length; i++) { String type= variables[i].getType(); if (getResolver(type) == null) { String unknown= BasicElementLabels.getJavaElementName(type); throw new TemplateException(Messages.format(JavaManipulationMessages.CodeTemplateContextType_validate_unknownvariable, unknown)); } required.remove(type); } if (!required.isEmpty()) { String missing= BasicElementLabels.getJavaElementName(required.get(0)); throw new TemplateException(Messages.format(JavaManipulationMessages.CodeTemplateContextType_validate_missingvariable, missing)); } super.validateVariables(variables); }