/** * Reads the properties from the given storage and * returns it. * * @param javaProject the Java project * @param accessorClassReference the accessor class reference * @return the properties or <code>null</code> if it was not successfully read */ public static Properties getProperties(IJavaProject javaProject, AccessorClassReference accessorClassReference) { try { IStorage storage= NLSHintHelper.getResourceBundle(javaProject, accessorClassReference); return getProperties(storage); } catch (JavaModelException ex) { // sorry no properties return null; } }
public static IStorage getResourceBundle(ICompilationUnit compilationUnit) throws JavaModelException { IJavaProject project= compilationUnit.getJavaProject(); if (project == null) return null; String name= getResourceBundleName(compilationUnit); if (name == null) return null; String packName= Signature.getQualifier(name); String resourceName= Signature.getSimpleName(name) + NLSRefactoring.PROPERTY_FILE_EXT; return getResourceBundle(project, packName, resourceName); }
/** * Reads the properties from the given storage and * returns it. * * @param javaProject the Java project * @param accessorClassReference the accessor class reference * @return the properties or <code>null</code> if it was not successfully read */ public static Properties getProperties(IJavaProject javaProject, AccessorClassReference accessorClassReference) { try { IStorage storage= NLSHintHelper.getResourceBundle(javaProject, accessorClassReference); return getProperties(storage); } catch (JavaModelException ex) { // sorry no properties return null; } }
public static IStorage getResourceBundle(ICompilationUnit compilationUnit) throws JavaModelException { IJavaProject project= compilationUnit.getJavaProject(); if (project == null) return null; String name= getResourceBundleName(compilationUnit); if (name == null) return null; String packName= Signature.getQualifier(name); String resourceName= Signature.getSimpleName(name) + NLSRefactoring.PROPERTY_FILE_EXT; return getResourceBundle(project, packName, resourceName); }
/** * Reads the properties from the given storage and * returns it. * * @param javaProject the Java project * @param accessorClassReference the accessor class reference * @return the properties or <code>null</code> if it was not successfully read */ public static Properties getProperties(IJavaProject javaProject, AccessorClassReference accessorClassReference) { try { IStorage storage= NLSHintHelper.getResourceBundle(javaProject, accessorClassReference); return getProperties(storage); } catch (JavaModelException ex) { // sorry no properties return null; } }
public static IStorage getResourceBundle(ICompilationUnit compilationUnit) throws JavaModelException { IJavaProject project= compilationUnit.getJavaProject(); if (project == null) return null; String name= getResourceBundleName(compilationUnit); if (name == null) return null; String packName= Signature.getQualifier(name); String resourceName= Signature.getSimpleName(name) + NLSRefactoring.PROPERTY_FILE_EXT; return getResourceBundle(project, packName, resourceName); }
public static IStorage getResourceBundle(IJavaProject javaProject, String packageName, String resourceName) throws JavaModelException { IPackageFragmentRoot[] allRoots= javaProject.getAllPackageFragmentRoots(); for (int i= 0; i < allRoots.length; i++) { IPackageFragmentRoot root= allRoots[i]; if (root.getKind() == IPackageFragmentRoot.K_SOURCE) { IStorage storage= getResourceBundle(root, packageName, resourceName); if (storage != null) return storage; } } return null; }
public static IStorage getResourceBundle(IJavaProject javaProject, String packageName, String resourceName) throws JavaModelException { IPackageFragmentRoot[] allRoots= javaProject.getAllPackageFragmentRoots(); for (int i= 0; i < allRoots.length; i++) { IPackageFragmentRoot root= allRoots[i]; if (root.getKind() == IPackageFragmentRoot.K_SOURCE) { IStorage storage= getResourceBundle(root, packageName, resourceName); if (storage != null) return storage; } } return null; }
public static IStorage getResourceBundle(IJavaProject javaProject, String packageName, String resourceName) throws JavaModelException { IPackageFragmentRoot[] allRoots= javaProject.getAllPackageFragmentRoots(); for (int i= 0; i < allRoots.length; i++) { IPackageFragmentRoot root= allRoots[i]; if (root.getKind() == IPackageFragmentRoot.K_SOURCE) { IStorage storage= getResourceBundle(root, packageName, resourceName); if (storage != null) return storage; } } return null; }
public static IStorage getResourceBundle(ICompilationUnit compilationUnit) throws JavaModelException { if (compilationUnit == null) return null; if (!ActionUtil.isOnBuildPath(compilationUnit)) return null; IType[] types= compilationUnit.getTypes(); if (types.length != 1) return null; if (!isPotentialNLSAccessor(compilationUnit)) return null; return NLSHintHelper.getResourceBundle(compilationUnit); }
public static IStorage getResourceBundle(ICompilationUnit compilationUnit) throws JavaModelException { if (compilationUnit == null) return null; if (!ActionUtil.isOnBuildPath(compilationUnit)) return null; IType[] types= compilationUnit.getTypes(); if (types.length != 1) return null; if (!isPotentialNLSAccessor(compilationUnit)) return null; return NLSHintHelper.getResourceBundle(compilationUnit); }
private SearchPatternData tryIfPropertyCuSelected(ICompilationUnit compilationUnit) throws JavaModelException { if (compilationUnit == null) return null; if (!ActionUtil.isOnBuildPath(compilationUnit)) return null; IType[] types= compilationUnit.getTypes(); if (types.length > 1) return null; IStorage bundle= NLSHintHelper.getResourceBundle(compilationUnit); if (!(bundle instanceof IFile)) return null; return new SearchPatternData(types[0], (IFile)bundle); }
public static IStorage getResourceBundle(IJavaProject javaProject, AccessorClassReference accessorClassReference) throws JavaModelException { String resourceBundle= accessorClassReference.getResourceBundleName(); if (resourceBundle == null) return null; String resourceName= Signature.getSimpleName(resourceBundle) + NLSRefactoring.PROPERTY_FILE_EXT; String packName= Signature.getQualifier(resourceBundle); ITypeBinding accessorClass= accessorClassReference.getBinding(); if (accessorClass.isFromSource()) return getResourceBundle(javaProject, packName, resourceName); else if (accessorClass.getJavaElement() != null) return getResourceBundle((IPackageFragmentRoot)accessorClass.getJavaElement().getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT), packName, resourceName); return null; }
public static IStorage getResourceBundle(IJavaProject javaProject, AccessorClassReference accessorClassReference) throws JavaModelException { String resourceBundle= accessorClassReference.getResourceBundleName(); if (resourceBundle == null) return null; String resourceName= Signature.getSimpleName(resourceBundle) + NLSRefactoring.PROPERTY_FILE_EXT; String packName= Signature.getQualifier(resourceBundle); ITypeBinding accessorClass= accessorClassReference.getBinding(); if (accessorClass.isFromSource()) return getResourceBundle(javaProject, packName, resourceName); else if (accessorClass.getJavaElement() != null) return getResourceBundle((IPackageFragmentRoot)accessorClass.getJavaElement().getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT), packName, resourceName); return null; }
@Override public void open() { IStorage propertiesFile= null; try { ITypeBinding typeBinding= fAccessorClassReference.getBinding(); propertiesFile= NLSHintHelper.getResourceBundle(typeBinding.getJavaElement().getJavaProject(), fAccessorClassReference); } catch (JavaModelException e) { // Don't open the file } openKeyInPropertiesFile(fKeyName, propertiesFile, fEditor); }
public static IStorage getResourceBundle(IJavaProject javaProject, AccessorClassReference accessorClassReference) throws JavaModelException { String resourceBundle= accessorClassReference.getResourceBundleName(); if (resourceBundle == null) return null; String resourceName= Signature.getSimpleName(resourceBundle) + NLSRefactoring.PROPERTY_FILE_EXT; String packName= Signature.getQualifier(resourceBundle); ITypeBinding accessorClass= accessorClassReference.getBinding(); if (accessorClass.isFromSource()) return getResourceBundle(javaProject, packName, resourceName); else if (accessorClass.getJavaElement() != null) return getResourceBundle((IPackageFragmentRoot)accessorClass.getJavaElement().getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT), packName, resourceName); return null; }
@Override public void open() { IStorage propertiesFile= null; try { ITypeBinding typeBinding= fAccessorClassReference.getBinding(); propertiesFile= NLSHintHelper.getResourceBundle(typeBinding.getJavaElement().getJavaProject(), fAccessorClassReference); } catch (JavaModelException e) { // Don't open the file } openKeyInPropertiesFile(fKeyName, propertiesFile, fEditor); }
propertiesFile= NLSHintHelper.getResourceBundle(je.getJavaProject(), ref); if (propertiesFile == null) return toHtml(JavaHoverMessages.NLSStringHover_NLSStringHover_PropertiesFileNotDetectedWarning, ""); //$NON-NLS-1$
return null; IStorage resourceBundle= NLSHintHelper.getResourceBundle(unit); if (!(resourceBundle instanceof IFile)) return null;
return null; IStorage resourceBundle= NLSHintHelper.getResourceBundle(unit); if (!(resourceBundle instanceof IFile)) return null;