Java Code Examples for org.eclipse.xtext.naming.QualifiedName.toString()

The following are Jave code examples for showing how to use toString() of the org.eclipse.xtext.naming.QualifiedName class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: n4js   File: N4JSModel.java   Source Code and License Vote up 6 votes
/**
 * @see IN4JSSourceContainer#findArtifact(QualifiedName, Optional)
 */
public URI findArtifact(IN4JSSourceContainer sourceContainer, QualifiedName name, Optional<String> fileExtension) {
	final String ext = fileExtension.or("").trim();
	final String extWithDot = !ext.isEmpty() && !ext.startsWith(".") ? "." + ext : ext;
	final String pathStr = name.toString("/") + extWithDot; // no need for IQualifiedNameConverter here!
	if (sourceContainer.isLibrary()) {
		return null; // TODO support for finding artifacts in libraries
	} else {
		URI artifactLocation = workspace.findArtifactInFolder(sourceContainer.getLocation(), pathStr);
		if (null == artifactLocation) {
			artifactLocation = externalLibraryWorkspace.findArtifactInFolder(sourceContainer.getLocation(),
					pathStr);
		}
		return artifactLocation;
	}
}
 
Example 2
Project: gemoc-studio-modeldebugging   File: LaunchConfigurationMainTab.java   Source Code and License Vote up 6 votes
/**
 * Update _entryPointModelElement with pretty name
 */
private void updateMainElementName(){
	try {
		Resource model = getModel();
		EObject mainElement = null;
		if(model != null){
			mainElement = model.getEObject(_entryPointModelElementText.getText());
		}
		if(mainElement != null){
			org.eclipse.xtext.naming.DefaultDeclarativeQualifiedNameProvider nameprovider = new DefaultDeclarativeQualifiedNameProvider();
			QualifiedName qname = nameprovider.getFullyQualifiedName(mainElement);
			String objectName = qname != null ? qname.toString(): mainElement.toString();
			String prettyName =	objectName+ " : "+mainElement.eClass().getName();
			_entryPointModelElementLabel.setText(prettyName);
		}
	} catch (Exception e) {	}
}
 
Example 3
Project: n4js   File: PolyFilledProvision.java   Source Code and License Vote up 5 votes
/**
 * @param qualifiedName
 *            with {@code #POLY}-marker to be converted to a String without the polyfill-marker.
 * @return string representation without polyfill marker
 */
public static String withoutPolyfillAsString(QualifiedName qualifiedName) {
	// Assumption: 2nd-last segment is "!POLY"
	String last = qualifiedName.getLastSegment();
	String poly = qualifiedName.skipLast(1).getLastSegment();
	assert(N4TSQualifiedNameProvider.POLYFILL_SEGMENT.equals(poly));
	QualifiedName ret = qualifiedName.skipLast(2).append(last);
	return ret.toString();
}