mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 21:05:37 +02:00
[430900] RSE table enhancement to populate full column when clicking
column for sorting purposes
This commit is contained in:
parent
23e662c98c
commit
2acc687d5b
4 changed files with 2661 additions and 2619 deletions
|
@ -82,6 +82,7 @@
|
||||||
* Samuel Wu (IBM) - [398988] [ftp] FTP Only support to zVM
|
* Samuel Wu (IBM) - [398988] [ftp] FTP Only support to zVM
|
||||||
* Xuan Chen (IBM) - [399101] RSE edit actions on local files that map to actually workspace resources should not use temp files
|
* Xuan Chen (IBM) - [399101] RSE edit actions on local files that map to actually workspace resources should not use temp files
|
||||||
* David McKnight (IBM) - [420798] Slow performances in RDz 9.0 with opening 7000 files located on a network driver.
|
* David McKnight (IBM) - [420798] Slow performances in RDz 9.0 with opening 7000 files located on a network driver.
|
||||||
|
* David McKnight (IBM) - [430900] RSE table enhancement to populate full column when clicking column for sorting purposes
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.files.ui.view;
|
package org.eclipse.rse.internal.files.ui.view;
|
||||||
|
@ -309,7 +310,7 @@ public class SystemViewRemoteFileAdapter
|
||||||
synchronized (_files){
|
synchronized (_files){
|
||||||
files = (IRemoteFile[])_files.toArray(new IRemoteFile[_files.size()]);
|
files = (IRemoteFile[])_files.toArray(new IRemoteFile[_files.size()]);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < files.length; i++){
|
for (int i = 0; i < files.length && !monitor.isCanceled(); i++){
|
||||||
IRemoteFile rFile = files[i];
|
IRemoteFile rFile = files[i];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -321,7 +322,10 @@ public class SystemViewRemoteFileAdapter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_permissionsJobMap.remove(_service);
|
_permissionsJobMap.remove(_service);
|
||||||
|
if (monitor.isCanceled()){
|
||||||
|
return Status.CANCEL_STATUS;
|
||||||
|
}
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2002, 2013 IBM Corporation and others.
|
* Copyright (c) 2002, 2014 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -16,6 +16,7 @@
|
||||||
* David McKnight (IBM) - [355467] The result of sorting resources that contains null blank cells is not correct in Remote System Details view.
|
* David McKnight (IBM) - [355467] The result of sorting resources that contains null blank cells is not correct in Remote System Details view.
|
||||||
* David McKnight (IBM) - [357587] Custom sorter is changed to SystemTableViewSorter
|
* David McKnight (IBM) - [357587] Custom sorter is changed to SystemTableViewSorter
|
||||||
* David McKnight (IBM) - [398306] table sorting of RSE table views inconsistent with Eclipse
|
* David McKnight (IBM) - [398306] table sorting of RSE table views inconsistent with Eclipse
|
||||||
|
* David McKnight (IBM) - [430900] RSE table enhancement to populate full column when clicking column for sorting purposes
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.ui.view;
|
package org.eclipse.rse.internal.ui.view;
|
||||||
|
@ -95,7 +96,13 @@ public class SystemTableViewSorter extends ViewerSorter
|
||||||
|
|
||||||
// deal with equal objects
|
// deal with equal objects
|
||||||
if (name1 == name2){
|
if (name1 == name2){
|
||||||
return 0;
|
if (_columnNumber > 0){
|
||||||
|
name1 = getValueFor(e1, 0);
|
||||||
|
name2 = getValueFor(e2, 0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,389 +1,391 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2002, 2009 IBM Corporation and others.
|
* Copyright (c) 2002, 2009 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
|
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
|
||||||
* David McKnight (IBM) - [216161] table view needs to handle context when filter reference is input
|
* David McKnight (IBM) - [216161] table view needs to handle context when filter reference is input
|
||||||
* David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
|
* David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
|
||||||
* David McKnight (IBM) - [278848] NPE in Remote System Details view
|
* David McKnight (IBM) - [278848] NPE in Remote System Details view
|
||||||
* David McKnight (IBM) - [284917] Deleting a folder in a fresh workspace throws NPE
|
* David McKnight (IBM) - [284917] Deleting a folder in a fresh workspace throws NPE
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.ui.view;
|
package org.eclipse.rse.ui.view;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.core.runtime.ListenerList;
|
import org.eclipse.core.runtime.ListenerList;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import org.eclipse.jface.viewers.ILabelProvider;
|
import org.eclipse.jface.viewers.ILabelProvider;
|
||||||
import org.eclipse.jface.viewers.ILabelProviderListener;
|
import org.eclipse.jface.viewers.ILabelProviderListener;
|
||||||
import org.eclipse.jface.viewers.ITableLabelProvider;
|
import org.eclipse.jface.viewers.ITableLabelProvider;
|
||||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
import org.eclipse.rse.core.filters.ISystemFilterReference;
|
import org.eclipse.rse.core.filters.ISystemFilterReference;
|
||||||
import org.eclipse.rse.core.model.ISystemContainer;
|
import org.eclipse.rse.core.model.ISystemContainer;
|
||||||
import org.eclipse.rse.core.model.ISystemViewInputProvider;
|
import org.eclipse.rse.core.model.ISystemViewInputProvider;
|
||||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||||
import org.eclipse.rse.internal.ui.view.SystemViewPromptableAdapter;
|
import org.eclipse.rse.internal.ui.view.SystemViewPromptableAdapter;
|
||||||
import org.eclipse.rse.internal.ui.view.SystemViewRootInputAdapter;
|
import org.eclipse.rse.internal.ui.view.SystemViewRootInputAdapter;
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
import org.eclipse.ui.views.properties.IPropertyDescriptor;
|
import org.eclipse.ui.views.properties.IPropertyDescriptor;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the content and label provider for the SystemTableView. This class is
|
* This is the content and label provider for the SystemTableView. This class is
|
||||||
* used both to populate the SystemTableView but also to resolve the icon and
|
* used both to populate the SystemTableView but also to resolve the icon and
|
||||||
* labels for the cells in the table.
|
* labels for the cells in the table.
|
||||||
*
|
*
|
||||||
* @since 3.0 Moved from internal to API
|
* @since 3.0 Moved from internal to API
|
||||||
*/
|
*/
|
||||||
public class SystemTableViewProvider implements ILabelProvider, ITableLabelProvider, ITreeContentProvider
|
public class SystemTableViewProvider implements ILabelProvider, ITableLabelProvider, ITreeContentProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
private ListenerList listeners = new ListenerList(1);
|
private ListenerList listeners = new ListenerList(1);
|
||||||
|
|
||||||
protected Object[] _lastResults = null;
|
protected Object[] _lastResults = null;
|
||||||
protected Object _lastObject = null;
|
protected Object _lastObject = null;
|
||||||
protected SimpleDateFormat _dateFormat = new SimpleDateFormat();
|
protected SimpleDateFormat _dateFormat = new SimpleDateFormat();
|
||||||
protected Viewer _viewer = null;
|
protected Viewer _viewer = null;
|
||||||
protected int _maxCharsInColumnZero = 0;
|
protected int _maxCharsInColumnZero = 0;
|
||||||
|
private boolean _sortOnly = false;
|
||||||
/**
|
|
||||||
* The cache of images that have been dispensed by this provider.
|
/**
|
||||||
* Maps ImageDescriptor->Image.
|
* The cache of images that have been dispensed by this provider.
|
||||||
*/
|
* Maps ImageDescriptor->Image.
|
||||||
private Map imageTable = new Hashtable(40);
|
*/
|
||||||
private ISystemTableViewColumnManager _columnManager;
|
private Map imageTable = new Hashtable(40);
|
||||||
private HashMap cache;
|
private ISystemTableViewColumnManager _columnManager;
|
||||||
/**
|
private HashMap cache;
|
||||||
* Constructor for table view provider where a column manager is present.
|
/**
|
||||||
* In this case, the columns are customizable by the user.
|
* Constructor for table view provider where a column manager is present.
|
||||||
* @param columnManager
|
* In this case, the columns are customizable by the user.
|
||||||
*/
|
* @param columnManager the column manager
|
||||||
public SystemTableViewProvider(ISystemTableViewColumnManager columnManager)
|
*/
|
||||||
{
|
public SystemTableViewProvider(ISystemTableViewColumnManager columnManager)
|
||||||
super();
|
{
|
||||||
_columnManager= columnManager;
|
super();
|
||||||
cache = new HashMap();
|
_columnManager= columnManager;
|
||||||
}
|
cache = new HashMap();
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Constructor for table view provider where a column manager is not present.
|
/**
|
||||||
* In this case, the column can not be customized.
|
* Constructor for table view provider where a column manager is not present.
|
||||||
*/
|
* In this case, the column can not be customized.
|
||||||
public SystemTableViewProvider()
|
*/
|
||||||
{
|
public SystemTableViewProvider()
|
||||||
super();
|
{
|
||||||
_columnManager= null;
|
super();
|
||||||
}
|
_columnManager= null;
|
||||||
|
}
|
||||||
|
|
||||||
public void inputChanged(Viewer visualPart, Object oldInput, Object newInput)
|
|
||||||
{
|
public void inputChanged(Viewer visualPart, Object oldInput, Object newInput)
|
||||||
_viewer = visualPart;
|
{
|
||||||
}
|
_viewer = visualPart;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean isDeleted(Object element)
|
|
||||||
{
|
public boolean isDeleted(Object element)
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
public Object[] getChildren(Object object)
|
|
||||||
{
|
public Object[] getChildren(Object object)
|
||||||
return getElements(object);
|
{
|
||||||
}
|
return getElements(object);
|
||||||
|
}
|
||||||
public Object getParent(Object object)
|
|
||||||
{
|
public Object getParent(Object object)
|
||||||
ISystemViewElementAdapter adapter = getAdapterFor(object);
|
{
|
||||||
if (adapter != null)
|
ISystemViewElementAdapter adapter = getAdapterFor(object);
|
||||||
return adapter.getParent(object);
|
if (adapter != null)
|
||||||
return null;
|
return adapter.getParent(object);
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
public boolean hasChildren(Object object)
|
|
||||||
{
|
public boolean hasChildren(Object object)
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
public Object getElementAt(Object object, int i)
|
|
||||||
{
|
public Object getElementAt(Object object, int i)
|
||||||
|
{
|
||||||
return null;
|
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
protected ISystemViewElementAdapter getAdapterFor(Object object)
|
|
||||||
{
|
protected ISystemViewElementAdapter getAdapterFor(Object object)
|
||||||
ISystemViewElementAdapter result = null;
|
{
|
||||||
if (_viewer != null)
|
ISystemViewElementAdapter result = null;
|
||||||
{
|
if (_viewer != null)
|
||||||
result = SystemAdapterHelpers.getViewAdapter(object, _viewer);
|
{
|
||||||
}
|
result = SystemAdapterHelpers.getViewAdapter(object, _viewer);
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
result = SystemAdapterHelpers.getViewAdapter(object);
|
{
|
||||||
}
|
result = SystemAdapterHelpers.getViewAdapter(object);
|
||||||
if (result != null)
|
}
|
||||||
result.setPropertySourceInput(object);
|
if (result != null)
|
||||||
|
result.setPropertySourceInput(object);
|
||||||
// for bug 278848
|
|
||||||
if (_viewer != null && _viewer.getInput() instanceof ISystemViewInputProvider)
|
// for bug 278848
|
||||||
{
|
if (_viewer != null && _viewer.getInput() instanceof ISystemViewInputProvider)
|
||||||
ISystemViewInputProvider inputProvider = (ISystemViewInputProvider)_viewer.getInput();
|
{
|
||||||
result.setInput(inputProvider);
|
ISystemViewInputProvider inputProvider = (ISystemViewInputProvider)_viewer.getInput();
|
||||||
}
|
result.setInput(inputProvider);
|
||||||
|
}
|
||||||
return result;
|
|
||||||
}
|
return result;
|
||||||
|
}
|
||||||
public Object[] getElements(Object object)
|
|
||||||
{
|
public Object[] getElements(Object object)
|
||||||
Object[] results = null;
|
{
|
||||||
/*
|
Object[] results = null;
|
||||||
if (object == _lastObject && (_lastResults != null && _lastResults.length > 0)
|
if (_sortOnly && (object == _lastObject && (_lastResults != null && _lastResults.length > 0)))
|
||||||
{
|
{
|
||||||
return _lastResults;
|
// _sortOnly is used to by-pass a remote query when we're just sorting by columns
|
||||||
}
|
_sortOnly = false; // after using the cache once, revert back to normal query
|
||||||
else
|
return _lastResults;
|
||||||
if (object instanceof IAdaptable)
|
}
|
||||||
*/
|
else
|
||||||
{
|
{
|
||||||
ISystemViewElementAdapter adapter = getAdapterFor(object);
|
ISystemViewElementAdapter adapter = getAdapterFor(object);
|
||||||
if (adapter != null)
|
if (adapter != null)
|
||||||
{
|
{
|
||||||
adapter.setViewer(_viewer);
|
adapter.setViewer(_viewer);
|
||||||
|
|
||||||
// do we have context?
|
// do we have context?
|
||||||
if (object instanceof ISystemFilterReference) {
|
if (object instanceof ISystemFilterReference) {
|
||||||
ISubSystem ss = adapter.getSubSystem(object);
|
ISubSystem ss = adapter.getSubSystem(object);
|
||||||
|
|
||||||
ContextObject context = new ContextObject(object, ss, (ISystemFilterReference)object);
|
ContextObject context = new ContextObject(object, ss, (ISystemFilterReference)object);
|
||||||
results = adapter.getChildren(context, new NullProgressMonitor());
|
results = adapter.getChildren(context, new NullProgressMonitor());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
results = adapter.getChildren((IAdaptable)object, new NullProgressMonitor());
|
results = adapter.getChildren((IAdaptable)object, new NullProgressMonitor());
|
||||||
|
|
||||||
}
|
}
|
||||||
if (adapter instanceof SystemViewRootInputAdapter)
|
if (adapter instanceof SystemViewRootInputAdapter)
|
||||||
{
|
{
|
||||||
ArrayList filterredResults = new ArrayList();
|
ArrayList filterredResults = new ArrayList();
|
||||||
for (int i = 0; i < results.length; i++)
|
for (int i = 0; i < results.length; i++)
|
||||||
{
|
{
|
||||||
Object result = results[i];
|
Object result = results[i];
|
||||||
ISystemViewElementAdapter cadapter = getAdapterFor(result);
|
ISystemViewElementAdapter cadapter = getAdapterFor(result);
|
||||||
if (!(cadapter instanceof SystemViewPromptableAdapter))
|
if (!(cadapter instanceof SystemViewPromptableAdapter))
|
||||||
{
|
{
|
||||||
filterredResults.add(result);
|
filterredResults.add(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
results = filterredResults.toArray();
|
results = filterredResults.toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
_lastResults = results;
|
_lastResults = results;
|
||||||
_lastObject = object;
|
_lastObject = object;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (results == null)
|
if (results == null)
|
||||||
{
|
{
|
||||||
return new Object[0];
|
return new Object[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getText(Object object)
|
public String getText(Object object)
|
||||||
{
|
{
|
||||||
String result = getAdapterFor(object).getText(object);
|
String result = getAdapterFor(object).getText(object);
|
||||||
int len = result.length();
|
int len = result.length();
|
||||||
if (len > _maxCharsInColumnZero)
|
if (len > _maxCharsInColumnZero)
|
||||||
{
|
{
|
||||||
_maxCharsInColumnZero = len;
|
_maxCharsInColumnZero = len;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxCharsInColumnZero()
|
public int getMaxCharsInColumnZero()
|
||||||
{
|
{
|
||||||
return _maxCharsInColumnZero;
|
return _maxCharsInColumnZero;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Image getImage(Object object)
|
public Image getImage(Object object)
|
||||||
{
|
{
|
||||||
ImageDescriptor descriptor = getAdapterFor(object).getImageDescriptor(object);
|
ImageDescriptor descriptor = getAdapterFor(object).getImageDescriptor(object);
|
||||||
|
|
||||||
Image image = null;
|
Image image = null;
|
||||||
if (descriptor != null)
|
if (descriptor != null)
|
||||||
{
|
{
|
||||||
Object iobj = imageTable.get(descriptor);
|
Object iobj = imageTable.get(descriptor);
|
||||||
if (iobj == null)
|
if (iobj == null)
|
||||||
{
|
{
|
||||||
image = descriptor.createImage();
|
image = descriptor.createImage();
|
||||||
imageTable.put(descriptor, image);
|
imageTable.put(descriptor, image);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
image = (Image) iobj;
|
image = (Image) iobj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getColumnText(Object obj, int index)
|
public String getColumnText(Object obj, int index)
|
||||||
{
|
{
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
{
|
{
|
||||||
// get the first descriptor
|
// get the first descriptor
|
||||||
return getText(obj);
|
return getText(obj);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
index = index - 1;
|
index = index - 1;
|
||||||
ISystemViewElementAdapter adapter = getAdapterFor(obj);
|
ISystemViewElementAdapter adapter = getAdapterFor(obj);
|
||||||
|
|
||||||
IPropertyDescriptor[] descriptors = null;
|
IPropertyDescriptor[] descriptors = null;
|
||||||
if (_columnManager != null)
|
if (_columnManager != null)
|
||||||
{
|
{
|
||||||
descriptors = _columnManager.getVisibleDescriptors(adapter);
|
descriptors = _columnManager.getVisibleDescriptors(adapter);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
descriptors = adapter.getUniquePropertyDescriptors();
|
descriptors = adapter.getUniquePropertyDescriptors();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (descriptors.length > index)
|
if (descriptors.length > index)
|
||||||
{
|
{
|
||||||
IPropertyDescriptor descriptor = descriptors[index];
|
IPropertyDescriptor descriptor = descriptors[index];
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Object key = descriptor.getId();
|
Object key = descriptor.getId();
|
||||||
|
|
||||||
Object propertyValue = adapter.getPropertyValue(key);
|
Object propertyValue = adapter.getPropertyValue(key);
|
||||||
|
|
||||||
if (propertyValue instanceof String)
|
if (propertyValue instanceof String)
|
||||||
{
|
{
|
||||||
return (String) propertyValue;
|
return (String) propertyValue;
|
||||||
}
|
}
|
||||||
else if (propertyValue instanceof Date)
|
else if (propertyValue instanceof Date)
|
||||||
{
|
{
|
||||||
return _dateFormat.format((Date)propertyValue);
|
return _dateFormat.format((Date)propertyValue);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (propertyValue != null)
|
if (propertyValue != null)
|
||||||
{
|
{
|
||||||
return propertyValue.toString();
|
return propertyValue.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Image getColumnImage(Object obj, int i)
|
public Image getColumnImage(Object obj, int i)
|
||||||
{
|
{
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
return getImage(obj);
|
return getImage(obj);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addListener(ILabelProviderListener listener)
|
public void addListener(ILabelProviderListener listener)
|
||||||
{
|
{
|
||||||
listeners.add(listener);
|
listeners.add(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLabelProperty(Object element, String property)
|
public boolean isLabelProperty(Object element, String property)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeListener(ILabelProviderListener listener)
|
public void removeListener(ILabelProviderListener listener)
|
||||||
{
|
{
|
||||||
listeners.remove(listener);
|
listeners.remove(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cache the objects for the given parent.
|
* Cache the objects for the given parent.
|
||||||
* @param parent the parent object.
|
* @param parent the parent object.
|
||||||
* @param children the children to cache.
|
* @param children the children to cache.
|
||||||
*/
|
*/
|
||||||
public void setCachedObjects(Object parent, Object[] children) {
|
public void setCachedObjects(Object parent, Object[] children) {
|
||||||
cache.put(parent, children);
|
cache.put(parent, children);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the cached objects for the given parent.
|
* Returns the cached objects for the given parent.
|
||||||
* @param parent the parent object.
|
* @param parent the parent object.
|
||||||
* @return the cached children.
|
* @return the cached children.
|
||||||
*/
|
*/
|
||||||
public Object[] getCachedObjects(Object parent) {
|
public Object[] getCachedObjects(Object parent) {
|
||||||
return (Object[])(cache.get(parent));
|
return (Object[])(cache.get(parent));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setCache(Object[] newCache)
|
public void setCache(Object[] newCache)
|
||||||
{
|
{
|
||||||
_lastResults = newCache;
|
_lastResults = newCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object[] getCache()
|
public Object[] getCache()
|
||||||
{
|
{
|
||||||
return _lastResults;
|
return _lastResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean flushCache()
|
public boolean flushCache()
|
||||||
{
|
{
|
||||||
if (_lastResults == null)
|
if (_lastResults == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (_lastObject instanceof ISystemContainer)
|
if (_lastObject instanceof ISystemContainer)
|
||||||
{
|
{
|
||||||
// ((ISystemContainer)_lastObject).markStale(true);
|
// ((ISystemContainer)_lastObject).markStale(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
_lastResults = null;
|
_lastResults = null;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
}
|
||||||
|
|
||||||
}
|
public void setSortOnly(boolean flag){
|
||||||
}
|
_sortOnly = flag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue