/** * Adds the fs index key description. * * @param fsid the fsid * @param key the key */ public void addFsIndexKeyDescription(FsIndexDescription fsid, FsIndexKeyDescription key) { FsIndexKeyDescription[] prevKeys = fsid.getKeys(); FsIndexKeyDescription[] newKeys = new FsIndexKeyDescription[prevKeys == null ? 1 : prevKeys.length + 1]; if (null != prevKeys) System.arraycopy(prevKeys, 0, newKeys, 0, prevKeys.length); newKeys[newKeys.length - 1] = key; fsid.setKeys(newKeys); }
/** * Gets the already used features. * * @param ndx the ndx * @return the already used features */ public List getAlreadyUsedFeatures(FsIndexDescription ndx) { List result = new ArrayList(); FsIndexKeyDescription[] items = ndx.getKeys(); if (null == items) return result; for (int i = 0; i < items.length; i++) { result.add(items[i].getFeatureName()); } return result; }
/** * Removes the fs index key description. * * @param fsid the fsid * @param key the key */ public void removeFsIndexKeyDescription(FsIndexDescription fsid, FsIndexKeyDescription key) { fsid.setKeys((FsIndexKeyDescription[]) Utility.removeElementFromArray(fsid.getKeys(), key, FsIndexKeyDescription.class)); }
/** * Checks if is feature used in index. * * @param fullFeatureName the full feature name * @return true, if is feature used in index */ private boolean isFeatureUsedInIndex(String fullFeatureName) { if (!isLocalProcessingDescriptor()) { return false; } FsIndexCollection indexCollection = editor.getMergedFsIndexCollection(); FsIndexDescription[] fsid = (null == indexCollection) ? null : indexCollection.getFsIndexes(); if (null != fsid) { for (int i = 0; i < fsid.length; i++) { FsIndexKeyDescription[] keys = fsid[i].getKeys(); if (null != keys) { for (int j = 0; j < keys.length; j++) { if (keys[j].getFeatureName().equals(fullFeatureName)) return true; } } } } return false; }
/** * Swap index keys. * * @param itemBelow the item below * @param newSelection the new selection */ public static void swapIndexKeys(TableTreeItem itemBelow, int newSelection) { TableTreeItem parent = itemBelow.getParentItem(); FsIndexDescription fsid = getFsIndexDescriptionFromTableTreeItem(parent); int i = getIndex(itemBelow); FsIndexKeyDescription[] keys = fsid.getKeys(); FsIndexKeyDescription temp = keys[i]; keys[i] = keys[i - 1]; keys[i - 1] = temp; // swap items in the GUI swapTableTreeItems(itemBelow, newSelection); }
for (int i = 0; i < fsid.length; i++) { if (typeName.equals(fsid[i].getTypeName())) { FsIndexKeyDescription[] keys = fsid[i].getKeys(); if (null != keys) { for (int j = 0; j < keys.length; j++) {
comparator.setType(type); FsIndexKeyDescription[] keys = aIndexes[i].getKeys(); if (keys != null) { for (int j = 0; j < keys.length; j++) {
/** * Update index spec. * * @param item the item * @param ndx the ndx */ private void updateIndexSpec(TableTreeItem item, FsIndexDescription ndx) { item.setText(INDEX_NAME_COL, ndx.getLabel()); item.setText(INDEX_TYPE_COL, formatName(ndx.getTypeName())); item.setText(INDEX_KIND_COL, handleDefaultIndexKind(ndx.getKind())); item.setData(ndx); removeChildren(item); FsIndexKeyDescription[] keys = ndx.getKeys(); if (null != keys) for (int i = 0; i < keys.length; i++) { updateKeySpec(new TableTreeItem(item, SWT.NONE), keys[i]); } }
indexTypeUI.setText(existingNDX.getTypeName()); keys = existingNDX.getKeys(); if (null != keys) { for (int i = 0; i < keys.length; i++) {
if (typeName.equals(indexes[i].getTypeName())) { FsIndexKeyDescription[] newFsKeys = (FsIndexKeyDescription[]) Utility .removeElementsFromArray(indexes[i].getKeys(), typeOrFeatureName, FsIndexKeyDescription.class, fsIndexKeyDescCompare); if (newFsKeys != indexes[i].getKeys()) { somethingChanged = true; indexes[i].setKeys(newFsKeys);
fsid.setLabel(setValueChanged(dialog.indexName, fsid.getLabel())); fsid.setTypeName(setValueChanged(dialog.indexType, fsid.getTypeName())); fsid.setKeys(setValueChangedKeys(dialog.keys, fsid.getKeys())); fsid.setKind(setValueChanged(dialog.indexKind, handleDefaultIndexKind(fsid.getKind())));