private int getPrefixLength(IFolder folder) { Object parent = fContentProvider.getParent(folder); int folderNameLenght = folder.getName().length() + 1; if (parent instanceof IPackageFragment) { String fragmentName = ((IPackageFragment) parent).getElementName(); return fragmentName.length() + 1 + folderNameLenght; } else if (parent instanceof IFolder) { return getPrefixLength((IFolder) parent) + folderNameLenght; } else { return folderNameLenght; } }
private String getSpecificText(Object element) { if (!fIsFlatLayout && element instanceof IPackageFragment) { IPackageFragment fragment = (IPackageFragment) element; Object parent = fContentProvider.getHierarchicalPackageParent(fragment); if (parent instanceof IPackageFragment) { return getNameDelta((IPackageFragment) parent, fragment); } else if (parent instanceof IFolder) { // bug 152735 return getNameDelta((IFolder) parent, fragment); } } else if (element instanceof IWorkingSet) { return ((IWorkingSet) element).getLabel(); } return null; }
public String getText(Object element) { if (fIsFlatLayout || !(element instanceof IPackageFragment)) return super.getText(element); IPackageFragment fragment = (IPackageFragment) element; if (fragment.isDefaultPackage()) { return super.getText(fragment); } else { Object parent = fContentProvider.getPackageFragmentProvider().getParent(fragment); if (parent instanceof IPackageFragment) { return getNameDelta((IPackageFragment) parent, fragment); } else if (parent instanceof IFolder) { int prefixLength = getPrefixLength((IFolder) parent); return fragment.getElementName().substring(prefixLength); } else return super.getText(fragment); } }