Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2002-05-17 15:15:04 -0400
committerJean Michel-Lemieux2002-05-17 15:15:04 -0400
commit2ffb3b6561d8dfaa88fae6d6939059b227a5eff4 (patch)
tree70f7550ed7196de2b7053ddfe259926b230b8568
parent406bec2e85cd5333d0e81adb88a94215dd8ccece (diff)
downloadeclipse.platform.team-2ffb3b6561d8dfaa88fae6d6939059b227a5eff4.tar.gz
eclipse.platform.team-2ffb3b6561d8dfaa88fae6d6939059b227a5eff4.tar.xz
eclipse.platform.team-2ffb3b6561d8dfaa88fae6d6939059b227a5eff4.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/IRemoteTargetResource.java5
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/MappingSelectionPage.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/RemoteResourceElement.java19
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteElement.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerView.java126
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerViewLabelProvider.java40
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteRootsElement.java8
7 files changed, 180 insertions, 28 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/IRemoteTargetResource.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/IRemoteTargetResource.java
index c4005dd27..a8495b7b7 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/IRemoteTargetResource.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/target/IRemoteTargetResource.java
@@ -38,6 +38,11 @@ public interface IRemoteTargetResource extends IRemoteResource {
public int getSize() throws TeamException;
/**
+ * Returns the last modified time
+ */
+ public String getLastModified() throws TeamException;
+
+ /**
* Return a boolean value indicating whether or not this resource exists on the
* remote server.
*/
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/MappingSelectionPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/MappingSelectionPage.java
index 4fe19dd44..f2a85c5b4 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/MappingSelectionPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/MappingSelectionPage.java
@@ -107,7 +107,7 @@ public class MappingSelectionPage extends TargetWizardPage {
private void setViewerInput() {
if(this.site == null || viewer == null)
return;
- viewer.setInput(new SiteRootsElement(new Site[] {site}, false /* show only folders */));
+ viewer.setInput(new SiteRootsElement(new Site[] {site}, RemoteResourceElement.SHOW_FOLDERS));
}
/**
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/RemoteResourceElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/RemoteResourceElement.java
index 1882acd0b..746d50425 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/RemoteResourceElement.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/RemoteResourceElement.java
@@ -17,16 +17,19 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.model.IWorkbenchAdapter;
public class RemoteResourceElement implements IWorkbenchAdapter, IAdaptable {
- IRemoteTargetResource remote;
- boolean showFiles = true;
+ final public static int SHOW_FILES = 1;
+ final public static int SHOW_FOLDERS = 2;
+
+ private IRemoteTargetResource remote;
+ private int showMask = SHOW_FILES | SHOW_FOLDERS;
public RemoteResourceElement(IRemoteTargetResource remote) {
this.remote = remote;
}
- public RemoteResourceElement(IRemoteTargetResource remote, boolean showFiles) {
+ public RemoteResourceElement(IRemoteTargetResource remote, int showMask) {
this.remote = remote;
- this.showFiles = showFiles;
+ this.showMask = showMask;
}
public IRemoteTargetResource getRemoteResource() {
@@ -49,8 +52,12 @@ public class RemoteResourceElement implements IWorkbenchAdapter, IAdaptable {
int n = 0;
for (int i = 0; i < children.length; i++) {
IRemoteTargetResource child = (IRemoteTargetResource)children[i];
- if(child.isContainer() || showFiles) {
- remoteElements.add(new RemoteResourceElement(child, showFiles));
+ if(child.isContainer()) {
+ if((showMask & SHOW_FOLDERS) != 0) {
+ remoteElements.add(new RemoteResourceElement(child, showMask));
+ }
+ } else if((showMask & SHOW_FILES) != 0) {
+ remoteElements.add(new RemoteResourceElement(child, showMask));
}
}
result[0] = (RemoteResourceElement[])remoteElements.toArray(new RemoteResourceElement[remoteElements.size()]);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteElement.java
index 82298b97c..a81be077d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteElement.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteElement.java
@@ -17,15 +17,15 @@ import org.eclipse.ui.model.IWorkbenchAdapter;
public class SiteElement implements IWorkbenchAdapter, IAdaptable {
private Site site;
- private boolean showFiles = true;
+ private int showMask = RemoteResourceElement.SHOW_FILES | RemoteResourceElement.SHOW_FOLDERS;
public SiteElement(Site site) {
this.site = site;
}
- public SiteElement(Site site, boolean showFiles) {
+ public SiteElement(Site site, int showMask) {
this.site = site;
- this.showFiles = showFiles;
+ this.showMask = showMask;
}
public Site getSite() {
@@ -43,7 +43,7 @@ public class SiteElement implements IWorkbenchAdapter, IAdaptable {
public Object[] getChildren(Object o) {
try {
- return new RemoteResourceElement(site.getRemoteResource(), showFiles).getChildren(this);
+ return new RemoteResourceElement(site.getRemoteResource(), showMask).getChildren(this);
} catch (TeamException e) {
TeamUIPlugin.handle(e);
return new Object[0];
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerView.java
index 2a38135b5..2d7191bac 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerView.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerView.java
@@ -1,19 +1,44 @@
package org.eclipse.team.internal.ui.target;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.swing.text.html.parser.TagElement;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ColumnLayoutData;
+import org.eclipse.jface.viewers.ColumnPixelData;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.target.IRemoteTargetResource;
import org.eclipse.team.core.target.ISiteListener;
import org.eclipse.team.core.target.Site;
import org.eclipse.team.core.target.TargetManager;
-import org.eclipse.team.internal.ui.ConfigureProjectWizard;
import org.eclipse.team.internal.ui.Policy;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.ui.ISharedImages;
import org.eclipse.team.ui.TeamImages;
import org.eclipse.ui.IActionBars;
@@ -25,7 +50,8 @@ public class SiteExplorerView extends ViewPart implements ISiteListener {
public static final String VIEW_ID = "org.eclipse.team.ui.target.SiteExplorerView"; //$NON-NLS-1$
// The tree viewer
- private TreeViewer viewer;
+ private TableViewer tableViewer;
+ private TreeViewer treeViewer;
// The root
private SiteRootsElement root;
@@ -36,27 +62,98 @@ public class SiteExplorerView extends ViewPart implements ISiteListener {
/**
* @see IWorkbenchPart#createPartControl(Composite)
*/
- public void createPartControl(Composite parent) {
- root = new SiteRootsElement();
- viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- viewer.setContentProvider(new SiteLazyContentProvider());
- viewer.setLabelProvider(new WorkbenchLabelProvider());
- getSite().setSelectionProvider(viewer);
- viewer.setInput(root);
- viewer.setSorter(new SiteViewSorter());
- viewer.getControl().addKeyListener(new KeyAdapter() {
+ public void createPartControl(Composite p) {
+ SashForm sash = new SashForm(p, SWT.HORIZONTAL);
+ sash.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ root = new SiteRootsElement(TargetManager.getSites(), RemoteResourceElement.SHOW_FOLDERS);
+
+ treeViewer = new TreeViewer(sash, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ treeViewer.setContentProvider(new SiteLazyContentProvider());
+ treeViewer.setLabelProvider(new WorkbenchLabelProvider());
+
+ treeViewer.setSorter(new SiteViewSorter());
+ treeViewer.getControl().addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent event) {
if (event.keyCode == SWT.F5) {
refresh();
}
}
});
+
+ treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ updateFileTable();
+ }
+ });
+
+ treeViewer.setInput(root);
+
+ Table table = new Table(sash, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
+ TableLayout tlayout = new TableLayout();
+
+ TableColumn tableColumn = new TableColumn(table, SWT.NULL);
+ tableColumn.setText("Name");
+ tableColumn = new TableColumn(table, SWT.NULL);
+ tableColumn.setText("Size");
+ tableColumn.setAlignment(SWT.RIGHT);
+ tableColumn = new TableColumn(table, SWT.NULL);
+ tableColumn.setText("Modified");
+ tableColumn = new TableColumn(table, SWT.NULL);
+ tableColumn.setText("URL");
+ ColumnLayoutData cLayout = new ColumnPixelData(21);
+ tlayout.addColumnData(cLayout);
+ cLayout = new ColumnPixelData(20);
+ tlayout.addColumnData(cLayout);
+ cLayout = new ColumnWeightData(100, true);
+ tlayout.addColumnData(cLayout);
+ cLayout = new ColumnPixelData(100);
+ tlayout.addColumnData(cLayout);
+ table.setLayout(tlayout);
+ table.setHeaderVisible(true);
+
+ tableViewer = new TableViewer(table);
+ tableViewer.setContentProvider(new SiteLazyContentProvider());
+ tableViewer.setLabelProvider(new SiteExplorerViewLabelProvider());
+
TargetManager.addSiteListener(this);
initalizeToolbarActions();
}
+ private IRemoteTargetResource getSelectedRemoteFolder() {
+ IStructuredSelection selection = (IStructuredSelection)treeViewer.getSelection();
+ if (!selection.isEmpty()) {
+ final List filesSelection = new ArrayList();
+ Iterator it = selection.iterator();
+ while(it.hasNext()) {
+ Object o = it.next();
+ if(o instanceof RemoteResourceElement) {
+ return ((RemoteResourceElement)o).getRemoteResource();
+ } else if(o instanceof SiteElement) {
+ try {
+ return ((SiteElement)o).getSite().getRemoteResource();
+ } catch (TeamException e) {
+ return null;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Method updateFileTable.
+ */
+ private void updateFileTable() {
+ final IRemoteTargetResource remoteFolder = getSelectedRemoteFolder();
+ final Set tags = new HashSet();
+ if(remoteFolder != null) {
+ tableViewer.setInput(new RemoteResourceElement(remoteFolder, RemoteResourceElement.SHOW_FILES));
+ }
+ }
+
private void initalizeToolbarActions() {
- final Shell shell = viewer.getTree().getShell();
+ final Shell shell = tableViewer.getTable().getShell();
// Create actions
// Refresh (toolbar)
@@ -97,6 +194,9 @@ public class SiteExplorerView extends ViewPart implements ISiteListener {
}
protected void refresh() {
- viewer.refresh();
+ root = new SiteRootsElement(TargetManager.getSites(), RemoteResourceElement.SHOW_FOLDERS);
+ treeViewer.setInput(root);
+ treeViewer.refresh();
+ tableViewer.refresh();
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerViewLabelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerViewLabelProvider.java
new file mode 100644
index 000000000..7fcbd6360
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerViewLabelProvider.java
@@ -0,0 +1,40 @@
+package org.eclipse.team.internal.ui.target;
+
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+
+public class SiteExplorerViewLabelProvider extends WorkbenchLabelProvider implements ITableLabelProvider {
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ if (columnIndex == 0) {
+ return super.getImage(element);
+ }
+ return null;
+ }
+ public String getColumnText(Object element, int columnIndex) {
+ try {
+ switch (columnIndex) {
+ case 0 :
+ return super.getText(element);
+ case 1 :
+ if(element instanceof RemoteResourceElement) {
+ return new Integer(((RemoteResourceElement)element).getRemoteResource().getSize()).toString() + " Bytes";
+ }
+ case 2 :
+ if(element instanceof RemoteResourceElement) {
+ return ((RemoteResourceElement)element).getRemoteResource().getLastModified();
+ }
+ case 3 :
+ if(element instanceof RemoteResourceElement) {
+ return ((RemoteResourceElement)element).getRemoteResource().getURL().toExternalForm();
+ }
+ }
+ return "";
+ } catch(TeamException e) {
+ return "";
+ }
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteRootsElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteRootsElement.java
index 142f7afdc..b7bc64fdf 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteRootsElement.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteRootsElement.java
@@ -8,11 +8,11 @@ import org.eclipse.ui.model.IWorkbenchAdapter;
public class SiteRootsElement implements IWorkbenchAdapter, IAdaptable {
private Site[] sites = null;
- private boolean showFiles = true;
+ private int showMask = RemoteResourceElement.SHOW_FILES | RemoteResourceElement.SHOW_FOLDERS;
- public SiteRootsElement(Site[] sites, boolean showFiles) {
+ public SiteRootsElement(Site[] sites, int showMask) {
this.sites = sites;
- this.showFiles = showFiles;
+ this.showMask = showMask;
}
public SiteRootsElement() {
@@ -32,7 +32,7 @@ public class SiteRootsElement implements IWorkbenchAdapter, IAdaptable {
}
SiteElement[] siteElements = new SiteElement[childSites.length];
for (int i = 0; i < childSites.length; i++) {
- siteElements[i] = new SiteElement(childSites[i], showFiles);
+ siteElements[i] = new SiteElement(childSites[i], showMask);
}
return siteElements;
}

Back to the top