private List getExternalizedElements(IStructuredSelection selection) { ArrayList res= new ArrayList(); for (Iterator iter= selection.iterator(); iter.hasNext();) { NLSSubstitution substitution= (NLSSubstitution) iter.next(); if (substitution.getState() == NLSSubstitution.EXTERNALIZED && !substitution.hasStateChanged()) { res.add(substitution); } } return res; }
private List<NLSSubstitution> getExternalizedElements(IStructuredSelection selection) { ArrayList<NLSSubstitution> res= new ArrayList<>(); for (Iterator<?> iter= selection.iterator(); iter.hasNext();) { NLSSubstitution substitution= (NLSSubstitution) iter.next(); if (substitution.getState() == NLSSubstitution.EXTERNALIZED && !substitution.hasStateChanged()) { res.add(substitution); } } return res; }
private List<NLSSubstitution> getExternalizedElements(IStructuredSelection selection) { ArrayList<NLSSubstitution> res= new ArrayList<>(); for (Iterator<?> iter= selection.iterator(); iter.hasNext();) { NLSSubstitution substitution= (NLSSubstitution) iter.next(); if (substitution.getState() == NLSSubstitution.EXTERNALIZED && !substitution.hasStateChanged()) { res.add(substitution); } } return res; }
public void generateKey(NLSSubstitution[] substitutions, Properties properties) { if (fState != EXTERNALIZED || ((fState == EXTERNALIZED) && hasStateChanged())) { int number= 0; while (true) { String ithKey= createKey(number); if (!properties.containsKey(fPrefix + ithKey) && !containsKey(substitutions, ithKey)) { fCachedPrefixPlusKey= null; fKey= ithKey; return; } number++; } } }
public void generateKey(NLSSubstitution[] substitutions, Properties properties) { if (fState != EXTERNALIZED || ((fState == EXTERNALIZED) && hasStateChanged())) { int number= 0; while (true) { String ithKey= createKey(number); if (!properties.containsKey(fPrefix + ithKey) && !containsKey(substitutions, ithKey)) { fCachedPrefixPlusKey= null; fKey= ithKey; return; } number++; } } }
public static void updateSubtitutions(NLSSubstitution[] substitutions, Properties props, String accessorClassName) { for (int i= 0; i < substitutions.length; i++) { NLSSubstitution substitution= substitutions[i]; if ((substitution.getState() == NLSSubstitution.EXTERNALIZED) && !substitution.hasStateChanged()) { substitution.setInitialValue(props.getProperty(substitution.getKey())); substitution.setUpdatedAccessor(accessorClassName); } } }
public static void updateSubtitutions(NLSSubstitution[] substitutions, Properties props, String accessorClassName) { for (int i= 0; i < substitutions.length; i++) { NLSSubstitution substitution= substitutions[i]; if ((substitution.getState() == NLSSubstitution.EXTERNALIZED) && !substitution.hasStateChanged()) { substitution.setInitialValue(props.getProperty(substitution.getKey())); substitution.setUpdatedAccessor(accessorClassName); } } }
public static void updateSubtitutions(NLSSubstitution[] substitutions, Properties props, String accessorClassName) { for (int i= 0; i < substitutions.length; i++) { NLSSubstitution substitution= substitutions[i]; if ((substitution.getState() == NLSSubstitution.EXTERNALIZED) && !substitution.hasStateChanged()) { substitution.setInitialValue(props.getProperty(substitution.getKey())); substitution.setUpdatedAccessor(accessorClassName); } } }
static boolean doInsert(NLSSubstitution substitution, Map<String, NLSSubstitution> newKeyToSubstMap, Map<String, NLSSubstitution> oldKeyToSubstMap) { if (substitution.getState() != NLSSubstitution.EXTERNALIZED) { return false; // does not go into the property file } if (!substitution.hasStateChanged() && substitution.getInitialValue() != null) { if (!substitution.isKeyRename() || oldKeyToSubstMap.get(substitution.getInitialKey()) == substitution) { return false; // no key rename and was not a duplicate } } if (newKeyToSubstMap.get(substitution.getKey()) == substitution) { // only insert if we're not a duplicate return true; } return false; }
static boolean doInsert(NLSSubstitution substitution, Map<String, NLSSubstitution> newKeyToSubstMap, Map<String, NLSSubstitution> oldKeyToSubstMap) { if (substitution.getState() != NLSSubstitution.EXTERNALIZED) { return false; // does not go into the property file } if (!substitution.hasStateChanged() && substitution.getInitialValue() != null) { if (!substitution.isKeyRename() || oldKeyToSubstMap.get(substitution.getInitialKey()) == substitution) { return false; // no key rename and was not a duplicate } } if (newKeyToSubstMap.get(substitution.getKey()) == substitution) { // only insert if we're not a duplicate return true; } return false; }
static boolean doInsert(NLSSubstitution substitution, Map newKeyToSubstMap, Map oldKeyToSubstMap) { if (substitution.getState() != NLSSubstitution.EXTERNALIZED) { return false; // does not go into the property file } if (!substitution.hasStateChanged() && substitution.getInitialValue() != null) { if (!substitution.isKeyRename() || oldKeyToSubstMap.get(substitution.getInitialKey()) == substitution) { return false; // no key rename and was not a duplicate } } if (newKeyToSubstMap.get(substitution.getKey()) == substitution) { // only insert if we're not a duplicate return true; } return false; }
static boolean doReplace(NLSSubstitution substitution, Map newKeyToSubstMap, Map oldKeyToSubstMap) { if (substitution.getState() != NLSSubstitution.EXTERNALIZED || substitution.hasStateChanged() || substitution.getInitialValue() == null) { return false; // was not in property file before } if (oldKeyToSubstMap.get(substitution.getInitialKey()) != substitution) { return false; // not the owner of this key } if (substitution.isKeyRename() || substitution.isValueRename()) { if (newKeyToSubstMap.get(substitution.getKey()) == substitution) { // only rename if we're not a duplicate. duplicates will be removed return true; } } return false; }
static boolean doReplace(NLSSubstitution substitution, Map<String, NLSSubstitution> newKeyToSubstMap, Map<String, NLSSubstitution> oldKeyToSubstMap) { if (substitution.getState() != NLSSubstitution.EXTERNALIZED || substitution.hasStateChanged() || substitution.getInitialValue() == null) { return false; // was not in property file before } if (oldKeyToSubstMap.get(substitution.getInitialKey()) != substitution) { return false; // not the owner of this key } if (substitution.isKeyRename() || substitution.isValueRename()) { if (newKeyToSubstMap.get(substitution.getKey()) == substitution) { // only rename if we're not a duplicate. duplicates will be removed return true; } } return false; }
static boolean doReplace(NLSSubstitution substitution, Map<String, NLSSubstitution> newKeyToSubstMap, Map<String, NLSSubstitution> oldKeyToSubstMap) { if (substitution.getState() != NLSSubstitution.EXTERNALIZED || substitution.hasStateChanged() || substitution.getInitialValue() == null) { return false; // was not in property file before } if (oldKeyToSubstMap.get(substitution.getInitialKey()) != substitution) { return false; // not the owner of this key } if (substitution.isKeyRename() || substitution.isValueRename()) { if (newKeyToSubstMap.get(substitution.getKey()) == substitution) { // only rename if we're not a duplicate. duplicates will be removed return true; } } return false; }
private void setSelectedTasks(int state) { Assert.isTrue(state == NLSSubstitution.EXTERNALIZED || state == NLSSubstitution.IGNORED || state == NLSSubstitution.INTERNALIZED); List selected= getSelectedTableEntries(); String[] props= new String[]{PROPERTIES[STATE_PROP]}; for (Iterator iter= selected.iterator(); iter.hasNext();) { NLSSubstitution substitution= (NLSSubstitution) iter.next(); substitution.setState(state); if ((substitution.getState() == NLSSubstitution.EXTERNALIZED) && substitution.hasStateChanged()) { substitution.generateKey(fSubstitutions); } } fTableViewer.update(selected.toArray(), props); fTableViewer.getControl().setFocus(); updateButtonStates((IStructuredSelection) fTableViewer.getSelection()); }
private RefactoringStatus checkKeys() { RefactoringStatus result= new RefactoringStatus(); NLSSubstitution[] subs= fSubstitutions; for (int i= 0; i < subs.length; i++) { NLSSubstitution substitution= subs[i]; if ((substitution.getState() == NLSSubstitution.EXTERNALIZED) && substitution.hasStateChanged()) { result.merge(checkKey(substitution.getKey())); } } return result; }
private RefactoringStatus checkKeys() { RefactoringStatus result= new RefactoringStatus(); NLSSubstitution[] subs= fSubstitutions; for (int i= 0; i < subs.length; i++) { NLSSubstitution substitution= subs[i]; if ((substitution.getState() == NLSSubstitution.EXTERNALIZED) && substitution.hasStateChanged()) { result.merge(checkKey(substitution.getKey())); } } return result; }
private void setSelectedTasks(int state) { Assert.isTrue(state == NLSSubstitution.EXTERNALIZED || state == NLSSubstitution.IGNORED || state == NLSSubstitution.INTERNALIZED); List<?> selected= getSelectedTableEntries(); String[] props= new String[]{PROPERTIES[STATE_PROP]}; for (Iterator<?> iter= selected.iterator(); iter.hasNext();) { NLSSubstitution substitution= (NLSSubstitution) iter.next(); substitution.setState(state); if ((substitution.getState() == NLSSubstitution.EXTERNALIZED) && substitution.hasStateChanged()) { substitution.generateKey(fSubstitutions, getProperties(fNLSRefactoring.getPropertyFileHandle())); } } fTableViewer.update(selected.toArray(), props); fTableViewer.getControl().setFocus(); updateButtonStates((IStructuredSelection) fTableViewer.getSelection()); }
private void setSelectedTasks(int state) { Assert.isTrue(state == NLSSubstitution.EXTERNALIZED || state == NLSSubstitution.IGNORED || state == NLSSubstitution.INTERNALIZED); List<?> selected= getSelectedTableEntries(); String[] props= new String[]{PROPERTIES[STATE_PROP]}; for (Iterator<?> iter= selected.iterator(); iter.hasNext();) { NLSSubstitution substitution= (NLSSubstitution) iter.next(); substitution.setState(state); if ((substitution.getState() == NLSSubstitution.EXTERNALIZED) && substitution.hasStateChanged()) { substitution.generateKey(fSubstitutions, getProperties(fNLSRefactoring.getPropertyFileHandle())); } } fTableViewer.update(selected.toArray(), props); fTableViewer.getControl().setFocus(); updateButtonStates((IStructuredSelection) fTableViewer.getSelection()); }
private RefactoringStatus checkKeys() { RefactoringStatus result= new RefactoringStatus(); NLSSubstitution[] subs= fSubstitutions; for (int i= 0; i < subs.length; i++) { NLSSubstitution substitution= subs[i]; if ((substitution.getState() == NLSSubstitution.EXTERNALIZED) && substitution.hasStateChanged()) { result.merge(checkKey(substitution.getKey())); } } return result; }