protected NamespaceInfo createNamespaceInfo() { NamespaceInfo info = new NamespaceInfo(); namespaceInfoList.add(info); return info; } }
public void updateButtonEnabledState() { ISelection selection = tableViewer.getSelection(); Object selectedObject = (selection instanceof IStructuredSelection) ? ((IStructuredSelection) selection).getFirstElement() : null; NamespaceInfo info = (NamespaceInfo) selectedObject; editButton.setEnabled(info != null); deleteButton.setEnabled((info != null) && (info.getProperty("unremovable") == null)); //$NON-NLS-1$ }
protected void addNamespaceInfoList(List list, boolean isImplied) { if (list != null) { for (Iterator i = list.iterator(); i.hasNext(); ) { NamespaceInfo info = (NamespaceInfo)i.next(); NamespaceInfo clone = new NamespaceInfo(info); if (isImplied) { clone.setProperty("isImplied", "true"); //$NON-NLS-1$ //$NON-NLS-2$ } addNamespaceInfo(clone); } } }
List oldNamespaceInfoList = NamespaceInfo.cloneNamespaceInfoList(namespaceInfoList); NamespaceInfo oldCopy = new NamespaceInfo(info); info.setProperty("oldCopy", oldCopy); //$NON-NLS-1$
public void mouseDown(MouseEvent e) { TableItem item = getTable().getItem(new Point(e.x, e.y)); if (item != null) { Object obj = item.getData(); if (obj != null) { NamespaceInfo info = (NamespaceInfo) obj; TableColumn col = getTable().getColumn(0); if (e.x < col.getWidth()) // if the point falls within // the // Select column then perform // check/uncheck { String currentState = (String) info.getProperty("checked"); //$NON-NLS-1$ System.out.println("currentState" + currentState); //$NON-NLS-1$ if ((currentState == null) || currentState.equals("false")) //$NON-NLS-1$ { info.setProperty("checked", "true"); //$NON-NLS-1$ //$NON-NLS-2$ } else { info.setProperty("checked", "false"); //$NON-NLS-1$ //$NON-NLS-2$ } refresh(); } } } } }
info.setProperty("locationHint-readOnly", "true"); //$NON-NLS-1$ //$NON-NLS-2$ info.setProperty("uri-readOnly", "true"); //$NON-NLS-1$ //$NON-NLS-2$ info.setProperty("unremovable", "true"); //$NON-NLS-1$ //$NON-NLS-2$ } else { info.locationHint = null;
public void normalize() { uri = getNormalizedValue(uri); prefix = getNormalizedValue(prefix); locationHint= getNormalizedValue(locationHint); }
List oldNamespaceInfoList = NamespaceInfo.cloneNamespaceInfoList(namespaceInfoList); NamespaceInfo oldCopy = new NamespaceInfo(info); info.setProperty("oldCopy", oldCopy); //$NON-NLS-1$
for (Iterator iterator = namespaceInfoList.iterator(); iterator.hasNext();) { NamespaceInfo nsInfo = (NamespaceInfo) iterator.next(); nsInfo.normalize(); for (Iterator iterator = namespaceInfoList.iterator(); iterator.hasNext();) { NamespaceInfo nsInfo = (NamespaceInfo) iterator.next(); nsInfo.normalize(); if ((nsInfo.uri != null) && nsInfo.isPrefixRequired && (nsInfo.prefix == null)) { result = XMLUIMessages._UI_WARNING_PREFIX_NOT_SPECIFIED + " '" + nsInfo.uri + "'"; //$NON-NLS-1$ //$NON-NLS-2$
public static List cloneNamespaceInfoList(List oldList) { List newList = new Vector(oldList.size()); for (Iterator i = oldList.iterator(); i.hasNext(); ) { NamespaceInfo oldInfo = (NamespaceInfo)i.next(); newList.add(new NamespaceInfo(oldInfo)); } return newList; } }
public void updateButtonEnabledState() { Object selection = getSelection(tableViewer.getSelection()); NamespaceInfo info = (NamespaceInfo) selection; editButton.setEnabled(info != null); deleteButton.setEnabled((info != null) && (info.getProperty("unremovable") == null)); //$NON-NLS-1$ }
public void addNoNamespaceSchemaLocation(String locationHint) { NamespaceInfo nsInfo = new NamespaceInfo(); nsInfo.prefix = null; nsInfo.uri = ""; //$NON-NLS-1$ nsInfo.locationHint = locationHint; internalAddNamespaceInfo("", nsInfo); //$NON-NLS-1$ }
public NamespaceInfo getNamespaceInfoForURI(String uri, boolean testImplied) { NamespaceInfo result = null; for (Iterator i = hashtable.values().iterator(); i.hasNext(); ) { NamespaceInfo nsInfo = (NamespaceInfo)i.next(); if (isMatchingString(nsInfo.uri, uri)) { result = nsInfo; if (testImplied && nsInfo.getProperty("isImplied") != null) //$NON-NLS-1$ { // continue } else { break; } } } return result; }
protected void addBuiltInNamespaces(List list) { String xsiNamespace = "http://www.w3.org/2001/XMLSchema-instance"; //$NON-NLS-1$ String xsdNamespace = "http://www.w3.org/2001/XMLSchema"; //$NON-NLS-1$ if (!isAlreadyDeclared(xsiNamespace)) { list.add(new NamespaceInfo("http://www.w3.org/2001/XMLSchema-instance", "xsi", null)); //$NON-NLS-1$ //$NON-NLS-2$ } if (!isAlreadyDeclared(xsdNamespace)) { list.add(new NamespaceInfo("http://www.w3.org/2001/XMLSchema", "xsd", null)); //$NON-NLS-1$ //$NON-NLS-2$ } }
protected Map createPrefixMapping(List oldList, List newList) { Map map = new Hashtable(); Hashtable oldURIToPrefixTable = new Hashtable(); for (Iterator i = oldList.iterator(); i.hasNext();) { NamespaceInfo oldInfo = (NamespaceInfo) i.next(); oldURIToPrefixTable.put(oldInfo.uri, oldInfo); } for (Iterator i = newList.iterator(); i.hasNext();) { NamespaceInfo newInfo = (NamespaceInfo) i.next(); NamespaceInfo oldInfo = (NamespaceInfo) oldURIToPrefixTable.get(newInfo.uri != null ? newInfo.uri : ""); //$NON-NLS-1$ // if oldInfo is non null ... there's a matching URI in the old // set // we can use its prefix to detemine out mapping // // if oldInfo is null ... we use the 'oldCopy' we stashed away // assuming that the user changed the URI and the prefix if (oldInfo == null) { oldInfo = (NamespaceInfo) newInfo.getProperty("oldCopy"); //$NON-NLS-1$ } if (oldInfo != null) { String newPrefix = newInfo.prefix != null ? newInfo.prefix : ""; //$NON-NLS-1$ String oldPrefix = oldInfo.prefix != null ? oldInfo.prefix : ""; //$NON-NLS-1$ if (!oldPrefix.equals(newPrefix)) { map.put(oldPrefix, newPrefix); } } } return map; }
public void addNamespaceInfo(String prefix, String uri, String locationHint) { NamespaceInfo nsInfo = new NamespaceInfo(); nsInfo.prefix = prefix; nsInfo.uri = uri; nsInfo.locationHint = locationHint; internalAddNamespaceInfo(prefix != null ? prefix : "", nsInfo); //$NON-NLS-1$ }
oldInfo = (NamespaceInfo)newInfo.getProperty("oldCopy"); //$NON-NLS-1$
protected void createAnyElementNode(CMAnyElement anyElement) { String uri = anyElement.getNamespaceURI(); if ((uri != null) && !uri.startsWith("##")) //$NON-NLS-1$ { if (table.get(uri) == null) { NamespaceInfo info = new NamespaceInfo(); info.uri = uri; info.prefix = "p" + count++; //$NON-NLS-1$ table.put(uri, info); list.add(info); } } } }
uriField.setText(getDisplayValue(fInfo.uri)); uriField.addModifyListener(modifyListener); uriField.setEnabled(fInfo.getProperty("uri-readOnly") == null); //$NON-NLS-1$ prefixField.setText(getDisplayValue(fInfo.prefix)); prefixField.addModifyListener(modifyListener); prefixField.setEnabled(fInfo.getProperty("prefix-readOnly") == null); //$NON-NLS-1$ locationHintField.setText(getDisplayValue(fInfo.locationHint)); locationHintField.addModifyListener(modifyListener); locationHintField.setEnabled(fInfo.getProperty("locationHint-readOnly") == null); //$NON-NLS-1$