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.
Restrict Pin View and Open View to active CPP debug context.
That is if any CPP application is under debug. Because Pin View is never enabled other than CPP application debug session. This also includes Action to Command migration. see eclipse-cdt#1048
- Loading branch information
1 parent
9e04dc5
commit 8e73224
Showing
6 changed files
with
361 additions
and
288 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
41 changes: 0 additions & 41 deletions
41
...cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/OpenNewViewActionDelegate.java
This file was deleted.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
...clipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/OpenNewViewHandler.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,41 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2010, 2014 Texas Instruments and others | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Patrick Chuong (Texas Instruments) - Initial implementation of run() | ||
* Marc Dumais (Ericsson) - Bug 437692 | ||
* Raghunandana Murthappa(Advantest Europe GmbH) - Issue 1048 | ||
*******************************************************************************/ | ||
package org.eclipse.cdt.debug.internal.ui.actions; | ||
|
||
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.handlers.HandlerUtil; | ||
|
||
/** | ||
* Handler that opens the new View of the view type selected. This is used by | ||
* the OpenNewViewCommand which is contributed to debug related views. | ||
*/ | ||
public class OpenNewViewHandler extends AbstractHandler { | ||
private OpenNewViewAction fOpenNewViewAction = new OpenNewViewAction(); | ||
|
||
@Override | ||
public Object execute(ExecutionEvent event) throws ExecutionException { | ||
IViewPart viewPart = (IViewPart) HandlerUtil.getActivePart(event); | ||
fOpenNewViewAction.init(viewPart); | ||
fOpenNewViewAction.run(); | ||
|
||
return IStatus.OK; | ||
} | ||
|
||
} |
65 changes: 65 additions & 0 deletions
65
...dt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/PinCommandEnablementTester.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,65 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2025 Advantest Europe GmbH and others. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Raghunandana Murthappa | ||
*******************************************************************************/ | ||
package org.eclipse.cdt.debug.internal.ui.actions; | ||
|
||
import java.util.Set; | ||
|
||
import org.eclipse.core.expressions.PropertyTester; | ||
import org.eclipse.debug.core.DebugPlugin; | ||
import org.eclipse.debug.core.ILaunch; | ||
import org.eclipse.ui.IViewPart; | ||
import org.eclipse.ui.part.WorkbenchPart; | ||
|
||
/** | ||
* Tests if Pin View Command can be enabled. This is tested in 2 steps. | ||
* <p> | ||
* 1. If a view is already pinned(which will be passes as argument) then command | ||
* must be enabled until it is unpinned. 2. A valid CDT Debug Launch is active | ||
* within Debug Launch Manager. | ||
* </p> | ||
* | ||
* @author Raghunandana Murthappa | ||
*/ | ||
public class PinCommandEnablementTester extends PropertyTester { | ||
|
||
private static final String GDB_LAUNCH_TYPE = "org.eclipse.cdt.dsf.gdb.launching.GdbLaunch"; //$NON-NLS-1$ | ||
private static final String PIN_VIEW_COMMAND_PROP_TEST_NAME = "canPinViewEnabled"; //$NON-NLS-1$ | ||
|
||
@Override | ||
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { | ||
if (PIN_VIEW_COMMAND_PROP_TEST_NAME.equals(property)) { | ||
// Check if the View was pinned, then button must be there to Unpin. | ||
Set<IViewPart> pinnedViews = PinViewHandler.getPinnedViews(); | ||
if (pinnedViews.size() > 0 && args.length == 1) { | ||
for (IViewPart viewPart : pinnedViews) { | ||
WorkbenchPart vPart = (WorkbenchPart) viewPart; | ||
if (args[0].equals(vPart.getPartName())) { | ||
return true; | ||
} | ||
} | ||
} | ||
// Check if any CDT launch is active. | ||
ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches(); | ||
for (ILaunch launch : launches) { | ||
if (launch.getClass().getName().equals(GDB_LAUNCH_TYPE) && !launch.isTerminated()) { | ||
return true; | ||
} | ||
|
||
} | ||
|
||
} | ||
return false; | ||
} | ||
|
||
} |
Oops, something went wrong.