public String getColumnText(Object element, int columnIndex) { String columnText= ""; //$NON-NLS-1$ if (element instanceof NLSSubstitution) { NLSSubstitution substitution= (NLSSubstitution) element; if (columnIndex == KEY_PROP) { if (substitution.getState() == NLSSubstitution.EXTERNALIZED) { columnText= substitution.getKey(); } } else if ((columnIndex == VAL_PROP) && (substitution.getValue() != null)) { columnText= substitution.getValue(); } } return unwindEscapeChars(columnText); }
@Override public String getColumnText(Object element, int columnIndex) { String columnText= ""; //$NON-NLS-1$ if (element instanceof NLSSubstitution) { NLSSubstitution substitution= (NLSSubstitution) element; if (columnIndex == KEY_PROP) { if (substitution.getState() == NLSSubstitution.EXTERNALIZED) { columnText= BasicElementLabels.getJavaElementName(substitution.getKey()); } } else if ((columnIndex == VAL_PROP) && (substitution.getValue() != null)) { columnText= substitution.getValue(); } } return getEscapedAsciiString(columnText); }
@Override public String getColumnText(Object element, int columnIndex) { String columnText= ""; //$NON-NLS-1$ if (element instanceof NLSSubstitution) { NLSSubstitution substitution= (NLSSubstitution) element; if (columnIndex == KEY_PROP) { if (substitution.getState() == NLSSubstitution.EXTERNALIZED) { columnText= BasicElementLabels.getJavaElementName(substitution.getKey()); } } else if ((columnIndex == VAL_PROP) && (substitution.getValue() != null)) { columnText= substitution.getValue(); } } return getEscapedAsciiString(columnText); }
/** * @see ICellModifier#getValue(Object, String) */ public Object getValue(Object element, String property) { if (element instanceof NLSSubstitution) { NLSSubstitution substitution= (NLSSubstitution) element; String res= null; if (PROPERTIES[KEY_PROP].equals(property)) { res= substitution.getKeyWithoutPrefix(); } else if (PROPERTIES[VAL_PROP].equals(property)) { res= substitution.getValue(); } else if (PROPERTIES[STATE_PROP].equals(property)) { return new Integer(substitution.getState()); } if (res != null) { return unwindEscapeChars(res); } return ""; //$NON-NLS-1$ } return ""; //$NON-NLS-1$ }
private void checkMissingKeys(RefactoringStatus status) { for (int i= 0; i < fSubstitutions.length; i++) { NLSSubstitution substitution= fSubstitutions[i]; if ((substitution.getValue() == null) && (substitution.getKey() != null)) { status.addWarning(NLSUIMessages.ExternalizeWizardPage_warning_keymissing); return; } } }
private void checkMissingKeys(RefactoringStatus status) { for (int i= 0; i < fSubstitutions.length; i++) { NLSSubstitution substitution= fSubstitutions[i]; if ((substitution.getValue() == null) && (substitution.getKey() != null)) { status.addWarning(NLSUIMessages.ExternalizeWizardPage_warning_keymissing); return; } } }
private void checkMissingKeys(RefactoringStatus status) { for (int i= 0; i < fSubstitutions.length; i++) { NLSSubstitution substitution= fSubstitutions[i]; if ((substitution.getValue() == null) && (substitution.getKey() != null)) { status.addWarning(NLSUIMessages.ExternalizeWizardPage_warning_keymissing); return; } } }
/** * @see ICellModifier#getValue(Object, String) */ @Override public Object getValue(Object element, String property) { if (element instanceof NLSSubstitution) { NLSSubstitution substitution= (NLSSubstitution) element; String res= null; if (PROPERTIES[KEY_PROP].equals(property)) { res= substitution.getKeyWithoutPrefix(); } else if (PROPERTIES[VAL_PROP].equals(property)) { res= substitution.getValue(); } else if (PROPERTIES[STATE_PROP].equals(property)) { return Integer.valueOf(substitution.getState()); } if (res != null) { return getEscapedAsciiString(res); } return ""; //$NON-NLS-1$ } return ""; //$NON-NLS-1$ }
/** * @see ICellModifier#getValue(Object, String) */ @Override public Object getValue(Object element, String property) { if (element instanceof NLSSubstitution) { NLSSubstitution substitution= (NLSSubstitution) element; String res= null; if (PROPERTIES[KEY_PROP].equals(property)) { res= substitution.getKeyWithoutPrefix(); } else if (PROPERTIES[VAL_PROP].equals(property)) { res= substitution.getValue(); } else if (PROPERTIES[STATE_PROP].equals(property)) { return new Integer(substitution.getState()); } if (res != null) { return getEscapedAsciiString(res); } return ""; //$NON-NLS-1$ } return ""; //$NON-NLS-1$ }
private Image getNLSImage(NLSSubstitution sub) { if ((sub.getValue() == null) && (sub.getKey() != null)) { // Missing keys JavaElementImageDescriptor imageDescriptor= new JavaElementImageDescriptor(getNLSImageDescriptor(sub.getState()), JavaElementImageDescriptor.WARNING, JavaElementImageProvider.SMALL_SIZE); return JavaPlugin.getImageDescriptorRegistry().get(imageDescriptor); } else if (sub.isConflicting(fSubstitutions) || !isKeyValid(sub, null)) { JavaElementImageDescriptor imageDescriptor= new JavaElementImageDescriptor(getNLSImageDescriptor(sub.getState()), JavaElementImageDescriptor.ERROR, JavaElementImageProvider.SMALL_SIZE); return JavaPlugin.getImageDescriptorRegistry().get(imageDescriptor); } else { return getNLSImage(sub.getState()); } }
private Image getNLSImage(NLSSubstitution sub) { if ((sub.getValue() == null) && (sub.getKey() != null)) { // Missing keys JavaElementImageDescriptor imageDescriptor= new JavaElementImageDescriptor(getNLSImageDescriptor(sub.getState()), JavaElementImageDescriptor.WARNING, JavaElementImageProvider.SMALL_SIZE); return JavaPlugin.getImageDescriptorRegistry().get(imageDescriptor); } else if (sub.isConflicting(fSubstitutions) || !isKeyValid(sub, null)) { JavaElementImageDescriptor imageDescriptor= new JavaElementImageDescriptor(getNLSImageDescriptor(sub.getState()), JavaElementImageDescriptor.ERROR, JavaElementImageProvider.SMALL_SIZE); return JavaPlugin.getImageDescriptorRegistry().get(imageDescriptor); } else { return getNLSImage(sub.getState()); } }
private Image getNLSImage(NLSSubstitution sub) { if ((sub.getValue() == null) && (sub.getKey() != null)) { // Missing keys JavaElementImageDescriptor imageDescriptor= new JavaElementImageDescriptor(getNLSImageDescriptor(sub.getState()), JavaElementImageDescriptor.WARNING, JavaElementImageProvider.SMALL_SIZE); return JavaPlugin.getImageDescriptorRegistry().get(imageDescriptor); } else if (sub.isConflicting(fSubstitutions) || !isKeyValid(sub, null)) { JavaElementImageDescriptor imageDescriptor= new JavaElementImageDescriptor(getNLSImageDescriptor(sub.getState()), JavaElementImageDescriptor.ERROR, JavaElementImageProvider.SMALL_SIZE); return JavaPlugin.getImageDescriptorRegistry().get(imageDescriptor); } else { return getNLSImage(sub.getState()); } }
private static void addReplaceEdits(TextChange textChange, NLSSubstitution[] substitutions, Map<String, NLSSubstitution> newKeyToSubstMap, Map<String, NLSSubstitution> oldKeyToSubstMap, PropertyFileDocumentModel model) { for (int i= 0; i < substitutions.length; i++) { NLSSubstitution substitution= substitutions[i]; if (doReplace(substitution, newKeyToSubstMap, oldKeyToSubstMap)) { KeyValuePair initialPair= new KeyValuePair(substitution.getInitialKey(), substitution.getInitialValue()); String key= PropertyFileDocumentModel.escape(substitution.getKey(), false); String value= PropertyFileDocumentModel.escape(substitution.getValue(), true) + model.getLineDelimiter(); KeyValuePair newPair= new KeyValuePair(key, value); TextEdit edit= model.replace(initialPair, newPair); if (edit != null) { TextChangeCompatibility.addTextEdit(textChange, Messages.format(NLSMessages.NLSPropertyFileModifier_replace_entry, BasicElementLabels.getJavaElementName(substitution.getKey())), edit); } } } }
private static void addReplaceEdits(TextChange textChange, NLSSubstitution[] substitutions, Map<String, NLSSubstitution> newKeyToSubstMap, Map<String, NLSSubstitution> oldKeyToSubstMap, PropertyFileDocumentModel model) { for (int i= 0; i < substitutions.length; i++) { NLSSubstitution substitution= substitutions[i]; if (doReplace(substitution, newKeyToSubstMap, oldKeyToSubstMap)) { KeyValuePair initialPair= new KeyValuePair(substitution.getInitialKey(), substitution.getInitialValue()); String key= PropertyFileDocumentModel.escape(substitution.getKey(), false); String value= PropertyFileDocumentModel.escape(substitution.getValue(), true) + model.getLineDelimiter(); KeyValuePair newPair= new KeyValuePair(key, value); TextEdit edit= model.replace(initialPair, newPair); if (edit != null) { TextChangeCompatibility.addTextEdit(textChange, Messages.format(NLSMessages.NLSPropertyFileModifier_replace_entry, BasicElementLabels.getJavaElementName(substitution.getKey())), edit); } } } }