Java Code Examples for org.eclipse.xtext.util.Strings#skipLastToken()

The following examples show how to use org.eclipse.xtext.util.Strings#skipLastToken() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EMFGeneratorFragment.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public String[] getExportedPackagesRt(Grammar grammar) {
	List<GeneratedMetamodel> typeSelect = org.eclipse.xtext.EcoreUtil2.typeSelect(
			grammar.getMetamodelDeclarations(), GeneratedMetamodel.class);
	Set<String> exportedPackages = new LinkedHashSet<String>();
	if (modelPluginID == null) {
		for (GeneratedMetamodel generatedMetamodel : typeSelect) {
			final String modelPackage = Strings.skipLastToken(
					getGeneratedEPackageName(grammar, generatedMetamodel.getEPackage()), ".");
			exportedPackages.add(modelPackage);
			exportedPackages.add(modelPackage + ".impl");
			exportedPackages.add(modelPackage + ".util");
		}
	}
	return exportedPackages.toArray(new String[exportedPackages.size()]);
}
 
Example 2
Source File: GeneratorFragment.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public String[] getExportedPackagesRt(Grammar grammar) {
	if (isGenerateStub(grammar) || isGenerateJavaMain(grammar))
		return new String[] { Strings.skipLastToken(getGeneratorName(grammar, getNaming()), ".") };
	else 
		return new String[0];
}
 
Example 3
Source File: XbaseGeneratorFragment.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public String[] getExportedPackagesRt(Grammar grammar) {
	if(usesXbaseGrammar(grammar) && (generateXtendInferrer || useInferredJvmModel) && !skipExportedPackage) {
		return new String[] { Strings.skipLastToken(getJvmModelInferrerName(grammar, getNaming()), ".") };
	}
	return null;
}
 
Example 4
Source File: FormatterFragment.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public String[] getExportedPackagesRt(Grammar grammar) {
	if(isGenerateStub())
		return new String[] { Strings.skipLastToken(getFormatterName(grammar, getNaming()), ".") };
	else
		return null;
}
 
Example 5
Source File: Naming.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
public String packageName(String className) {
	return Strings.skipLastToken(className, ".");
}
 
Example 6
Source File: Naming.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @since 2.0
 */
public String toPackageName(String name) {
	return Strings.skipLastToken(name, ".");
}
 
Example 7
Source File: AbstractScopingFragment.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public String[] getExportedPackagesRt(Grammar grammar) {
	if (!isGenerateStub(grammar))
		return new String[0];
	return new String[] { Strings.skipLastToken(getScopeProviderName(grammar, getNaming()),".") };
}
 
Example 8
Source File: ClassFileDebugInfoExtractor.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void visit(int arg0, int arg1, String arg2, String arg3, String arg4, String[] arg5) {
	name = Strings.lastToken(arg2, "/");
	pkg = Strings.skipLastToken(arg2, "/");
}