Simulator Service Provider plug-in changes:
[platform/upstream/iotivity.git] / service / simulator / java / eclipse-plugin / ClientControllerPlugin / src / oic / simulator / clientcontroller / view / ResourceManagerView.java
1 /*
2  * Copyright 2015 Samsung Electronics All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package oic.simulator.clientcontroller.view;
18
19 import java.util.List;
20 import java.util.Set;
21
22 import oic.simulator.clientcontroller.Activator;
23 import oic.simulator.clientcontroller.listener.IFindResourceUIListener;
24 import oic.simulator.clientcontroller.manager.ResourceManager;
25 import oic.simulator.clientcontroller.remoteresource.RemoteResource;
26 import oic.simulator.clientcontroller.utils.Constants;
27 import oic.simulator.clientcontroller.view.dialogs.FindResourceWizard;
28 import oic.simulator.clientcontroller.view.dialogs.LoadRAMLDialog;
29 import oic.simulator.clientcontroller.view.dialogs.ResourceWizardDialog;
30
31 import org.eclipse.jface.dialogs.MessageDialog;
32 import org.eclipse.jface.viewers.ISelectionChangedListener;
33 import org.eclipse.jface.viewers.IStructuredSelection;
34 import org.eclipse.jface.viewers.ITreeContentProvider;
35 import org.eclipse.jface.viewers.LabelProvider;
36 import org.eclipse.jface.viewers.SelectionChangedEvent;
37 import org.eclipse.jface.viewers.TreeViewer;
38 import org.eclipse.jface.viewers.Viewer;
39 import org.eclipse.jface.window.Window;
40 import org.eclipse.jface.wizard.WizardDialog;
41 import org.eclipse.swt.SWT;
42 import org.eclipse.swt.custom.CTabFolder;
43 import org.eclipse.swt.custom.CTabItem;
44 import org.eclipse.swt.events.MenuAdapter;
45 import org.eclipse.swt.events.MenuEvent;
46 import org.eclipse.swt.events.SelectionAdapter;
47 import org.eclipse.swt.events.SelectionEvent;
48 import org.eclipse.swt.graphics.Color;
49 import org.eclipse.swt.graphics.Image;
50 import org.eclipse.swt.layout.GridData;
51 import org.eclipse.swt.layout.GridLayout;
52 import org.eclipse.swt.widgets.Button;
53 import org.eclipse.swt.widgets.Composite;
54 import org.eclipse.swt.widgets.Display;
55 import org.eclipse.swt.widgets.Group;
56 import org.eclipse.swt.widgets.Menu;
57 import org.eclipse.swt.widgets.MenuItem;
58 import org.eclipse.swt.widgets.Tree;
59 import org.eclipse.ui.PlatformUI;
60 import org.eclipse.ui.dialogs.FilteredTree;
61 import org.eclipse.ui.dialogs.PatternFilter;
62 import org.eclipse.ui.part.ViewPart;
63
64 /**
65  * This class manages and shows the resource manager view in the perspective.
66  */
67 public class ResourceManagerView extends ViewPart {
68
69     public static final String      VIEW_ID = "oic.simulator.clientcontroller.view.resourcemanager";
70
71     private Button                  findResButton;
72     private Button                  refreshButton;
73
74     private TreeViewer              treeViewer;
75     private TreeViewer              favTreeViewer;
76
77     private CTabFolder              folder;
78     private CTabItem                foundResTab;
79     private CTabItem                favResTab;
80
81     private ResourceManager         resourceManager;
82
83     private IFindResourceUIListener findListener;
84
85     private Boolean                 foundResource;
86
87     private MessageDialog           findDialog;
88
89     private MessageDialog           refreshDialog;
90
91     private Thread                  sleepThreadHandle;
92
93     public ResourceManagerView() {
94         resourceManager = Activator.getDefault().getResourceManager();
95
96         findListener = new IFindResourceUIListener() {
97
98             @Override
99             public void onNewResourceFound(final RemoteResource resource) {
100                 if (null == resource) {
101                     return;
102                 }
103                 // Changing the status of the find operation.
104                 setFoundResource(true);
105
106                 // Interrupt the sleep thread.
107                 if (null != sleepThreadHandle && sleepThreadHandle.isAlive()) {
108                     sleepThreadHandle.interrupt();
109                 }
110
111                 // Update the tree viewer
112                 Display.getDefault().asyncExec(new Runnable() {
113                     @Override
114                     public void run() {
115                         if (!treeViewer.getControl().isDisposed()) {
116                             treeViewer.refresh();
117                         }
118
119                         if (!favTreeViewer.getControl().isDisposed()) {
120                             favTreeViewer.refresh();
121                         }
122
123                         // Close the find dialog
124                         if (null != findDialog) {
125                             findDialog.close();
126                         }
127
128                         // Close the refresh dialog
129                         if (null != refreshDialog) {
130                             refreshDialog.close();
131                         }
132                     }
133                 });
134             }
135         };
136     }
137
138     @Override
139     public void createPartControl(Composite parent) {
140         Composite compContent = new Composite(parent, SWT.NONE);
141         compContent.setLayout(new GridLayout());
142         GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
143         compContent.setLayoutData(gd);
144
145         Composite buttonComp = new Composite(compContent, SWT.NONE);
146         buttonComp.setLayout(new GridLayout(2, false));
147
148         gd = new GridData();
149         gd.horizontalAlignment = SWT.FILL;
150         gd.grabExcessHorizontalSpace = true;
151
152         buttonComp.setLayoutData(gd);
153
154         findResButton = new Button(buttonComp, SWT.PUSH);
155         findResButton.setText("Find Resources");
156         findResButton.setToolTipText("Find OIC resources");
157
158         gd = new GridData();
159         gd.widthHint = 130;
160         findResButton.setLayoutData(gd);
161
162         refreshButton = new Button(buttonComp, SWT.PUSH);
163         refreshButton.setText("Refresh");
164         refreshButton.setToolTipText("Restart the search once again");
165
166         gd = new GridData();
167         gd.widthHint = 90;
168         refreshButton.setLayoutData(gd);
169
170         // Create a Tab Folder.
171         folder = new CTabFolder(compContent, SWT.BORDER);
172         gd = new GridData(SWT.FILL, SWT.FILL, true, true);
173         folder.setLayoutData(gd);
174         folder.setSimple(false);
175         folder.setUnselectedCloseVisible(false);
176         folder.setUnselectedImageVisible(false);
177         folder.addSelectionListener(new SelectionAdapter() {
178             @Override
179             public void widgetSelected(SelectionEvent e) {
180                 // Tab is switched.
181                 treeViewer.setSelection(null);
182                 favTreeViewer.setSelection(null);
183                 resourceManager.resourceSelectionChanged(null);
184             }
185         });
186
187         createFoundResourcesArea();
188
189         createFavoriteResourcesArea();
190
191         folder.setSelection(foundResTab);
192
193         findDialog = new MessageDialog(Display.getDefault().getActiveShell(),
194                 "Finding Servers", null,
195                 "Finding the requested servers\nPlease wait...",
196                 MessageDialog.INFORMATION, new String[] { "Cancel" }, 0);
197         // findDialog.setBlockOnOpen(false);
198
199         refreshDialog = new MessageDialog(
200                 Display.getDefault().getActiveShell(),
201                 "Finding Servers",
202                 null,
203                 "Refreshing the search and finding the requested servers once again\nPlease wait...",
204                 MessageDialog.INFORMATION, new String[] { "Cancel" }, 0);
205         // refreshDialog.setBlockOnOpen(false);
206
207         addUIListeners();
208
209         addManagerListeners();
210
211         // Setting the initial visibility of refresh based on the last known
212         // search operation.
213         Set<String> prevSearchTypes = resourceManager.getLastKnownSearchTypes();
214         if (null == prevSearchTypes || prevSearchTypes.size() < 1) {
215             refreshButton.setEnabled(false);
216         } else {
217             refreshButton.setEnabled(true);
218         }
219     }
220
221     private void createFoundResourcesArea() {
222         foundResTab = new CTabItem(folder, SWT.NULL);
223         foundResTab.setText("Found Resources");
224
225         // Create a group to show all the discovered resources.
226         // Adding the group to the folder.
227         Group resourceGroup = new Group(folder, SWT.NONE);
228         // resourceGroup.setText("Discovered Resources");
229
230         Color color = Display.getDefault().getSystemColor(SWT.COLOR_WHITE);
231         resourceGroup.setBackground(color);
232
233         resourceGroup.setLayout(new GridLayout(1, false));
234         GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
235         resourceGroup.setLayoutData(gd);
236
237         PatternFilter filter = new PatternFilter();
238         FilteredTree filteredTree = new FilteredTree(resourceGroup,
239                 SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE, filter, true);
240         treeViewer = filteredTree.getViewer();
241         treeViewer.getTree().setLayoutData(
242                 new GridData(SWT.FILL, SWT.FILL, true, true));
243         treeViewer.setContentProvider(new TreeContentProvider());
244         treeViewer.setLabelProvider(new TreeLabelProvider());
245         treeViewer.setInput(new Object());
246
247         addMenuToFoundResources();
248
249         foundResTab.setControl(resourceGroup);
250     }
251
252     private void addMenuToFoundResources() {
253
254         if (null != treeViewer) {
255             final Tree resourceTreeHead = treeViewer.getTree();
256             if (null != resourceTreeHead) {
257                 // Below code creates menu entries and shows them on right
258                 // clicking a resource
259                 final Menu menu = new Menu(resourceTreeHead);
260                 resourceTreeHead.setMenu(menu);
261                 menu.addMenuListener(new MenuAdapter() {
262                     @Override
263                     public void menuShown(MenuEvent e) {
264                         // Clear existing menu items
265                         MenuItem[] items = menu.getItems();
266                         for (int index = 0; index < items.length; index++) {
267                             items[index].dispose();
268                         }
269                         MenuItem uploadRAMLItem = new MenuItem(menu, SWT.NONE);
270                         uploadRAMLItem.setText("Upload RAML Configuration");
271                         uploadRAMLItem
272                                 .addSelectionListener(new SelectionAdapter() {
273                                     @Override
274                                     public void widgetSelected(SelectionEvent e) {
275                                         // Open the RAML configuration dialog if
276                                         // RAML file is not yet uploaded for the
277                                         // currently selected resource
278                                         RemoteResource resource = resourceManager
279                                                 .getCurrentResourceInSelection();
280                                         if (null == resource) {
281                                             return;
282                                         }
283                                         if (!resource.isConfigUploaded()) {
284                                             // Open the dialog in a separate
285                                             // UI thread.
286                                             PlatformUI.getWorkbench()
287                                                     .getDisplay()
288                                                     .syncExec(new Thread() {
289                                                         @Override
290                                                         public void run() {
291                                                             LoadRAMLDialog ramlDialog = new LoadRAMLDialog(
292                                                                     Display.getDefault()
293                                                                             .getActiveShell());
294                                                             if (ramlDialog
295                                                                     .open() != Window.OK) {
296                                                                 return;
297                                                             }
298                                                             String configFilePath = ramlDialog
299                                                                     .getConfigFilePath();
300                                                             if (null == configFilePath
301                                                                     || configFilePath
302                                                                             .length() < 1) {
303                                                                 MessageDialog
304                                                                         .openInformation(
305                                                                                 Display.getDefault()
306                                                                                         .getActiveShell(),
307                                                                                 "Invalid RAML Config path",
308                                                                                 "Configuration file path is invalid.");
309                                                                 return;
310                                                             }
311                                                             resourceManager
312                                                                     .setConfigFilePath(
313                                                                             resourceManager
314                                                                                     .getCurrentResourceInSelection(),
315                                                                             configFilePath);
316                                                         }
317                                                     });
318                                         } else {
319                                             MessageDialog
320                                                     .openInformation(Display
321                                                             .getDefault()
322                                                             .getActiveShell(),
323                                                             "Already Uploaded",
324                                                             "Configuration file for the selected resource is already uploaded");
325                                         }
326                                     }
327                                 });
328
329                         RemoteResource resource = resourceManager
330                                 .getCurrentResourceInSelection();
331                         if (null == resource) {
332                             return;
333                         }
334                         String menuText = !resource.isFavorite() ? "Add to favorites"
335                                 : "Remove from favorites";
336                         MenuItem addToFavMenuItem = new MenuItem(menu, SWT.NONE);
337                         addToFavMenuItem.setText(menuText);
338                         addToFavMenuItem
339                                 .addSelectionListener(new SelectionAdapter() {
340                                     @Override
341                                     public void widgetSelected(SelectionEvent e) {
342                                         RemoteResource resource = (RemoteResource) ((IStructuredSelection) treeViewer
343                                                 .getSelection())
344                                                 .getFirstElement();
345                                         if (null == resource) {
346                                             return;
347                                         }
348                                         if (!resource.isFavorite()) {
349                                             resourceManager
350                                                     .addResourcetoFavorites(resource);
351                                             resourceManager
352                                                     .addResourceURItoFavorites(resource);
353                                         } else {
354                                             resourceManager
355                                                     .removeResourceFromFavorites(resource);
356                                             resourceManager
357                                                     .removeResourceURIFromFavorites(resource);
358                                         }
359                                         favTreeViewer.refresh();
360                                     }
361                                 });
362                     }
363                 });
364             }
365         }
366     }
367
368     private void createFavoriteResourcesArea() {
369         favResTab = new CTabItem(folder, SWT.NULL);
370         favResTab.setText("Favorite Resources");
371
372         // Create a group to show all the discovered resources.
373         // Adding the group to the folder.
374         Group resourceGroup = new Group(folder, SWT.NONE);
375         // resourceGroup.setText("Discovered Resources");
376
377         Color color = Display.getDefault().getSystemColor(SWT.COLOR_WHITE);
378         resourceGroup.setBackground(color);
379
380         resourceGroup.setLayout(new GridLayout(1, false));
381         GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
382         resourceGroup.setLayoutData(gd);
383
384         PatternFilter filter = new PatternFilter();
385         FilteredTree filteredTree = new FilteredTree(resourceGroup,
386                 SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE, filter, true);
387         favTreeViewer = filteredTree.getViewer();
388         favTreeViewer.getTree().setLayoutData(
389                 new GridData(SWT.FILL, SWT.FILL, true, true));
390         favTreeViewer.setContentProvider(new FavTreeContentProvider());
391         favTreeViewer.setLabelProvider(new TreeLabelProvider());
392         favTreeViewer.setInput(new Object());
393
394         favResTab.setControl(resourceGroup);
395
396         addMenuToFavResources();
397     }
398
399     private void addMenuToFavResources() {
400         if (null != favTreeViewer) {
401             final Tree resourceTreeHead = favTreeViewer.getTree();
402             if (null != resourceTreeHead) {
403                 // Below code creates menu entries and shows them on right
404                 // clicking a resource
405                 final Menu menu = new Menu(resourceTreeHead);
406                 resourceTreeHead.setMenu(menu);
407                 menu.addMenuListener(new MenuAdapter() {
408                     @Override
409                     public void menuShown(MenuEvent e) {
410                         // Clear existing menu items
411                         MenuItem[] items = menu.getItems();
412                         for (int index = 0; index < items.length; index++) {
413                             items[index].dispose();
414                         }
415                         MenuItem addToFavMenuItem = new MenuItem(menu, SWT.NONE);
416                         addToFavMenuItem.setText("Remove from favorites");
417                         addToFavMenuItem
418                                 .addSelectionListener(new SelectionAdapter() {
419                                     @Override
420                                     public void widgetSelected(SelectionEvent e) {
421                                         RemoteResource resource = (RemoteResource) ((IStructuredSelection) favTreeViewer
422                                                 .getSelection())
423                                                 .getFirstElement();
424                                         if (null == resource) {
425                                             return;
426                                         }
427                                         resourceManager
428                                                 .removeResourceFromFavorites(resource);
429                                         resourceManager
430                                                 .removeResourceURIFromFavorites(resource);
431                                         favTreeViewer.refresh();
432                                     }
433                                 });
434                     }
435                 });
436             }
437         }
438     }
439
440     private void addUIListeners() {
441         findResButton.addSelectionListener(new SelectionAdapter() {
442             @Override
443             public void widgetSelected(SelectionEvent e) {
444                 PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
445
446                     @Override
447                     public void run() {
448                         FindResourceWizard findWizard = new FindResourceWizard();
449                         ResourceWizardDialog wizardDialog = new ResourceWizardDialog(
450                                 PlatformUI.getWorkbench().getDisplay()
451                                         .getActiveShell(), findWizard);
452                         int open = wizardDialog.open();
453                         if (open == WizardDialog.OK) {
454                             // Setting initial value on starting the find
455                             // operation.
456                             setFoundResource(false);
457
458                             Set<String> searchTypes = findWizard
459                                     .getSearchTypes();
460                             // Delete cached details of resources based on the
461                             // given search types.
462                             // If there are no resource types to search, then
463                             // all resources
464                             // will be deleted.
465                             resourceManager.deleteResources(searchTypes);
466
467                             // Update the tree
468                             treeViewer.refresh();
469                             favTreeViewer.refresh();
470
471                             // Call native method to find Resources
472                             boolean result = resourceManager
473                                     .findResourceRequest(searchTypes);
474                             if (result) {
475                                 searchUIOperation(false);
476                             } else {
477                                 MessageDialog
478                                         .openError(Display.getDefault()
479                                                 .getActiveShell(),
480                                                 "Find Resource status",
481                                                 "Operation failed due to some problems in core layer.");
482                             }
483
484                             // Store this information for refresh
485                             // functionality
486                             resourceManager
487                                     .setLastKnownSearchTypes(searchTypes);
488
489                             // Change the refresh visibility
490                             refreshButton.setEnabled(true);
491                         }
492                     }
493                 });
494             }
495         });
496
497         refreshButton.addSelectionListener(new SelectionAdapter() {
498             @Override
499             public void widgetSelected(SelectionEvent e) {
500                 Set<String> searchTypes = resourceManager
501                         .getLastKnownSearchTypes();
502                 setFoundResource(false);
503
504                 // Delete cached details of resources based on the given search
505                 // types.
506                 // If there are no resource types to search, then all resources
507                 // will be deleted.
508                 resourceManager.deleteResources(searchTypes);
509
510                 // Update the tree
511                 treeViewer.refresh();
512                 favTreeViewer.refresh();
513
514                 // Call native method to find Resources
515                 boolean result = resourceManager
516                         .findResourceRequest(searchTypes);
517                 if (result) {
518                     searchUIOperation(true);
519                 } else {
520                     MessageDialog
521                             .openError(Display.getDefault().getActiveShell(),
522                                     "Find Resource status",
523                                     "Operation failed due to some problems in core layer.");
524                 }
525             }
526         });
527
528         // Below code adds a listener to the tree for selection changes
529         // and notifies the resource manager
530         ISelectionChangedListener treeSelectionListener = new ISelectionChangedListener() {
531
532             @Override
533             public void selectionChanged(SelectionChangedEvent e) {
534                 if (e.getSelection().isEmpty()) {
535                     return;
536                 }
537                 if (e.getSelection() instanceof IStructuredSelection) {
538                     IStructuredSelection selection = (IStructuredSelection) e
539                             .getSelection();
540                     RemoteResource resource = (RemoteResource) selection
541                             .getFirstElement();
542                     if (null == resource) {
543                         return;
544                     }
545                     resourceManager.resourceSelectionChanged(resource);
546                 }
547             }
548         };
549
550         treeViewer.addSelectionChangedListener(treeSelectionListener);
551         favTreeViewer.addSelectionChangedListener(treeSelectionListener);
552     }
553
554     // If refresh is true, then Refresh Dialog else Find Dialog will be shown.
555     private void searchUIOperation(boolean refresh) {
556         final MessageDialog targetDialog;
557         if (refresh) {
558             targetDialog = refreshDialog;
559         } else {
560             targetDialog = findDialog;
561         }
562         // Open the dialog in a new thread.
563         PlatformUI.getWorkbench().getDisplay().syncExec(new Thread() {
564
565             @Override
566             public void run() {
567                 if (isFoundResource()) {
568                     setFoundResource(false);
569                     return;
570                 }
571
572                 PlatformUI.getWorkbench().getDisplay().asyncExec(new Thread() {
573                     @Override
574                     public void run() {
575                         targetDialog.open(); // This method returns once the
576                         // cancel button is pressed.
577
578                         // Interrupt the sleep thread.
579                         if (null != sleepThreadHandle
580                                 && sleepThreadHandle.isAlive()) {
581                             sleepThreadHandle.interrupt();
582                         }
583
584                         // Set the status of find.
585                         setFoundResource(false);
586                     }
587                 });
588
589                 // Thread for find time-out.
590                 sleepThreadHandle = new Thread() {
591                     Thread child;
592
593                     public void run() {
594                         try {
595                             Thread.sleep(Constants.FIND_RESOURCES_TIMEOUT * 1000);
596                         } catch (InterruptedException e) {
597                             return;
598                         }
599
600                         child = new Thread() {
601                             @Override
602                             public void run() {
603                                 if (null != targetDialog) {
604                                     targetDialog.close();
605
606                                     // Check if any new resources are
607                                     // discovered.
608                                     // Is no new resources, then display a
609                                     // message box.
610                                     if (!isFoundResource()) {
611                                         MessageDialog
612                                                 .openInformation(
613                                                         Display.getDefault()
614                                                                 .getActiveShell(),
615                                                         "No servers found",
616                                                         "No servers are available as of now.\n"
617                                                                 + "Please check the servers' status and press"
618                                                                 + "'Refresh' button to restart the search.");
619                                     } else {
620                                         // Resetting the status to false for
621                                         // ensuring safety.
622                                         setFoundResource(false);
623                                     }
624                                 }
625                             }
626                         };
627
628                         PlatformUI.getWorkbench().getDisplay().syncExec(child);
629                     }
630                 };
631                 sleepThreadHandle.start();
632             }
633         });
634     }
635
636     private void addManagerListeners() {
637         resourceManager.addFindresourceUIListener(findListener);
638     }
639
640     @Override
641     public void dispose() {
642         // Unregister the listener
643         if (null != findListener) {
644             resourceManager.removeFindresourceUIListener(findListener);
645             resourceManager.resourceSelectionChanged(null);
646         }
647         super.dispose();
648     }
649
650     @Override
651     public void setFocus() {
652         // TODO Auto-generated method stub
653
654     }
655
656     public synchronized void setFoundResource(boolean value) {
657         foundResource = value;
658     }
659
660     public synchronized boolean isFoundResource() {
661         return foundResource;
662     }
663 }
664
665 class TreeContentProvider implements ITreeContentProvider {
666
667     @Override
668     public void dispose() {
669     }
670
671     @Override
672     public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
673
674     }
675
676     @Override
677     public Object[] getChildren(Object parent) {
678         return null;
679     }
680
681     @Override
682     public Object[] getElements(Object parent) {
683         List<RemoteResource> resourceList = Activator.getDefault()
684                 .getResourceManager().getResourceList();
685         return resourceList.toArray();
686     }
687
688     @Override
689     public Object getParent(Object child) {
690         return null;
691     }
692
693     @Override
694     public boolean hasChildren(Object parent) {
695         return false;
696     }
697
698 }
699
700 class FavTreeContentProvider implements ITreeContentProvider {
701
702     @Override
703     public void dispose() {
704     }
705
706     @Override
707     public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
708
709     }
710
711     @Override
712     public Object[] getChildren(Object parent) {
713         return null;
714     }
715
716     @Override
717     public Object[] getElements(Object parent) {
718         List<RemoteResource> resourceList = Activator.getDefault()
719                 .getResourceManager().getFavResourceList();
720         return resourceList.toArray();
721     }
722
723     @Override
724     public Object getParent(Object child) {
725         return null;
726     }
727
728     @Override
729     public boolean hasChildren(Object parent) {
730         return false;
731     }
732
733 }
734
735 class TreeLabelProvider extends LabelProvider {
736     @Override
737     public String getText(Object element) {
738         RemoteResource resource = (RemoteResource) element;
739         return resource.getResourceURI();
740     }
741
742     // TODO: Commenting temporarily until resource icons are finalized.
743     /*@Override
744     public Image getImage(Object element) {
745         RemoteResource resource = (RemoteResource) element;
746         ResourceManager resourceManager = Activator.getDefault()
747                 .getResourceManager();
748         return resourceManager.getImage(resource.getResourceURI());
749     }*/
750 }