-
Notifications
You must be signed in to change notification settings - Fork 165
Add active launch indicator to launch history menu #2652
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,7 @@ | |
| import org.eclipse.core.resources.IResource; | ||
| import org.eclipse.core.runtime.CoreException; | ||
| import org.eclipse.debug.core.DebugPlugin; | ||
| import org.eclipse.debug.core.ILaunch; | ||
| import org.eclipse.debug.core.ILaunchConfiguration; | ||
| import org.eclipse.debug.core.ILaunchConfigurationType; | ||
| import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; | ||
|
|
@@ -347,8 +348,12 @@ protected void fillMenu(Menu menu) { | |
|
|
||
| // Add favorites | ||
| int accelerator = 1; | ||
| ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches(); | ||
| for (ILaunchConfiguration launch : favoriteList) { | ||
| LaunchAction action= new LaunchAction(launch, getMode()); | ||
| if (launches.length > 0 && checkIfLaunched(launch, launches)) { | ||
| action.setText(action.getText() + " \u2699"); //$NON-NLS-1$ | ||
| } | ||
| addToMenu(menu, action, accelerator); | ||
| accelerator++; | ||
| } | ||
|
|
@@ -361,6 +366,9 @@ protected void fillMenu(Menu menu) { | |
| // Add history launches next | ||
| for (ILaunchConfiguration launch : historyList) { | ||
| LaunchAction action= new LaunchAction(launch, getMode()); | ||
| if (launches.length > 0 && checkIfLaunched(launch, launches)) { | ||
| action.setText(action.getText() + " \u2699"); //$NON-NLS-1$ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are two spaces between text and new character intended?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes two spaces are required. else it wont look good |
||
| } | ||
|
Comment on lines
351
to
+371
|
||
| addToMenu(menu, action, accelerator); | ||
| accelerator++; | ||
| } | ||
|
|
@@ -373,6 +381,22 @@ protected void fillMenu(Menu menu) { | |
| } | ||
| } | ||
|
|
||
| /** | ||
| * Returns whether the given launch configuration has been launched. | ||
| * | ||
| * @param launchConfiguration the launch configuration | ||
| * @param launches the current active launches | ||
| * @return {@code true} if a matching launch exists, {@code false} otherwise | ||
| */ | ||
| private boolean checkIfLaunched(ILaunchConfiguration launchConfiguration, ILaunch[] launches) { | ||
| for (ILaunch launch : launches) { | ||
| if (launch.getLaunchConfiguration().equals(launchConfiguration) && !launch.isTerminated()) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. launch.getLaunchConfiguration() can be null |
||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
|
Comment on lines
+384
to
+397
|
||
| } | ||
|
|
||
| /** | ||
| * Adds a separator to the given menu | ||
| * | ||
|
|
||
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.
Can you please guard the new code, including fetching of the launch configs by first check if
launchPrefis set? Same below.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.
Added a length check for launches
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 check is not needed, the
checkIfLaunched()will not do much if it is empty, same below