Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2013-07-10 08:48:26 +0000
committerUwe Stieber2013-07-10 08:48:26 +0000
commitf02b03ca0ec5b1055c5896cbadb9f2b2ece2b0bb (patch)
treef2ecd2b7d4a1090451e6c6e21e8edf99868d544f /target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui
parent1463305593bde20a65523d3fbd91cc34b803c522 (diff)
downloadorg.eclipse.tcf-f02b03ca0ec5b1055c5896cbadb9f2b2ece2b0bb.tar.gz
org.eclipse.tcf-f02b03ca0ec5b1055c5896cbadb9f2b2ece2b0bb.tar.xz
org.eclipse.tcf-f02b03ca0ec5b1055c5896cbadb9f2b2ece2b0bb.zip
Target Explorer: Fix remote file system issues
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/META-INF/MANIFEST.MF3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.xml54
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeAdapterFactory.java202
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/EditorHandlerDelegate.java55
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/BasicFolderSection.java230
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/services/UIService.java38
6 files changed, 247 insertions, 335 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/META-INF/MANIFEST.MF
index 6f641ae39..77b1272fc 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/META-INF/MANIFEST.MF
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/META-INF/MANIFEST.MF
@@ -54,5 +54,4 @@ Export-Package: org.eclipse.tcf.te.tcf.filesystem.ui.activator;x-internal:=true,
org.eclipse.tcf.te.tcf.filesystem.ui.internal.tabbed;x-internal:=true,
org.eclipse.tcf.te.tcf.filesystem.ui.internal.testers;x-internal:=true,
org.eclipse.tcf.te.tcf.filesystem.ui.internal.wizards;x-internal:=true,
- org.eclipse.tcf.te.tcf.filesystem.ui.nls;x-internal:=true,
- org.eclipse.tcf.te.tcf.filesystem.ui.services
+ org.eclipse.tcf.te.tcf.filesystem.ui.nls;x-internal:=true
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 7074626fd..a621432cc 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
@@ -95,21 +95,6 @@
</commonFilter>
</extension>
-<!-- Service contributions -->
- <extension point="org.eclipse.tcf.te.runtime.services.services">
- <service
- class="org.eclipse.tcf.te.tcf.filesystem.ui.services.UIService"
- id="org.eclipse.tcf.te.tcf.filesytsem.uiservice">
- <serviceType class="org.eclipse.tcf.te.runtime.services.interfaces.IUIService"/>
- <enablement>
- <or>
- <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"/>
- <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.model.FSModel"/>
- </or>
- </enablement>
- </service>
- </extension>
-
<!-- Editor page contributions -->
<extension point="org.eclipse.tcf.te.ui.views.editorPages">
<editorPage
@@ -127,14 +112,13 @@
pageId="org.eclipse.tcf.te.tcf.filesystem.FSExplorerEditorPage">
<enablement>
<with variable="activeEditorInput">
- <adapt type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel">
- <test property="org.eclipse.tcf.te.tcf.locator.hasRemoteService" value="FileSystem"/>
- <test
- property="org.eclipse.tcf.te.runtime.preference"
- args="bundleId=org.eclipse.tcf.te.tcf.filesystem.ui,key=te.tcf.filesystem.core.feature.editor.content.enable"
- value="true">
- </test>
- </adapt>
+ <instanceof value="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"/>
+ <test property="org.eclipse.tcf.te.tcf.locator.hasRemoteService" value="FileSystem"/>
+ <test
+ property="org.eclipse.tcf.te.runtime.preference"
+ args="bundleId=org.eclipse.tcf.te.tcf.filesystem.ui,key=te.tcf.filesystem.core.feature.editor.content.enable"
+ value="true">
+ </test>
</with>
</enablement>
</editorPageBinding>
@@ -1691,24 +1675,12 @@
<factory
adaptableType="org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode"
class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters.FSTreeNodeAdapterFactory">
- <adapter
- type="org.eclipse.ui.IActionFilter">
- </adapter>
- <adapter
- type="org.eclipse.jface.viewers.ILabelProvider">
- </adapter>
- <adapter
- type="org.eclipse.ui.IPersistableElement">
- </adapter>
- <adapter
- type="org.eclipse.tcf.te.ui.interfaces.ILazyLoader">
- </adapter>
- <adapter
- type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel">
- </adapter>
- <adapter
- type="org.eclipse.tcf.te.ui.interfaces.ISearchable">
- </adapter>
+ <adapter type="org.eclipse.ui.IActionFilter"/>
+ <adapter type="org.eclipse.jface.viewers.ILabelProvider"/>
+ <adapter type="org.eclipse.ui.IPersistableElement"/>
+ <adapter type="org.eclipse.tcf.te.ui.interfaces.ILazyLoader"/>
+ <adapter type="org.eclipse.tcf.te.ui.interfaces.ISearchable"/>
+ <adapter type="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider"/>
</factory>
<factory
adaptableType="org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel"
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeAdapterFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeAdapterFactory.java
index 278420737..5c9c6772e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeAdapterFactory.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeAdapterFactory.java
@@ -1,84 +1,118 @@
-/*******************************************************************************
- * 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.adapters;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
-import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
-import org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns.FSTreeElementLabelProvider;
-import org.eclipse.tcf.te.tcf.filesystem.ui.internal.search.FSTreeNodeSearchable;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.ui.interfaces.ILazyLoader;
-import org.eclipse.tcf.te.ui.interfaces.ISearchable;
-import org.eclipse.ui.IActionFilter;
-import org.eclipse.ui.IPersistableElement;
-
-/**
- * The adapter factory of <code>FSTreeNode</code> over <code>IActionFilter</code>
- */
-public class FSTreeNodeAdapterFactory implements IAdapterFactory {
- private static ILabelProvider nodeLabelProvider = new FSTreeElementLabelProvider();
- // The fFilters map caching fFilters for FS nodes.
- private Map<FSTreeNode, NodeStateFilter> filters;
-
- /**
- * Constructor.
- */
- public FSTreeNodeAdapterFactory(){
- this.filters = Collections.synchronizedMap(new HashMap<FSTreeNode, NodeStateFilter>());
- }
-
- /* (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 FSTreeNode) {
- FSTreeNode node = (FSTreeNode) adaptableObject;
- if(adapterType == IActionFilter.class) {
- NodeStateFilter filter = filters.get(node);
- if(filter == null){
- filter = new NodeStateFilter(node);
- filters.put(node, filter);
- }
- return filter;
- }
- else if(adapterType == ILabelProvider.class) {
- return nodeLabelProvider;
- }
- else if(adapterType == IPersistableElement.class && UIPlugin.isExpandedPersisted()) {
- return new PersistableNode(node);
- }
- else if(adapterType == ILazyLoader.class) {
- return new FSTreeNodeLoader(node);
- }
- else if(adapterType == IPeerModel.class) {
- return node.getPeerModel();
- }
- else if(adapterType == ISearchable.class) {
- return new FSTreeNodeSearchable(node);
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
- */
- @Override
- public Class[] getAdapterList() {
- return new Class[] { IActionFilter.class, ILabelProvider.class, IPersistableElement.class, ILazyLoader.class, ISearchable.class };
- }
-}
+/*******************************************************************************
+ * 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.adapters;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns.FSTreeElementLabelProvider;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.search.FSTreeNodeSearchable;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider;
+import org.eclipse.tcf.te.ui.interfaces.ILazyLoader;
+import org.eclipse.tcf.te.ui.interfaces.ISearchable;
+import org.eclipse.ui.IActionFilter;
+import org.eclipse.ui.IPersistableElement;
+
+/**
+ * The adapter factory of <code>FSTreeNode</code> over <code>IActionFilter</code>
+ */
+public class FSTreeNodeAdapterFactory implements IAdapterFactory {
+ private static ILabelProvider nodeLabelProvider = new FSTreeElementLabelProvider();
+ // The fFilters map caching fFilters for FS nodes.
+ private Map<FSTreeNode, NodeStateFilter> filters;
+
+ public static class FSTreeNodePeerModelProvider extends PlatformObject implements IPeerModelProvider {
+ private final FSTreeNode node;
+
+ /**
+ * Constructor
+ */
+ public FSTreeNodePeerModelProvider(FSTreeNode node) {
+ Assert.isNotNull(node);
+ this.node = node;
+ }
+
+ /**
+ * Returns the associated file system tree node.
+ *
+ * @return The associated file system tree node.
+ */
+ public final FSTreeNode getFSTreeNode() {
+ return node;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider#getPeerModel()
+ */
+ @Override
+ public final IPeerModel getPeerModel() {
+ return node.peerNode;
+ }
+ }
+
+ /**
+ * Constructor.
+ */
+ public FSTreeNodeAdapterFactory() {
+ this.filters = Collections.synchronizedMap(new HashMap<FSTreeNode, NodeStateFilter>());
+ }
+
+ /*
+ * (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 FSTreeNode) {
+ FSTreeNode node = (FSTreeNode) adaptableObject;
+ if (adapterType == IActionFilter.class) {
+ NodeStateFilter filter = filters.get(node);
+ if (filter == null) {
+ filter = new NodeStateFilter(node);
+ filters.put(node, filter);
+ }
+ return filter;
+ }
+ else if (adapterType == ILabelProvider.class) {
+ return nodeLabelProvider;
+ }
+ else if (adapterType == IPersistableElement.class && UIPlugin.isExpandedPersisted()) {
+ return new PersistableNode(node);
+ }
+ else if (adapterType == ILazyLoader.class) {
+ return new FSTreeNodeLoader(node);
+ }
+ else if (adapterType == IPeerModelProvider.class) {
+ return new FSTreeNodePeerModelProvider(node);
+ }
+ else if (adapterType == ISearchable.class) {
+ return new FSTreeNodeSearchable(node);
+ }
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ @Override
+ public Class[] getAdapterList() {
+ return new Class[] { IActionFilter.class, ILabelProvider.class, IPersistableElement.class, ILazyLoader.class, ISearchable.class, IPeerModelProvider.class };
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/EditorHandlerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/EditorHandlerDelegate.java
deleted file mode 100644
index fb64aac8b..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/EditorHandlerDelegate.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * EditorHandlerDelegate.java
- * Created on Jan 25, 2012
- *
- * Copyright (c) 2012, 2013 Wind River Systems, Inc.
- *
- * The right to copy, distribute, modify, or otherwise make use
- * of this software may be licensed only pursuant to the terms
- * of an applicable Wind River license agreement.
- */
-package org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers;
-
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.FSModel;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
-import org.eclipse.tcf.te.tcf.filesystem.ui.internal.pages.FSExplorerEditorPage;
-import org.eclipse.tcf.te.tcf.ui.handler.AbstractPeerModelEditorHandlerDelegate;
-import org.eclipse.tcf.te.ui.swt.DisplayUtil;
-import org.eclipse.tcf.te.ui.views.editor.Editor;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.forms.editor.FormEditor;
-import org.eclipse.ui.forms.editor.IFormPage;
-
-/**
- * Systems context node properties command handler implementation.
- */
-public class EditorHandlerDelegate extends AbstractPeerModelEditorHandlerDelegate {
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.handler.IEditorHandlerDelegate#postOpenProperties(org.eclipse.ui.IEditorPart, java.lang.Object)
- */
- @Override
- public void postOpenEditor(IEditorPart editor, final Object element) {
- if (editor instanceof FormEditor) {
- final FormEditor formEditor = (FormEditor)editor;
- DisplayUtil.safeAsyncExec(new Runnable() {
- @Override
- public void run() {
- IFormPage page = formEditor.setActivePage("org.eclipse.tcf.te.tcf.filesystem.FSExplorerEditorPage"); //$NON-NLS-1$
- // If the element is a context node, select the node
- if (page != null && element instanceof FSTreeNode || element instanceof FSModel) {
- Viewer viewer = ((FSExplorerEditorPage)page).getTreeControl().getViewer();
- if (viewer != null) {
- viewer.setSelection(new StructuredSelection(element), true);
- }
- }
- else if (formEditor instanceof Editor) {
- ((Editor)formEditor).setActivePage(0);
- }
- }
- });
- }
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/BasicFolderSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/BasicFolderSection.java
index 165af9d80..1376ff9be 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/BasicFolderSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/tabbed/BasicFolderSection.java
@@ -1,116 +1,116 @@
-/*******************************************************************************
- * 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.tabbed;
-
-import java.text.DateFormat;
-import java.text.DecimalFormat;
-import java.util.Date;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
-import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider;
-import org.eclipse.tcf.te.tcf.ui.tabbed.BaseTitledSection;
-import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-
-/**
- * The section that displays the basic information of a folder.
- */
-public class BasicFolderSection extends BaseTitledSection {
- // The formatter for the size of a file.
- private static final DecimalFormat SIZE_FORMAT = new DecimalFormat();
-
- // The original node to be displayed and edited.
- protected FSTreeNode node;
- // The copy used to be edited.
- protected FSTreeNode clone;
-
- // The text for the name of the node.
- protected Text nameText;
- // The text for the type of the node.
- protected Text typeText;
- // The text for the location of the node.
- protected Text locationText;
- // The text for the modified time of the node.
- protected Text modifiedText;
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
- */
- @Override
- public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
- super.createControls(parent, aTabbedPropertySheetPage);
- nameText = createTextField(null, Messages.GeneralInformationPage_Name);
- typeText = createTextField(nameText, Messages.GeneralInformationPage_Type);
- locationText = createWrapTextField(typeText, Messages.GeneralInformationPage_Location);
- modifiedText = createTextField(locationText, Messages.GeneralInformationPage_Modified);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#updateData(org.eclipse.tcf.te.ui.interfaces.IPropertyChangeProvider)
- */
- @Override
- protected void updateInput(IPeerModelProvider input) {
- Assert.isTrue(input instanceof FSTreeNode);
- this.node = (FSTreeNode) input;
- this.clone = (FSTreeNode) node.clone();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
- */
- @Override
- public void refresh() {
- SWTControlUtil.setText(nameText, clone != null ? clone.name : ""); //$NON-NLS-1$
- SWTControlUtil.setText(typeText, clone != null ? clone.getFileType() : ""); //$NON-NLS-1$
- String location = clone == null || clone.isRoot() ? Messages.GeneralInformationPage_Computer : clone.getLocation();
- SWTControlUtil.setText(locationText, location);
- SWTControlUtil.setText(modifiedText, clone != null ? getDateText(clone.attr.mtime) : ""); //$NON-NLS-1$
- super.refresh();
- }
-
- /**
- * Get the string of the specific time using the formatter, DATE_FORMAT.
- *
- * @param time The time to be formatted.
- * @return The string in the format of DATE_FORMAT.
- */
- protected String getDateText(long time) {
- DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT);
- return dateFormat.format(new Date(time));
- }
-
- /**
- * Get the string of the file size using using the formatter, SIZE_FORMAT.
- *
- * @param size
- * The size of the file to be formatted.
- * @return The string in the format of SIZE_FORMAT.
- */
- protected String getSizeText(long size) {
- return NLS.bind(Messages.GeneralInformationPage_FileSizeInfo, SIZE_FORMAT.format(size / 1024), SIZE_FORMAT.format(size));
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#getText()
- */
- @Override
- protected String getText() {
- return Messages.BasicFolderSection_BasicInfoText;
- }
+/*******************************************************************************
+ * 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.tabbed;
+
+import java.text.DateFormat;
+import java.text.DecimalFormat;
+import java.util.Date;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
+import org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters.FSTreeNodeAdapterFactory.FSTreeNodePeerModelProvider;
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModelProvider;
+import org.eclipse.tcf.te.tcf.ui.tabbed.BaseTitledSection;
+import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+/**
+ * The section that displays the basic information of a folder.
+ */
+public class BasicFolderSection extends BaseTitledSection {
+ // The formatter for the size of a file.
+ private static final DecimalFormat SIZE_FORMAT = new DecimalFormat();
+
+ // The original node to be displayed and edited.
+ protected FSTreeNode node;
+ // The copy used to be edited.
+ protected FSTreeNode clone;
+
+ // The text for the name of the node.
+ protected Text nameText;
+ // The text for the type of the node.
+ protected Text typeText;
+ // The text for the location of the node.
+ protected Text locationText;
+ // The text for the modified time of the node.
+ protected Text modifiedText;
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ */
+ @Override
+ public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.createControls(parent, aTabbedPropertySheetPage);
+ nameText = createTextField(null, Messages.GeneralInformationPage_Name);
+ typeText = createTextField(nameText, Messages.GeneralInformationPage_Type);
+ locationText = createWrapTextField(typeText, Messages.GeneralInformationPage_Location);
+ modifiedText = createTextField(locationText, Messages.GeneralInformationPage_Modified);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#updateData(org.eclipse.tcf.te.ui.interfaces.IPropertyChangeProvider)
+ */
+ @Override
+ protected void updateInput(IPeerModelProvider input) {
+ Assert.isTrue(input instanceof FSTreeNodePeerModelProvider);
+ this.node = ((FSTreeNodePeerModelProvider)input).getFSTreeNode();
+ this.clone = (FSTreeNode) node.clone();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh()
+ */
+ @Override
+ public void refresh() {
+ SWTControlUtil.setText(nameText, clone != null ? clone.name : ""); //$NON-NLS-1$
+ SWTControlUtil.setText(typeText, clone != null ? clone.getFileType() : ""); //$NON-NLS-1$
+ String location = clone == null || clone.isRoot() ? Messages.GeneralInformationPage_Computer : clone.getLocation();
+ SWTControlUtil.setText(locationText, location);
+ SWTControlUtil.setText(modifiedText, clone != null ? getDateText(clone.attr.mtime) : ""); //$NON-NLS-1$
+ super.refresh();
+ }
+
+ /**
+ * Get the string of the specific time using the formatter, DATE_FORMAT.
+ *
+ * @param time The time to be formatted.
+ * @return The string in the format of DATE_FORMAT.
+ */
+ protected String getDateText(long time) {
+ DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT);
+ return dateFormat.format(new Date(time));
+ }
+
+ /**
+ * Get the string of the file size using using the formatter, SIZE_FORMAT.
+ *
+ * @param size
+ * The size of the file to be formatted.
+ * @return The string in the format of SIZE_FORMAT.
+ */
+ protected String getSizeText(long size) {
+ return NLS.bind(Messages.GeneralInformationPage_FileSizeInfo, SIZE_FORMAT.format(size / 1024), SIZE_FORMAT.format(size));
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#getText()
+ */
+ @Override
+ protected String getText() {
+ return Messages.BasicFolderSection_BasicInfoText;
+ }
} \ No newline at end of file
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/services/UIService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/services/UIService.java
deleted file mode 100644
index 807e594e7..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/services/UIService.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * UIService.java
- * Created on Nov 15, 2012
- *
- * Copyright (c) 2012, 2013 Wind River Systems, Inc.
- *
- * The right to copy, distribute, modify, or otherwise make use
- * of this software may be licensed only pursuant to the terms
- * of an applicable Wind River license agreement.
- */
-package org.eclipse.tcf.te.tcf.filesystem.ui.services;
-
-import org.eclipse.tcf.te.runtime.services.AbstractService;
-import org.eclipse.tcf.te.runtime.services.interfaces.IUIService;
-import org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.EditorHandlerDelegate;
-import org.eclipse.tcf.te.ui.interfaces.handler.IEditorHandlerDelegate;
-
-/**
- * UI service implementation.
- */
-public class UIService extends AbstractService implements IUIService {
- private final IEditorHandlerDelegate editorHandlerDelegate = new EditorHandlerDelegate();
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.runtime.services.interfaces.IUIService#getDelegate(java.lang.Object, java.lang.Class)
- */
- @SuppressWarnings("unchecked")
- @Override
- public <V> V getDelegate(Object context, Class<? extends V> clazz) {
-
- if (IEditorHandlerDelegate.class.isAssignableFrom(clazz)) {
- return (V) editorHandlerDelegate;
- }
-
- return null;
- }
-
-}

Back to the top