@Override public boolean equals(Object object) { return object instanceof JavaProjectSourceLocation && getJavaProject().equals(((JavaProjectSourceLocation)object).getJavaProject()); }
/** * Constructs a new source location that will retrieve source * elements from the given Java project. * * @param project Java project */ public JavaProjectSourceLocation(IJavaProject project) { setJavaProject(project); }
@Override public void initializeFrom(String memento) throws CoreException { Exception ex = null; try { Element root = null; DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); parser.setErrorHandler(new DefaultHandler()); StringReader reader = new StringReader(memento); InputSource source = new InputSource(reader); root = parser.parse(source).getDocumentElement(); String name = root.getAttribute("name"); //$NON-NLS-1$ if (isEmpty(name)) { abort(LaunchingMessages.JavaProjectSourceLocation_Unable_to_initialize_source_location___missing_project_name_3, null); } else { IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(name); setJavaProject(JavaCore.create(proj)); } return; } catch (ParserConfigurationException e) { ex = e; } catch (SAXException e) { ex = e; } catch (IOException e) { ex = e; } abort(LaunchingMessages.JavaProjectSourceLocation_Exception_occurred_initializing_source_location__4, ex); }
IProject project = (IProject)entry.getResource(); if (project != null && project.exists() && project.isOpen()) { location = new JavaProjectSourceLocation(JavaCore.create(project));
@Override public void initializeFrom(String memento) throws CoreException { Exception ex = null; try { Element root = null; DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); parser.setErrorHandler(new DefaultHandler()); StringReader reader = new StringReader(memento); InputSource source = new InputSource(reader); root = parser.parse(source).getDocumentElement(); String name = root.getAttribute("name"); //$NON-NLS-1$ if (isEmpty(name)) { abort(LaunchingMessages.JavaProjectSourceLocation_Unable_to_initialize_source_location___missing_project_name_3, null); } else { IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(name); setJavaProject(JavaCore.create(proj)); } return; } catch (ParserConfigurationException e) { ex = e; } catch (SAXException e) { ex = e; } catch (IOException e) { ex = e; } abort(LaunchingMessages.JavaProjectSourceLocation_Exception_occurred_initializing_source_location__4, ex); }
IProject project = (IProject)entry.getResource(); if (project != null && project.exists() && project.isOpen()) { location = new JavaProjectSourceLocation(JavaCore.create(project));
@Override public boolean equals(Object object) { return object instanceof JavaProjectSourceLocation && getJavaProject().equals(((JavaProjectSourceLocation)object).getJavaProject()); }
/** * Constructs a new source location that will retrieve source * elements from the given Java project. * * @param project Java project */ public JavaProjectSourceLocation(IJavaProject project) { setJavaProject(project); }
@Override public int hashCode() { return getJavaProject().hashCode(); }
@Override public int hashCode() { return getJavaProject().hashCode(); }
@Override public String getMemento() throws CoreException { Document doc = DebugPlugin.newDocument(); Element node = doc.createElement("javaProjectSourceLocation"); //$NON-NLS-1$ doc.appendChild(node); node.setAttribute("name", getJavaProject().getElementName()); //$NON-NLS-1$ return DebugPlugin.serializeDocument(doc); }
@Override public String getMemento() throws CoreException { Document doc = DebugPlugin.newDocument(); Element node = doc.createElement("javaProjectSourceLocation"); //$NON-NLS-1$ doc.appendChild(node); node.setAttribute("name", getJavaProject().getElementName()); //$NON-NLS-1$ return DebugPlugin.serializeDocument(doc); }
/** * @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; }