-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor CamelDebuggerSession: Simplify breakpoint handling and improve clarity in path modification logic #1076
base: main
Are you sure you want to change the base?
Conversation
… run configuration by introducing explaining variable and extracting method for improved clarity
…s and decompose conditions in CamelDebuggerSession
…ells Refactor/implementation smells
refactor: replace conditional logic in breakpoint handling with polymorphism
import java.util.Map; | ||
|
||
public final class FileTypeHandlerRegistry { | ||
private static final Map<String, FileTypeHandler> HANDLERS = new HashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use Map.of instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The project mainly uses HashMap for consistency. So I just stick with that to maintain uniformity
refactor: resolve design smell using pull-up method and extract class
What is your reason for sending this PR? This is a IDE plugin for users of Apache Camel. Are you using Apache Camel? We are looking for actual end users of Apache Camel that wants to improve this plugin with new features and improvements that make this plugin better for every Camel end users. |
This pull request includes several important changes to the Camel plugin codebase, focusing on refactoring and improving the structure of language handling and completion providers. The most significant changes include the introduction of abstract completion providers, the extraction of language classes into separate files, and the addition of a file type handler registry for breakpoints.
Refactoring and Code Structure Improvements:
src/main/java/com/github/cameltooling/idea/completion/contributor/CamelContributor.java
: IntroducedAbstractCompletionProvider
to replace the existingEndpointCompletion
andPropertiesCompletion
classes, and refactored their implementations to extend this new abstract class. [1] [2]Language Handling:
src/main/java/com/github/cameltooling/idea/language/CamelLanguages.java
: Removed inner language classes (DatasonnetLanguage
,SimpleLanguage
,ConstantLanguage
) and their associated methods.src/main/java/com/github/cameltooling/idea/language/ConstantLanguage.java
: AddedConstantLanguage
class as a standalone file.src/main/java/com/github/cameltooling/idea/language/DatasonnetLanguage.java
: AddedDatasonnetLanguage
class as a standalone file.src/main/java/com/github/cameltooling/idea/language/SimpleLanguage.java
: AddedSimpleLanguage
class as a standalone file.Breakpoint Handling:
src/main/java/com/github/cameltooling/idea/runner/debugger/breakpoint/CamelBreakpointType.java
: Replaced the switch statement with aFileTypeHandlerRegistry
to handle different file types for breakpoints.src/main/java/com/github/cameltooling/idea/runner/debugger/breakpoint/FileTypeHandler.java
: IntroducedFileTypeHandler
interface for handling different file types.src/main/java/com/github/cameltooling/idea/runner/debugger/breakpoint/FileTypeHandlerRegistry.java
: AddedFileTypeHandlerRegistry
to manage file type handlers.These changes collectively improve the maintainability and extensibility of the codebase by modularizing language definitions, abstracting common functionalities, and centralizing file type handling logic.