summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorTobias Schwarz2012-05-02 03:12:33 (EDT)
committer Uwe Stieber2012-05-02 03:12:33 (EDT)
commitc5788b1da92746ede39c09345d1907b5469e9304 (patch)
tree9f14f044753b187e0c2f99eeb5b8e3bcf5ec33dd
parent138f869c6581ea43e9b8831b3b2e6ff0c8f2e9ee (diff)
downloadorg.eclipse.tcf-c5788b1da92746ede39c09345d1907b5469e9304.zip
org.eclipse.tcf-c5788b1da92746ede39c09345d1907b5469e9304.tar.gz
org.eclipse.tcf-c5788b1da92746ede39c09345d1907b5469e9304.tar.bz2
Target Explorer: ADD Launches to project explorer
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/projects/ReferencedProjectItem.java1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.properties99
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.xml335
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/adapters/RefreshHandlerDelegate.java106
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/handler/NewLaunchConfigurationContributionItem.java295
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/viewer/LaunchNavigatorContentProvider.java328
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/viewer/LaunchTreeLabelProvider.java195
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchModel.java368
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchNode.java290
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/selection/LaunchSelectionManager.java49
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/tabs/refprojects/RefProjectsSection.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/filetransfer/FileTransferItem.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/icons/obj16/root.gifbin0 -> 577 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/plugin.xml3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/internal/adapters/AdapterFactory.java44
15 files changed, 1269 insertions, 848 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/projects/ReferencedProjectItem.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/projects/ReferencedProjectItem.java
index efb1561..5140628 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/projects/ReferencedProjectItem.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/persistence/projects/ReferencedProjectItem.java
@@ -22,6 +22,7 @@ public class ReferencedProjectItem extends PropertiesContainer implements IRefer
* Constructor.
*/
public ReferencedProjectItem() {
+ setProperty(PROPERTY_ENABLED, true);
}
/* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.properties
index 5d48895..ab39818 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.properties
@@ -1,48 +1,51 @@
-##################################################################################
-# Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
-# This program and the accompanying materials are made available under the terms
-# of the Eclipse Public License v1.0 which accompanies this distribution, and is
-# available at http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Wind River Systems - initial API and implementation
-##################################################################################
-
-pluginName = Target Explorer, Launching, UI
-providerName = Eclipse.org - TCF
-
-# ***** Extension Points *****
-
-ExtensionPoint.tabs.name=Launch Configuration Tabs Extension Point
-
-# ***** Command Contributions *****
-
-command.showInDebugView.name=Show in Debug View Command
-command.showInDebugView.description=Show the selected context in the Debug View
-
-command.attach.name=Attach Context Command
-command.attach.description=Attach to the selected Context
-
-command.detach.name=Detach Context Command
-command.detach.description=Detach from the selected Context
-
-# ***** Editor page Contributions *****
-
-LauchEditorPage.name=Launches
-LauchEditorPage.column.name=Launch Configurations
-
-ReferencedProjects.propertyTab.name=Referenced Projects
-FileTransfers.propertyTab.name=File Transfers
-General.propertyTab.name=General
-
-# ***** Menu Contributions *****
-
-New.menu.name=New
-Open.menu.name=Open
-OpenAs.menu.name=Open As
-Delete.menu.name=Delete
-Delete.menu.mnemonic=D
-Refresh.menu.name=Refresh
-Refresh.menu.mnemonic=f
-ShowIn.menu.name=Show In
-Properties.menu.name=Properties
+##################################################################################
+# Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
+# This program and the accompanying materials are made available under the terms
+# of the Eclipse Public License v1.0 which accompanies this distribution, and is
+# available at http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Wind River Systems - initial API and implementation
+##################################################################################
+
+pluginName = Target Explorer, Launching, UI
+providerName = Eclipse.org - TCF
+
+# ***** Extension Points *****
+
+ExtensionPoint.tabs.name=Launch Configuration Tabs Extension Point
+
+# ***** Command Contributions *****
+
+command.showInDebugView.name=Show in Debug View Command
+command.showInDebugView.description=Show the selected context in the Debug View
+
+command.attach.name=Attach Context Command
+command.attach.description=Attach to the selected Context
+
+command.detach.name=Detach Context Command
+command.detach.description=Detach from the selected Context
+
+# ***** Editor page Contributions *****
+
+LauchEditorPage.name=Launches
+LauchEditorPage.column.name=Launch Configurations
+
+ReferencedProjects.propertyTab.name=Referenced Projects
+FileTransfers.propertyTab.name=File Transfers
+General.propertyTab.name=General
+
+# ***** Menu Contributions *****
+
+New.menu.name=New
+Open.menu.name=Open
+OpenAs.menu.name=Open As
+Delete.menu.name=Delete
+Delete.menu.mnemonic=D
+Refresh.menu.name=Refresh
+Refresh.menu.mnemonic=f
+ShowIn.menu.name=Show In
+Properties.menu.name=Properties
+
+LauchTree.name=Launches
+
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 1bc2f6b..0847376 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
@@ -33,6 +33,39 @@
</editorPage>
</extension>
+<!-- Navigator viewer contributions -->
+ <extension point="org.eclipse.ui.navigator.viewer">
+ <viewerContentBinding viewerId="org.eclipse.ui.navigator.ProjectExplorer">
+ <includes>
+ <contentExtension
+ pattern="org.eclipse.tcf.te.launch.ui.navigator.project.*"
+ isRoot="false"/>
+ </includes>
+ </viewerContentBinding>
+ </extension>
+
+<!-- Navigator content contributions -->
+ <extension point="org.eclipse.ui.navigator.navigatorContent">
+ <navigatorContent
+ id="org.eclipse.tcf.te.launch.ui.navigator.project.content"
+ name="%LauchTree.name"
+ icon="icons/obj16/root.gif"
+ activeByDefault="false"
+ contentProvider="org.eclipse.tcf.te.launch.ui.internal.viewer.LaunchNavigatorContentProvider"
+ labelProvider="org.eclipse.tcf.te.launch.ui.internal.viewer.LaunchTreeLabelProvider"
+ priority="normal">
+ <triggerPoints>
+ <instanceof value="org.eclipse.core.resources.IProject"/>
+ </triggerPoints>
+ <possibleChildren>
+ <instanceof value="org.eclipse.tcf.te.launch.ui.model.LaunchNode"/>
+ </possibleChildren>
+ <commonSorter
+ class="org.eclipse.tcf.te.launch.ui.internal.viewer.LaunchTreeViewerSorter">
+ </commonSorter>
+ </navigatorContent>
+ </extension>
+
<!-- Viewer contributions -->
<extension point="org.eclipse.tcf.te.ui.viewers">
<viewer
@@ -40,7 +73,7 @@
autoExpandLevel="2"
contentProvider="org.eclipse.tcf.te.launch.ui.internal.viewer.LaunchTreeContentProvider"
helpId="org.eclipse.tcf.te.launch.ui.LaunchEditorPage"
- menuId="org.eclipse.tcf.te.launch.ui.menu.launches">
+ menuId="org.eclipse.tcf.te.launch.ui.editor.menu.launches">
<creation>
<style name="SWT.FULL_SELECTION"/>
<style name="SWT.SINGLE"/>
@@ -59,13 +92,172 @@
<!-- Launches menu contributions -->
<extension point="org.eclipse.ui.menus">
+ <!-- Project explorer launches menu contributions -->
+ <menuContribution locationURI="popup:org.eclipse.ui.navigator.ProjectExplorer#PopupMenu">
+ <separator
+ name="group.new"
+ visible="true">
+ </separator>
+ <menu
+ id="org.eclipse.tcf.te.launch.ui.views.project.menu.new"
+ label="%New.menu.name">
+ <dynamic
+ id="org.eclipse.tcf.te.launch.ui.views.project.dynamic.new"
+ class="org.eclipse.tcf.te.launch.ui.internal.handler.NewLaunchConfigurationContributionItem">
+ <visibleWhen>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate
+ ifEmpty="false"
+ operator="and">
+ <or>
+ <test property="org.eclipse.tcf.te.launch.ui.model.isLaunchConfig"/>
+ <test property="org.eclipse.tcf.te.launch.ui.model.isLaunchConfigType"/>
+ </or>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </dynamic>
+ </menu>
+ <separator
+ name="group.showIn"
+ visible="true">
+ </separator>
+ <menu
+ id="org.eclipse.tcf.te.launch.ui.views.project.menu.showIn"
+ label="%ShowIn.menu.name">
+ <command
+ commandId="org.eclipse.tcf.te.ui.views.command.ShowInProperties"
+ id="org.eclipse.tcf.te.launch.ui.views.project.commands.showInProperties"
+ icon="icons/eview16/prop_ps.gif"
+ label="%Properties.menu.name"
+ style="push">
+ <visibleWhen>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate
+ ifEmpty="false"
+ operator="and">
+ <test property="org.eclipse.tcf.te.launch.ui.model.isLaunchConfig"/>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ <visibleWhen checkEnabled="true"/>
+ </menu>
+ <separator
+ name="group.launch"
+ visible="true">
+ </separator>
+ <dynamic
+ id="org.eclipse.tcf.te.launch.ui.views.project.dynamic.launch"
+ class="org.eclipse.tcf.te.launch.ui.internal.handler.LaunchLaunchConfigurationContributionItem">
+ <visibleWhen>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate
+ ifEmpty="false"
+ operator="and">
+ <test property="org.eclipse.tcf.te.launch.ui.model.isLaunchConfig"/>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </dynamic>
+ <separator
+ name="group.open"
+ visible="true">
+ </separator>
+ <menu
+ id="org.eclipse.tcf.te.launch.ui.views.project.menu.open"
+ label="%Open.menu.name">
+ <dynamic
+ id="org.eclipse.tcf.te.launch.ui.views.project.dynamic.open"
+ class="org.eclipse.tcf.te.launch.ui.internal.handler.OpenLaunchConfigurationContributionItem">
+ </dynamic>
+ <visibleWhen>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate
+ ifEmpty="false"
+ operator="and">
+ <test property="org.eclipse.tcf.te.launch.ui.model.isLaunchConfigType"/>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </menu>
+ <separator
+ name="group.openAs"
+ visible="true">
+ </separator>
+ <menu
+ id="org.eclipse.tcf.te.launch.ui.views.project.menu.openAs"
+ label="%OpenAs.menu.name">
+ <dynamic
+ id="org.eclipse.tcf.te.launch.ui.views.project.dynamic.openAs"
+ class="org.eclipse.tcf.te.launch.ui.internal.handler.OpenLaunchConfigurationContributionItem">
+ </dynamic>
+ <visibleWhen>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate
+ ifEmpty="false"
+ operator="and">
+ <test property="org.eclipse.tcf.te.launch.ui.model.isLaunchConfig"/>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </menu>
+ <separator
+ name="group.delete"
+ visible="false">
+ </separator>
+ <command
+ commandId="org.eclipse.ui.edit.delete"
+ id="org.eclipse.tcf.te.launch.ui.views.project.commands.delete"
+ label="%Delete.menu.name"
+ mnemonic="%Delete.menu.mnemonic"
+ style="push">
+ <visibleWhen checkEnabled="false">
+ <with variable="selection">
+ <count value="1"/>
+ <iterate
+ ifEmpty="false"
+ operator="and">
+ <test property="org.eclipse.tcf.te.ui.views.isDeletableElement"/>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ <separator
+ name="group.refresh"
+ visible="true">
+ </separator>
+ <command
+ commandId="org.eclipse.tcf.te.ui.command.refresh"
+ id="org.eclipse.tcf.te.launch.ui.views.project.commands.refresh"
+ label="%Refresh.menu.name"
+ mnemonic="%Refresh.menu.mnemonic"
+ style="push">
+ <visibleWhen checkEnabled="false">
+ <with variable="selection">
+ <count value="1"/>
+ <iterate
+ ifEmpty="false"
+ operator="and">
+ <test property="org.eclipse.tcf.te.ui.views.isRefreshableElement"/>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+
<!-- Target explorer launches menu contributions -->
<menuContribution locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.new">
<menu
id="org.eclipse.tcf.te.ui.views.View.menu.new"
label="%New.menu.name">
<dynamic
- id="org.eclipse.tcf.te.launch.ui.navigator.dynamic.new"
+ id="org.eclipse.tcf.te.launch.ui.views.target.dynamic.new"
class="org.eclipse.tcf.te.launch.ui.internal.handler.NewLaunchConfigurationContributionItem">
<visibleWhen>
<with variable="selection">
@@ -85,7 +277,7 @@
</menuContribution>
<menuContribution locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.launch">
<dynamic
- id="org.eclipse.tcf.te.launch.ui.navigator.dynamic.launch"
+ id="org.eclipse.tcf.te.launch.ui.views.target.dynamic.launch"
class="org.eclipse.tcf.te.launch.ui.internal.handler.LaunchLaunchConfigurationContributionItem">
<visibleWhen>
<with variable="selection">
@@ -101,10 +293,10 @@
</menuContribution>
<menuContribution locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.edit">
<menu
- id="org.eclipse.tcf.te.launch.ui.navigator.menu.open"
+ id="org.eclipse.tcf.te.launch.ui.views.target.menu.open"
label="%Open.menu.name">
<dynamic
- id="org.eclipse.tcf.te.launch.ui.navigator.dynamic.open"
+ id="org.eclipse.tcf.te.launch.ui.views.target.dynamic.open"
class="org.eclipse.tcf.te.launch.ui.internal.handler.OpenLaunchConfigurationContributionItem">
</dynamic>
<visibleWhen>
@@ -119,10 +311,10 @@
</visibleWhen>
</menu>
<menu
- id="org.eclipse.tcf.te.launch.ui.navigator.menu.openAs"
+ id="org.eclipse.tcf.te.launch.ui.views.target.menu.openAs"
label="%OpenAs.menu.name">
<dynamic
- id="org.eclipse.tcf.te.launch.ui.navigator.dynamic.openAs"
+ id="org.eclipse.tcf.te.launch.ui.views.target.dynamic.openAs"
class="org.eclipse.tcf.te.launch.ui.internal.handler.OpenLaunchConfigurationContributionItem">
</dynamic>
<visibleWhen>
@@ -139,16 +331,16 @@
</menuContribution>
<!-- Launches editor page menu contributions -->
- <menuContribution locationURI="popup:org.eclipse.tcf.te.launch.ui.menu.launches">
+ <menuContribution locationURI="popup:org.eclipse.tcf.te.launch.ui.editor.menu.launches">
<separator
name="group.new"
visible="true">
</separator>
<menu
- id="org.eclipse.tcf.te.launch.ui.menu.new"
+ id="org.eclipse.tcf.te.launch.ui.editor.menu.new"
label="%New.menu.name">
<dynamic
- id="org.eclipse.tcf.te.launch.ui.dynamic.new"
+ id="org.eclipse.tcf.te.launch.ui.editor.dynamic.new"
class="org.eclipse.tcf.te.launch.ui.internal.handler.NewLaunchConfigurationContributionItem">
<visibleWhen>
<with variable="selection">
@@ -170,10 +362,11 @@
visible="true">
</separator>
<menu
- id="org.eclipse.tcf.te.launch.ui.menu.showIn"
+ id="org.eclipse.tcf.te.launch.ui.editor.menu.showIn"
label="%ShowIn.menu.name">
<command
commandId="org.eclipse.tcf.te.ui.views.command.ShowInProperties"
+ id="org.eclipse.tcf.te.launch.ui.editor.commands.showInProperties"
icon="icons/eview16/prop_ps.gif"
label="%Properties.menu.name"
style="push">
@@ -195,7 +388,7 @@
visible="true">
</separator>
<dynamic
- id="org.eclipse.tcf.te.launch.ui.dynamic.launch"
+ id="org.eclipse.tcf.te.launch.ui.editor.dynamic.launch"
class="org.eclipse.tcf.te.launch.ui.internal.handler.LaunchLaunchConfigurationContributionItem">
<visibleWhen>
<with variable="selection">
@@ -213,10 +406,10 @@
visible="true">
</separator>
<menu
- id="org.eclipse.tcf.te.launch.ui.menu.open"
+ id="org.eclipse.tcf.te.launch.ui.editor.menu.open"
label="%Open.menu.name">
<dynamic
- id="org.eclipse.tcf.te.launch.ui.dynamic.open"
+ id="org.eclipse.tcf.te.launch.ui.editor.dynamic.open"
class="org.eclipse.tcf.te.launch.ui.internal.handler.OpenLaunchConfigurationContributionItem">
</dynamic>
<visibleWhen>
@@ -231,10 +424,10 @@
</visibleWhen>
</menu>
<menu
- id="org.eclipse.tcf.te.launch.ui.menu.openAs"
+ id="org.eclipse.tcf.te.launch.ui.editor.menu.openAs"
label="%OpenAs.menu.name">
<dynamic
- id="org.eclipse.tcf.te.launch.ui.dynamic.openAs"
+ id="org.eclipse.tcf.te.launch.ui.editor.dynamic.openAs"
class="org.eclipse.tcf.te.launch.ui.internal.handler.OpenLaunchConfigurationContributionItem">
</dynamic>
<visibleWhen>
@@ -254,7 +447,7 @@
</separator>
<command
commandId="org.eclipse.ui.edit.delete"
- id="org.eclipse.tcf.te.launch.ui.commands.delete"
+ id="org.eclipse.tcf.te.launch.ui.editor.commands.delete"
label="%Delete.menu.name"
mnemonic="%Delete.menu.mnemonic"
style="push">
@@ -275,7 +468,7 @@
</separator>
<command
commandId="org.eclipse.tcf.te.ui.command.refresh"
- id="org.eclipse.tcf.te.launch.ui.commands.refresh"
+ id="org.eclipse.tcf.te.launch.ui.editor.commands.refresh"
label="%Refresh.menu.name"
mnemonic="%Refresh.menu.mnemonic"
style="push">
@@ -333,12 +526,66 @@
<!-- Handler contributions -->
<extension point="org.eclipse.ui.handlers">
<handler
+ class="org.eclipse.tcf.te.ui.views.handler.DeleteHandler"
+ commandId="org.eclipse.ui.edit.delete">
+ <activeWhen>
+ <and>
+ <with variable="activePartId">
+ <equals value="org.eclipse.ui.navigator.ProjectExplorer"/>
+ </with>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate
+ ifEmpty="false"
+ operator="and">
+ <test property="org.eclipse.tcf.te.launch.ui.model.isLaunchConfig"/>
+ </iterate>
+ </with>
+ </and>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.eclipse.tcf.te.ui.views.handler.RefreshHandler"
+ commandId="org.eclipse.tcf.te.ui.command.refresh">
+ <activeWhen>
+ <and>
+ <with variable="activePartId">
+ <equals value="org.eclipse.ui.navigator.ProjectExplorer"/>
+ </with>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate
+ ifEmpty="false"
+ operator="and">
+ <instanceof value="org.eclipse.tcf.te.launch.ui.model.LaunchNode"/>
+ </iterate>
+ </with>
+ </and>
+ </activeWhen>
+ </handler>
+ <handler
class="org.eclipse.tcf.te.ui.views.handler.ShowInPropertiesHandler"
commandId="org.eclipse.tcf.te.ui.views.command.ShowInProperties">
<activeWhen>
- <with variable="activePartId">
- <equals value="org.eclipse.tcf.te.ui.views.Editor"/>
- </with>
+ <and>
+ <with variable="activePartId">
+ <or>
+ <equals value="org.eclipse.tcf.te.ui.views.Editor"/>
+ <equals value="org.eclipse.ui.navigator.ProjectExplorer"/>
+ </or>
+ </with>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate
+ ifEmpty="false"
+ operator="and">
+ <or>
+ <test property="org.eclipse.tcf.te.launch.ui.model.isLaunchConfigType"/>
+ <test property="org.eclipse.tcf.te.launch.ui.model.isLaunchConfig"/>
+ </or>
+ </iterate>
+ </with>
+ </and>
</activeWhen>
</handler>
</extension>
@@ -360,6 +607,23 @@
category="org.eclipse.tcf.te"/>
</propertyTabs>
</extension>
+
+ <extension point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
+ <propertyTabs contributorId="org.eclipse.ui.navigator.ProjectExplorer">
+ <propertyTab
+ id="org.eclipse.tcf.te.launch.ui.project.propertytab.refprojects"
+ label="%ReferencedProjects.propertyTab.name"
+ category="general"/>
+ <propertyTab
+ id="org.eclipse.tcf.te.launch.ui.project.propertytab.filetransfers"
+ label="%FileTransfers.propertyTab.name"
+ category="general"/>
+ <propertyTab
+ id="org.eclipse.tcf.te.launch.ui.project.propertytab.general"
+ label="%General.propertyTab.name"
+ category="general"/>
+ </propertyTabs>
+ </extension>
<!-- Property section contributions -->
<extension point="org.eclipse.ui.views.properties.tabbed.propertySections">
@@ -390,4 +654,33 @@
tab="org.eclipse.tcf.te.launch.ui.propertytab.filetransfers"/>
</propertySections>
</extension>
+
+ <extension point="org.eclipse.ui.views.properties.tabbed.propertySections">
+ <propertySections contributorId="org.eclipse.ui.navigator.ProjectExplorer">
+ <propertySection
+ id="org.eclipse.tcf.te.launch.ui.project.launchconfigtype"
+ class="org.eclipse.tcf.te.launch.ui.internal.properties.LaunchConfigTypePropertiesSection"
+ enablesFor="1"
+ filter="org.eclipse.tcf.te.launch.ui.internal.properties.LaunchConfigTypeFilter"
+ tab="org.eclipse.tcf.te.launch.ui.project.propertytab.general"/>
+ <propertySection
+ id="org.eclipse.tcf.te.launch.ui.project.launchcontext"
+ class="org.eclipse.tcf.te.launch.ui.internal.properties.LaunchContextPropertiesSection"
+ enablesFor="1"
+ filter="org.eclipse.tcf.te.launch.ui.internal.properties.LaunchContextFilter"
+ tab="org.eclipse.tcf.te.launch.ui.project.propertytab.general"/>
+ <propertySection
+ id="org.eclipse.tcf.te.launch.ui.project.propertysection.refprojetcs"
+ class="org.eclipse.tcf.te.launch.ui.internal.properties.RefProjectsPropertiesSection"
+ enablesFor="1"
+ filter="org.eclipse.tcf.te.launch.ui.internal.properties.RefProjectsFilter"
+ tab="org.eclipse.tcf.te.launch.ui.project.propertytab.refprojects"/>
+ <propertySection
+ id="org.eclipse.tcf.te.launch.ui.project.propertysection.filetransfers"
+ class="org.eclipse.tcf.te.launch.ui.internal.properties.FileTransferPropertiesSection"
+ enablesFor="1"
+ filter="org.eclipse.tcf.te.launch.ui.internal.properties.FileTransferFilter"
+ tab="org.eclipse.tcf.te.launch.ui.project.propertytab.filetransfers"/>
+ </propertySections>
+ </extension>
</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/adapters/RefreshHandlerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/adapters/RefreshHandlerDelegate.java
index 8165201..7807a58 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/adapters/RefreshHandlerDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/adapters/RefreshHandlerDelegate.java
@@ -1,53 +1,53 @@
-/*******************************************************************************
- * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.launch.ui.internal.adapters;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.tcf.te.launch.ui.model.LaunchModel;
-import org.eclipse.tcf.te.launch.ui.model.LaunchNode;
-import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.ui.views.interfaces.handler.IRefreshHandlerDelegate;
-
-/**
- * Launch tree node refresh handler delegate implementation.
- */
-public class RefreshHandlerDelegate implements IRefreshHandlerDelegate {
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.interfaces.handler.IRefreshHandlerDelegate#canRefresh(java.lang.Object)
- */
- @Override
- public boolean canRefresh(Object element) {
- if (element instanceof LaunchNode) {
- return true;
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.interfaces.handler.IRefreshHandlerDelegate#refresh(java.lang.Object, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
- */
- @Override
- public void refresh(Object element, IPropertiesContainer state, ICallback callback) {
- Assert.isNotNull(element);
- Assert.isNotNull(state);
-
- if (canRefresh(element)) {
- LaunchNode node = (LaunchNode) element;
- LaunchModel model = LaunchModel.getLaunchModel(node.getRootModelNode());
- model.refresh();
- }
- if (callback != null) {
- callback.done(this, Status.OK_STATUS);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.launch.ui.internal.adapters;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.tcf.te.launch.ui.model.LaunchModel;
+import org.eclipse.tcf.te.launch.ui.model.LaunchNode;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.ui.views.interfaces.handler.IRefreshHandlerDelegate;
+
+/**
+ * Launch tree node refresh handler delegate implementation.
+ */
+public class RefreshHandlerDelegate implements IRefreshHandlerDelegate {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.interfaces.handler.IRefreshHandlerDelegate#canRefresh(java.lang.Object)
+ */
+ @Override
+ public boolean canRefresh(Object element) {
+ if (element instanceof LaunchNode) {
+ return true;
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.interfaces.handler.IRefreshHandlerDelegate#refresh(java.lang.Object, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ */
+ @Override
+ public void refresh(Object element, IPropertiesContainer state, ICallback callback) {
+ Assert.isNotNull(element);
+ Assert.isNotNull(state);
+
+ if (canRefresh(element)) {
+ LaunchNode node = (LaunchNode) element;
+ LaunchModel model = node.getModel();
+ model.refresh();
+ }
+ if (callback != null) {
+ callback.done(this, Status.OK_STATUS);
+ }
+ }
+}
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 0c20586..58ba1d1 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
@@ -1,137 +1,158 @@
-/*******************************************************************************
- * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tcf.te.launch.ui.internal.handler;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.expressions.IEvaluationContext;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchMode;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.ILaunchGroup;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.tcf.te.launch.core.lm.LaunchConfigHelper;
-import org.eclipse.tcf.te.launch.core.lm.LaunchManager;
-import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchManagerDelegate;
-import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification;
-import org.eclipse.tcf.te.launch.core.selection.interfaces.ILaunchSelection;
-import org.eclipse.tcf.te.launch.ui.activator.UIPlugin;
-import org.eclipse.tcf.te.launch.ui.model.LaunchNode;
-import org.eclipse.tcf.te.launch.ui.selection.LaunchSelectionManager;
-import org.eclipse.ui.ISources;
-import org.eclipse.ui.actions.CompoundContributionItem;
-import org.eclipse.ui.handlers.IHandlerService;
-import org.eclipse.ui.menus.IWorkbenchContribution;
-import org.eclipse.ui.services.IServiceLocator;
-
-/**
- * LaunchLaunchConfigurationContributionItem
- */
-public class NewLaunchConfigurationContributionItem extends CompoundContributionItem implements IWorkbenchContribution {
-
- private boolean enabled = true;
-
- // Service locator to located the handler service.
- private IServiceLocator serviceLocator;
-
- /**
- * Constructor.
- */
- public NewLaunchConfigurationContributionItem() {
- super();
- }
-
- /**
- * Constructor.
- * @param id
- */
- public NewLaunchConfigurationContributionItem(String id) {
- super(id);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.menus.IWorkbenchContribution#initialize(org.eclipse.ui.services.IServiceLocator)
- */
- @Override
- public void initialize(IServiceLocator serviceLocator) {
- this.serviceLocator = serviceLocator;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.ContributionItem#isEnabled()
- */
- @Override
- public boolean isEnabled() {
- return enabled;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()
- */
- @Override
- protected IContributionItem[] getContributionItems() {
- // Get the selected node.
- IHandlerService service = (IHandlerService)serviceLocator.getService(IHandlerService.class);
- IEvaluationContext state = service.getCurrentState();
- 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 sel = LaunchSelectionManager.getInstance().getLaunchSelection(type, mode, LaunchSelectionManager.PART_ID_TE_VIEW);
- final ILaunchSpecification launchSpec = delegate.getLaunchSpecification(type.getIdentifier(), sel);
- 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));
- }
- }
- catch (Exception e) {
- }
- }
-
- enabled = !items.isEmpty();
- return items.toArray(new IContributionItem[items.size()]);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tcf.te.launch.ui.internal.handler;
+
+import java.util.ArrayList;
+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;
+import org.eclipse.debug.core.ILaunchMode;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.ILaunchGroup;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.tcf.te.launch.core.lm.LaunchConfigHelper;
+import org.eclipse.tcf.te.launch.core.lm.LaunchManager;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchManagerDelegate;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification;
+import org.eclipse.tcf.te.launch.core.selection.LaunchSelection;
+import org.eclipse.tcf.te.launch.core.selection.ProjectSelectionContext;
+import org.eclipse.tcf.te.launch.core.selection.RemoteSelectionContext;
+import org.eclipse.tcf.te.launch.core.selection.interfaces.ILaunchSelection;
+import org.eclipse.tcf.te.launch.core.selection.interfaces.ISelectionContext;
+import org.eclipse.tcf.te.launch.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.launch.ui.model.LaunchNode;
+import org.eclipse.tcf.te.launch.ui.selection.LaunchSelectionManager;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+import org.eclipse.ui.ISources;
+import org.eclipse.ui.actions.CompoundContributionItem;
+import org.eclipse.ui.handlers.IHandlerService;
+import org.eclipse.ui.menus.IWorkbenchContribution;
+import org.eclipse.ui.services.IServiceLocator;
+
+/**
+ * LaunchLaunchConfigurationContributionItem
+ */
+public class NewLaunchConfigurationContributionItem extends CompoundContributionItem implements IWorkbenchContribution {
+
+ private boolean enabled = true;
+
+ // Service locator to located the handler service.
+ private IServiceLocator serviceLocator;
+
+ /**
+ * Constructor.
+ */
+ public NewLaunchConfigurationContributionItem() {
+ super();
+ }
+
+ /**
+ * Constructor.
+ * @param id
+ */
+ public NewLaunchConfigurationContributionItem(String id) {
+ super(id);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.menus.IWorkbenchContribution#initialize(org.eclipse.ui.services.IServiceLocator)
+ */
+ @Override
+ public void initialize(IServiceLocator serviceLocator) {
+ this.serviceLocator = serviceLocator;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.ContributionItem#isEnabled()
+ */
+ @Override
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()
+ */
+ @Override
+ protected IContributionItem[] getContributionItems() {
+ // Get the selected node.
+ IHandlerService service = (IHandlerService)serviceLocator.getService(IHandlerService.class);
+ IEvaluationContext state = service.getCurrentState();
+ 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 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));
+ }
+ }
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ enabled = !items.isEmpty();
+ return items.toArray(new IContributionItem[items.size()]);
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/viewer/LaunchNavigatorContentProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/viewer/LaunchNavigatorContentProvider.java
index 4a11a10..1774177 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/viewer/LaunchNavigatorContentProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/viewer/LaunchNavigatorContentProvider.java
@@ -1,163 +1,165 @@
-/*******************************************************************************
- * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.launch.ui.internal.viewer;
-
-import java.util.EventObject;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.viewers.ITreeViewerListener;
-import org.eclipse.jface.viewers.TreeExpansionEvent;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.tcf.te.launch.ui.model.LaunchModel;
-import org.eclipse.tcf.te.launch.ui.model.LaunchNode;
-import org.eclipse.tcf.te.runtime.events.ChangeEvent;
-import org.eclipse.tcf.te.runtime.events.EventManager;
-import org.eclipse.tcf.te.runtime.interfaces.events.IEventListener;
-import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
-import org.eclipse.tcf.te.ui.trees.TreeContentProvider;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.navigator.ICommonContentExtensionSite;
-import org.eclipse.ui.navigator.ICommonContentProvider;
-
-/**
- * Launches content provider for the common navigator of Target Explorer.
- */
-public class LaunchNavigatorContentProvider extends TreeContentProvider implements ICommonContentProvider, ITreeViewerListener, IEventListener {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
- */
- @Override
- public Object getParent(Object element) {
- if (element instanceof LaunchNode) {
- LaunchNode node = (LaunchNode)element;
- if (LaunchNode.TYPE_ROOT.equals(node.getType())) {
- return node.getRootModelNode();
- }
-
- if (!isRootNodeVisible() && LaunchNode.TYPE_LAUNCH_CONFIG_TYPE.equals(node.getType())) {
- return node.getRootModelNode();
- }
- return ((LaunchNode)element).getParent();
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.trees.TreeContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- super.inputChanged(viewer, oldInput, newInput);
- EventManager.getInstance().addEventListener(this, ChangeEvent.class);
- this.viewer.addTreeListener(this);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.trees.TreeContentProvider#dispose()
- */
- @Override
- public void dispose() {
- super.dispose();
- EventManager.getInstance().removeEventListener(this);
- this.viewer.removeTreeListener(this);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
- */
- @Override
- public Object[] getChildren(Object element) {
- super.getChildren(element);
-
- if (element instanceof LaunchNode) {
- return ((LaunchNode)element).getChildren();
- }
- else if (element instanceof IModelNode) {
- if (isRootNodeVisible()) {
- return new Object[]{LaunchModel.getLaunchModel((IModelNode)element).getRoot()};
- }
- return LaunchModel.getLaunchModel((IModelNode)element).getRoot().getChildren();
- }
- return NO_ELEMENTS;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
- */
- @Override
- public boolean hasChildren(Object element) {
- if (element instanceof LaunchNode) {
- return ((LaunchNode)element).hasChildren();
- }
- else if (element instanceof IModelNode) {
- return LaunchModel.getLaunchModel((IModelNode)element).getRoot().hasChildren();
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.navigator.ICommonContentProvider#init(org.eclipse.ui.navigator.ICommonContentExtensionSite)
- */
- @Override
- public void init(ICommonContentExtensionSite config) {
- Assert.isNotNull(config);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.navigator.IMementoAware#restoreState(org.eclipse.ui.IMemento)
- */
- @Override
- public void restoreState(IMemento aMemento) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.navigator.IMementoAware#saveState(org.eclipse.ui.IMemento)
- */
- @Override
- public void saveState(IMemento aMemento) {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeViewerListener#treeCollapsed(org.eclipse.jface.viewers.TreeExpansionEvent)
- */
- @Override
- public void treeCollapsed(TreeExpansionEvent event) {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeViewerListener#treeExpanded(org.eclipse.jface.viewers.TreeExpansionEvent)
- */
- @Override
- public void treeExpanded(TreeExpansionEvent event) {
- }
-
- /**
- * If the root node of the tree is visible.
- *
- * @return true if it is visible.
- */
- protected boolean isRootNodeVisible() {
- return true;
- }
-
- @Override
- public void eventFired(EventObject event) {
- if (event.getSource() instanceof LaunchModel) {
- this.viewer.refresh(true);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.launch.ui.internal.viewer;
+
+import java.util.EventObject;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.ITreeViewerListener;
+import org.eclipse.jface.viewers.TreeExpansionEvent;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.tcf.te.launch.ui.model.LaunchModel;
+import org.eclipse.tcf.te.launch.ui.model.LaunchNode;
+import org.eclipse.tcf.te.runtime.events.ChangeEvent;
+import org.eclipse.tcf.te.runtime.events.EventManager;
+import org.eclipse.tcf.te.runtime.interfaces.events.IEventListener;
+import org.eclipse.tcf.te.ui.trees.TreeContentProvider;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonContentProvider;
+
+/**
+ * Launches content provider for the common navigator of Target Explorer.
+ */
+public class LaunchNavigatorContentProvider extends TreeContentProvider implements ICommonContentProvider, ITreeViewerListener, IEventListener {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+ */
+ @Override
+ public Object getParent(Object element) {
+ if (element instanceof LaunchNode) {
+ LaunchNode node = (LaunchNode)element;
+ if (node.getParent() == null || LaunchNode.TYPE_ROOT.equals(node.getType())) {
+ return node.getModel().getModelRoot();
+ }
+
+ if (!isRootNodeVisible() && LaunchNode.TYPE_LAUNCH_CONFIG_TYPE.equals(node.getType())) {
+ return node.getModel().getModelRoot();
+ }
+ return node.getParent();
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.trees.TreeContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ super.inputChanged(viewer, oldInput, newInput);
+ EventManager.getInstance().addEventListener(this, ChangeEvent.class);
+ this.viewer.addTreeListener(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.trees.TreeContentProvider#dispose()
+ */
+ @Override
+ public void dispose() {
+ super.dispose();
+ EventManager.getInstance().removeEventListener(this);
+ this.viewer.removeTreeListener(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+ */
+ @Override
+ public Object[] getChildren(Object element) {
+ super.getChildren(element);
+
+ if (element instanceof LaunchNode) {
+ return ((LaunchNode)element).getChildren();
+ }
+
+ LaunchModel model = LaunchModel.getLaunchModel(element);
+ if (model != null) {
+ if (isRootNodeVisible()) {
+ return new Object[]{model.getRootNode()};
+ }
+ return model.getRootNode().getChildren();
+ }
+ return NO_ELEMENTS;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+ */
+ @Override
+ public boolean hasChildren(Object element) {
+ if (element instanceof LaunchNode) {
+ return ((LaunchNode)element).hasChildren();
+ }
+ LaunchModel model = LaunchModel.getLaunchModel(element);
+ if (model != null) {
+ return model.getRootNode().hasChildren();
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.navigator.ICommonContentProvider#init(org.eclipse.ui.navigator.ICommonContentExtensionSite)
+ */
+ @Override
+ public void init(ICommonContentExtensionSite config) {
+ Assert.isNotNull(config);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.navigator.IMementoAware#restoreState(org.eclipse.ui.IMemento)
+ */
+ @Override
+ public void restoreState(IMemento aMemento) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.navigator.IMementoAware#saveState(org.eclipse.ui.IMemento)
+ */
+ @Override
+ public void saveState(IMemento aMemento) {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeViewerListener#treeCollapsed(org.eclipse.jface.viewers.TreeExpansionEvent)
+ */
+ @Override
+ public void treeCollapsed(TreeExpansionEvent event) {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeViewerListener#treeExpanded(org.eclipse.jface.viewers.TreeExpansionEvent)
+ */
+ @Override
+ public void treeExpanded(TreeExpansionEvent event) {
+ }
+
+ /**
+ * If the root node of the tree is visible.
+ *
+ * @return true if it is visible.
+ */
+ protected boolean isRootNodeVisible() {
+ return true;
+ }
+
+ @Override
+ public void eventFired(EventObject event) {
+ if (event.getSource() instanceof LaunchModel) {
+ this.viewer.refresh(true);
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/viewer/LaunchTreeLabelProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/viewer/LaunchTreeLabelProvider.java
index 7c534fd..962ab9c 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/viewer/LaunchTreeLabelProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/viewer/LaunchTreeLabelProvider.java
@@ -1,97 +1,98 @@
-/*******************************************************************************
- * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.launch.ui.internal.viewer;
-
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.tcf.te.launch.ui.activator.UIPlugin;
-import org.eclipse.tcf.te.launch.ui.internal.ImageConsts;
-import org.eclipse.tcf.te.launch.ui.model.LaunchNode;
-import org.eclipse.tcf.te.ui.jface.images.AbstractImageDescriptor;
-
-/**
- * The label provider for the tree column "launchConfigurations".
- */
-public class LaunchTreeLabelProvider extends LabelProvider implements ILabelDecorator {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
- */
- @Override
- public String getText(Object element) {
- if (element instanceof LaunchNode) {
- return ((LaunchNode)element).getName();
- }
- else if (element instanceof ILaunchConfigurationType) {
- return ((ILaunchConfigurationType)element).getName();
- }
- else if (element instanceof ILaunchConfiguration) {
- return ((ILaunchConfiguration)element).getName();
- }
- return super.getText(element);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
- */
- @Override
- public Image getImage(Object element) {
- if (element instanceof LaunchNode) {
- Image image = null;
- LaunchNode node = (LaunchNode)element;
- if (LaunchNode.TYPE_ROOT.equals(node.getType())) {
- image = UIPlugin.getImage(ImageConsts.OBJ_Launches_Root);
- }
- else if (LaunchNode.TYPE_LAUNCH_CONFIG_TYPE.equals(node.getType())) {
- image = DebugUITools.getImage(node.getLaunchConfigurationType().getIdentifier());
- }
- else if (LaunchNode.TYPE_LAUNCH_CONFIG.equals(node.getType())) {
- try {
- image = DebugUITools.getImage(node.getLaunchConfiguration().getType().getIdentifier());
- }
- catch (Exception e) {
- }
- }
- if (image != null) {
- return decorateImage(image, element);
- }
- }
- return super.getImage(element);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ILabelDecorator#decorateImage(org.eclipse.swt.graphics.Image, java.lang.Object)
- */
- @Override
- public Image decorateImage(final Image image, final Object element) {
- Image decoratedImage = null;
-
- if (image != null && element instanceof LaunchNode) {
- AbstractImageDescriptor descriptor = new LaunchNodeImageDescriptor(UIPlugin.getDefault().getImageRegistry(),
- image,
- (LaunchNode)element);
- decoratedImage = UIPlugin.getSharedImage(descriptor);
- }
-
- return decoratedImage;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ILabelDecorator#decorateText(java.lang.String, java.lang.Object)
- */
- @Override
- public String decorateText(final String text, final Object element) {
- return text;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.launch.ui.internal.viewer;
+
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.tcf.te.launch.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.launch.ui.internal.ImageConsts;
+import org.eclipse.tcf.te.launch.ui.model.LaunchNode;
+import org.eclipse.tcf.te.ui.jface.images.AbstractImageDescriptor;
+import org.eclipse.ui.navigator.IDescriptionProvider;
+
+/**
+ * The label provider for the tree column "launchConfigurations".
+ */
+public class LaunchTreeLabelProvider extends LabelProvider implements ILabelDecorator, IDescriptionProvider {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+ */
+ @Override
+ public String getText(Object element) {
+ if (element instanceof LaunchNode) {
+ return ((LaunchNode)element).getName();
+ }
+ return super.getText(element);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+ */
+ @Override
+ public Image getImage(Object element) {
+ if (element instanceof LaunchNode) {
+ Image image = null;
+ LaunchNode node = (LaunchNode)element;
+ if (LaunchNode.TYPE_ROOT.equals(node.getType())) {
+ image = UIPlugin.getImage(ImageConsts.OBJ_Launches_Root);
+ }
+ else if (LaunchNode.TYPE_LAUNCH_CONFIG_TYPE.equals(node.getType())) {
+ image = DebugUITools.getImage(node.getLaunchConfigurationType().getIdentifier());
+ }
+ else if (LaunchNode.TYPE_LAUNCH_CONFIG.equals(node.getType())) {
+ try {
+ image = DebugUITools.getImage(node.getLaunchConfiguration().getType().getIdentifier());
+ }
+ catch (Exception e) {
+ }
+ }
+ if (image != null) {
+ return decorateImage(image, element);
+ }
+ }
+ return super.getImage(element);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelDecorator#decorateImage(org.eclipse.swt.graphics.Image, java.lang.Object)
+ */
+ @Override
+ public Image decorateImage(final Image image, final Object element) {
+ Image decoratedImage = null;
+
+ if (image != null && element instanceof LaunchNode) {
+ AbstractImageDescriptor descriptor = new LaunchNodeImageDescriptor(UIPlugin.getDefault().getImageRegistry(),
+ image,
+ (LaunchNode)element);
+ decoratedImage = UIPlugin.getSharedImage(descriptor);
+ }
+
+ return decoratedImage;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelDecorator#decorateText(java.lang.String, java.lang.Object)
+ */
+ @Override
+ public String decorateText(final String text, final Object element) {
+ return text;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.navigator.IDescriptionProvider#getDescription(java.lang.Object)
+ */
+ @Override
+ public String getDescription(Object element) {
+ return getText(element);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchModel.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchModel.java
index 92692a2..183f29b 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchModel.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchModel.java
@@ -1,171 +1,197 @@
-/*******************************************************************************
- * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tcf.te.launch.ui.model;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationListener;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.tcf.te.launch.core.bindings.LaunchConfigTypeBindingsManager;
-import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPersistenceDelegate;
-import org.eclipse.tcf.te.launch.core.selection.LaunchSelection;
-import org.eclipse.tcf.te.launch.core.selection.RemoteSelectionContext;
-import org.eclipse.tcf.te.launch.ui.activator.UIPlugin;
-import org.eclipse.tcf.te.runtime.events.ChangeEvent;
-import org.eclipse.tcf.te.runtime.events.EventManager;
-import org.eclipse.tcf.te.runtime.model.interfaces.IContainerModelNode;
-import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService;
-
-/**
- * LaunchModel
- */
-public final class LaunchModel {
-
- /* default */static final String LAUNCH_MODEL_KEY = UIPlugin.getUniqueIdentifier() + ".launch.root"; //$NON-NLS-1$
-
- /**
- * Get the file system model of the peer model. If it does not
- * exist yet, create a new instance and store it.
- *
- * @param peerModel The peer model
- * @return The file system model connected this peer model.
- */
- public static LaunchModel getLaunchModel(final IModelNode modelNode) {
- if (modelNode != null) {
- IPropertiesAccessService service = ServiceManager.getInstance().getService(modelNode, IPropertiesAccessService.class);
- LaunchModel model = service != null ? (LaunchModel)service.getProperty(modelNode, LAUNCH_MODEL_KEY) : (LaunchModel)modelNode.getProperty(LAUNCH_MODEL_KEY);
- if (model == null) {
- model = new LaunchModel(modelNode);
- if (service != null) {
- service.setProperty(modelNode, LAUNCH_MODEL_KEY, model);
- }
- else {
- modelNode.setProperty(LAUNCH_MODEL_KEY, model);
- }
- }
- return model;
- }
- return null;
- }
-
- private final LaunchNode root;
-
- /**
- * Constructor.
- */
- private LaunchModel(IModelNode node) {
- root = new LaunchNode(node);
- refresh();
- DebugPlugin.getDefault().getLaunchManager().addLaunchConfigurationListener(new ILaunchConfigurationListener() {
- @Override
- public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
- if (!configuration.isWorkingCopy()) {
- if (refresh()) {
- EventManager.getInstance().fireEvent(new ChangeEvent(LaunchModel.this, "launchRemoved", null, null)); //$NON-NLS-1$
- }
- }
- }
- @Override
- public void launchConfigurationChanged(ILaunchConfiguration configuration) {
- if (!configuration.isWorkingCopy()) {
- refresh();
- EventManager.getInstance().fireEvent(new ChangeEvent(LaunchModel.this, "launchChanged", null, null)); //$NON-NLS-1$
- }
- }
- @Override
- public void launchConfigurationAdded(ILaunchConfiguration configuration) {
- if (!configuration.isWorkingCopy()) {
- if (refresh()) {
- EventManager.getInstance().fireEvent(new ChangeEvent(LaunchModel.this, "launchAdded", null, null)); //$NON-NLS-1$
- }
- }
- }
- });
- }
-
- public LaunchNode getRoot() {
- return root;
- }
-
- public boolean refresh() {
- boolean changed = false;
- IModelNode parent = root.getRootModelNode();
- String[] typeIds = LaunchConfigTypeBindingsManager.getInstance().getValidLaunchConfigTypes(
- new LaunchSelection(null, new RemoteSelectionContext(parent, true)));
- List<IModelNode> typeNodes = new ArrayList<IModelNode>(Arrays.asList(root.getChildren()));
- for (String typeId : typeIds) {
- ILaunchConfigurationType type = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(typeId);
- if (type.isPublic()) {
- IModelNode typeNode = find(type, typeNodes);
- if (typeNode != null) {
- typeNodes.remove(typeNode);
- }
- else {
- typeNode = new LaunchNode(type);
- root.add(typeNode);
- changed = true;
- }
-
- ILaunchConfiguration[] configs;
- try {
- configs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(type);
- }
- catch (Exception e) {
- configs = new ILaunchConfiguration[0];
- }
-
- List<IModelNode> configNodes = new ArrayList<IModelNode>(Arrays.asList(((IContainerModelNode)typeNode).getChildren()));
- for (ILaunchConfiguration config : configs) {
- IModelNode[] contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(config);
- if (parent != null && (contexts == null || Arrays.asList(contexts).contains(parent))) {
- IModelNode configNode = find(config, configNodes);
- if (configNode != null) {
- configNodes.remove(configNode);
- }
- else {
- configNode = new LaunchNode(config);
- ((IContainerModelNode)typeNode).add(configNode);
- changed = true;
- }
- }
- }
- for (IModelNode configToDelete : configNodes) {
- ((IContainerModelNode)typeNode).remove(configToDelete, true);
- changed = true;
- }
- }
- for (IModelNode typeToDelete : typeNodes) {
- root.remove(typeToDelete, true);
- changed = true;
- }
- }
- return changed;
- }
-
- private IModelNode find(Object data, List<IModelNode> list) {
- for (IModelNode candidate : list) {
- if (candidate instanceof LaunchNode) {
- if ((data instanceof LaunchNode && ((LaunchNode)candidate).equals(data)) ||
- (data instanceof ILaunchConfiguration && ((LaunchNode)candidate).equals(new LaunchNode((ILaunchConfiguration)data))) ||
- (data instanceof ILaunchConfigurationType && ((LaunchNode)candidate).equals(new LaunchNode((ILaunchConfigurationType)data)))) {
- return candidate;
- }
- }
- }
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tcf.te.launch.ui.model;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationListener;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.tcf.te.launch.core.bindings.LaunchConfigTypeBindingsManager;
+import org.eclipse.tcf.te.launch.core.interfaces.IReferencedProjectItem;
+import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPersistenceDelegate;
+import org.eclipse.tcf.te.launch.core.persistence.projects.ReferencedProjectItem;
+import org.eclipse.tcf.te.launch.core.persistence.projects.ReferencedProjectsPersistenceDelegate;
+import org.eclipse.tcf.te.launch.core.selection.LaunchSelection;
+import org.eclipse.tcf.te.launch.core.selection.ProjectSelectionContext;
+import org.eclipse.tcf.te.launch.core.selection.RemoteSelectionContext;
+import org.eclipse.tcf.te.runtime.events.ChangeEvent;
+import org.eclipse.tcf.te.runtime.events.EventManager;
+import org.eclipse.tcf.te.runtime.model.interfaces.IContainerModelNode;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+
+/**
+ * LaunchModel
+ */
+public final class LaunchModel {
+
+ private static final Map<Object,LaunchModel> models = new HashMap<Object, LaunchModel>();
+
+ /**
+ * Get the launch model of the rootNode.
+ * If it does not exist yet, create a new instance and store it.
+ *
+ * @param rootNode The rootNode of the model.
+ * @return The launch model.
+ */
+ public static LaunchModel getLaunchModel(final Object modelRoot) {
+ LaunchModel model = models.get(modelRoot);
+ if (model == null) {
+ model = new LaunchModel(modelRoot);
+ models.put(modelRoot, model);
+ }
+ return model;
+ }
+
+ private final LaunchNode rootNode;
+ private final Object modelRoot;
+
+ /**
+ * Constructor.
+ */
+ private LaunchModel(Object modelRoot) {
+ this.modelRoot = modelRoot;
+ rootNode = new LaunchNode(this);
+ refresh();
+ DebugPlugin.getDefault().getLaunchManager().addLaunchConfigurationListener(new ILaunchConfigurationListener() {
+ @Override
+ public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
+ if (!configuration.isWorkingCopy()) {
+ if (refresh()) {
+ EventManager.getInstance().fireEvent(new ChangeEvent(LaunchModel.this, "launchRemoved", null, null)); //$NON-NLS-1$
+ }
+ }
+ }
+ @Override
+ public void launchConfigurationChanged(ILaunchConfiguration configuration) {
+ if (!configuration.isWorkingCopy()) {
+ refresh();
+ EventManager.getInstance().fireEvent(new ChangeEvent(LaunchModel.this, "launchChanged", null, null)); //$NON-NLS-1$
+ }
+ }
+ @Override
+ public void launchConfigurationAdded(ILaunchConfiguration configuration) {
+ if (!configuration.isWorkingCopy()) {
+ if (refresh()) {
+ EventManager.getInstance().fireEvent(new ChangeEvent(LaunchModel.this, "launchAdded", null, null)); //$NON-NLS-1$
+ }
+ }
+ }
+ });
+ }
+
+ public LaunchNode getRootNode() {
+ return rootNode;
+ }
+
+ public Object getModelRoot() {
+ return modelRoot;
+ }
+
+ public boolean refresh() {
+ boolean changed = false;
+ Object parent = rootNode.getModel().getModelRoot();
+ String[] typeIds = new String[0];
+ if (parent instanceof IProject) {
+ typeIds = LaunchConfigTypeBindingsManager.getInstance().getValidLaunchConfigTypes(
+ new LaunchSelection(null, new ProjectSelectionContext((IProject)parent, true)));
+ }
+ else if (parent instanceof IModelNode) {
+ typeIds = LaunchConfigTypeBindingsManager.getInstance().getValidLaunchConfigTypes(
+ new LaunchSelection(null, new RemoteSelectionContext((IModelNode)parent, true)));
+ }
+ List<IModelNode> typeNodes = new ArrayList<IModelNode>(Arrays.asList(rootNode.getChildren()));
+ for (String typeId : typeIds) {
+ ILaunchConfigurationType type = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(typeId);
+ if (type.isPublic()) {
+ IModelNode typeNode = find(type, typeNodes);
+ if (typeNode != null) {
+ typeNodes.remove(typeNode);
+ }
+ else {
+ typeNode = new LaunchNode(type);
+ rootNode.add(typeNode);
+ changed = true;
+ }
+
+ ILaunchConfiguration[] configs;
+ try {
+ configs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(type);
+ }
+ catch (Exception e) {
+ configs = new ILaunchConfiguration[0];
+ }
+
+ List<IModelNode> configNodes = new ArrayList<IModelNode>(Arrays.asList(((IContainerModelNode)typeNode).getChildren()));
+ for (ILaunchConfiguration config : configs) {
+ if (parent instanceof IModelNode) {
+ IModelNode[] contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(config);
+ if (contexts == null || contexts.length == 0 || Arrays.asList(contexts).contains(parent)) {
+ IModelNode configNode = find(config, configNodes);
+ if (configNode != null) {
+ configNodes.remove(configNode);
+ }
+ else {
+ configNode = new LaunchNode(config);
+ ((IContainerModelNode)typeNode).add(configNode);
+ changed = true;
+ }
+ }
+ }
+ else if (parent instanceof IProject) {
+ IReferencedProjectItem[] projects = ReferencedProjectsPersistenceDelegate.getReferencedProjects(config);
+ IReferencedProjectItem project = new ReferencedProjectItem();
+ project.setProperty(IReferencedProjectItem.PROPERTY_PROJECT_NAME, ((IProject)parent).getName());
+ if (projects != null && Arrays.asList(projects).contains(project)) {
+ IModelNode configNode = find(config, configNodes);
+ if (configNode != null) {
+ configNodes.remove(configNode);
+ }
+ else {
+ configNode = new LaunchNode(config);
+ ((IContainerModelNode)typeNode).add(configNode);
+ changed = true;
+ }
+ }
+ }
+ }
+ for (IModelNode configToDelete : configNodes) {
+ ((IContainerModelNode)typeNode).remove(configToDelete, true);
+ changed = true;
+ }
+ }
+ for (IModelNode typeToDelete : typeNodes) {
+ rootNode.remove(typeToDelete, true);
+ changed = true;
+ }
+ }
+ return changed;
+ }
+
+ private IModelNode find(Object data, List<IModelNode> list) {
+ for (IModelNode candidate : list) {
+ if (candidate instanceof LaunchNode) {
+ if ((data instanceof LaunchNode && ((LaunchNode)candidate).equals(data)) ||
+ (data instanceof ILaunchConfiguration && ((LaunchNode)candidate).equals(new LaunchNode((ILaunchConfiguration)data))) ||
+ (data instanceof ILaunchConfigurationType && ((LaunchNode)candidate).equals(new LaunchNode((ILaunchConfigurationType)data)))) {
+ return candidate;
+ }
+ }
+ }
+ return null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchNode.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchNode.java
index 48f8f07..e47f5c7 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchNode.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchNode.java
@@ -1,142 +1,148 @@
-/*******************************************************************************
- * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tcf.te.launch.ui.model;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.tcf.te.launch.core.lm.LaunchConfigHelper;
-import org.eclipse.tcf.te.launch.core.lm.LaunchManager;
-import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchManagerDelegate;
-import org.eclipse.tcf.te.runtime.model.ContainerModelNode;
-import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
-
-/**
- * LaunchNode
- */
-public class LaunchNode extends ContainerModelNode {
-
- public static final String TYPE_ROOT = "root"; //$NON-NLS-1$
- public static final String TYPE_LAUNCH_CONFIG_TYPE = "launchConfigType"; //$NON-NLS-1$
- public static final String TYPE_LAUNCH_CONFIG = "launchConfig"; //$NON-NLS-1$
-
- private static final String PROPERTY_ROOT_MODEL_NODE = "modelNode"; //$NON-NLS-1$
-
- private LaunchNode(String type) {
- super();
- setProperty(IModelNode.PROPERTY_TYPE, type);
- }
-
- public LaunchNode(IModelNode modelNode) {
- this(TYPE_ROOT);
- setProperty(PROPERTY_ROOT_MODEL_NODE, modelNode);
- }
-
- public LaunchNode(ILaunchConfiguration config) {
- this(TYPE_LAUNCH_CONFIG);
- setProperty(TYPE_LAUNCH_CONFIG, config);
- }
-
- public LaunchNode(ILaunchConfigurationType configType) {
- this(TYPE_LAUNCH_CONFIG_TYPE);
- setProperty(TYPE_LAUNCH_CONFIG_TYPE, configType);
- }
-
- public String getType() {
- return getStringProperty(IModelNode.PROPERTY_TYPE);
- }
-
- public IModelNode getRootModelNode() {
- IModelNode node = (IModelNode)getProperty(PROPERTY_ROOT_MODEL_NODE);
- if (node == null && getParent() instanceof LaunchNode) {
- return ((LaunchNode)getParent()).getRootModelNode();
- }
- return node;
- }
-
- public ILaunchConfiguration getLaunchConfiguration() {
- if (TYPE_LAUNCH_CONFIG.equals(getType())) {
- return (ILaunchConfiguration)getProperty(TYPE_LAUNCH_CONFIG);
- }
- return null;
- }
-
- public ILaunchConfigurationType getLaunchConfigurationType() {
- if (TYPE_LAUNCH_CONFIG.equals(getType())) {
- return ((LaunchNode)getParent()).getLaunchConfigurationType();
- }
- else if (TYPE_LAUNCH_CONFIG_TYPE.equals(getType())) {
- return (ILaunchConfigurationType)getProperty(TYPE_LAUNCH_CONFIG_TYPE);
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.model.ModelNode#getName()
- */
- @Override
- public String getName() {
- if (TYPE_ROOT.equals(getType())) {
- return "Launches"; //$NON-NLS-1$
- }
- else if (TYPE_LAUNCH_CONFIG_TYPE.equals(getType())) {
- return getLaunchConfigurationType().getName();
- }
- else if (TYPE_LAUNCH_CONFIG.equals(getType())) {
- return getLaunchConfiguration().getName();
- }
- return super.getName();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.properties.PropertiesContainer#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof LaunchNode && getType() != null && getType().equals(((LaunchNode)obj).getType())) {
- if (TYPE_LAUNCH_CONFIG_TYPE.equals(getType())) {
- return getLaunchConfigurationType().equals(((LaunchNode)obj).getLaunchConfigurationType());
- }
- else if (TYPE_LAUNCH_CONFIG.equals(getType())) {
- return getLaunchConfiguration().equals(((LaunchNode)obj).getLaunchConfiguration());
- }
- }
- return super.equals(obj);
- }
-
- public boolean isValidFor(String mode) {
- if (TYPE_LAUNCH_CONFIG.equals(getType())) {
- List<String> modes;
- if (mode != null && mode.trim().length() > 0) {
- modes = new ArrayList<String>();
- modes.add(mode);
- }
- else {
- modes = Arrays.asList(LaunchConfigHelper.getLaunchConfigTypeModes(getLaunchConfigurationType(), false));
- }
- for (String m : modes) {
- ILaunchManagerDelegate delegate = LaunchManager.getInstance().getLaunchManagerDelegate(getLaunchConfigurationType(), m);
- if (delegate != null) {
- try {
- delegate.validate(mode, getLaunchConfiguration());
- }
- catch (Exception e) {
- return false;
- }
- }
- }
- }
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tcf.te.launch.ui.model;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.tcf.te.launch.core.lm.LaunchConfigHelper;
+import org.eclipse.tcf.te.launch.core.lm.LaunchManager;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchManagerDelegate;
+import org.eclipse.tcf.te.runtime.model.ContainerModelNode;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+
+/**
+ * LaunchNode
+ */
+public class LaunchNode extends ContainerModelNode {
+
+ public static final String TYPE_ROOT = "root"; //$NON-NLS-1$
+ public static final String TYPE_LAUNCH_CONFIG_TYPE = "launchConfigType"; //$NON-NLS-1$
+ public static final String TYPE_LAUNCH_CONFIG = "launchConfig"; //$NON-NLS-1$
+
+ private static final String PROPERTY_MODEL = "model"; //$NON-NLS-1$
+
+ private LaunchNode(String type) {
+ super();
+ setProperty(IModelNode.PROPERTY_TYPE, type);
+ }
+
+ public LaunchNode(LaunchModel model) {
+ this(TYPE_ROOT);
+ setProperty(PROPERTY_MODEL, model);
+ }
+
+ public LaunchNode(ILaunchConfiguration config) {
+ this(TYPE_LAUNCH_CONFIG);
+ setProperty(TYPE_LAUNCH_CONFIG, config);
+ }
+
+ public LaunchNode(ILaunchConfigurationType configType) {
+ this(TYPE_LAUNCH_CONFIG_TYPE);
+ setProperty(TYPE_LAUNCH_CONFIG_TYPE, configType);
+ }
+
+ public String getType() {
+ return getStringProperty(IModelNode.PROPERTY_TYPE);
+ }
+
+ public LaunchModel getModel() {
+ LaunchModel model = (LaunchModel)getProperty(PROPERTY_MODEL);
+ IModelNode parent = getParent();
+
+ while (model == null && parent != null) {
+ model = (LaunchModel)parent.getProperty(PROPERTY_MODEL);
+ parent = parent.getParent();
+ }
+
+ Assert.isNotNull(model);
+ return model;
+ }
+
+ public ILaunchConfiguration getLaunchConfiguration() {
+ if (TYPE_LAUNCH_CONFIG.equals(getType())) {
+ return (ILaunchConfiguration)getProperty(TYPE_LAUNCH_CONFIG);
+ }
+ return null;
+ }
+
+ public ILaunchConfigurationType getLaunchConfigurationType() {
+ if (TYPE_LAUNCH_CONFIG.equals(getType())) {
+ return ((LaunchNode)getParent()).getLaunchConfigurationType();
+ }
+ else if (TYPE_LAUNCH_CONFIG_TYPE.equals(getType())) {
+ return (ILaunchConfigurationType)getProperty(TYPE_LAUNCH_CONFIG_TYPE);
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.model.ModelNode#getName()
+ */
+ @Override
+ public String getName() {
+ if (TYPE_ROOT.equals(getType())) {
+ return "Launches"; //$NON-NLS-1$
+ }
+ else if (TYPE_LAUNCH_CONFIG_TYPE.equals(getType())) {
+ return getLaunchConfigurationType().getName();
+ }
+ else if (TYPE_LAUNCH_CONFIG.equals(getType())) {
+ return getLaunchConfiguration().getName();
+ }
+ return super.getName();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.properties.PropertiesContainer#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof LaunchNode && getType() != null && getType().equals(((LaunchNode)obj).getType())) {
+ if (TYPE_LAUNCH_CONFIG_TYPE.equals(getType())) {
+ return getLaunchConfigurationType().equals(((LaunchNode)obj).getLaunchConfigurationType());
+ }
+ else if (TYPE_LAUNCH_CONFIG.equals(getType())) {
+ return getLaunchConfiguration().equals(((LaunchNode)obj).getLaunchConfiguration());
+ }
+ }
+ return super.equals(obj);
+ }
+
+ public boolean isValidFor(String mode) {
+ if (TYPE_LAUNCH_CONFIG.equals(getType())) {
+ List<String> modes;
+ if (mode != null && mode.trim().length() > 0) {
+ modes = new ArrayList<String>();
+ modes.add(mode);
+ }
+ else {
+ modes = Arrays.asList(LaunchConfigHelper.getLaunchConfigTypeModes(getLaunchConfigurationType(), false));
+ }
+ for (String m : modes) {
+ ILaunchManagerDelegate delegate = LaunchManager.getInstance().getLaunchManagerDelegate(getLaunchConfigurationType(), m);
+ if (delegate != null) {
+ try {
+ delegate.validate(mode, getLaunchConfiguration());
+ }
+ catch (Exception e) {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/selection/LaunchSelectionManager.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/selection/LaunchSelectionManager.java
index 82aa886..65e108d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/selection/LaunchSelectionManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/selection/LaunchSelectionManager.java
@@ -111,21 +111,34 @@ public class LaunchSelectionManager {
List<ISelectionContext> contexts = new ArrayList<ISelectionContext>();
// Get the selected remote contexts
- Map<IModelNode, Set<IModelNode>> remoteCtxSelections = getRemoteCtxSelections(getPartSelection(PART_ID_TE_VIEW));
+ contexts.addAll(getSelectionContextsFor(PART_ID_TE_VIEW, type, mode, PART_ID_TE_VIEW.equalsIgnoreCase(preferredPartId)));
- for (IModelNode remoteCtx : remoteCtxSelections.keySet()) {
- contexts.add(new RemoteSelectionContext(remoteCtx, remoteCtxSelections.get(remoteCtx).toArray(),
- PART_ID_TE_VIEW.equalsIgnoreCase(preferredPartId)));
+ // Get the selected project contexts
+ contexts.addAll(getSelectionContextsFor(PART_ID_PROJECT_VIEW, type, mode, PART_ID_PROJECT_VIEW.equalsIgnoreCase(preferredPartId)));
+
+ return contexts.toArray(new ISelectionContext[contexts.size()]);
+ }
+
+ public List<ISelectionContext> getSelectionContextsFor(String partId, ILaunchConfigurationType type, String mode, boolean preferedPart) {
+ List<ISelectionContext> contexts = new ArrayList<ISelectionContext>();
+
+ if (PART_ID_TE_VIEW.equalsIgnoreCase(partId)) {
+ // Get the selected remote contexts
+ Map<IModelNode, Set<IModelNode>> remoteCtxSelections = getRemoteCtxSelections(getPartSelection(PART_ID_TE_VIEW));
+ for (IModelNode remoteCtx : remoteCtxSelections.keySet()) {
+ contexts.add(new RemoteSelectionContext(remoteCtx, remoteCtxSelections.get(remoteCtx).toArray(), preferedPart));
+ }
}
+ else if (PART_ID_PROJECT_VIEW.equalsIgnoreCase(partId)) {
- // Get the selected project contexts
- Map<IProject, Set<IPath>> projectSelections = getProjectSelections(getPartSelection(PART_ID_PROJECT_VIEW), true);
- for (IProject prj : projectSelections.keySet()) {
- contexts.add(new ProjectSelectionContext(prj, projectSelections.get(prj).toArray(),
- PART_ID_PROJECT_VIEW.equalsIgnoreCase(preferredPartId)));
+ // Get the selected project contexts
+ Map<IProject, Set<IPath>> projectSelections = getProjectSelections(getPartSelection(PART_ID_PROJECT_VIEW), true);
+ for (IProject prj : projectSelections.keySet()) {
+ contexts.add(new ProjectSelectionContext(prj, projectSelections.get(prj).toArray(), preferedPart));
+ }
}
- return contexts.toArray(new ISelectionContext[contexts.size()]);
+ return contexts;
}
/**
@@ -145,8 +158,8 @@ public class LaunchSelectionManager {
IModelNode remoteCtx = null;
IModelNode node = null;
- if (sel instanceof LaunchNode) {
- node = ((LaunchNode)sel).getRootModelNode();
+ if (sel instanceof LaunchNode && ((LaunchNode)sel).getModel().getModelRoot() instanceof IModelNode) {
+ node = (IModelNode)((LaunchNode)sel).getModel().getModelRoot();
}
else if (sel instanceof IModelNodeProvider) {
node = ((IModelNodeProvider)sel).getModelNode();
@@ -203,11 +216,16 @@ public class LaunchSelectionManager {
IProject prj = null;
IResource resource = null;
+ if (sel instanceof LaunchNode && ((LaunchNode)sel).getModel().getModelRoot() instanceof IResource) {
+ sel = ((LaunchNode)sel).getModel().getModelRoot();
+ }
+
// If the selection is not an IResource itself, try to adapt to it.
// This will possibly trigger an plugin activation on loadAdapter(...).
if (sel instanceof IResource) {
resource = (IResource)sel;
- } else {
+ }
+ else {
resource = (IResource)Platform.getAdapterManager().loadAdapter(sel, IResource.class.getName());
}
@@ -251,7 +269,10 @@ public class LaunchSelectionManager {
IProject prj = null;
IPath location = null;
- if (sel instanceof IProject) {
+ if (sel instanceof LaunchNode && ((LaunchNode)sel).getModel().getModelRoot() instanceof IProject) {
+ prj = (IProject)((LaunchNode)sel).getModel().getModelRoot();
+ }
+ else if (sel instanceof IProject) {
prj = (IProject)sel;
}
else if (sel instanceof IFile) {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/tabs/refprojects/RefProjectsSection.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/tabs/refprojects/RefProjectsSection.java
index aac159b..3bac617 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/tabs/refprojects/RefProjectsSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/tabs/refprojects/RefProjectsSection.java
@@ -380,7 +380,7 @@ public class RefProjectsSection extends AbstractTableSection implements ILaunchC
private boolean contains(List<IReferencedProjectItem> list, IProject project) {
for (IReferencedProjectItem item : list) {
if (item.isProperty(IReferencedProjectItem.PROPERTY_PROJECT_NAME, project.getName())) {
- return false;
+ return true;
}
}
return false;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/filetransfer/FileTransferItem.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/filetransfer/FileTransferItem.java
index 318ccc3..669566f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/filetransfer/FileTransferItem.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/filetransfer/FileTransferItem.java
@@ -24,6 +24,8 @@ public class FileTransferItem extends PropertiesContainer implements IFileTransf
* Constructor.
*/
public FileTransferItem() {
+ setProperty(PROPERTY_ENABLED, true);
+ setProperty(PROPERTY_DIRECTION, HOST_TO_TARGET);
}
/* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/icons/obj16/root.gif b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/icons/obj16/root.gif
new file mode 100644
index 0000000..6b3911b
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/icons/obj16/root.gif
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/plugin.xml
index 313dc30..d56ca45 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/plugin.xml
@@ -5,7 +5,7 @@
<!-- Adapter factory contributions -->
<extension point="org.eclipse.core.runtime.adapters">
<factory
- class=""
+ class="org.eclipse.tcf.te.tcf.launch.ui.internal.adapters.AdapterFactory"
adaptableType="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel">
<adapter type="org.eclipse.debug.ui.actions.ILaunchable"/>
</factory>
@@ -109,6 +109,7 @@
<navigatorContent
id="org.eclipse.tcf.te.tcf.launch.ui.navigator.content"
name="%LauchTree.name"
+ icon="icons/obj16/root.gif"
activeByDefault="false"
contentProvider="org.eclipse.tcf.te.launch.ui.internal.viewer.LaunchNavigatorContentProvider"
labelProvider="org.eclipse.tcf.te.launch.ui.internal.viewer.LaunchTreeLabelProvider"
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/internal/adapters/AdapterFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/internal/adapters/AdapterFactory.java
new file mode 100644
index 0000000..99cd90f
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/internal/adapters/AdapterFactory.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.launch.ui.internal.adapters;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.debug.ui.actions.ILaunchable;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+
+/**
+ * Adapter factory implementation.
+ */
+public class AdapterFactory implements IAdapterFactory {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ @Override
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof IPeerModel) {
+ if (ILaunchable.class.equals(adapterType)) {
+ return new ILaunchable() {};
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ @Override
+ public Class[] getAdapterList() {
+ return new Class<?>[] {
+ ILaunchable.class
+ };
+ }
+
+}