@Override public String lastSegment() { return uri.lastSegment(); }
@Override public String lastSegment() { return internalUri.lastSegment(); }
@Override public @Nullable String lastSegment() { return this.uri.lastSegment(); }
/** * @since 2.1 */ protected Object getImageForURI(URI uri) { String fileName = uri.lastSegment(); return imageUtil.getDefaultEditorImageDescriptor(fileName); }
/** * Retrieves the classpath component display string for the specified component. * @param component Component that represents a classpath component. * @return Display string. */ public static String getClasspathComponentDependencyDisplayString(final IVirtualComponent component) { final URI archiveURI = URI.createURI(ModuleURIUtil.getHandleString(component)); return archiveURI.lastSegment(); }
protected boolean isInfoFile(final Resource resource) { boolean _xblockexpression = false; { final String name = resource.getURI().trimFileExtension().lastSegment(); _xblockexpression = (Objects.equal(name, "package-info") || Objects.equal(name, "module-info")); } return _xblockexpression; }
@Override protected void doLoad(final InputStream inputStream, final Map<?, ?> options) throws IOException { final String encoding = this.getEncoding(this.getURI(), options); InputStreamReader _inputStreamReader = new InputStreamReader(inputStream, encoding); final String contentsAsString = CharStreams.toString(_inputStreamReader); this.contentsAsString = contentsAsString; char[] _charArray = contentsAsString.toCharArray(); String _lastSegment = this.getURI().lastSegment(); CompilationUnit _compilationUnit = new CompilationUnit(_charArray, _lastSegment, encoding, null); this.compilationUnit = _compilationUnit; }
@Override public boolean apply(Resource input) { if (input != null && input.getURI().lastSegment().contains(".") && input.isLoaded()) { return modelType.equalsIgnoreCase(input.getURI().fileExtension()); } else { return false; } } });
@Override public Workspace apply(Workspace object) { Project child = PropertiesFactory.eINSTANCE.createProject(); child.setName(uri.lastSegment()); object.getChildren().add(child); return object; } });
protected String getName() { StringBuilder buffer = new StringBuilder(getURI().lastSegment()); buffer.append(" - "); buffer.append(getURI().segment(1)); for (int i = 2; i < getURI().segmentCount() - 1; ++i) { buffer.append("/"); buffer.append(getURI().segment(i)); } return buffer.toString(); }
@Override public ProjectVersion apply(ProjectVersion object) { ProjectLocale locale = PropertiesFactory.eINSTANCE.createProjectLocale(); locale.setName(uri.lastSegment()); locale.setLocale((Locale) PropertiesFactory.eINSTANCE.createFromString(PropertiesPackage.Literals.LOCALE, uri.lastSegment())); PropertyResourceUtil.addNewLocale(locale, object); return object; } });
/** * @since 1.7 */ public static String getModelFileName(EObject object) { Resource eResource = object.eResource(); if (eResource != null) { return eResource.getURI().trimFileExtension().lastSegment(); } else { return ""; } }
protected String getDefaultArtifactFileName(EPackage ePackage) { if (ePackage.eResource() != null && ePackage.getESuperPackage() == null) { String fileName = ePackage.eResource().getURI().lastSegment(); int lastIndex = fileName.lastIndexOf('.'); if (lastIndex > 0) { return fileName.substring(0, lastIndex); } } return ConverterUtil.getQualifiedName(ePackage); }
@Override public URI normalize(URI uri) { if (URIHelperConstants.PROTOCOL.equals(uri.scheme())) { String qualifiedName = uri.lastSegment(); if (qualifiedName.lastIndexOf('$') != -1) { String outermostClassName = new BinaryClass(qualifiedName, classLoader).getOutermostClassName(); return URIHelperConstants.OBJECTS_URI.appendSegment(outermostClassName); } return uri; } return existing.normalize(uri); }
@Override public Project apply(Project object) { ProjectVersion child = PropertiesFactory.eINSTANCE.createProjectVersion(); ProjectLocale locale = PropertiesFactory.eINSTANCE.createProjectLocale(); child.getChildren().add(locale); child.setTemplate(locale); child.setName(uri.lastSegment()); object.getChildren().add(child); return object; } });
private void modify(ProgressMonitor progressMonitor, Resource modelResource) { ArrayList<Resource> resources = Lists.newArrayList(modelResource.getResourceSet().getResources()); for (Resource resource : resources) { if (shouldBeModified(resource)) { progressMonitor.subTask(" - pre-process model " + resource.getURI().lastSegment()); logger.info("Pre-process model '" + resource.getURI().lastSegment() + "'"); getConfiguration().getModelModifier().modifyModel((Model) resource.getEObject("/")); EObjectPropertiesAdapter.setProperty(resource, GeneratorConstants.MODIFIED_MODEL, Boolean.TRUE); } } }
protected boolean validate(final Resource resource) { String _lastSegment = resource.getURI().lastSegment(); String _plus = ("Starting validation for input: \'" + _lastSegment); String _plus_1 = (_plus + "\'"); StandaloneBuilder.LOG.info(_plus_1); final IResourceValidator resourceValidator = this.languageAccess(resource.getURI()).getResourceValidator(); final List<Issue> validationResult = resourceValidator.validate(resource, CheckMode.ALL, null); return this.issueHandler.handleIssue(validationResult); }
protected PropertyFileDescriptor createDescriptor(ProjectLocale projectLocale, URI childURI) { PropertyFileDescriptor fileDescriptor = PropertiesFactory.eINSTANCE.createPropertyFileDescriptor(); fileDescriptor.setLocation(childURI); fileDescriptor.setName(childURI.lastSegment()); fileDescriptor.setVariant(projectLocale.getLocale()); projectLocale.getDescriptors().add(fileDescriptor); Resolvable<?, Resolvable<?, ?>> parent = getOrCreateParent(projectLocale, childURI); parent.getChildren().add(fileDescriptor); return fileDescriptor; }
public Data exec(XtextResource state) throws Exception { IResourceServiceProvider provider = state.getResourceServiceProvider(); IStratumBreakpointSupport breakpointSupport = provider.get(IStratumBreakpointSupport.class); Data result = new Data(); result.name = state.getURI().lastSegment(); result.valid = breakpointSupport != null && breakpointSupport.isValidLineForBreakPoint(state, line); result.types = getClassNamePattern(state); result.lang = provider.get(LanguageInfo.class); return result; } });
protected IEditorPart openDefaultEditor(IStorage storage, URI uri) throws PartInitException { XtextReadonlyEditorInput editorInput = new XtextReadonlyEditorInput(storage); IWorkbenchPage page = getWorkbench().getActiveWorkbenchWindow().getActivePage(); return IDE.openEditor(page, editorInput, PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor( uri.lastSegment()).getId()); }