IJavaElement element= JavaCore.create(elementMem[i].getString(TAG_SELECTED_ELEMENT_PATH)); if (element != null && element.exists()) list.add(element);
String javaElementHandle= elementMem[i].getString(TAG_SELECTED_ELEMENT_PATH); if (javaElementHandle == null) {  IMemento[] packagesMem= elementMem[i].getChildren(TAG_LOGICAL_PACKAGE); LogicalPackage lp= null; for (int j= 0; j < packagesMem.length; j++) { javaElementHandle= packagesMem[j].getString(TAG_SELECTED_ELEMENT_PATH); Object pack= (IPackageFragment)JavaCore.create(javaElementHandle); if (pack instanceof IPackageFragment && ((IPackageFragment)pack).exists()) { if (lp == null) lp= new LogicalPackage((IPackageFragment)pack); else lp.add((IPackageFragment)pack); } } if (lp != null) list.add(lp); } else { IJavaElement element= JavaCore.create(javaElementHandle); if (element != null && element.exists()) list.add(element); }
	private ISelection restoreSelectionState(IMemento memento) {		if (memento == null)			return null;				IMemento childMem;		childMem= memento.getChild(TAG_SELECTED_ELEMENTS);		if (childMem != null) {			ArrayList list= new ArrayList();			IMemento[] elementMem= childMem.getChildren(TAG_SELECTED_ELEMENT);			for (int i= 0; i < elementMem.length; i++) {				IJavaElement element= JavaCore.create(elementMem[i].getString(TAG_SELECTED_ELEMENT_PATH));				if (element != null && element.exists())					list.add(element);			}			return new StructuredSelection(list);		}		return null;	}