public String getColumnText(Object element, int columnIndex) { Template template = (Template) element; switch (columnIndex) { case 0 : return template.getName(); case 1 : return template.getDescription(); default : return ""; //$NON-NLS-1$ } } }
public int compare(Viewer viewer, Object object1, Object object2) { if ((object1 instanceof Template) && (object2 instanceof Template)) { Template left = (Template) object1; Template right = (Template) object2; int result = left.getName().compareToIgnoreCase(right.getName()); if (result != 0) { return result; } return left.getDescription().compareToIgnoreCase(right.getDescription()); } return super.compare(viewer, object1, object2); }
private static boolean isSimilar(Template t, Template orig, boolean isCodeTemplates) { return orig.getName().equals(t.getName()) && orig.getContextTypeId().equals(t.getContextTypeId()) && (isCodeTemplates || orig.getDescription().equals(t.getDescription())); // only use description for templates (for, while...) }
private static boolean isSimilar(Template t, Template orig, boolean isCodeTemplates) { return orig.getName().equals(t.getName()) && orig.getContextTypeId().equals(t.getContextTypeId()) && (isCodeTemplates || orig.getDescription().equals(t.getDescription())); // only use description for templates (for, while...) }
private static boolean isSimilar(Template t, Template orig, boolean isCodeTemplates) { return orig.getName().equals(t.getName()) && orig.getContextTypeId().equals(t.getContextTypeId()) && (isCodeTemplates || orig.getDescription().equals(t.getDescription())); // only use description for templates (for, while...) }
@Override public String getDisplayString() { if (fDisplayString == null) { String[] arguments= new String[] { fTemplate.getName(), fTemplate.getDescription() }; fDisplayString= JFaceTextTemplateMessages.getFormattedString("TemplateProposal.displayString", arguments); //$NON-NLS-1$ } return fDisplayString; }
public String getDisplayString() { if (fDisplayString == null) { String[] arguments= new String[] { fTemplate.getName(), fTemplate.getDescription() }; fDisplayString= Messages.format(TemplateContentAssistMessages.TemplateProposal_displayString, arguments); } return fDisplayString; }
public String getDisplayString() { if (_displayString == null) { String[] arguments = new String[] { _template.getName(), _template.getDescription() }; _displayString = Messages.getFormattedString("TemplateProposal.displayString", arguments); //$NON-NLS-1$ } return _displayString; }
@Override public String getDisplayString() { if (fDisplayString == null) { String[] arguments= new String[] { fTemplate.getName(), fTemplate.getDescription() }; fDisplayString= JFaceTextTemplateMessages.getFormattedString("TemplateProposal.displayString", arguments); //$NON-NLS-1$ } return fDisplayString; }
private String getTemplateColumnText(TemplatePersistenceData data, int columnIndex) { switch (columnIndex) { case 0: return data.getTemplate().getName(); case 1: return data.getTemplate().getDescription(); default: return ""; //$NON-NLS-1$ } }
private String getTemplateColumnText(TemplatePersistenceData data, int columnIndex) { switch (columnIndex) { case 0: return data.getTemplate().getName(); case 1: return data.getTemplate().getDescription(); default: return ""; //$NON-NLS-1$ } }
/** * Creates a copy of a template. * * @param template the template to copy */ public Template(Template template) { this(template.getName(), template.getDescription(), template.getContextTypeId(), template.getPattern(), template.isAutoInsertable()); }
/** * Creates a copy of a template. * * @param template the template to copy */ public Template(Template template) { this(template.getName(), template.getDescription(), template.getContextTypeId(), template.getPattern(), template.isAutoInsertable()); }
@Override public StyledString getStyledDisplayString() { if (fDisplayString == null) { String[] arguments= new String[] { fTemplate.getName(), fTemplate.getDescription() }; String decorated= Messages.format(TemplateContentAssistMessages.TemplateProposal_displayString, arguments); StyledString string= new StyledString(fTemplate.getName(), StyledString.COUNTER_STYLER); fDisplayString= StyledCellLabelProvider.styleDecoratedString(decorated, StyledString.QUALIFIER_STYLER, string); } return fDisplayString; }
@Override public StyledString getStyledDisplayString() { if (fDisplayString == null) { String[] arguments= new String[] { fTemplate.getName(), fTemplate.getDescription() }; String decorated= Messages.format(TemplateContentAssistMessages.TemplateProposal_displayString, arguments); StyledString string= new StyledString(fTemplate.getName(), StyledString.COUNTER_STYLER); fDisplayString= StyledCellLabelProvider.styleDecoratedString(decorated, StyledString.QUALIFIER_STYLER, string); } return fDisplayString; }
/** * Only to be used by tests * * @param templateId the template id * @param pattern the new pattern * @param project not used */ public static void setCodeTemplate(String templateId, String pattern, IJavaProject project) { TemplateStoreCore codeTemplateStore= JavaManipulation.getCodeTemplateStore(); TemplatePersistenceData data= codeTemplateStore.getTemplateData(templateId); Template orig= data.getTemplate(); Template copy= new Template(orig.getName(), orig.getDescription(), orig.getContextTypeId(), pattern, true); data.setTemplate(copy); }
public static void setCodeTemplate(String templateId, String pattern, IJavaProject project) { TemplateStore codeTemplateStore= JavaPlugin.getDefault().getCodeTemplateStore(); TemplatePersistenceData data= codeTemplateStore.getTemplateData(templateId); Template orig= data.getTemplate(); Template copy= new Template(orig.getName(), orig.getDescription(), orig.getContextTypeId(), pattern, true); data.setTemplate(copy); }
/** * Only to be used by tests * * @param templateId the template id * @param pattern the new pattern * @param project not used */ public static void setCodeTemplate(String templateId, String pattern, IJavaProject project) { TemplateStore codeTemplateStore= JavaPlugin.getDefault().getCodeTemplateStore(); TemplatePersistenceData data= codeTemplateStore.getTemplateData(templateId); Template orig= data.getTemplate(); Template copy= new Template(orig.getName(), orig.getDescription(), orig.getContextTypeId(), pattern, true); data.setTemplate(copy); }
/** * Moves the selected template from one context to another. * * @param templates an array of template data * @param contextId the contextId * */ private void moveTemplates(TemplatePersistenceData[] templates, String contextId) { for (int i= 0; i < templates.length; i++) { Template t= templates[i].getTemplate(); templates[i].setTemplate(new Template(t.getName(), t.getDescription(), contextId, t .getPattern(), t.isAutoInsertable())); } saveTemplateStore(); fTreeViewer.setSelection(new StructuredSelection(templates), true); }
/** * Moves the selected template from one context to another. * * @param templates an array of template data * @param contextId the contextId * */ private void moveTemplates(TemplatePersistenceData[] templates, String contextId) { for (int i= 0; i < templates.length; i++) { Template t= templates[i].getTemplate(); templates[i].setTemplate(new Template(t.getName(), t.getDescription(), contextId, t .getPattern(), t.isAutoInsertable())); } saveTemplateStore(); fTreeViewer.setSelection(new StructuredSelection(templates), true); }