| Summary: | Bad code in org.eclipse.dltk.ui.ScriptElementLabels.appendTypeQualification | ||
|---|---|---|---|
| Product: | [Technology] DLTK | Reporter: | Bruno Medeiros <bruno.do.medeiros> |
| Component: | Common | Assignee: | dltk.common-inbox <dltk.common-inbox> |
| Status: | NEW --- | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 3.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | All | ||
| Whiteboard: | |||
It seems some bad Element Labels are being generated for types. If there is a ClassA in moduleM in packageP in source folder "src", one would expect a sensible default element label to be: "packageP.ModuleM.ClassA" however what we get is: "src ModuleM.ClassA" The source folder name gets added instead of the package name. This is presented as a minor UI issue, but also a bigger issue as the default text selection in the DLTK Search page. The Search Page will use the element labels as the default text, so if you have ClassA selected in the editor, you will get "src ModuleM.ClassA" instead of "packageP.ModuleM.ClassA", which should be the default, probably. It seems the problem is in org.eclipse.dltk.ui.ScriptElementLabels.appendTypeQualification(IType, long, StringBuffer) where probably the code should be something similar to this: protected void appendTypeQualification(IType type, long flags, StringBuffer buf) { try { final INamespace namespace = type.getNamespace(); if (namespace != null) { buf.append(namespace.getQualifiedName(".")); if(!namespace.isRoot()) { buf.append("."); } return; } } catch (ModelException e) { // ignore return; } IScriptFolder pkg = type.getScriptFolder(); getScriptFolderLabel(pkg, (flags & QUALIFIER_FLAGS), buf); buf.append("."); } This is easy to workaround as each language can provide their own ScriptElementLabels and fix the behavior above, but still it would be nice to have a better default.