-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Extracting superclass #1038
Extracting superclass #1038
Conversation
Can one of the admins verify this patch? |
ok. @vparfonov @garagatyi ? |
Commit allows to exclude one more check - |
Thank you Alex for the contribution! Generally I'm OK with these fixes, but in my opinion these classes should be refactored instead of using util methods. |
Ok. Yes, it is a better idea! |
Hi thanks for you work. This is good catch form you side. And i totally agree with you that will be better create base class for Upload File views and move basic logic there. |
@vparfonov Do you want it as a superclass for them? If so, I can do this in this PR. |
@alexVengrovsk superclass |
@vparfonov Ok. Will be done |
@vparfonov It is finished. Please, have a look. |
@vparfonov I resolved all conflicts. Can you check this PR? |
@skabashnyuk @garagatyi Sorry for bothering you, but is it something wrong with this PR? If so, tell me please and I will try to improve it. |
As for me fact that some presenter extends some util doesn't look good. Utils should be used by composition, not inheritance. But it is up to @vparfonov because his expertise in client-side code is deeper. |
yep will be better have something like BasicUploadPresenter or AbstractUploadPresenter instead of PresenterUtil |
@vparfonov It could be changed. Do you agree with @garagatyi about using composition instead of inheritance? Composition seems preferable for me too. |
@vparfonov I have renamed the PresenterUtil to the BasicUploadPresenter. I think, that now this PR is ready. |
|
||
protected boolean isResourceAndStorableNode(@Nullable Node node) { | ||
return node != null && node instanceof ResourceBasedNode<?> && node instanceof HasStorablePath; | ||
BasicUploadPresenter basicUploadPresenter = new BasicUploadPresenter(projectExplorer); |
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.
Not good use create presenter with constructor try please use injection instead. Thanks
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.
Ok
Signed-off-by: <alextrentton@gmail.com>
@vparfonov I have changed instance creation with injection |
Can one of the admins verify this patch? |
Signed-off-by: alextrentton@gmail.com
If-check in the
getResourceBasedNode()
method can be simplified. This change allows to exclude one check and protect method fromNullPointerException
. But this method still can throw this exception in lineObject o = selection.get(0);
I wasn't shure is it expected behaviour, so, didn't chenge anything there.
In the
parseMessage()
method it is posible to exclude the last if-check, because methodindexOf()
will return index or -1 if there is no searching sequence in the String.One more question - both changed classes have identical methods with identical bodies:
getResourceBasedNode()
,isResourceAndStorableNode()
,parseMessage()
. Maybe, it would be better to create some utility class (for example -UploadUtil
) with this methods and to use this class for bothUploadFilePresenter
andUploadFolderFromZipPresenter
?The same story about methods
addFile()
(fromUploadFileViewImpl
) andaddFileUploadForm()
(fromUploadFolderFromZipViewImpl
).