/** * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc * --> */ public String getText(Object object) { String label = CommonEditResourceHandler.getString("_UI_QName_type"); //$NON-NLS-1$ if (((QName) object).getNamespaceURI() != null && (((QName) object).getLocalPart() != null)) { label = CommonEditResourceHandler.getString("_UI_QName_type") + " " + //$NON-NLS-1$ //$NON-NLS-2$ ((QName) object).getNamespaceURI() + "#" + ((QName) object).getLocalPart(); //$NON-NLS-1$ } return label; }
/** * Performs the command activity required for the effect. The effect of calling * <code>execute</code> when <code>canExecute</code> returns <code>false</code>, or when * <code>canExecute</code> hasn't been called, is undefined. */ public void execute() { oldIsSet_ = eObject_.eIsSet(feature_); oldValue_ = eObject_.getNamespaceURI(); QNameHelper.setQNameNamespaceURI(eObject_, newValue_); if (nillable_ && newValue_ == null) eObject_.eUnset(feature_); }
/** * Performs the command activity required to <code>undo</code> the effects of a preceding * <code>execute</code> (or <code>redo</code>). The effect, if any, of calling * <code>undo</code> before <code>execute</code> or <code>redo</code> have been called, or * when canUndo returns <code>false</code>, is undefined. */ public void undo() { if (oldIsSet_) eObject_.eSet(feature_, oldValue_); else eObject_.eUnset(feature_); }
qnameEObject.setNamespaceURI(namespaceURI); qnameEObject.setLocalPart(localPart); prefix = qnameEObject.getInternalPrefixOrNsURI(); if (prefix==null || prefix.length()==0) qnameEObject.setValues(prefix, namespaceURI, localPart);
public static void setQNameNamespaceURI(QName qnameEObject, String namespaceURI) { String localpart = qnameEObject.getLocalPart(); setQNameValue(qnameEObject, namespaceURI, localpart); }
protected void setFeaturesOnChild(EObject child) { if (child instanceof QName) //This will always be true. { QName qname = (QName) child; String namespaceURIValue = featuresTexts_[0].getText(); String localPartValue = featuresTexts_[1].getText(); if (namespaceURIValue == null || namespaceURIValue.length() == 0) { //Just set the local part if (localPartValue != null && localPartValue.length() > 0) qname.setLocalPart(localPartValue); } else { if (localPartValue == null) localPartValue = ""; //$NON-NLS-1$ //Set namespace and local part using QNameHelper QNameHelper.setQNameValue(qname, namespaceURIValue, localPartValue); } } }
/** * Sets the namespaceURI, localpart, and prefix on the supplied QName to the supplied values respectively. * @param qnameEObject The properties on this QName will be set. If the QName does not belong to a Resource, * the version is assumed to be J2EE 1.4. * @param namespaceURI The namespaceURI * @param localPart The localPart * @param prefix The prefix. Used in JSR-109 v1.1 only. This is the prefix that will be used for the namespace declaration If the supplied prefix is null or of length 0, the existing prefix is used. If no prefix exists, and this * is a JSR-109 v1.1 descriptor the default prefix defined in DEFAULT_PREFIX is used. * @return boolean Returns true if values were set successfully. False otherwise. */ public static void setQNameValue(QName qnameEObject, String namespaceURI, String localPart, String prefix) { int versionID; //Get the versionID from the QName's Resource if available J2EEVersionResource res = (J2EEVersionResource)qnameEObject.eResource(); if (res == null) { //use a J2EE 1.4 version ID as the default versionID = J2EEVersionConstants.J2EE_1_4_ID; } else { versionID = res.getJ2EEVersionID(); } setQNameValue(qnameEObject, namespaceURI, localPart, prefix, versionID); }
/** * Returns the local part of the <service-qname>specified in the given <service-ref>. Returns a * blank String if <service-qname>is not specified in the provided <service-ref> */ private String getServiceQname(ServiceRef sr) { QName serviceQname = sr.getServiceQname(); if (serviceQname == null) return ""; //$NON-NLS-1$ String serviceLocalName = serviceQname.getLocalPart(); if (serviceLocalName == null) return ""; //$NON-NLS-1$ return serviceLocalName; }
/** * This does the same thing as ITableLabelProvider.getColumnText. */ public String getColumnText(Object object, int columnIndex) { QName qname = (QName) object; switch (columnIndex) { case 0 : return toDisplayString(qname.getNamespaceURI()); case 1 : return toDisplayString(qname.getLocalPart()); default : StringBuffer sb = new StringBuffer(); sb.append(qname.getNamespaceURI()); sb.append("#"); //$NON-NLS-1$ sb.append(qname.getLocalPart()); return sb.toString(); } }