forked from eclipse-cdt/cdt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate Refresh Action to Command/Handler framework and support
visibility only whne CDT debug is active. See eclipse-cdt#1034
- Loading branch information
1 parent
8d06425
commit 10b0148
Showing
4 changed files
with
140 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 0 additions & 59 deletions
59
...ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/RefreshActionDelegate.java
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
...sf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/actions/ViewRefreshHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.eclipse.cdt.dsf.debug.internal.ui.viewmodel.actions; | ||
|
||
import org.eclipse.cdt.dsf.debug.ui.viewmodel.actions.VMHandlerUtils; | ||
import org.eclipse.cdt.dsf.ui.viewmodel.IVMProvider; | ||
import org.eclipse.cdt.dsf.ui.viewmodel.update.ICachingVMProvider; | ||
import org.eclipse.core.commands.AbstractHandler; | ||
import org.eclipse.core.commands.ExecutionEvent; | ||
import org.eclipse.core.commands.ExecutionException; | ||
import org.eclipse.core.runtime.IStatus; | ||
import org.eclipse.ui.IViewPart; | ||
import org.eclipse.ui.IWorkbenchPart; | ||
import org.eclipse.ui.handlers.HandlerUtil; | ||
|
||
/** | ||
* Handler that handles the 'Refresh' toolbar contribution item that is present on all debug views. | ||
* | ||
* @author Raghunandana Murthappa | ||
*/ | ||
public class ViewRefreshHandler extends AbstractHandler { | ||
@Override | ||
public Object execute(ExecutionEvent event) throws ExecutionException { | ||
IWorkbenchPart activePart = HandlerUtil.getActivePart(event); | ||
if (activePart != null && activePart instanceof IViewPart view) { | ||
IVMProvider provider = VMHandlerUtils.getVMProviderForPart(view); | ||
if (provider instanceof ICachingVMProvider) { | ||
((ICachingVMProvider) provider).refresh(); | ||
} | ||
} | ||
return IStatus.OK; | ||
} | ||
} |