Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Chen2012-05-16 10:31:19 +0000
committerWilliam Chen2012-05-16 10:31:19 +0000
commit23928d4dbc8a573bfd3f96bf794ef77e19dc5a7d (patch)
treed73e622bcb97486638bbfae5c6264fd63a6b365f /target_explorer
parent398d230289abdcc2487cc2b3968f6d44eda06d19 (diff)
downloadorg.eclipse.tcf-23928d4dbc8a573bfd3f96bf794ef77e19dc5a7d.tar.gz
org.eclipse.tcf-23928d4dbc8a573bfd3f96bf794ef77e19dc5a7d.tar.xz
org.eclipse.tcf-23928d4dbc8a573bfd3f96bf794ef77e19dc5a7d.zip
Target Explorer: Refactoring the TreeViewerExplorerPage. Adding
decorating title bar.
Diffstat (limited to 'target_explorer')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.xml11
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/pages/LaunchExplorerEditorPage.java55
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/nls/Messages.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/nls/Messages.properties1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.xml14
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEditorPage.java54
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/META-INF/MANIFEST.MF3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/icons/obj16/process_polling.pngbin0 -> 507 bytes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.xml17
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/activator/UIPlugin.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/interfaces/ImageConsts.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/pages/ProcessMonitorEditorPage.java58
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/pages/ProcessMonitorTitleDecorator.java58
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.properties1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/TreeViewerExplorerEditorPage.java354
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui/schema/viewers.exsd24
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/activator/UIPlugin.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/interfaces/ImageConsts.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/AbstractTreeControl.java366
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/TreeControl.java31
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/TreeViewerExtension.java12
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/ViewerDescriptor.java30
25 files changed, 582 insertions, 524 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 53fe6ff78..b87c62496 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
@@ -31,7 +31,7 @@
<!-- Editor page contributions -->
<extension point="org.eclipse.tcf.te.ui.views.editorPages">
<editorPage
- class="org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage:org.eclipse.tcf.te.launch.ui.viewer.launches:Launches"
+ class="org.eclipse.tcf.te.launch.ui.internal.pages.LaunchExplorerEditorPage"
name="%LauchEditorPage.name"
icon="icons/obj16/launches_root.gif"
id="org.eclipse.tcf.te.launch.ui.LaunchEditorPage">
@@ -102,10 +102,7 @@
<viewer
id="org.eclipse.tcf.te.launch.ui.viewer.launches"
autoExpandLevel="2"
- contentProvider="org.eclipse.tcf.te.launch.ui.internal.viewer.LaunchEditorContentProvider"
- doubleClickCommand="org.eclipse.ui.navigator.Open"
- helpId="org.eclipse.tcf.te.launch.ui.LaunchEditorPage"
- menuId="org.eclipse.tcf.te.launch.ui.editor.menu.launches">
+ contentProvider="org.eclipse.tcf.te.launch.ui.internal.viewer.LaunchEditorContentProvider">
<creation>
<style name="SWT.FULL_SELECTION"/>
<style name="SWT.SINGLE"/>
@@ -312,7 +309,7 @@
</menuContribution>
<!-- Launches editor page menu contributions -->
- <menuContribution locationURI="popup:org.eclipse.tcf.te.launch.ui.editor.menu.launches">
+ <menuContribution locationURI="popup:org.eclipse.tcf.te.launch.ui.LaunchEditorPage">
<separator
name="group.new"
visible="true"/>
@@ -443,7 +440,7 @@
<!-- Launches editor page toolbar contributions -->
- <menuContribution locationURI="toolbar:org.eclipse.tcf.te.launch.ui.editor.menu.launches">
+ <menuContribution locationURI="toolbar:org.eclipse.tcf.te.launch.ui.LaunchEditorPage">
<separator
name="group.run"
visible="false"/>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/pages/LaunchExplorerEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/pages/LaunchExplorerEditorPage.java
new file mode 100644
index 000000000..39ee2d79c
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/pages/LaunchExplorerEditorPage.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.pages;
+
+import org.eclipse.tcf.te.launch.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage;
+
+/**
+ * The editor page to explore the launches.
+ */
+public class LaunchExplorerEditorPage extends TreeViewerExplorerEditorPage {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage#getViewerId()
+ */
+ @Override
+ protected String getViewerId() {
+ return "org.eclipse.tcf.te.launch.ui.viewer.launches"; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#getFormTitle()
+ */
+ @Override
+ protected String getFormTitle() {
+ return Messages.LaunchExplorerEditorPage_PageTitle;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage#getDoubleClickCommandId()
+ */
+ @Override
+ protected String getDoubleClickCommandId() {
+ return "org.eclipse.ui.navigator.Open"; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#getContextHelpId()
+ */
+ @Override
+ protected String getContextHelpId() {
+ return "org.eclipse.tcf.te.launch.ui.LaunchEditorPage"; //$NON-NLS-1$
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/nls/Messages.java
index c91431e44..7590875c5 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/nls/Messages.java
@@ -114,6 +114,8 @@ public class Messages extends NLS {
public static String LaunchEditorPage_title;
+ public static String LaunchExplorerEditorPage_PageTitle;
+
public static String DeleteHandlerDelegate_question_title;
public static String DeleteHandlerDelegate_question_message;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/nls/Messages.properties
index 3fa86f573..ad79aa25e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/nls/Messages.properties
@@ -57,6 +57,7 @@ FileTransferSection_toHost_text = <<
FileTransferSection_toTarget_text = >>
LaunchEditorPage_title = Launches
+LaunchExplorerEditorPage_PageTitle=Launches
DeleteHandlerDelegate_question_title = Question
DeleteHandlerDelegate_question_message = Are you sure you want to delete ''{0}''?
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.xml
index 9b5008871..a1d70f357 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.xml
@@ -98,9 +98,10 @@
<!-- Editor page contributions -->
<extension point="org.eclipse.tcf.te.ui.views.editorPages">
<editorPage
- class="org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage:org.eclipse.tcf.te.ui.controls.viewer.fs:File System Explorer"
- name="%FSExplorerEditorPage.name"
- id="org.eclipse.tcf.te.tcf.filesystem.FSExplorerEditorPage">
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.pages.FSExplorerEditorPage"
+ icon="icons/obj16/root.gif"
+ id="org.eclipse.tcf.te.tcf.filesystem.FSExplorerEditorPage"
+ name="%FSExplorerEditorPage.name">
</editorPage>
</extension>
@@ -127,7 +128,7 @@
<!-- Menu contributions -->
<extension point="org.eclipse.ui.menus">
- <menuContribution locationURI="popup:org.eclipse.tcf.te.ui.controls.menu.fs?after=additions">
+ <menuContribution locationURI="popup:org.eclipse.tcf.te.tcf.filesystem.FSExplorerEditorPage?after=additions">
<separator
name="group.new">
</separator>
@@ -934,7 +935,7 @@
</command>
</menuContribution>
<menuContribution
- locationURI="toolbar:org.eclipse.tcf.te.ui.controls.menu.fs?before=additions">
+ locationURI="toolbar:org.eclipse.tcf.te.tcf.filesystem.FSExplorerEditorPage?before=additions">
<command
commandId="org.eclipse.tcf.te.tcf.filesystem.commands.refreshViewer"
icon="icons/obj16/refresh.gif"
@@ -1918,10 +1919,7 @@
<viewer
autoExpandLevel="0"
contentProvider="org.eclipse.tcf.te.tcf.filesystem.ui.controls.FSTreeContentProvider"
- doubleClickCommand="org.eclipse.ui.navigator.Open"
- helpId="org.eclipse.tcf.te.tcf.filesystem.FSExplorerEditorPage"
id="org.eclipse.tcf.te.ui.controls.viewer.fs"
- menuId="org.eclipse.tcf.te.ui.controls.menu.fs"
persistent="true">
<creation>
<style name="SWT.FULL_SELECTION" />
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEditorPage.java
new file mode 100644
index 000000000..74099e68d
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/pages/FSExplorerEditorPage.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.filesystem.ui.internal.pages;
+
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage;
+/**
+ * The editor page for the file system explorer.
+ */
+public class FSExplorerEditorPage extends TreeViewerExplorerEditorPage {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage#getDoubleClickCommandId()
+ */
+ @Override
+ protected String getDoubleClickCommandId() {
+ return "org.eclipse.ui.navigator.Open"; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage#getViewerId()
+ */
+ @Override
+ protected String getViewerId() {
+ return "org.eclipse.tcf.te.ui.controls.viewer.fs"; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#getFormTitle()
+ */
+ @Override
+ protected String getFormTitle() {
+ return Messages.FSExplorerEditorPage_PageTitle;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#getContextHelpId()
+ */
+ @Override
+ protected String getContextHelpId() {
+ return "org.eclipse.tcf.te.tcf.filesystem.FSExplorerEditorPage"; //$NON-NLS-1$
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java
index 841bd79f3..860f620e3 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java
@@ -95,6 +95,7 @@ public class Messages extends NLS {
public static String FSDropTargetListener_ConfirmMoveTitle;
public static String FSDropTargetListener_MovingWarningMultiple;
public static String FSDropTargetListener_MovingWarningSingle;
+ public static String FSExplorerEditorPage_PageTitle;
public static String FSUpload_Cancel;
public static String FSUpload_No;
public static String FSUpload_OverwriteConfirmation;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties
index 1a2c57e70..a0e9476d0 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties
@@ -36,6 +36,7 @@ RemoteTypedElement_DowloadingFile=Downloading file {0}...
FSDropTargetListener_ConfirmMoveTitle=Confirm Move
FSDropTargetListener_MovingWarningMultiple=This operation will delete the files after moving. You can copy them without deletion by CTRL + dragging. \n\nAre you sure you want to move these {0} files/folders?
FSDropTargetListener_MovingWarningSingle=This operation will delete the file after moving. You can copy it without deletion by CTRL + dragging. \n\nAre you sure you want to move ''{0}''?
+FSExplorerEditorPage_PageTitle=File System Explorer
FSUpload_Cancel=Cancel
FSUpload_No=No
FSUpload_OverwriteConfirmation=A file with a same name already exists. Are you sure to overwrite {0}?
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/META-INF/MANIFEST.MF
index 68e101063..4d461ba35 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/META-INF/MANIFEST.MF
@@ -22,7 +22,8 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0",
org.eclipse.tcf.te.tcf.filesystem.core;bundle-version="1.0.0",
org.eclipse.tcf.te.tcf.filesystem.ui;bundle-version="1.0.0",
org.eclipse.tcf.te.tcf.processes.core;bundle-version="1.0.0",
- org.eclipse.tcf.te.tcf.ui;bundle-version="1.0.0"
+ org.eclipse.tcf.te.tcf.ui;bundle-version="1.0.0",
+ org.eclipse.tcf.te.ui.forms;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/icons/obj16/process_polling.png b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/icons/obj16/process_polling.png
new file mode 100644
index 000000000..fc7ce8a4a
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/icons/obj16/process_polling.png
Binary files differ
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.xml
index 123f1b780..fb5ca48b5 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/plugin.xml
@@ -15,9 +15,10 @@
<!-- Editor page contributions -->
<extension point="org.eclipse.tcf.te.ui.views.editorPages">
<editorPage
- class="org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage:org.eclipse.tcf.te.ui.controls.viewer.processes:Process Monitor"
- name="%ProcessExplorerEditorPage.name"
- id="org.eclipse.tcf.te.tcf.processes.ui.ProcessExplorerEditorPage">
+ class="org.eclipse.tcf.te.tcf.processes.ui.internal.pages.ProcessMonitorEditorPage"
+ icon="icons/obj16/process_root.gif"
+ id="org.eclipse.tcf.te.tcf.processes.ui.ProcessExplorerEditorPage"
+ name="%ProcessExplorerEditorPage.name">
</editorPage>
</extension>
@@ -40,7 +41,7 @@
<!-- Processes menu contributions -->
<extension point="org.eclipse.ui.menus">
- <menuContribution locationURI="toolbar:org.eclipse.tcf.te.ui.controls.menu.processes?before=additions">
+ <menuContribution locationURI="toolbar:org.eclipse.tcf.te.tcf.processes.ui.ProcessExplorerEditorPage?before=additions">
<command
commandId="org.eclipse.tcf.te.tcf.processes.ui.command.refreshViewer"
icon="icons/obj16/refresh.gif"
@@ -51,14 +52,14 @@
<command
commandId="org.eclipse.tcf.te.tcf.processes.ui.command.refreshInterval"
icon="icons/obj16/refresh_interval.png"
- id="org.eclipse.tcf.te.tcf.processes.ui.menu.refreshInterval"
+ id="org.eclipse.tcf.te.tcf.processes.ui.ProcessExplorerEditorPage.refreshInterval"
label="%command.configure.label"
style="pulldown"
tooltip="%command.configure.tooltip">
</command>
</menuContribution>
- <menuContribution locationURI="menu:org.eclipse.tcf.te.tcf.processes.ui.menu.refreshInterval">
+ <menuContribution locationURI="menu:org.eclipse.tcf.te.tcf.processes.ui.ProcessExplorerEditorPage.refreshInterval">
<dynamic
class="org.eclipse.tcf.te.tcf.processes.ui.internal.handler.ConfigIntervalDynamicContribution"
id="org.eclipse.tcf.te.tcf.processes.ui.menu.refreshIntervalDynamic">
@@ -108,7 +109,7 @@
</menuContribution>
<menuContribution
- locationURI="popup:org.eclipse.tcf.te.ui.controls.menu.processes?after=additions">
+ locationURI="popup:org.eclipse.tcf.te.tcf.processes.ui.ProcessExplorerEditorPage?after=additions">
<separator
name="group.launch.rundebug"
visible="true">
@@ -483,9 +484,7 @@
<viewer
autoExpandLevel="0"
contentProvider="org.eclipse.tcf.te.tcf.processes.ui.controls.ProcessTreeContentProvider"
- helpId="org.eclipse.tcf.te.tcf.processes.ui.ProcessExplorerEditorPage"
id="org.eclipse.tcf.te.ui.controls.viewer.processes"
- menuId="org.eclipse.tcf.te.ui.controls.menu.processes"
persistent="true">
<creation>
<style
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/activator/UIPlugin.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/activator/UIPlugin.java
index d5a4e2428..79cc96d2b 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/activator/UIPlugin.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/activator/UIPlugin.java
@@ -79,6 +79,8 @@ public class UIPlugin extends AbstractUIPlugin {
registry.put(ImageConsts.OBJ_Thread, ImageDescriptor.createFromURL(url));
url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ + "process_root.gif"); //$NON-NLS-1$
registry.put(ImageConsts.OBJ_Process_Root, ImageDescriptor.createFromURL(url));
+ url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_OBJ + "process_polling.png"); //$NON-NLS-1$
+ registry.put(ImageConsts.PM_POLLING, ImageDescriptor.createFromURL(url));
}
/**
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/interfaces/ImageConsts.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/interfaces/ImageConsts.java
index e1382d8e8..fbd257200 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/interfaces/ImageConsts.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/interfaces/ImageConsts.java
@@ -32,4 +32,6 @@ public interface ImageConsts {
public static final String OBJ_Process_Root = "OBJ_Process_Root"; //$NON-NLS-1$
public static final String OBJ_Thread = "OBJ_Thread"; //$NON-NLS-1$
+
+ public static final String PM_POLLING = "OBJ_Process_Polling"; //$NON-NLS-1$
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/pages/ProcessMonitorEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/pages/ProcessMonitorEditorPage.java
new file mode 100644
index 000000000..8a0b43fcd
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/pages/ProcessMonitorEditorPage.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.processes.ui.internal.pages;
+
+import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage;
+
+/**
+ * The editor page for Process Monitor.
+ */
+public class ProcessMonitorEditorPage extends TreeViewerExplorerEditorPage {
+ // The decorator used to decorate the title bar.
+ private ILabelDecorator decorator = new ProcessMonitorTitleDecorator();
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage#getViewerId()
+ */
+ @Override
+ protected String getViewerId() {
+ return "org.eclipse.tcf.te.ui.controls.viewer.processes"; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#getFormTitle()
+ */
+ @Override
+ protected String getFormTitle() {
+ return Messages.ProcessMonitorEditorPage_PageTitle;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#getContextHelpId()
+ */
+ @Override
+ protected String getContextHelpId() {
+ return "org.eclipse.tcf.te.tcf.processes.ui.ProcessExplorerEditorPage"; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.TreeViewerExplorerEditorPage#getTitleBarDecorator()
+ */
+ @Override
+ protected ILabelDecorator getTitleBarDecorator() {
+ return decorator;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/pages/ProcessMonitorTitleDecorator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/pages/ProcessMonitorTitleDecorator.java
new file mode 100644
index 000000000..1ca721f54
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/pages/ProcessMonitorTitleDecorator.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 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.processes.ui.internal.pages;
+
+import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.processes.core.model.ProcessModel;
+import org.eclipse.tcf.te.tcf.processes.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.processes.ui.interfaces.ImageConsts;
+
+/**
+ * The title bar decorator for Process Monitor.
+ */
+public class ProcessMonitorTitleDecorator extends LabelProvider implements ILabelDecorator {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelDecorator#decorateImage(org.eclipse.swt.graphics.Image, java.lang.Object)
+ */
+ @Override
+ public Image decorateImage(Image image, Object element) {
+ if(element instanceof IPeerModel) {
+ IPeerModel peerModel = (IPeerModel) element;
+ ProcessModel pModel = ProcessModel.getProcessModel(peerModel);
+ if(!pModel.isRefreshStopped()) {
+ return UIPlugin.getImage(ImageConsts.PM_POLLING);
+ }
+ return image;
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelDecorator#decorateText(java.lang.String, java.lang.Object)
+ */
+ @Override
+ public String decorateText(String text, Object element) {
+ if(element instanceof IPeerModel) {
+ IPeerModel peerModel = (IPeerModel) element;
+ ProcessModel pModel = ProcessModel.getProcessModel(peerModel);
+ if(!pModel.isRefreshStopped()) {
+ return text + " [Auto Refreshing]"; //$NON-NLS-1$
+ }
+ return text;
+ }
+ return null;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.java
index dc732fa9d..015e28786 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.java
@@ -174,4 +174,6 @@ public class Messages extends NLS {
public static String TerminateHandler_TerminationError;
public static String ProcessLabelProvider_RootNodeLabel;
+
+ public static String ProcessMonitorEditorPage_PageTitle;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.properties
index 363444707..e6bd5124f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/nls/Messages.properties
@@ -126,3 +126,4 @@ GeneralInformationPage_Type=Type:
GeneralInformationPage_User=User:
TerminateHandler_TerminationError=Termination Error
ProcessLabelProvider_RootNodeLabel=Processes
+ProcessMonitorEditorPage_PageTitle=Process Monitor
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/TreeViewerExplorerEditorPage.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/TreeViewerExplorerEditorPage.java
index 98b386f4a..d09426a6a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/TreeViewerExplorerEditorPage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/editor/pages/TreeViewerExplorerEditorPage.java
@@ -9,67 +9,127 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.views.editor.pages;
-import java.util.StringTokenizer;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.net.URL;
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.ParameterizedCommand;
+import org.eclipse.core.expressions.EvaluationContext;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.util.SafeRunnable;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWTException;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.tcf.te.core.interfaces.IViewerInput;
import org.eclipse.tcf.te.ui.forms.CustomFormToolkit;
import org.eclipse.tcf.te.ui.trees.TreeControl;
+import org.eclipse.ui.ISources;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.forms.IManagedForm;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.Form;
+import org.eclipse.ui.handlers.IHandlerService;
+import org.eclipse.ui.part.MultiPageSelectionProvider;
+import org.osgi.framework.Bundle;
/**
* Tree viewer based editor page implementation.
*/
-public class TreeViewerExplorerEditorPage extends AbstractCustomFormToolkitEditorPage {
+public abstract class TreeViewerExplorerEditorPage extends AbstractCustomFormToolkitEditorPage implements IDoubleClickListener {
// The references to the pages subcontrol's (needed for disposal)
private TreeControl treeControl;
- private String viewerId;
- private String titleText;
-
+ private IToolBarManager toolbarMgr;
+ private PropertyChangeListener pcListener;
+ private Image formImage;
+
/* (non-Javadoc)
* @see org.eclipse.ui.forms.editor.FormPage#dispose()
*/
@Override
public void dispose() {
+ Object input = getEditorInputNode();
+ IViewerInput viewerInput = getViewerInput(input);
+ if(viewerInput != null && pcListener != null) {
+ viewerInput.removePropertyChangeListener(pcListener);
+ }
+ if(formImage != null) {
+ formImage.dispose();
+ }
if (treeControl != null) { treeControl.dispose(); treeControl = null; }
super.dispose();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
* @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractEditorPage#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
*/
@Override
public void setInitializationData(IConfigurationElement config, String propertyName, Object data) {
super.setInitializationData(config, propertyName, data);
- if(data != null && data instanceof String) {
- String args = (String) data;
- StringTokenizer st = new StringTokenizer(args, ":"); //$NON-NLS-1$
- if(st.hasMoreTokens())
- viewerId = st.nextToken();
- if(st.hasMoreTokens())
- titleText = st.nextToken();
+ String iconPath = config.getAttribute("icon"); //$NON-NLS-1$
+ if(iconPath != null) {
+ String bundleId = config.getContributor().getName();
+ Bundle bundle = Platform.getBundle(bundleId);
+ if(bundle != null) {
+ URL iconURL = bundle.getEntry(iconPath);
+ if(iconURL != null) {
+ ImageDescriptor iconDesc = ImageDescriptor.createFromURL(iconURL);
+ if(iconDesc != null) {
+ formImage = iconDesc.createImage();
+ }
+ }
+ }
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#getFormImage()
+ */
+ @Override
+ protected Image getFormImage() {
+ return formImage;
+ }
+
+ /*
+ * (non-Javadoc)
* @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#configureManagedForm(org.eclipse.ui.forms.IManagedForm)
*/
@Override
protected void configureManagedForm(IManagedForm managedForm) {
- Assert.isNotNull(managedForm);
-
- // Configure main layout
- Composite body = managedForm.getForm().getBody();
- GridLayout layout = new GridLayout();
- layout.marginHeight = 2; layout.marginWidth = 0;
- body.setLayout(layout);
- body.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
+ treeControl = doCreateTreeControl();
+ super.configureManagedForm(managedForm);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.editor.pages.AbstractCustomFormToolkitEditorPage#createToolbarContributionItems(org.eclipse.jface.action.IToolBarManager)
+ */
+ @Override
+ protected void createToolbarContributionItems(IToolBarManager manager) {
+ this.toolbarMgr = manager;
+ treeControl.createToolbarContributionItems(manager);
+ super.createToolbarContributionItems(manager);
}
/* (non-Javadoc)
@@ -80,45 +140,98 @@ public class TreeViewerExplorerEditorPage extends AbstractCustomFormToolkitEdito
Assert.isNotNull(parent);
Assert.isNotNull(toolkit);
- Section section = toolkit.getFormToolkit().createSection(parent, ExpandableComposite.TITLE_BAR);
- String title = titleText == null ? getTitle() :titleText;
- // Stretch to a length of 40 characters to make sure the title can be changed
- // to hold and show text up to this length
- StringBuilder builder = new StringBuilder();
- builder.append(title);
- while (builder.length() < 40) {
- builder.append(" "); //$NON-NLS-1$
- }
- // Set the title to the section
- section.setText(builder.toString());
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = 0;
- data.heightHint = 0;
- section.setLayoutData(data);
-
- // Create the client area
- Composite client = toolkit.getFormToolkit().createComposite(section);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0; layout.marginHeight = 0;
- client.setLayout(layout);
- section.setClient(client);
-
// Setup the tree control
- treeControl = doCreateTreeControl();
Assert.isNotNull(treeControl);
- treeControl.setupFormPanel((Composite)section.getClient(), toolkit);
+ treeControl.setupFormPanel(parent, toolkit);
+
+ // Register the context menu at the parent workbench part site.
+ getSite().registerContextMenu(getId(), treeControl.getContextMenuManager(), treeControl.getViewer());
// Set the initial input
- treeControl.getViewer().setInput(getEditorInputNode());
+ Object input = getEditorInputNode();
+ treeControl.getViewer().setInput(input);
+
+ addViewerListeners();
+
+ updateUI();
}
/**
+ * Add tree viewer listeners to the tree control.
+ */
+ private void addViewerListeners() {
+ TreeViewer viewer = (TreeViewer) treeControl.getViewer();
+ viewer.addSelectionChangedListener(new ISelectionChangedListener(){
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ propagateSelection();
+ }});
+ viewer.getTree().addFocusListener(new FocusAdapter(){
+ @Override
+ public void focusGained(FocusEvent e) {
+ propagateSelection();
+ }
+ });
+ viewer.addDoubleClickListener(this);
+
+ Object input = getEditorInputNode();
+ IViewerInput viewerInput = getViewerInput(input);
+ if(viewerInput != null) {
+ pcListener = new PropertyChangeListener() {
+ @Override
+ public void propertyChange(final PropertyChangeEvent event) {
+ Object object = event.getSource();
+ if (object == getEditorInputNode()) {
+ if (Display.getCurrent() != null) {
+ updateUI();
+ }
+ else {
+ Display display = getSite().getShell().getDisplay();
+ display.asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ updateUI();
+ }
+ });
+ }
+ }
+ }
+ };
+ viewerInput.addPropertyChangeListener(pcListener);
+ }
+ }
+
+ /**
+ * Get the viewer input adapter for the input.
+ *
+ * @param input the input of the tree viewer.
+ * @return The adapter.
+ */
+ private IViewerInput getViewerInput(Object input) {
+ IViewerInput viewerInput = null;
+ if (input != null) {
+ if (input instanceof IViewerInput) {
+ viewerInput = (IViewerInput) input;
+ }
+ else {
+ if (input instanceof IAdaptable) {
+ viewerInput = (IViewerInput) ((IAdaptable) input).getAdapter(IViewerInput.class);
+ }
+ if (viewerInput == null) {
+ viewerInput = (IViewerInput) Platform.getAdapterManager().getAdapter(input, IViewerInput.class);
+ }
+ }
+ }
+ return viewerInput;
+ }
+
+ /**
* Creates and returns a tree control.
*
* @return The new tree control.
*/
protected TreeControl doCreateTreeControl() {
- return new TreeControl(viewerId, this);
+ return new TreeControl(getViewerId(), this);
}
/**
@@ -129,4 +242,137 @@ public class TreeViewerExplorerEditorPage extends AbstractCustomFormToolkitEdito
public final TreeControl getTreeControl() {
return treeControl;
}
+
+ /**
+ * Update the page's ui including its toolbar and title text and image.
+ */
+ protected void updateUI() {
+ toolbarMgr.update(true);
+ ILabelDecorator decorator = getTitleBarDecorator();
+ if (decorator != null) {
+ IManagedForm managedForm = getManagedForm();
+ Form form = managedForm.getForm().getForm();
+ Object element = getEditorInputNode();
+ String text = getFormTitle();
+ if (text != null) {
+ text = decorator.decorateText(text, element);
+ if (text != null) {
+ try {
+ form.setText(text);
+ }
+ catch (Exception e) {
+ // Ignore any disposed exception
+ }
+ }
+ }
+ Image image = getFormImage();
+ image = decorator.decorateImage(image, element);
+ if (image != null) {
+ try {
+ form.setImage(image);
+ }
+ catch (Exception e) {
+ // Ignore any disposed exception
+ }
+ }
+ }
+ }
+
+ /**
+ * Get the title bar's decorator or null if there's no decorator for it.
+ */
+ protected ILabelDecorator getTitleBarDecorator() {
+ return null;
+ }
+
+ /**
+ * Propagate the current selection to the editor's selection provider.
+ */
+ protected void propagateSelection() {
+ ISelection selection = treeControl.getViewer().getSelection();
+ ISelectionProvider selectionProvider = getSite().getSelectionProvider();
+ // If the parent control is already disposed, we have no real chance of
+ // testing for it. Catch the SWT exception here just in case.
+ try {
+ selectionProvider.setSelection(selection);
+ if (selectionProvider instanceof MultiPageSelectionProvider) {
+ SelectionChangedEvent changedEvent = new SelectionChangedEvent(selectionProvider, selection);
+ ((MultiPageSelectionProvider) selectionProvider).firePostSelectionChanged(changedEvent);
+ }
+ }
+ catch (SWTException e) {
+ /* ignored on purpose */
+ }
+ }
+
+ /**
+ * Get the id of the command invoked when the tree is double-clicked.
+ * If the id is null, then no command is invoked.
+ *
+ * @return The double-click command id.
+ */
+ protected String getDoubleClickCommandId() {
+ return null;
+ }
+
+ /**
+ * Get the tree viewer's id. This viewer id is used by
+ * viewer extension to define columns and filters.
+ *
+ * @return This viewer's id or null.
+ */
+ protected abstract String getViewerId();
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
+ */
+ @Override
+ public void doubleClick(final DoubleClickEvent event) {
+ // If an handled and enabled command is registered for the ICommonActionConstants.OPEN
+ // retargetable action id, redirect the double click handling to the command handler.
+ //
+ // Note: The default tree node expansion must be re-implemented in the active handler!
+ String commandId = getDoubleClickCommandId();
+ Command cmd = null;
+ if(commandId != null) {
+ ICommandService service = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class);
+ cmd = service != null ? service.getCommand(commandId) : null;
+ }
+ if (cmd != null && cmd.isDefined() && cmd.isEnabled()) {
+ final Command command = cmd;
+ SafeRunner.run(new SafeRunnable(){
+ @Override
+ public void handleException(Throwable e) {
+ // Ignore exception
+ }
+ @Override
+ public void run() throws Exception {
+ ISelection selection = event.getSelection();
+ EvaluationContext ctx = new EvaluationContext(null, selection);
+ ctx.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, selection);
+ ctx.addVariable(ISources.ACTIVE_MENU_SELECTION_NAME, selection);
+ ctx.addVariable(ISources.ACTIVE_WORKBENCH_WINDOW_NAME, PlatformUI.getWorkbench().getActiveWorkbenchWindow());
+ IWorkbenchPartSite site = getSite();
+ ctx.addVariable(ISources.ACTIVE_PART_ID_NAME, site.getId());
+ ctx.addVariable(ISources.ACTIVE_PART_NAME, TreeViewerExplorerEditorPage.this);
+ ctx.addVariable(ISources.ACTIVE_SITE_NAME, site);
+ ctx.addVariable(ISources.ACTIVE_SHELL_NAME, site.getShell());
+ ctx.setAllowPluginActivation(true);
+
+ ParameterizedCommand pCmd = ParameterizedCommand.generateCommand(command, null);
+ Assert.isNotNull(pCmd);
+ IHandlerService handlerSvc = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class);
+ Assert.isNotNull(handlerSvc);
+ handlerSvc.executeCommandInContext(pCmd, null, ctx);
+ }});
+ } else {
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ Object element = selection.getFirstElement();
+ TreeViewer viewer = (TreeViewer) treeControl.getViewer();
+ if (viewer.isExpandable(element)) {
+ viewer.setExpandedState(element, !viewer.getExpandedState(element));
+ }
+ }
+ }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/schema/viewers.exsd b/target_explorer/plugins/org.eclipse.tcf.te.ui/schema/viewers.exsd
index 748a4b3ce..c71844745 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui/schema/viewers.exsd
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/schema/viewers.exsd
@@ -94,30 +94,6 @@
</documentation>
</annotation>
</attribute>
- <attribute name="menuId" type="string">
- <annotation>
- <documentation>
- The context menu id of the tree viewer.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="doubleClickCommand" type="string">
- <annotation>
- <documentation>
- The command invoked when double clicked.
- </documentation>
- <appinfo>
- <meta.attribute kind="identifier" basedOn="org.eclipse.ui.commands/command/@id"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="helpId" type="string">
- <annotation>
- <documentation>
- The help id of the tree viewer.
- </documentation>
- </annotation>
- </attribute>
</complexType>
</element>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/activator/UIPlugin.java b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/activator/UIPlugin.java
index c312dc8fd..4a0ea24a5 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/activator/UIPlugin.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/activator/UIPlugin.java
@@ -108,8 +108,6 @@ public class UIPlugin extends AbstractUIPlugin {
registry.put(ImageConsts.VIEWER_FILTER_CONFIG_DISABLED, ImageDescriptor.createFromURL(url));
url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_ELCL + "filter_ps.gif"); //$NON-NLS-1$
registry.put(ImageConsts.VIEWER_FILTER_CONFIG_ENABLED, ImageDescriptor.createFromURL(url));
- url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_ELCL + "help.gif"); //$NON-NLS-1$
- registry.put(ImageConsts.VIEWER_HELP, ImageDescriptor.createFromURL(url));
url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_ELCL + "collapseall.gif"); //$NON-NLS-1$
registry.put(ImageConsts.VIEWER_COLLAPSE_ALL, ImageDescriptor.createFromURL(url));
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/interfaces/ImageConsts.java b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/interfaces/ImageConsts.java
index ca33183e2..6f026f403 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/interfaces/ImageConsts.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/interfaces/ImageConsts.java
@@ -79,11 +79,6 @@ public interface ImageConsts {
public static final String VIEWER_FILTER_CONFIG_DISABLED = "ViewerFilterConfig_disabled"; //$NON-NLS-1$
/**
- * The key to access the viewer help image.
- */
- public static final String VIEWER_HELP = "ViewerHelp"; //$NON-NLS-1$
-
- /**
* The key to access the target object gold overlay image.
*/
public static final String GOLD_OVR = "GoldOverlay"; //$NON-NLS-1$
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/AbstractTreeControl.java b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/AbstractTreeControl.java
index 21187cf05..8e6c6388e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/AbstractTreeControl.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/AbstractTreeControl.java
@@ -10,8 +10,6 @@
package org.eclipse.tcf.te.ui.trees;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
@@ -20,81 +18,47 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
-import org.eclipse.core.commands.Command;
-import org.eclipse.core.commands.ParameterizedCommand;
-import org.eclipse.core.expressions.EvaluationContext;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.SafeRunner;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.SafeRunnable;
import org.eclipse.jface.viewers.ColumnViewerEditor;
import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ILabelDecorator;
import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.TreeViewerEditor;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTException;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.tcf.te.core.interfaces.IViewerInput;
import org.eclipse.tcf.te.runtime.utils.Host;
import org.eclipse.tcf.te.ui.WorkbenchPartControl;
-import org.eclipse.tcf.te.ui.activator.UIPlugin;
import org.eclipse.tcf.te.ui.forms.CustomFormToolkit;
-import org.eclipse.tcf.te.ui.interfaces.ImageConsts;
-import org.eclipse.tcf.te.ui.nls.Messages;
import org.eclipse.ui.IDecoratorManager;
-import org.eclipse.ui.ISources;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.commands.ICommandService;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.handlers.IHandlerService;
-import org.eclipse.ui.menus.IMenuService;
-import org.eclipse.ui.part.MultiPageSelectionProvider;
/**
* Abstract tree control implementation.
*/
-public abstract class AbstractTreeControl extends WorkbenchPartControl implements SelectionListener,
- IDoubleClickListener, PropertyChangeListener, ISelectionChangedListener, FocusListener {
+public abstract class AbstractTreeControl extends WorkbenchPartControl implements SelectionListener {
// Reference to the tree viewer instance
private TreeViewer viewer;
// Reference to the selection changed listener
@@ -107,8 +71,8 @@ public abstract class AbstractTreeControl extends WorkbenchPartControl implement
private TreeViewerState viewerState;
// The action to configure the filters.
private ConfigFilterAction configFilterAction;
- // The tool bar manager
- private ToolBarManager toolbarManager;
+ // The menu manager
+ private MenuManager manager;
/**
* Constructor.
@@ -122,8 +86,8 @@ public abstract class AbstractTreeControl extends WorkbenchPartControl implement
*
* @param parentPart The parent workbench part this control is embedded in or <code>null</code>.
*/
- public AbstractTreeControl(IWorkbenchPart parentPart) {
- super(parentPart);
+ public AbstractTreeControl(IWorkbenchPart parent) {
+ super(parent);
}
/* (non-Javadoc)
@@ -171,10 +135,10 @@ public abstract class AbstractTreeControl extends WorkbenchPartControl implement
// Create the tree viewer
viewer = doCreateTreeViewer(parent);
// And configure the tree viewer
- configureTreeViewer(viewer);
+ doConfigureTreeViewer(viewer);
// Prepare popup menu and toolbar
- createContributionItems(viewer);
+ doCreateContributionItems(viewer);
}
/**
@@ -193,7 +157,7 @@ public abstract class AbstractTreeControl extends WorkbenchPartControl implement
*
* @param viewer The tree viewer. Must not be <code>null</code>.
*/
- protected void configureTreeViewer(TreeViewer viewer) {
+ protected void doConfigureTreeViewer(TreeViewer viewer) {
Assert.isNotNull(viewer);
viewer.setAutoExpandLevel(getAutoExpandLevel());
@@ -206,8 +170,6 @@ public abstract class AbstractTreeControl extends WorkbenchPartControl implement
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (method.getName().equals("inputChanged")) { //$NON-NLS-1$
onInputChanged(args[1], args[2]);
- } else if(method.getName().equals("dispose")) { //$NON-NLS-1$
- onContentProviderDisposed();
}
return method.invoke(contentProvider, args);
}
@@ -222,21 +184,11 @@ public abstract class AbstractTreeControl extends WorkbenchPartControl implement
viewer.getTree().setLayoutData(doCreateTreeViewerLayoutData(viewer));
// Attach the selection changed listener
- viewer.addSelectionChangedListener(this);
selectionChangedListener = doCreateTreeViewerSelectionChangedListener(viewer);
if (selectionChangedListener != null) {
viewer.addSelectionChangedListener(selectionChangedListener);
}
- viewer.addDoubleClickListener(this);
-
- // Set the help context.
- String helpContextId = getHelpId();
- if (helpContextId != null) {
- PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getTree(), helpContextId);
- }
- Tree tree = viewer.getTree();
- tree.addFocusListener(this);
// Define an editor activation strategy for the common viewer so as to be invoked only programmatically.
ColumnViewerEditorActivationStrategy activationStrategy = new TreeViewerEditorActivationStrategy(getViewerId(), viewer);
TreeViewerEditor.create(viewer, null, activationStrategy, ColumnViewerEditor.DEFAULT);
@@ -250,64 +202,19 @@ public abstract class AbstractTreeControl extends WorkbenchPartControl implement
* @param newInput The new input.
*/
void onInputChanged(Object oldInput, Object newInput) {
- if(oldInput != null) {
- uninstallPropertyChangeListener(oldInput);
- }
columns = doCreateViewerColumns(newInput);
filterDescriptors = doCreateFilterDescriptors(newInput);
if (isStatePersistent()) {
updateViewerState(newInput);
}
- createTreeColumns(viewer);
+ doCreateTreeColumns(viewer);
viewer.getTree().setHeaderVisible(true);
updateFilters();
new TreeViewerHeaderMenu(this).create();
configFilterAction.updateEnablement();
- if(newInput != null) {
- installPropertyChangeListener(newInput);
- }
- }
-
- /**
- * Handle the event when the content provider is disposed.
- * Un-install the property change listener that has been added
- * to the input.
- *
- * @param oldInput the old input.
- * @param newInput The new input.
- */
- void onContentProviderDisposed() {
- Object input = viewer.getInput();
- if(input != null) {
- uninstallPropertyChangeListener(input);
- }
- }
-
- /**
- * Uninstall the property change listener from the specified input.
- *
- * @param input The input of the tree viewer.
- */
- private void uninstallPropertyChangeListener(Object input) {
- IViewerInput viewerInput = ViewerStateManager.getViewerInput(input);
- if(viewerInput != null) {
- viewerInput.removePropertyChangeListener(this);
- }
}
/**
- * Install the property change listener to the input of the tree viewer.
- *
- * @param input The input of the tree viewer.
- */
- private void installPropertyChangeListener(Object input) {
- IViewerInput viewerInput = ViewerStateManager.getViewerInput(input);
- if(viewerInput != null) {
- viewerInput.addPropertyChangeListener(this);
- }
- }
-
- /**
* Update the viewer state using the states from the viewerState which
* is retrieved or created based on the input.
*
@@ -368,7 +275,7 @@ public abstract class AbstractTreeControl extends WorkbenchPartControl implement
return true;
}
else if (!column.isVisible() && visible) {
- TreeColumn treeColumn = createTreeColumn(column, false);
+ TreeColumn treeColumn = doCreateTreeColumn(column, false);
column.setTreeColumn(treeColumn);
column.setVisible(visible);
return true;
@@ -387,15 +294,6 @@ public abstract class AbstractTreeControl extends WorkbenchPartControl implement
}
/**
- * Get the help context id of this viewer.
- *
- * @return The help context id or null if no help available.
- */
- protected String getHelpId() {
- return null;
- }
-
- /**
* Create the tree viewer columns from the viewers extension.
* Subclass may override it to provide its customized viewer columns.
*
@@ -448,7 +346,7 @@ public abstract class AbstractTreeControl extends WorkbenchPartControl implement
*
* @param viewer The tree viewer.
*/
- protected void createTreeColumns(TreeViewer viewer) {
+ protected void doCreateTreeColumns(TreeViewer viewer) {
Assert.isTrue(columns != null && columns.length > 0);
List<ColumnDescriptor> visibleColumns = new ArrayList<ColumnDescriptor>();
for (ColumnDescriptor column : columns) {
@@ -460,7 +358,7 @@ public abstract class AbstractTreeControl extends WorkbenchPartControl implement
return o1.getOrder() < o2.getOrder() ? -1 : (o1.getOrder() > o2.getOrder() ? 1 : 0);
}});
for(ColumnDescriptor visibleColumn : visibleColumns) {
- createTreeColumn(visibleColumn, true);
+ doCreateTreeColumn(visibleColumn, true);
}
if(!Host.isWindowsHost()) {
Tree tree = viewer.getTree();
@@ -484,7 +382,7 @@ public abstract class AbstractTreeControl extends WorkbenchPartControl implement
* @param append If the new column should be appended.
* @return The tree column created.
*/
- TreeColumn createTreeColumn(final ColumnDescriptor column, boolean append) {
+ TreeColumn doCreateTreeColumn(final ColumnDescriptor column, boolean append) {
Tree tree = viewer.getTree();
final TreeColumn treeColumn = append ? new TreeColumn(tree, column.getStyle()) :
new TreeColumn(tree, column.getStyle(), getColumnIndex(column));
@@ -626,11 +524,11 @@ public abstract class AbstractTreeControl extends WorkbenchPartControl implement
*
* @param viewer The tree viewer instance. Must not be <code>null</code>.
*/
- protected void createContributionItems(TreeViewer viewer) {
+ protected void doCreateContributionItems(TreeViewer viewer) {
Assert.isNotNull(viewer);
// Create the menu manager
- MenuManager manager = new MenuManager("#PopupMenu"); //$NON-NLS-1$
+ manager = new MenuManager("#PopupMenu"); //$NON-NLS-1$
// Attach the menu listener
manager.addMenuListener(new IMenuListener() {
@Override
@@ -642,72 +540,15 @@ public abstract class AbstractTreeControl extends WorkbenchPartControl implement
manager.setRemoveAllWhenShown(true);
// Associated with the tree
viewer.getTree().setMenu(manager.createContextMenu(viewer.getTree()));
-
- // Register the context menu at the parent workbench part site.
- if (getParentPart() != null && getParentPart().getSite() != null && getContextMenuId() != null) {
- getParentPart().getSite().registerContextMenu(getContextMenuId(), manager, viewer);
- }
-
- // The toolbar is a bit more complicated as we want to have the
- // toolbar placed within the section title.
- createToolbarContributionItem(viewer);
}
-
+
/**
- * Returns the context menu id.
- *
- * @return The context menu id.
+ * Get the context menu manager.
+ *
+ * @return the context menu manager.
*/
- protected abstract String getContextMenuId();
-
- /**
- * Creates the toolbar within the section parent of the given tree viewer.
- *
- * @param viewer The tree viewer instance. Must not be <code>null</code>.
- */
- protected void createToolbarContributionItem(TreeViewer viewer) {
- Assert.isNotNull(viewer);
-
- // Determine the section parent from the tree viewer
- Composite parent = viewer.getTree().getParent();
- while (parent != null && !(parent instanceof Section)) {
- parent = parent.getParent();
- }
-
- // We are done here if we cannot find a section parent or the parent is disposed
- if (parent == null || parent.isDisposed()) {
- return;
- }
-
- toolbarManager = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL | SWT.RIGHT);
- // create the toolbar items
- createToolBarItems(toolbarManager);
- if (getParentPart() != null && getParentPart().getSite() != null && getContextMenuId() != null) {
- IMenuService service = (IMenuService) getParentPart().getSite().getService(IMenuService.class);
- if (service != null) {
- service.populateContributionManager(toolbarManager, "toolbar:" + this.getContextMenuId()); //$NON-NLS-1$
- }
- }
- ToolBar toolbar = toolbarManager.createControl(parent);
-
- // The cursor within the toolbar shall change to an hand
- final Cursor handCursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
- toolbar.setCursor(handCursor);
- // Cursor needs to be explicitly disposed
- toolbar.addDisposeListener(new DisposeListener() {
- @Override
- public void widgetDisposed(DisposeEvent e) {
- if (handCursor.isDisposed() == false) {
- handCursor.dispose();
- }
- }
- });
-
- // If the parent composite is a forms section, set the toolbar
- // as text client to the section header
- Section section = (Section)parent;
- // Set the toolbar as text client
- section.setTextClient(toolbar);
+ public MenuManager getContextMenuManager() {
+ return manager;
}
/**
@@ -718,21 +559,9 @@ public abstract class AbstractTreeControl extends WorkbenchPartControl implement
*
* @param toolbarManager The toolbar to add the toolbar items too. Must not be <code>null</code>.
*/
- protected void createToolBarItems(ToolBarManager toolbarManager) {
- Assert.isNotNull(toolbarManager);
- toolbarManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ public void createToolbarContributionItems(IToolBarManager toolbarManager) {
toolbarManager.add(new CollapseAllAction(this));
toolbarManager.add(configFilterAction = new ConfigFilterAction(this));
- Action action = new Action(null, IAction.AS_PUSH_BUTTON){
- @Override
- public void run() {
- PlatformUI.getWorkbench().getHelpSystem().displayDynamicHelp();
- }
- };
- action.setToolTipText(Messages.AbstractTreeControl_HelpTooltip);
- ImageDescriptor image = UIPlugin.getImageDescriptor(ImageConsts.VIEWER_HELP);
- action.setImageDescriptor(image);
- toolbarManager.add(action);
}
/**
@@ -816,153 +645,4 @@ public abstract class AbstractTreeControl extends WorkbenchPartControl implement
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
-
- /**
- * Listens to the double-click event of the tree and expand or collapse
- * the tree by default. Subclass may override this method to invoke certain
- * command.
- *
- * @param event the double click event
- * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(DoubleClickEvent)
- */
- @Override
- public void doubleClick(final DoubleClickEvent event) {
- // If an handled and enabled command is registered for the ICommonActionConstants.OPEN
- // retargetable action id, redirect the double click handling to the command handler.
- //
- // Note: The default tree node expansion must be re-implemented in the active handler!
- String commandId = getDoubleClickCommandId();
- Command cmd = null;
- if(commandId != null) {
- ICommandService service = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class);
- cmd = service != null ? service.getCommand(commandId) : null;
- }
- if (cmd != null && cmd.isDefined() && cmd.isEnabled()) {
- final Command command = cmd;
- SafeRunner.run(new SafeRunnable(){
- @Override
- public void handleException(Throwable e) {
- // Ignore exception
- }
- @Override
- public void run() throws Exception {
- ISelection selection = event.getSelection();
- EvaluationContext ctx = new EvaluationContext(null, selection);
- ctx.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, selection);
- ctx.addVariable(ISources.ACTIVE_MENU_SELECTION_NAME, selection);
- ctx.addVariable(ISources.ACTIVE_WORKBENCH_WINDOW_NAME, PlatformUI.getWorkbench().getActiveWorkbenchWindow());
- IWorkbenchPart part = getParentPart();
- if (part != null) {
- IWorkbenchPartSite site = part.getSite();
- ctx.addVariable(ISources.ACTIVE_PART_ID_NAME, site.getId());
- ctx.addVariable(ISources.ACTIVE_PART_NAME, part);
- ctx.addVariable(ISources.ACTIVE_SITE_NAME, site);
- ctx.addVariable(ISources.ACTIVE_SHELL_NAME, site.getShell());
- }
- ctx.setAllowPluginActivation(true);
-
- ParameterizedCommand pCmd = ParameterizedCommand.generateCommand(command, null);
- Assert.isNotNull(pCmd);
- IHandlerService handlerSvc = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class);
- Assert.isNotNull(handlerSvc);
- handlerSvc.executeCommandInContext(pCmd, null, ctx);
- }});
- } else {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- Object element = selection.getFirstElement();
- TreeViewer viewer = (TreeViewer) getViewer();
- if (viewer.isExpandable(element)) {
- viewer.setExpandedState(element, !viewer.getExpandedState(element));
- }
- }
- }
-
- /**
- * Get the id of the command invoked when the tree is double-clicked.
- * If the id is null, then no command is invoked.
- *
- * @return The double-click command id.
- */
- protected String getDoubleClickCommandId() {
- return null;
- }
-
- /*
- * (non-Javadoc)
- * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
- */
- @Override
- public void propertyChange(final PropertyChangeEvent event) {
- Object object = event.getSource();
- if (object == viewer.getInput()) {
- ToolBar toolbar = toolbarManager.getControl();
- if (!toolbar.isDisposed()) {
- Display display = toolbar.getDisplay();
- if (display.getThread() == Thread.currentThread()) {
- IContributionItem[] items = toolbarManager.getItems();
- for (IContributionItem item : items) {
- item.update();
- }
- }
- else {
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- propertyChange(event);
- }
- });
- }
- }
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.swt.events.FocusListener#focusGained(org.eclipse.swt.events.FocusEvent)
- */
- @Override
- public void focusGained(FocusEvent e) {
- propagateSelection();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.swt.events.FocusListener#focusLost(org.eclipse.swt.events.FocusEvent)
- */
- @Override
- public void focusLost(FocusEvent e) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- propagateSelection();
- }
-
- /**
- * Propagate the current selection to the editor's selection provider.
- */
- private void propagateSelection() {
- IWorkbenchPart parent = getParentPart();
- if (parent != null) {
- IWorkbenchPartSite site = parent.getSite();
- if (site != null) {
- ISelection selection = getViewer().getSelection();
- ISelectionProvider selectionProvider = site.getSelectionProvider();
- // If the parent control is already disposed, we have no real chance of
- // testing for it. Catch the SWT exception here just in case.
- try {
- selectionProvider.setSelection(selection);
- if (selectionProvider instanceof MultiPageSelectionProvider) {
- SelectionChangedEvent changedEvent = new SelectionChangedEvent(selectionProvider, selection);
- ((MultiPageSelectionProvider) selectionProvider).firePostSelectionChanged(changedEvent);
- }
- } catch (SWTException e) {
- /* ignored on purpose */
- }
- }
- }
- }
} \ No newline at end of file
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/TreeControl.java b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/TreeControl.java
index f00636c98..4a53802b6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/TreeControl.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/TreeControl.java
@@ -84,8 +84,8 @@ public class TreeControl extends AbstractTreeControl {
* @see org.eclipse.tcf.te.ui.trees.AbstractTreeControl#configureTreeViewer(org.eclipse.jface.viewers.TreeViewer)
*/
@Override
- protected void configureTreeViewer(TreeViewer viewer) {
- super.configureTreeViewer(viewer);
+ protected void doConfigureTreeViewer(TreeViewer viewer) {
+ super.doConfigureTreeViewer(viewer);
IConfigurationElement configuration = viewerDescriptor.getDragConfig();
if(configuration != null) {
int operations = viewerExtension.parseDnd(configuration);
@@ -140,37 +140,10 @@ public class TreeControl extends AbstractTreeControl {
/*
* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.trees.AbstractTreeControl#getHelpId()
- */
- @Override
- protected String getHelpId() {
- return viewerDescriptor.getHelpId();
- }
-
- /*
- * (non-Javadoc)
* @see org.eclipse.tcf.te.ui.trees.AbstractTreeControl#getAutoExpandLevel()
*/
@Override
protected int getAutoExpandLevel() {
return viewerDescriptor.getAutoExpandLevel();
}
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.trees.AbstractTreeControl#getDoubleClickCommandId()
- */
- @Override
- protected String getDoubleClickCommandId() {
- return viewerDescriptor.getDoubleClickCommand();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.trees.AbstractTreeControl#getContextMenuId()
- */
- @Override
- protected String getContextMenuId() {
- return viewerDescriptor.getContextMenuId();
- }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/TreeViewerExtension.java b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/TreeViewerExtension.java
index 676270584..8ff9d7708 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/TreeViewerExtension.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/TreeViewerExtension.java
@@ -136,18 +136,6 @@ public class TreeViewerExtension {
catch (NumberFormatException nfe) {
}
}
- value = configuration.getAttribute("menuId"); //$NON-NLS-1$
- if (value != null) {
- descriptor.setContextMenuId(value);
- }
- value = configuration.getAttribute("doubleClickCommand"); //$NON-NLS-1$
- if (value != null) {
- descriptor.setDoubleClickCommand(value);
- }
- value = configuration.getAttribute("helpId"); //$NON-NLS-1$
- if (value != null) {
- descriptor.setHelpId(value);
- }
return descriptor;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/ViewerDescriptor.java b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/ViewerDescriptor.java
index 692df2567..9a82ccffc 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/ViewerDescriptor.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui/src/org/eclipse/tcf/te/ui/trees/ViewerDescriptor.java
@@ -28,12 +28,6 @@ public class ViewerDescriptor {
private boolean persistent = false;
// The auto expand level.
private int autoExpandLevel = 2;
- // The context menu id.
- private String menuId;
- // The command invoked when double clicked.
- private String doubleClickCommand;
- // The help id of the tree viewer.
- private String helpId;
public IConfigurationElement getStyleConfig() {
return styleConfig;
@@ -82,28 +76,4 @@ public class ViewerDescriptor {
public void setAutoExpandLevel(int autoExpandLevel) {
this.autoExpandLevel = autoExpandLevel;
}
-
- public String getContextMenuId() {
- return menuId;
- }
-
- public void setContextMenuId(String menuId) {
- this.menuId = menuId;
- }
-
- public String getDoubleClickCommand() {
- return doubleClickCommand;
- }
-
- public void setDoubleClickCommand(String doubleClickCommand) {
- this.doubleClickCommand = doubleClickCommand;
- }
-
- public String getHelpId() {
- return helpId;
- }
-
- public void setHelpId(String helpId) {
- this.helpId = helpId;
- }
}

Back to the top