# HG changeset patch # User Eugene Ostroukhov # Date 1276121769 25200 # Node ID f0817aeb2d7eb9ed552d872960bfa9a4e63dd503 # Parent 715f288b552a54ff3644216dd76aac8b8799ba19 Minor coding problem was fixed diff -r 715f288b552a -r f0817aeb2d7e org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/jsdt/PhoneGapInferrenceProvider.java --- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/jsdt/PhoneGapInferrenceProvider.java Wed Jun 09 14:44:32 2010 -0700 +++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/libraries/jsdt/PhoneGapInferrenceProvider.java Wed Jun 09 15:16:09 2010 -0700 @@ -37,58 +37,55 @@ import org.symbian.tools.wrttools.Activator; public class PhoneGapInferrenceProvider implements InferrenceProvider { - public static final String ID = "org.symbian.tools.wrttools.phonegap"; - private static final Collection PHONEGAP_TYPES = new TreeSet( - Arrays.asList("Acceleration", "AccelerationOptions", - "Accelerometer", "Camera", "DeviceError", "Contacts", - "Contact", "Geolocation", "PositionOptions", "Coordinates", - "Media", "Notification", "Orientation", "Position", - "PositionError", "Sms", "Storage")); - - public int applysTo(IInferenceFile scriptFile) { - String path = String.valueOf(scriptFile.getFileName()); + public static final String ID = "org.symbian.tools.wrttools.phonegap"; + private static final Collection PHONEGAP_TYPES = new TreeSet(Arrays.asList("Acceleration", + "AccelerationOptions", "Accelerometer", "Camera", "DeviceError", "Contacts", "Contact", "Geolocation", + "PositionOptions", "Coordinates", "Media", "Notification", "Orientation", "Position", "PositionError", + "Sms", "Storage")); - IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile( - new Path(path)); - if (file != null && file.isAccessible()) { - IJavaScriptUnit unit = (IJavaScriptUnit) JavaScriptCore - .create(file); - try { - IType[] types = unit.getAllTypes(); - int typeCount = 0; - for (IType type : types) { - if (PHONEGAP_TYPES.contains(type.getElementName())) { - typeCount += 1; - } - } - if (typeCount > 1) { - return ONLY_THIS; - } - } catch (JavaScriptModelException e) { - Activator.log(e); - } - } - return NOT_THIS; - } + public int applysTo(IInferenceFile scriptFile) { + Path path = new Path(String.valueOf(scriptFile.getFileName())); + if (path.segmentCount() > 1) { + IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); + if (file != null && file.isAccessible()) { + IJavaScriptUnit unit = (IJavaScriptUnit) JavaScriptCore.create(file); + try { + IType[] types = unit.getAllTypes(); + int typeCount = 0; + for (IType type : types) { + if (PHONEGAP_TYPES.contains(type.getElementName())) { + typeCount += 1; + } + } + if (typeCount > 1) { + return ONLY_THIS; + } + } catch (JavaScriptModelException e) { + Activator.log(e); + } + } + } + return NOT_THIS; + } - public String getID() { - return ID; - } + public String getID() { + return ID; + } - public InferEngine getInferEngine() { - final InferEngine engine = new PhoneGapInferEngine(); - engine.inferenceProvider = this; - return engine; - } + public InferEngine getInferEngine() { + final InferEngine engine = new PhoneGapInferEngine(); + engine.inferenceProvider = this; + return engine; + } - public RefactoringSupport getRefactoringSupport() { - // TODO Auto-generated method stub - return null; - } + public RefactoringSupport getRefactoringSupport() { + // TODO Auto-generated method stub + return null; + } - public ResolutionConfiguration getResolutionConfiguration() { - final ResolutionConfiguration configuration = new ResolutionConfiguration(); - return configuration; - } + public ResolutionConfiguration getResolutionConfiguration() { + final ResolutionConfiguration configuration = new ResolutionConfiguration(); + return configuration; + } }