/** * 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); }
/** * 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); }
@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); }