Navigation: Main README | Architecture | TODO
The Usage View plugin provides a table-based view for detecting naming conflicts in Java codebases. It analyzes Java code using AST (Abstract Syntax Tree) parsing to identify variables with the same name but different types across your codebase.
- 📊 Table View - Display all variables in organized, sortable tables
- 🔍 Naming Conflict Detection - Find variables with the same name but different types
- 🔄 Automatic Updates - View updates automatically when switching between files
- 🎯 Link with Selection - Synchronize with Project Explorer and editor selections
- 🔌 Eclipse Integration - Seamlessly integrated with Eclipse IDE
- ⚙️ Startup Control - Optional auto-show at Eclipse startup via preferences
The primary use case is identifying naming conflicts where the same variable name is used with different types, which can lead to confusion and bugs:
// Example of naming conflict that will be detected:
String userId = "123"; // Type: String
int userId = 456; // Type: int - CONFLICT!- Identify potentially confusing variable naming patterns
- Find variables that might benefit from more descriptive names
- Support refactoring efforts by visualizing all variable bindings
- Browse all variables in a project, package, or file
- Navigate quickly to variable declarations
- Understand variable usage patterns across the codebase
- Open Window → Show View → Other...
- Navigate to Java category
- Select JavaHelper View (or Usage View)
Alternatively, the view can be configured to automatically show at Eclipse startup via preferences.
- Select a project, package, or Java file in Project Explorer
- The view automatically updates when "Link with Selection" is enabled (default)
- View displays all variable bindings from the selected Java element
- Enable "Filter Naming Conflicts" to show only variables with the same name but different types
The plugin currently detects naming conflicts - variables with the same name but different types. This helps identify potentially confusing naming patterns that could lead to bugs.
- Local variables - Variables declared within methods
- Fields - Class and instance fields
- Parameters - Method and constructor parameters
All variable bindings are extracted through AST parsing with full type resolution.
The view displays the following information for each variable binding:
- Name - The variable name
- Qualified Name - Full type information including package
- Package - The package containing the variable
- Deprecated - Indicates if the binding is marked as deprecated
- Declaring Method - The method where the variable is declared (for local variables)
- Link with Selection - Toggle to enable/disable automatic updates based on selection
- Filter Naming Conflicts - Show only variables with naming conflicts (same name, different type)
- Sort by Column - Click any column header to sort the table
- Refresh - Manually refresh the view content
Configure view behavior through preferences:
- Window → Preferences → Java → Usage View
- Show View at Startup - Enable/disable automatic view display when Eclipse starts
Currently, the preference system supports controlling startup behavior. Additional configuration options for naming patterns and rules are planned for future releases (see TODO.md).
- Architecture - Implementation details
- TODO - Future enhancements
- Main README - Overview
The Usage View integrates with:
- Eclipse Views framework - Standard Eclipse view with toolbar and menu integration
- Java model API - Uses IJavaElement for navigation
- AST analysis - Full AST parsing with binding resolution via AstProcessorBuilder from sandbox_common
- IPartListener2 - Automatic updates when switching between editors
- IStartup - Optional automatic display at Eclipse startup
The view uses the AstProcessorBuilder API from sandbox_common for efficient AST traversal:
AstProcessorBuilder.with(new ReferenceHolder<String, Object>())
.onSimpleName((simpleName, dataHolder) -> {
IBinding binding = simpleName.resolveBinding();
if (binding instanceof IVariableBinding variableBinding) {
collectedVariableBindings.add(variableBinding);
}
return true;
})
.build(astNode);The NamingConflictFilter analyzes variable bindings and identifies conflicts where:
- Multiple variables share the same name
- But have different types (different ITypeBinding)
This helps developers identify potentially confusing naming patterns.
The Usage View complements:
- Refactoring tools - Identify candidates for renaming before refactoring
- Extra Search - Use together to find all usages before renaming
- JDT Cleanup - Part of the broader sandbox cleanup ecosystem
- Pattern Detection: Currently only detects "same name, different type" conflicts
- No Quick Fixes: Identifies issues but does not provide automatic refactoring
- No Export: Cannot export results to CSV or other formats
- No Custom Rules: Cannot define custom naming conventions or patterns
See TODO.md for planned features:
- Configurable naming conventions - Define custom naming rules
- Quick fixes - Automatic refactoring suggestions
- Enhanced pattern detection - Detect more subtle naming inconsistencies (case variations, abbreviations, etc.)
- Export functionality - CSV/Excel export for reporting
- Batch operations - Apply fixes to multiple variables at once
Eclipse Public License 2.0 (EPL-2.0)
Related Plugins: Extra Search, Common Utilities