use of org.eclipse.wst.dtd.core.internal.emf.DTDFile in project webtools.sourceediting by eclipse.
the class DTDExternalEntityImpl method setEntityReferencedFromAnotherFile.
/**
* @generated This field/method will be replaced during code generation.
*/
public void setEntityReferencedFromAnotherFile(DTDFile newEntityReferencedFromAnotherFile) {
DTDFile oldEntityReferencedFromAnotherFile = entityReferencedFromAnotherFile;
entityReferencedFromAnotherFile = newEntityReferencedFromAnotherFile;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DTDPackage.DTD_EXTERNAL_ENTITY__ENTITY_REFERENCED_FROM_ANOTHER_FILE, oldEntityReferencedFromAnotherFile, entityReferencedFromAnotherFile));
}
use of org.eclipse.wst.dtd.core.internal.emf.DTDFile in project webtools.sourceediting by eclipse.
the class DTDResourceImpl method save.
public void save(OutputStream os, Object options) throws Exception {
if (contents != null) {
Iterator i = contents.iterator();
while (i.hasNext()) {
Object obj = i.next();
if (obj instanceof DTDFile) {
try {
DTDPrinter printer = new DTDPrinter(true);
printer.visitDTDFile((DTDFile) obj);
String s = printer.getBuffer().toString();
os.write(s.getBytes());
// Reset the dirty flag after the resource is saved
setModified(false);
} catch (Exception e) {
}
break;
}
}
}
}
use of org.eclipse.wst.dtd.core.internal.emf.DTDFile in project webtools.sourceediting by eclipse.
the class DTDModelBuilder method updateSystemID.
/**
* The SystemID attribute is set to whatever the user enters e.g.
* com/ibm/b2b/xmimodels/xxx.dtd.xmi
*
* In the unparse() method, parse out the DTD file name from the classpath
* name. e.g. returns xxx.dtd
*/
private void updateSystemID(DTDExternalEntity extEntity, EntityDecl entityDecl) {
String systemId = entityDecl.getSystemId();
String publicId = entityDecl.getPublicId();
if (systemId != null) {
URIResolver idResolver = URIResolverPlugin.createResolver();
String uri = idResolver.resolve(dtd.getName(), publicId, systemId);
ExternalDTDModel ed = dtdUtil.getExternalDTDModel(resources, uri);
if (ed != null) {
DTDFile referenceDtdFile = ed.getExternalDTDFile();
extEntity.setEntityReferencedFromAnotherFile(referenceDtdFile);
extEntity.setSystemID(systemId);
} else {
if (entityDecl.getErrorMessage() == null) {
ErrorMessage dtdError = new ErrorMessage();
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
dtdError.setErrorMessage(DTDCoreMessages._ERROR_INCL_FILE_LOAD_FAILURE + " '" + systemId + "'");
addErrorMessage(dtdError, extEntity.getDTDEntity());
}
if (systemId != null) {
extEntity.setSystemID(systemId);
} else {
// $NON-NLS-1$
extEntity.setSystemID("");
}
}
} else // end of if ()
{
// set the system id to be ""
// $NON-NLS-1$
extEntity.setSystemID("");
}
}
use of org.eclipse.wst.dtd.core.internal.emf.DTDFile in project webtools.sourceediting by eclipse.
the class DTDElementImpl method getReferences.
// returns all references in the same DTDFile that reference this element
public Collection getReferences() {
DTDFile file = getDTDFile();
final Collection result = new ArrayList();
DTDVisitor visitRefs = new DTDVisitor() {
public void visitDTDElementReferenceContent(DTDElementReferenceContent elementReferenceContent) {
if (elementReferenceContent.getReferencedElement() == DTDElementImpl.this) {
result.add(elementReferenceContent);
}
// end of if ()
}
};
visitRefs.visitDTDFile(file);
return result;
}
use of org.eclipse.wst.dtd.core.internal.emf.DTDFile in project webtools.sourceediting by eclipse.
the class DTDImpl method buildCMDocument.
public static CMDocument buildCMDocument(String uri) {
DTDFile dtdFile = buildDTDModel(uri);
CMDocument cmDocument = (CMDocument) getAdapter(dtdFile);
return cmDocument;
}
Aggregations