-
Notifications
You must be signed in to change notification settings - Fork 96
Wrap viewer in CheckboxTablePart within a FilteredTable #1666
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
Conversation
ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/shared/CachedCheckboxTableViewer.java
Show resolved
Hide resolved
<resource path="src/org/eclipse/pde/internal/ui/shared/CachedCheckboxTableViewer.java" type="org.eclipse.pde.internal.ui.shared.CachedCheckboxTableViewer"> | ||
<filter comment="Extends CheckboxTableViewer to match CachedCheckboxTreeviewer" id="571473929"> | ||
<message_arguments> | ||
<message_argument value="CheckboxTableViewer"/> | ||
<message_argument value="CachedCheckboxTableViewer"/> | ||
</message_arguments> | ||
</filter> | ||
</resource> |
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.
I'm not sure whether inheritance is better than composition. But otherwise it's not possible to respond to e.g. calling setAllChecked() on the viewer.
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.
As far as I know, one should in general prefer composition/references over inheritance. But first a solution has to work technically.
12ec3ef
to
54ce71c
Compare
That looks very useful @ptziegler. Can you solve the conflicts? Would it make sense to implement the FilteredCheckBoxTable in platform.ui? @HannesWell any concerns with the general approach? |
Both classes would then be identical, with the only difference being that one uses a And given that you can use an e4 table with an e3 workbench, I think that's the better approach, rather than to duplicate the class.
I can have a look later today. I'll then also try to prepare a PR for M2E so its copy of the PluginListPage also uses the correct content provider. |
d935870
to
ff41115
Compare
Conflict has been resolved and M2E PR has been created: eclipse-m2e/m2e-core#1968 |
My concern is that older m2e will not work with new Eclipse versions and new m2e versions will not work with older Eclipse versions. Could this be handled in m2e but checking on a certain plug-in version or an instanceOf check? |
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.
any concerns with the general approach?
No objection from my side.
- The Cross-platform page of the "Deployable features" export wizard.
Looking at the provided screenshot and thinking about that there are generally not that many supported archs, I would say that a search is not really necessary in this particular case.
After a first quick look I just have a few minor code-style remarks.
And maybe a bit off-topic, but do you think it would be simple to add a search for the dependency-tree shown in
DependenciesViewTreePage
?
private FilteredCheckboxTable filteredTable; | ||
|
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.
Is this field necessary? It looks like this could also just be a local variable in createStructuredViewer()
.
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.
No, the viewer is only used inside the method and can be converted to a local variable. I've updated the PR.
* @return checked leaf elements | ||
*/ | ||
public Object[] getAllCheckedElements() { | ||
return checkState.toArray(new Object[checkState.size()]); |
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.
return checkState.toArray(new Object[checkState.size()]); | |
return checkState.toArray(Object[]::new); |
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.
Done
for (Object element : elements) { | ||
checkState.add(element); | ||
} |
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.
for (Object element : elements) { | |
checkState.add(element); | |
} | |
Collections.addAll(checkState, elements); |
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.
Done as well.
Acknowledged. It also doesn't harm to have it. So keeping it simpler is fine.
Awesome! Yes adding it there would also make sense. Do you think it would make sense to add this in this PR as well or would you prefer a separate one? |
ff41115
to
94203e8
Compare
Ye ask and ye shall receive: #1737 |
I've also removed the changes to the plugin table so that it doesn't cause issues with M2E. |
94203e8
to
ae57261
Compare
By using the FilteredTable, we get a quick-filter for all extending parts for free. This includes: - The Cross-platform page of the "Deployable features" export wizard. - The Update Java Classpath page of the "Update classpath..." action - The Template Selection page of the "Plug-in Project" page. Together with the quick-filter comes a caching of the checked table items. Those elements remain checked, even if currently hidden by the filter and will be restored once they become visible again.
ae57261
to
273296e
Compare
@ptziegler is this one ready from your side? I would like to merge it. Would be nice to these filters. |
@vogella This one should be good to go. |
Thanks @ptziegler |
By using the FilteredTable, we get a quick-filter for all extending parts for free. This includes:
Together with the quick-filter comes a caching of the checked table items. Those elements remain checked, even if currently hidden by the filter and will be restored once they become visible again.
Furthermore, the PluginListPage has been adapted to use a CheckboxTablePart rather than a CheckboxTreePart (effectively reverting 4c1edad), to match the list of plugins that it displays.
Contributes to #1497