@Override public String segment(int i) { return uri.segment(i); }
/** * Does the passed URI have the form platform:/plugin/... ? * * @param uri * @return <code>true</code> if uri is platform plugin protocol. * * @since 1.0.0 */ public static boolean isPlatformPluginResourceURI(URI uri) { return JEMUtilPlugin.PLATFORM_PROTOCOL.equals(uri.scheme()) && JEMUtilPlugin.PLATFORM_PLUGIN.equals(uri.segment(0)); }
/** * Does the passed URI have the form platform:/resource/... ? * * @param uri * @return <code>true</code> if it is a platform resource protocol. * * @since 1.0.0 */ public static boolean isPlatformResourceURI(URI uri) { return JEMUtilPlugin.PLATFORM_PROTOCOL.equals(uri.scheme()) && JEMUtilPlugin.PLATFORM_RESOURCE.equals(uri.segment(0)); }
public static boolean isPlatformMetaResource(Resource res) { URI uri = res.getURI(); return "platform".equals(uri.scheme()) && "meta".equals(uri.segment(0)); //$NON-NLS-1$ //$NON-NLS-2$ }
protected String getModelProject() { String modelDirectory = getModelDirectory(); if (!isBlank(modelDirectory)) { return URI.createURI(modelDirectory).segment(0); } return null; }
protected String getModelProject() { String modelDirectory = getModelDirectory(); if (!isBlank(modelDirectory)) { return URI.createURI(modelDirectory).segment(0); } return null; }
/** * @since 2.9 */ protected boolean isProjectLocal(URI uri, final String encodedProjectName) { if (uri == null || uri.segmentCount() < 2 || !uri.isPlatformResource()) return false; else return !uri.segment(1).equals(encodedProjectName); }
public CharSequence wrapWithTraceData(CharSequence sequence, URI originResourceURI, int originOffset, int originLength, int originLineNumber, int originEndLineNumber) { if (!originResourceURI.isPlatformResource()) { throw new IllegalArgumentException("URI has to be a platform resource uri but was: " + originResourceURI+ ". Use #wrapWithTraceData(CharSequence, URI, String, int, int) instead."); } return wrapWithTraceData(sequence, originResourceURI, originResourceURI.segment(1), originOffset, originLength, originLineNumber, originEndLineNumber); }
public static URI computeTemplateResourceLocation(Locale locale, URI translationLocation, Locale masterLocale, ProjectVersion version) { PropertyScanner scanner = createScanner(version); URI parentPath = version.absoluteFilePath(); File path = scanner.findTemplate(new File(parentPath.path()+translationLocation.toString()), null); URI location = URI.createFileURI(path.getAbsolutePath()); URI trimmedLocation = URI.createURI(location.segment(parentPath.segmentCount())); for (int i = parentPath.segmentCount()+1; i < location.segmentCount(); i++) { //append the other segments trimmedLocation = trimmedLocation.appendSegment(location.segment(i)); } return trimmedLocation; }
public String getPackageName(URI javaURI) { if (isTypeURI(javaURI) || isPackageURI(javaURI)) { if (javaURI.segmentCount() == 1) { return javaURI.segment(0); } else if (javaURI.segmentCount() == 0) return ""; //$NON-NLS-1$ else throw new IllegalArgumentException(javaURI.toString()); } else throw new IllegalArgumentException(javaURI.toString()); }
protected boolean isGlobalPluginLoad(URI aURI) { if (WorkbenchResourceHelperBase.isPlatformPluginResourceURI(aURI)) { String[] globalPlugins = JEMUtilPlugin.getGlobalLoadingPluginNames(); for (int i=0;i<globalPlugins.length;i++) { if (aURI.segment(1).startsWith(globalPlugins[i])) return true; } } return false; } }
protected static String getContentTypeName(URI uri) { if (WorkbenchResourceHelperBase.isPlatformResourceURI(uri) || !isValidFullyQualifiedModuleURI(uri)) return null; String contentTypeIdentifier = (uri.segmentCount() > 3 ? uri.segment(ModuleURI.CONTENT_TYPE_INDX) : null); if (contentTypeIdentifier != null && Platform.getContentTypeManager().getContentType(uri.segment(ModuleURI.CONTENT_TYPE_INDX)) != null) return contentTypeIdentifier; else return null; } public static boolean isValidFullyQualifiedModuleURI(URI aModuleURI) {