List of usage examples for org.eclipse.jface.viewers TreePath hashCode
public int hashCode(IElementComparer comparer)
From source file:eu.modelwriter.marker.internal.MarkerFactory.java
License:Open Source License
/** * @param selections//ww w. j a v a 2 s. c o m * @return */ public static String getQualifiedName(final ITreeSelection selections) { final TreePath[] paths = selections.getPaths(); // Consider only not empty and single selection if (selections.isEmpty() || selections.size() > 1) { return null; } final TreePath path = paths[0]; IElementComparer comparer = null; if (selections instanceof TreeSelection) { comparer = ((TreeSelection) selections).getElementComparer(); } System.out.println(path.hashCode(comparer)); for (int i = 1; i < path.getSegmentCount(); i++) { if (path.getSegment(i) instanceof ResourceFactoryImpl) { final EcoreResourceFactoryImpl eResourceFactory = (EcoreResourceFactoryImpl) path.getSegment(i); System.out.println(eResourceFactory.getClass().getName() + ": " + eResourceFactory.toString()); } else if (path.getSegment(i) instanceof ENamedElement) { final ENamedElement namedElement = (ENamedElement) path.getSegment(i); System.out.println(namedElement.getClass().getName() + ": " + namedElement.getName()); } else { System.out.println("?"); } } return null; }