|
Lines 22-30
Link Here
|
| 22 |
import org.eclipse.core.runtime.CoreException; |
22 |
import org.eclipse.core.runtime.CoreException; |
| 23 |
import org.eclipse.core.runtime.IPath; |
23 |
import org.eclipse.core.runtime.IPath; |
| 24 |
import org.eclipse.jem.util.logger.proxy.Logger; |
24 |
import org.eclipse.jem.util.logger.proxy.Logger; |
| 25 |
import org.eclipse.jface.viewers.ILabelProviderListener; |
25 |
import org.eclipse.jface.viewers.ILabelDecorator; |
|
|
26 |
import org.eclipse.jface.viewers.ILabelProvider; |
| 26 |
import org.eclipse.jface.viewers.IStructuredContentProvider; |
27 |
import org.eclipse.jface.viewers.IStructuredContentProvider; |
| 27 |
import org.eclipse.jface.viewers.ITableLabelProvider; |
28 |
import org.eclipse.jface.viewers.ITableLabelProvider; |
|
|
29 |
import org.eclipse.jface.viewers.LabelProvider; |
| 28 |
import org.eclipse.jface.viewers.Viewer; |
30 |
import org.eclipse.jface.viewers.Viewer; |
| 29 |
import org.eclipse.jst.j2ee.application.internal.operations.ClassPathSelection; |
31 |
import org.eclipse.jst.j2ee.application.internal.operations.ClassPathSelection; |
| 30 |
import org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil; |
32 |
import org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil; |
|
Lines 38-50
Link Here
|
| 38 |
import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities; |
40 |
import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities; |
| 39 |
import org.eclipse.jst.javaee.application.Application; |
41 |
import org.eclipse.jst.javaee.application.Application; |
| 40 |
import org.eclipse.swt.graphics.Image; |
42 |
import org.eclipse.swt.graphics.Image; |
|
|
43 |
import org.eclipse.ui.PlatformUI; |
| 44 |
import org.eclipse.ui.model.WorkbenchLabelProvider; |
| 41 |
import org.eclipse.wst.common.componentcore.ComponentCore; |
45 |
import org.eclipse.wst.common.componentcore.ComponentCore; |
| 42 |
import org.eclipse.wst.common.componentcore.ModuleCoreNature; |
46 |
import org.eclipse.wst.common.componentcore.ModuleCoreNature; |
| 43 |
import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent; |
47 |
import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent; |
| 44 |
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; |
48 |
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; |
| 45 |
import org.eclipse.wst.common.componentcore.resources.IVirtualReference; |
49 |
import org.eclipse.wst.common.componentcore.resources.IVirtualReference; |
| 46 |
|
50 |
|
| 47 |
public class AvailableJ2EEComponentsForEARContentProvider implements IStructuredContentProvider, ITableLabelProvider { |
51 |
public class AvailableJ2EEComponentsForEARContentProvider extends LabelProvider |
|
|
52 |
implements IStructuredContentProvider, ITableLabelProvider { |
| 48 |
|
53 |
|
| 49 |
final static String PATH_SEPARATOR = String.valueOf(IPath.SEPARATOR); |
54 |
final static String PATH_SEPARATOR = String.valueOf(IPath.SEPARATOR); |
| 50 |
|
55 |
|
|
Lines 53-63
Link Here
|
| 53 |
private boolean isEE5 = false; |
58 |
private boolean isEE5 = false; |
| 54 |
private String libDir = null; |
59 |
private String libDir = null; |
| 55 |
|
60 |
|
|
|
61 |
private ILabelDecorator decorator = PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator(); |
| 56 |
|
62 |
|
| 57 |
public AvailableJ2EEComponentsForEARContentProvider(IVirtualComponent aEarComponent, int j2eeVersion) { |
63 |
private ILabelProvider workbenchLabelProvider = new WorkbenchLabelProvider(); |
|
|
64 |
|
| 65 |
private AvailableJ2EEComponentsForEARContentProvider instance; |
| 66 |
|
| 67 |
public AvailableJ2EEComponentsForEARContentProvider(IVirtualComponent aEarComponent, int j2eeVersion, ILabelDecorator decorator) { |
| 58 |
super(); |
68 |
super(); |
| 59 |
this.j2eeVersion = j2eeVersion; |
69 |
this.j2eeVersion = j2eeVersion; |
| 60 |
earComponent = aEarComponent; |
70 |
earComponent = aEarComponent; |
|
|
71 |
|
| 72 |
this.decorator = decorator; |
| 61 |
} |
73 |
} |
| 62 |
|
74 |
|
| 63 |
/* |
75 |
/* |
|
Lines 217-225
Link Here
|
| 217 |
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int) |
229 |
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int) |
| 218 |
*/ |
230 |
*/ |
| 219 |
public Image getColumnImage(Object element, int columnIndex) { |
231 |
public Image getColumnImage(Object element, int columnIndex) { |
|
|
232 |
if (columnIndex >=2){ |
| 233 |
return null; |
| 234 |
} |
| 235 |
if (element instanceof IVirtualComponent) { |
| 236 |
IVirtualComponent comp = (IVirtualComponent)element; |
| 237 |
return getDecoratedImage(comp); |
| 238 |
} else if (element instanceof IProject){ |
| 239 |
return workbenchLabelProvider.getImage(element); |
| 240 |
} |
| 220 |
return null; |
241 |
return null; |
| 221 |
} |
242 |
} |
| 222 |
|
243 |
|
|
|
244 |
private Image getDecoratedImage(IVirtualComponent comp) { |
| 245 |
return getDecoratedImage(comp.getProject()); |
| 246 |
} |
| 247 |
|
| 248 |
private Image getDecoratedImage(IProject project) { |
| 249 |
Image image = workbenchLabelProvider.getImage(project); |
| 250 |
if (decorator != null) { |
| 251 |
Image decorated = decorator.decorateImage(image, project); |
| 252 |
if (decorated != null) { |
| 253 |
return decorated; |
| 254 |
} |
| 255 |
} |
| 256 |
return image; |
| 257 |
} |
| 258 |
|
| 223 |
/* |
259 |
/* |
| 224 |
* (non-Javadoc) |
260 |
* (non-Javadoc) |
| 225 |
* |
261 |
* |
|
Lines 256-302
Link Here
|
| 256 |
} |
292 |
} |
| 257 |
return null; |
293 |
return null; |
| 258 |
} |
294 |
} |
| 259 |
/* |
295 |
|
| 260 |
* (non-Javadoc) |
|
|
| 261 |
* |
| 262 |
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, |
| 263 |
* java.lang.Object, java.lang.Object) |
| 264 |
*/ |
| 265 |
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { |
| 266 |
//do nothing |
| 267 |
} |
| 268 |
|
| 269 |
/* |
| 270 |
* (non-Javadoc) |
| 271 |
* |
| 272 |
* @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener) |
| 273 |
*/ |
| 274 |
public void addListener(ILabelProviderListener listener) { |
| 275 |
//do nothing |
| 276 |
} |
| 277 |
|
| 278 |
/* |
| 279 |
* (non-Javadoc) |
| 280 |
* |
| 281 |
* @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, |
| 282 |
* java.lang.String) |
| 283 |
*/ |
| 284 |
public boolean isLabelProperty(Object element, String property) { |
| 285 |
return false; |
| 286 |
} |
| 287 |
|
| 288 |
/* |
| 289 |
* (non-Javadoc) |
| 290 |
* |
| 291 |
* @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener) |
| 292 |
*/ |
| 293 |
public void removeListener(ILabelProviderListener listener) { |
| 294 |
//do nothing |
| 295 |
} |
| 296 |
|
| 297 |
/* (non-Javadoc) |
296 |
/* (non-Javadoc) |
| 298 |
* @see org.eclipse.jface.viewers.IContentProvider#dispose() |
297 |
* @see org.eclipse.jface.viewers.IContentProvider#dispose() |
| 299 |
*/ |
298 |
*/ |
| 300 |
public void dispose() { |
299 |
public void dispose() { |
| 301 |
} |
300 |
} |
|
|
301 |
|
| 302 |
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { |
| 303 |
|
| 304 |
} |
| 302 |
} |
305 |
} |