/** * Checks if is bound. * * @param key the key * @return true, if is bound */ private boolean isBound(String key) { ResourceManagerConfiguration rmc = editor.getResolvedExternalResourcesAndBindings(); if (null == rmc) { // happens if there is no such xml element in the descriptor return false; } ExternalResourceBinding[] xrb = rmc.getExternalResourceBindings(); if (null != xrb) for (int i = 0; i < xrb.length; i++) { if (key.equals(xrb[i].getKey())) return true; } return false; }
/** * Fill bindings. * * @param parent the parent * @param xrd the xrd * @param bindings the bindings */ private void fillBindings(TreeItem parent, ExternalResourceDescription xrd, ExternalResourceBinding[] bindings) { if (null != bindings) { for (int i = 0; i < bindings.length; i++) { if (bindings[i].getResourceName().equals(xrd.getName())) { addBindingToGUI(parent, bindings[i].getKey(), bindings[i]); } } } }
/** * Removes the bound flag in dependency section. * * @param xrb the xrb */ private void removeBoundFlagInDependencySection(ExternalResourceBinding xrb) { String key = xrb.getKey(); TableItem[] items = resourceDependencySection.getTable().getItems(); for (int i = 0; i < items.length; i++) { if (key.equals(items[i].getText(ResourceDependencySection.KEY_COL))) items[i].setText(0, ""); // reset bound } }
/** * Propagate key change. * * @param newKey the new key * @param oldKey the old key */ private void propagateKeyChange(String newKey, String oldKey) { ExternalResourceBinding[] xrb = getExternalResourceBindings(); if (null != xrb) for (int i = 0; i < xrb.length; i++) { if (oldKey.equals(xrb[i].getKey())) { xrb[i].setKey(newKey); editor.getResourcesPage().getResourceBindingsSection().markStale(); return; // only 1 binding at most } } }