@Override public boolean equals(Object object) { return object instanceof DirectorySourceLocation && getDirectory().equals(((DirectorySourceLocation)object).getDirectory()); }
/** * Constructs a new source location that will retrieve source * elements from the given directory. * * @param directory a directory */ public DirectorySourceLocation(File directory) { setDirectory(directory); }
if (isEmpty(path)) { abort(LaunchingMessages.DirectorySourceLocation_Unable_to_initialize_source_location___missing_directory_path_3, null); } else { File dir = new File(path); if (dir.exists() && dir.isDirectory()) { setDirectory(dir); } else { abort(NLS.bind(LaunchingMessages.DirectorySourceLocation_Unable_to_initialize_source_location___directory_does_not_exist___0__4, new String[] {path}), null); ex = e; abort(LaunchingMessages.DirectorySourceLocation_Exception_occurred_initializing_source_location__5, ex);
if (file.exists()) { if (file.isDirectory()) { location = new DirectorySourceLocation(file); } else { location = new ArchiveSourceLocation(path, entry.getSourceAttachmentRootLocation());
if (isEmpty(path)) { abort(LaunchingMessages.DirectorySourceLocation_Unable_to_initialize_source_location___missing_directory_path_3, null); } else { File dir = new File(path); if (dir.exists() && dir.isDirectory()) { setDirectory(dir); } else { abort(NLS.bind(LaunchingMessages.DirectorySourceLocation_Unable_to_initialize_source_location___directory_does_not_exist___0__4, new String[] {path}), null); ex = e; abort(LaunchingMessages.DirectorySourceLocation_Exception_occurred_initializing_source_location__5, ex);
if (file.exists()) { if (file.isDirectory()) { location = new DirectorySourceLocation(file); } else { location = new ArchiveSourceLocation(path, entry.getSourceAttachmentRootLocation());
@Override public boolean equals(Object object) { return object instanceof DirectorySourceLocation && getDirectory().equals(((DirectorySourceLocation)object).getDirectory()); }
/** * Constructs a new source location that will retrieve source * elements from the given directory. * * @param directory a directory */ public DirectorySourceLocation(File directory) { setDirectory(directory); }
@Override public int hashCode() { return getDirectory().hashCode(); }
@Override public int hashCode() { return getDirectory().hashCode(); }
@Override public String getMemento() throws CoreException { Document doc = DebugPlugin.newDocument(); Element node = doc.createElement("directorySourceLocation"); //$NON-NLS-1$ doc.appendChild(node); node.setAttribute("path", getDirectory().getAbsolutePath()); //$NON-NLS-1$ return DebugPlugin.serializeDocument(doc); }
@Override public String getMemento() throws CoreException { Document doc = DebugPlugin.newDocument(); Element node = doc.createElement("directorySourceLocation"); //$NON-NLS-1$ doc.appendChild(node); node.setAttribute("path", getDirectory().getAbsolutePath()); //$NON-NLS-1$ return DebugPlugin.serializeDocument(doc); }
@Override public Object findSourceElement(String name) throws CoreException { if (getDirectory() == null) { return null; int lastSlash = pathStr.lastIndexOf('/'); try { IPath root = new Path(getDirectory().getCanonicalPath()); boolean possibleInnerType = false; String typeName = pathStr;
@Override public Object findSourceElement(String name) throws CoreException { if (getDirectory() == null) { return null; } String pathStr= name.replace('.', '/'); int lastSlash = pathStr.lastIndexOf('/'); try { IPath root = new Path(getDirectory().getCanonicalPath()); boolean possibleInnerType = false; String typeName = pathStr; do { IPath filePath = root.append(new Path(typeName + ".java")); //$NON-NLS-1$ File file = filePath.toFile(); if (file.exists()) { return new LocalFileStorage(file); } int index = typeName.lastIndexOf('$'); if (index > lastSlash) { typeName = typeName.substring(0, index); possibleInnerType = true; } else { possibleInnerType = false; } } while (possibleInnerType); } catch (IOException e) { throw new CoreException(new Status(IStatus.ERROR, LaunchingPlugin.getUniqueIdentifier(), e.getMessage(), e)); } return null; }
/** * @see IWorkbenchAdapter#getLabel(Object) */ public String getLabel(Object o) { if (o instanceof JavaProjectSourceLocation) { return fJavaElementLabelProvider.getText(((JavaProjectSourceLocation)o).getJavaProject()); } else if (o instanceof DirectorySourceLocation) { try { return ((DirectorySourceLocation)o).getDirectory().getCanonicalPath(); } catch (IOException e) { JDIDebugUIPlugin.log(e); return ((DirectorySourceLocation)o).getDirectory().getName(); } } else if (o instanceof ArchiveSourceLocation) { return ((ArchiveSourceLocation)o).getName(); } return null; }