-
Notifications
You must be signed in to change notification settings - Fork 228
Show recently used "File > New" wizards #1922
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
base: master
Are you sure you want to change the base?
Show recently used "File > New" wizards #1922
Conversation
|
@lathapatil : could you please provide some screenshot showing the change? |
|
@iloveeclipse Yes, PFB for recently used 5 new shortcuts |
295f697 to
9f5a9d4
Compare
9f5a9d4 to
aecf9a8
Compare
aecf9a8 to
92cba6d
Compare
| } | ||
| // To add shortcuts from OTHER... wizard regardless of perspective | ||
| Collection<IContributionItem> otherItems = new LinkedList<>(); | ||
| if (!RecentNewWizardSelection.getInstance().getSelectedFromOther().isEmpty()) { |
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.
Method name getSelectedFromOther() and derived variable names are unfortunate, I had no idea how to understand these names.
Why not just RecentNewWizardSelection.getInstance().getItems() ?
| /** | ||
| * Returns the action for the given wizard id, or null if not found. | ||
| * | ||
| * @since 3.132 |
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.
- Please make the method package protected, as we don't expect anyone to overwrite it.
- Please remove "since" comment after making the method package protected, as it would not be new API anymore.
- If this would be changed to "public" as proposed, this would be wrong version, API tooling shows an error in the IDE. It should be
3.134and MANIFESt.MF version should be changed from3.133.100to3.134.0, because new API method would be added.
@laeubi, @HannesWell : looks like API tooling validation on jenkins stopped to work (second time I see it after #2430).
Could you please check whether is that tycho, PDE or jenkins/maven configuration issue?
| public WorkbenchPlugin() { | ||
| super(); | ||
| inst = this; | ||
| recentNewWizardsPreferenceManager = new RecentNewWizardsPreferenceManager(); |
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.
Never ever do anything in bundle constructor! Any bundle initialization code should be added in the start() method.
| if (uiBundle != null) | ||
| uiBundle.start(Bundle.START_TRANSIENT); | ||
|
|
||
| List<String> recentlyUsedNewWizards = recentNewWizardsPreferenceManager.getMenuShortcutsFromPreferences(); |
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.
This code doesn't belong to the bundle activator, it is an internal implementation detail of the RecentNewWizardsPreferenceManager and should be done there.
| testableTracker = null; | ||
| } | ||
| // Store recently used new page shortcuts to preferences | ||
| Set<String> selectedFromOther = RecentNewWizardSelection.getInstance().getSelectedFromOther(); |
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.
This code doesn't belong to the bundle activator, it is an internal implementation detail of the RecentNewWizardsPreferenceManager and should be done there. What yuo could do is to call RecentNewWizardsPreferenceManager.shutdown() here.
| } | ||
|
|
||
| /** | ||
| * @return Returns the selectedElement. |
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.
Comment is meaningless. Instead, one could provide information that the selection could be null
| * they will persist into the next invocation of this wizard page | ||
| */ | ||
| protected void saveWidgetValues() { | ||
| RecentNewWizardSelection.getInstance().addItem(newResourcePage.getSelectedElement().getId()); |
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.
newResourcePage.getSelectedElement() may return null, so please add check before.
| * of the menu manager with New Wizard actions. The recently used new wizards | ||
| * will appear before the "Other" shortcut. | ||
| * | ||
| * @since 3.5 |
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.
please remove "since", this package is not API
| public class RecentNewWizardSelection { | ||
| private Set<String> selectedFromOther = new LinkedHashSet<>(); | ||
| private static RecentNewWizardSelection instance; | ||
| private static final int MAX_MENU_SIZE = 5; |
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.
If you intended to have 5 recent items: currently only four are kept.
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.
If you intended to have 5 recent items: currently only four are kept.
Could you please share the scenario you tested .
It do not add the shortcuts if it is already present as part of fixed shortcuts (highlighted in the plugin perspective image) of current perspective . The last used shortcuts change if you switch the perspective .
Java perspective
When I switch to plugin perspective ..
| * @return the set of recently used new wizard menu shortcut IDs | ||
| */ | ||
|
|
||
| public Set<String> getSelectedFromOther() { |
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 would propose to rename getSelectedFromOther to getItems() or getMenuIds() or getIds()
Check if API tools are working in platform UI. This PR should fail validation because it adds new API with wrong since tag. See eclipse-platform#2430 See eclipse-platform#1922
Check if API tools are working in platform UI. This PR should fail validation because it adds new API with wrong since tag. See eclipse-platform#2430 See eclipse-platform#1922
Changes requested in the PR eclipse-platform#1837 are addressed here Review points addressed
92cba6d to
3683ab5
Compare



Changes requested in the PR
#1837 are addressed here
Fixes : #1530