Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2012-11-13 11:23:50 -0500
committerUwe Stieber2012-11-13 11:24:46 -0500
commit8497b1d7b2d2a59a1a7c1cd4d62252b3d6acba9d (patch)
tree5cccf1e74cb68994bb55989788646c0c00e2901d
parent1d960d276ba232ebf56472fe60dc8b86405e12a0 (diff)
downloadorg.eclipse.tcf-8497b1d7b2d2a59a1a7c1cd4d62252b3d6acba9d.tar.gz
org.eclipse.tcf-8497b1d7b2d2a59a1a7c1cd4d62252b3d6acba9d.tar.xz
org.eclipse.tcf-8497b1d7b2d2a59a1a7c1cd4d62252b3d6acba9d.zip
Target Explorer: Fix Bug 394184 - Installing TCF Target Explorer corrupts ProjectExplorer view
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.xml13
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/handler/LaunchLaunchConfigurationContributionItem.java30
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/handler/NewLaunchConfigurationContributionItem.java97
3 files changed, 70 insertions, 70 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.xml
index 3c8af6a53..eeba78cdf 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.xml
@@ -188,10 +188,10 @@
<dynamic
id="org.eclipse.tcf.te.launch.ui.views.project.dynamic.new"
class="org.eclipse.tcf.te.launch.ui.internal.handler.NewLaunchConfigurationContributionItem">
- <visibleWhen>
- <reference definitionId="launch.expressions.isMultiLaunchConfigOrType"/>
- </visibleWhen>
</dynamic>
+ <visibleWhen>
+ <reference definitionId="launch.expressions.isMultiLaunchConfigOrType"/>
+ </visibleWhen>
</menu>
<separator
name="group.showIn"
@@ -205,11 +205,10 @@
icon="icons/eview16/prop_ps.gif"
label="%Properties.menu.name"
style="push">
- <visibleWhen>
- <reference definitionId="launch.expressions.isSingleLaunchConfig"/>
- </visibleWhen>
</command>
- <visibleWhen checkEnabled="true"/>
+ <visibleWhen>
+ <reference definitionId="launch.expressions.isSingleLaunchConfig"/>
+ </visibleWhen>
</menu>
<separator
name="group.launch"
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/handler/LaunchLaunchConfigurationContributionItem.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/handler/LaunchLaunchConfigurationContributionItem.java
index 894b18e22..468740cbe 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/handler/LaunchLaunchConfigurationContributionItem.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/handler/LaunchLaunchConfigurationContributionItem.java
@@ -14,7 +14,7 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.expressions.IEvaluationContext;
-import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchMode;
import org.eclipse.debug.ui.DebugUITools;
@@ -84,21 +84,23 @@ public class LaunchLaunchConfigurationContributionItem extends CompoundContribut
ISelection selection = (ISelection)state.getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
IStructuredSelection iss = (IStructuredSelection)selection;
Object obj = iss.getFirstElement();
- Assert.isTrue(obj instanceof LaunchNode);
- LaunchNode node = (LaunchNode) obj;
List<IContributionItem> items = new ArrayList<IContributionItem>();
- if (node.getLaunchConfiguration() != null) {
- try {
- for (String mode : LaunchConfigHelper.getLaunchConfigTypeModes(node.getLaunchConfigurationType(), false)) {
- ILaunchMode launchMode = DebugPlugin.getDefault().getLaunchManager().getLaunchMode(mode);
- IAction action = new LaunchAction(node.getLaunchConfiguration(), mode);
- action.setText(launchMode.getLabel());
- action.setImageDescriptor(DebugUITools.getLaunchGroup(node.getLaunchConfiguration(), mode).getImageDescriptor());
- action.setEnabled(node.isValidFor(mode));
- items.add(new ActionContributionItem(action));
+ if (obj instanceof LaunchNode) {
+ LaunchNode node = (LaunchNode) obj;
+ if (node.getLaunchConfiguration() != null) {
+ try {
+ for (String mode : LaunchConfigHelper.getLaunchConfigTypeModes(node.getLaunchConfigurationType(), false)) {
+ ILaunchMode launchMode = DebugPlugin.getDefault().getLaunchManager().getLaunchMode(mode);
+ IAction action = new LaunchAction(node.getLaunchConfiguration(), mode);
+ action.setText(launchMode.getLabel());
+ action.setImageDescriptor(DebugUITools.getLaunchGroup(node.getLaunchConfiguration(), mode).getImageDescriptor());
+ action.setEnabled(node.isValidFor(mode));
+ items.add(new ActionContributionItem(action));
+ }
+ }
+ catch (Exception e) {
+ if (Platform.inDebugMode()) e.printStackTrace();
}
- }
- catch (Exception e) {
}
}
enabled = !items.isEmpty();
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/handler/NewLaunchConfigurationContributionItem.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/handler/NewLaunchConfigurationContributionItem.java
index 566e845ac..506e41943 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/handler/NewLaunchConfigurationContributionItem.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/handler/NewLaunchConfigurationContributionItem.java
@@ -15,7 +15,6 @@ import java.util.List;
import org.eclipse.core.expressions.IEvaluationContext;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.Assert;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
@@ -101,60 +100,60 @@ public class NewLaunchConfigurationContributionItem extends CompoundContribution
ISelection selection = (ISelection)state.getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
IStructuredSelection iss = (IStructuredSelection)selection;
Object obj = iss.getFirstElement();
- Assert.isTrue(obj instanceof LaunchNode);
- final LaunchNode node = (LaunchNode) obj;
List<IContributionItem> items = new ArrayList<IContributionItem>();
- final ILaunchConfigurationType type = node.getLaunchConfigurationType();
- if (type != null) {
- try {
- for (String mode : LaunchConfigHelper.getLaunchConfigTypeModes(type, false)) {
- ILaunchManagerDelegate delegate = LaunchManager.getInstance().getLaunchManagerDelegate(type, mode);
- ILaunchSelection launchSelection = null;
- if (node.getModel().getModelRoot() instanceof ICategory) {
- launchSelection = LaunchSelectionManager.getInstance().getLaunchSelection(type, mode, LaunchSelectionManager.PART_ID_TE_VIEW);
- }
- else if (node.getModel().getModelRoot() instanceof IModelNode) {
- List<ISelectionContext> selectionContexts = new ArrayList<ISelectionContext>();
- selectionContexts.add(new RemoteSelectionContext((IModelNode)node.getModel().getModelRoot(), true));
- selectionContexts.addAll(LaunchSelectionManager.getInstance().getSelectionContextsFor(LaunchSelectionManager.PART_ID_PROJECT_VIEW, type, mode, false));
- launchSelection = new LaunchSelection(mode, selectionContexts.toArray(new ISelectionContext[selectionContexts.size()]));
- }
- else if (node.getModel().getModelRoot() instanceof IProject) {
- List<ISelectionContext> selectionContexts = new ArrayList<ISelectionContext>();
- selectionContexts.add(new ProjectSelectionContext((IProject)node.getModel().getModelRoot(), true));
- selectionContexts.addAll(LaunchSelectionManager.getInstance().getSelectionContextsFor(LaunchSelectionManager.PART_ID_TE_VIEW, type, mode, false));
- launchSelection = new LaunchSelection(mode, selectionContexts.toArray(new ISelectionContext[selectionContexts.size()]));
- }
- if (launchSelection != null) {
- final ILaunchSpecification launchSpec = delegate.getLaunchSpecification(type.getIdentifier(), launchSelection);
- final ILaunchGroup launchGroup = DebugUITools.getLaunchGroup(type.newInstance(null, "temp"), mode); //$NON-NLS-1$
- ILaunchMode launchMode = DebugPlugin.getDefault().getLaunchManager().getLaunchMode(mode);
- IAction action = new Action() {
- @Override
- public void run() {
- try {
- ILaunchConfiguration config = LaunchManager.getInstance().createOrUpdateLaunchConfiguration(null, launchSpec);
- DebugUITools.openLaunchConfigurationDialogOnGroup(
- UIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(),
- new StructuredSelection(config),
- launchGroup.getIdentifier());
- }
- catch (Exception e) {
- e.printStackTrace();
+ if (obj instanceof LaunchNode) {
+ final LaunchNode node = (LaunchNode) obj;
+ final ILaunchConfigurationType type = node.getLaunchConfigurationType();
+ if (type != null) {
+ try {
+ for (String mode : LaunchConfigHelper.getLaunchConfigTypeModes(type, false)) {
+ ILaunchManagerDelegate delegate = LaunchManager.getInstance().getLaunchManagerDelegate(type, mode);
+ ILaunchSelection launchSelection = null;
+ if (node.getModel().getModelRoot() instanceof ICategory) {
+ launchSelection = LaunchSelectionManager.getInstance().getLaunchSelection(type, mode, LaunchSelectionManager.PART_ID_TE_VIEW);
+ }
+ else if (node.getModel().getModelRoot() instanceof IModelNode) {
+ List<ISelectionContext> selectionContexts = new ArrayList<ISelectionContext>();
+ selectionContexts.add(new RemoteSelectionContext((IModelNode)node.getModel().getModelRoot(), true));
+ selectionContexts.addAll(LaunchSelectionManager.getInstance().getSelectionContextsFor(LaunchSelectionManager.PART_ID_PROJECT_VIEW, type, mode, false));
+ launchSelection = new LaunchSelection(mode, selectionContexts.toArray(new ISelectionContext[selectionContexts.size()]));
+ }
+ else if (node.getModel().getModelRoot() instanceof IProject) {
+ List<ISelectionContext> selectionContexts = new ArrayList<ISelectionContext>();
+ selectionContexts.add(new ProjectSelectionContext((IProject)node.getModel().getModelRoot(), true));
+ selectionContexts.addAll(LaunchSelectionManager.getInstance().getSelectionContextsFor(LaunchSelectionManager.PART_ID_TE_VIEW, type, mode, false));
+ launchSelection = new LaunchSelection(mode, selectionContexts.toArray(new ISelectionContext[selectionContexts.size()]));
+ }
+ if (launchSelection != null) {
+ final ILaunchSpecification launchSpec = delegate.getLaunchSpecification(type.getIdentifier(), launchSelection);
+ final ILaunchGroup launchGroup = DebugUITools.getLaunchGroup(type.newInstance(null, "temp"), mode); //$NON-NLS-1$
+ ILaunchMode launchMode = DebugPlugin.getDefault().getLaunchManager().getLaunchMode(mode);
+ IAction action = new Action() {
+ @Override
+ public void run() {
+ try {
+ ILaunchConfiguration config = LaunchManager.getInstance().createOrUpdateLaunchConfiguration(null, launchSpec);
+ DebugUITools.openLaunchConfigurationDialogOnGroup(
+ UIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(),
+ new StructuredSelection(config),
+ launchGroup.getIdentifier());
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
}
- }
- };
- action.setText(launchMode.getLabel() + " Configuration"); //$NON-NLS-1$
- action.setImageDescriptor(launchGroup.getImageDescriptor());
- items.add(new ActionContributionItem(action));
+ };
+ action.setText(launchMode.getLabel() + " Configuration"); //$NON-NLS-1$
+ action.setImageDescriptor(launchGroup.getImageDescriptor());
+ items.add(new ActionContributionItem(action));
+ }
}
}
- }
- catch (Exception e) {
- e.printStackTrace();
+ catch (Exception e) {
+ e.printStackTrace();
+ }
}
}
-
enabled = !items.isEmpty();
return items.toArray(new IContributionItem[items.size()]);
}

Back to the top