Displaying and editing the complex value types for attributes.
[platform/upstream/iotivity.git] / service / simulator / java / eclipse-plugin / ClientControllerPlugin / src / oic / simulator / clientcontroller / view / AttributeView.java
index 255d9f1..953e8f0 100644 (file)
@@ -16,7 +16,6 @@
 
 package oic.simulator.clientcontroller.view;
 
-import java.util.List;
 import java.util.Map;
 
 import oic.simulator.clientcontroller.Activator;
@@ -28,35 +27,40 @@ import oic.simulator.clientcontroller.listener.IPutUIListener;
 import oic.simulator.clientcontroller.listener.IResourceSelectionChangedUIListener;
 import oic.simulator.clientcontroller.listener.IVerificationUIListener;
 import oic.simulator.clientcontroller.manager.ResourceManager;
-import oic.simulator.clientcontroller.remoteresource.PutPostAttributeModel;
+import oic.simulator.clientcontroller.remoteresource.AttributeElement;
 import oic.simulator.clientcontroller.remoteresource.RemoteResource;
-import oic.simulator.clientcontroller.remoteresource.RemoteResourceAttribute;
+import oic.simulator.clientcontroller.remoteresource.ResourceRepresentation;
 import oic.simulator.clientcontroller.utils.Constants;
+import oic.simulator.clientcontroller.utils.Utility;
 import oic.simulator.clientcontroller.view.dialogs.PostRequestDialog;
 import oic.simulator.clientcontroller.view.dialogs.PutRequestDialog;
 import oic.simulator.clientcontroller.view.dialogs.VerificationDialog;
 
 import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.StyledCellLabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerCell;
 import org.eclipse.jface.window.Window;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.part.ViewPart;
+import org.oic.simulator.AttributeValue.ValueType;
+import org.oic.simulator.SimulatorResourceAttribute;
+import org.oic.simulator.client.SimulatorRemoteResource.VerificationType;
 
 /**
  * This class manages and shows the attribute view in the perspective.
@@ -65,7 +69,7 @@ public class AttributeView extends ViewPart {
 
     public static final String                  VIEW_ID        = "oic.simulator.clientcontroller.view.attribute";
 
-    private TableViewer                         attTblViewer;
+    private TreeViewer                          attViewer;
 
     private Button                              getButton;
     private Button                              putButton;
@@ -100,24 +104,19 @@ public class AttributeView extends ViewPart {
 
                     @Override
                     public void run() {
-                        System.out
-                                .println("AttributeView: onResourceSelectionChange");
                         resourceInSelection = resource;
 
                         // Set visibility of manual and automation controls
                         setVisibility((resource == null) ? false : true);
 
                         // Update the attribute table
-                        if (null != attTblViewer
-                                && !attTblViewer.getControl().isDisposed()) {
-                            System.out.println("viewer is alive");
-                            updateViewer(getData(resource));
+                        if (null != attViewer
+                                && !attViewer.getControl().isDisposed()) {
+                            updateViewer(resource);
                         }
 
                         // Update the observe status
                         updateObserve(resource);
-
-                        // Update the pay-load details if any
                     }
                 });
             }
@@ -131,30 +130,20 @@ public class AttributeView extends ViewPart {
 
                     @Override
                     public void run() {
-
-                        System.out.println("AttributeView: onGetCompleted");
                         if (null == resource) {
                             return;
                         }
                         // Update the attribute table
                         if (resourceInSelection != resource) {
-                            System.out
-                                    .println("AttributeView: get response arrived for a different resource");
                             return;
                         }
-                        updateViewer(getData(resource));
+                        updateViewer(resource);
 
                         // Update the observe status
                         updateObserve(resource);
-
-                        // Update the pay-load details if any
                     }
                 });
             }
-
-            @Override
-            public void onGetFailed(RemoteResource resource) {
-            }
         };
 
         putUIListener = new IPutUIListener() {
@@ -165,30 +154,20 @@ public class AttributeView extends ViewPart {
 
                     @Override
                     public void run() {
-
-                        System.out.println("AttributeView: onPutCompleted");
                         if (null == resource) {
                             return;
                         }
                         // Update the attribute table
                         if (resourceInSelection != resource) {
-                            System.out
-                                    .println("AttributeView: put response arrived for a different resource");
                             return;
                         }
-                        updateViewer(getData(resource));
+                        updateViewer(resource);
 
                         // Update the observe status
                         updateObserve(resource);
-
-                        // Update the pay-load details if any
                     }
                 });
             }
-
-            @Override
-            public void onPutFailed(RemoteResource resource) {
-            }
         };
 
         postUIListener = new IPostUIListener() {
@@ -199,30 +178,20 @@ public class AttributeView extends ViewPart {
 
                     @Override
                     public void run() {
-
-                        System.out.println("AttributeView: onPostCompleted");
                         if (null == resource) {
                             return;
                         }
                         // Update the attribute table
                         if (resourceInSelection != resource) {
-                            System.out
-                                    .println("AttributeView: post response arrived for a different resource");
                             return;
                         }
-                        updateViewer(getData(resource));
+                        updateViewer(resource);
 
                         // Update the observe status
                         updateObserve(resource);
-
-                        // Update the pay-load details if any
                     }
                 });
             }
-
-            @Override
-            public void onPostFailed(RemoteResource resource) {
-            }
         };
 
         observeUIListener = new IObserveUIListener() {
@@ -233,30 +202,20 @@ public class AttributeView extends ViewPart {
 
                     @Override
                     public void run() {
-
-                        System.out.println("AttributeView: onObserveCompleted");
                         if (null == resource) {
                             return;
                         }
                         // Update the attribute table
                         if (resourceInSelection != resource) {
-                            System.out
-                                    .println("AttributeView: observe response arrived for a different resource");
                             return;
                         }
-                        updateViewer(getData(resource));
+                        updateViewer(resource);
 
                         // Update the observe status
                         updateObserve(resource);
-
-                        // Update the pay-load details if any
                     }
                 });
             }
-
-            @Override
-            public void onObserveFailed(RemoteResource resource) {
-            }
         };
 
         verificationUIListener = new IVerificationUIListener() {
@@ -268,7 +227,7 @@ public class AttributeView extends ViewPart {
 
                     @Override
                     public void run() {
-                        changeReqBtnVisibility(autoType, false);
+                        // changeReqBtnVisibility(autoType, false);
                     }
                 });
             }
@@ -280,7 +239,7 @@ public class AttributeView extends ViewPart {
 
                     @Override
                     public void run() {
-                        changeReqBtnVisibility(autoType, true);
+                        // changeReqBtnVisibility(autoType, true);
                     }
                 });
             }
@@ -292,7 +251,7 @@ public class AttributeView extends ViewPart {
 
                     @Override
                     public void run() {
-                        changeReqBtnVisibility(autoType, true);
+                        // changeReqBtnVisibility(autoType, true);
                     }
                 });
             }
@@ -306,15 +265,10 @@ public class AttributeView extends ViewPart {
 
                     @Override
                     public void run() {
-
-                        System.out
-                                .println("AttributeView: onConfigurationUploaded");
                         if (null == resource) {
                             return;
                         }
                         if (resourceInSelection != resource) {
-                            System.out
-                                    .println("AttributeView: config upload response arrived for a different resource");
                             return;
                         }
                         if (!automateButton.isDisposed()) {
@@ -342,40 +296,33 @@ public class AttributeView extends ViewPart {
         }
     }
 
-    private Map<String, RemoteResourceAttribute> getData(RemoteResource resource) {
-        if (null == resource) {
-            return null;
+    private void updateViewer(RemoteResource resource) {
+        if (null == attViewer) {
+            return;
         }
-        Map<String, RemoteResourceAttribute> attMap = resource
-                .getResourceAttributesMap();
-        System.out.println("AttributeView: \n" + attMap);
-        return attMap;
-    }
-
-    private void updateViewer(Map<String, RemoteResourceAttribute> attMap) {
-        if (null != attTblViewer) {
-            Table tbl = attTblViewer.getTable();
-            if (null != attMap) {
-                attTblViewer.setInput(attMap.entrySet().toArray());
-                if (!tbl.isDisposed()) {
-                    tbl.setLinesVisible(true);
-                }
-            } else {
-                if (!tbl.isDisposed()) {
-                    tbl.removeAll();
-                    tbl.setLinesVisible(false);
-                }
+        Tree tree = attViewer.getTree();
+        if (null != resource) {
+            attViewer.setInput(resource.getResourceRepresentation());
+            if (!tree.isDisposed()) {
+                tree.setLinesVisible(true);
+            }
+        } else {
+            if (!tree.isDisposed()) {
+                tree.removeAll();
+                tree.setLinesVisible(false);
             }
         }
     }
 
     private void updateObserve(RemoteResource resource) {
-        if (null == resource) {
+        if (null == resource || observeResButton.isDisposed()) {
             return;
         }
         boolean observed = resource.isObserved();
-        if (!observeResButton.isDisposed()) {
-            observeResButton.setSelection(observed);
+        if (observed) {
+            observeResButton.setText(Constants.STOP_OBSERVE);
+        } else {
+            observeResButton.setText(Constants.OBSERVE);
         }
     }
 
@@ -383,7 +330,7 @@ public class AttributeView extends ViewPart {
     public void createPartControl(Composite parent) {
         Color color = Display.getDefault().getSystemColor(SWT.COLOR_WHITE);
 
-        parent.setLayout(new GridLayout(2, false));
+        parent.setLayout(new GridLayout());
         GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
         parent.setLayoutData(gd);
 
@@ -402,9 +349,7 @@ public class AttributeView extends ViewPart {
 
         setupAttributeTable(attGroup);
 
-        setupMessageArea(parent);
-
-        setupResourceLevelOpsArea(parent);
+        setupRequestControls(parent);
 
         setUIListeners();
 
@@ -413,26 +358,24 @@ public class AttributeView extends ViewPart {
         setVisibility(false);
 
         // Updating the data in the UI as per the resource in selection.
-        if (null != attTblViewer && !attTblViewer.getControl().isDisposed()) {
-            updateViewer(getData(resourceManager
-                    .getCurrentResourceInSelection()));
+        if (null != attViewer && !attViewer.getControl().isDisposed()) {
+            updateViewer(resourceManager.getCurrentResourceInSelection());
         }
     }
 
-    private void setupMessageArea(Composite parent) {
+    private void setupRequestControls(Composite parent) {
         GridData gd;
         Color color = Display.getDefault().getSystemColor(SWT.COLOR_WHITE);
-        Group msgTypesGrp = new Group(parent, SWT.NONE);
+        Composite opsComp = new Composite(parent, SWT.NONE);
         gd = new GridData();
         gd.grabExcessHorizontalSpace = true;
         gd.horizontalAlignment = SWT.FILL;
-        msgTypesGrp.setLayoutData(gd);
-        GridLayout grid = new GridLayout(3, false);
-        msgTypesGrp.setLayout(grid);
-        msgTypesGrp.setText("Request Types");
-        msgTypesGrp.setBackground(color);
+        opsComp.setLayoutData(gd);
+        GridLayout grid = new GridLayout(5, false);
+        opsComp.setLayout(grid);
+        opsComp.setBackground(color);
 
-        getButton = new Button(msgTypesGrp, SWT.PUSH);
+        getButton = new Button(opsComp, SWT.PUSH);
         getButton.setText("GET");
         gd = new GridData();
         gd.grabExcessHorizontalSpace = true;
@@ -440,7 +383,7 @@ public class AttributeView extends ViewPart {
         gd.widthHint = 50;
         getButton.setLayoutData(gd);
 
-        putButton = new Button(msgTypesGrp, SWT.PUSH);
+        putButton = new Button(opsComp, SWT.PUSH);
         putButton.setText("PUT");
         gd = new GridData();
         gd.grabExcessHorizontalSpace = true;
@@ -448,95 +391,58 @@ public class AttributeView extends ViewPart {
         gd.widthHint = 50;
         putButton.setLayoutData(gd);
 
-        postButton = new Button(msgTypesGrp, SWT.PUSH);
+        postButton = new Button(opsComp, SWT.PUSH);
         postButton.setText("POST");
         gd = new GridData();
         gd.grabExcessHorizontalSpace = true;
         gd.horizontalAlignment = SWT.FILL;
         gd.widthHint = 50;
         postButton.setLayoutData(gd);
-    }
 
-    private void setupResourceLevelOpsArea(Composite parent) {
-        GridData gd;
-        Color color = Display.getDefault().getSystemColor(SWT.COLOR_WHITE);
-        Group resOpsGrp = new Group(parent, SWT.NONE);
+        observeResButton = new Button(opsComp, SWT.PUSH);
+        observeResButton.setText(Constants.OBSERVE);
         gd = new GridData();
         gd.grabExcessHorizontalSpace = true;
         gd.horizontalAlignment = SWT.FILL;
-        resOpsGrp.setLayoutData(gd);
-        GridLayout grid = new GridLayout(2, false);
-        resOpsGrp.setLayout(grid);
-        resOpsGrp.setText("Resource-Level Operations");
-        resOpsGrp.setBackground(color);
+        observeResButton.setLayoutData(gd);
 
-        automateButton = new Button(resOpsGrp, SWT.PUSH);
+        automateButton = new Button(opsComp, SWT.PUSH);
         automateButton.setText("Automation");
         gd = new GridData();
         gd.grabExcessHorizontalSpace = true;
         gd.horizontalAlignment = SWT.FILL;
         automateButton.setLayoutData(gd);
-
-        observeResButton = new Button(resOpsGrp, SWT.CHECK);
-        observeResButton.setText("Observe");
-        gd = new GridData();
-        gd.grabExcessHorizontalSpace = true;
-        gd.horizontalAlignment = SWT.FILL;
-        observeResButton.setLayoutData(gd);
     }
 
     private void setupAttributeTable(Group attGroup) {
-        attTblViewer = new TableViewer(attGroup, SWT.SINGLE | SWT.H_SCROLL
-                | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
+        Tree addressTree = new Tree(attGroup, SWT.SINGLE | SWT.BORDER
+                | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
+        addressTree.setHeaderVisible(true);
 
-        createAttributeColumns(attTblViewer);
+        attViewer = new TreeViewer(addressTree);
+
+        createAttributeColumns(attViewer);
 
         // make lines and header visible
-        Table table = attTblViewer.getTable();
-        table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-        table.setHeaderVisible(true);
-        table.setLinesVisible(true);
+        Tree tree = attViewer.getTree();
+        tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+        tree.setHeaderVisible(true);
+        tree.setLinesVisible(true);
 
-        attTblViewer.setContentProvider(new AttributeContentProvider());
+        attViewer.setContentProvider(new AttributeContentProvider());
+        attViewer.setLabelProvider(new AttributeLabelProvider());
     }
 
-    public void createAttributeColumns(TableViewer tableViewer) {
+    public void createAttributeColumns(TreeViewer viewer) {
+        Tree tree = viewer.getTree();
 
-        TableViewerColumn attName = new TableViewerColumn(tableViewer, SWT.NONE);
-        attName.getColumn().setWidth(attTblColWidth[0]);
-        attName.getColumn().setText(attTblHeaders[0]);
-        attName.setLabelProvider(new StyledCellLabelProvider() {
-            @Override
-            public void update(ViewerCell cell) {
-                Object element = cell.getElement();
-                if (element instanceof Map.Entry) {
-                    @SuppressWarnings("unchecked")
-                    Map.Entry<String, RemoteResourceAttribute> entry = (Map.Entry<String, RemoteResourceAttribute>) element;
-                    cell.setText(entry.getKey());
-                }
-            }
-        });
+        TreeColumn attName = new TreeColumn(tree, SWT.NONE);
+        attName.setWidth(attTblColWidth[0]);
+        attName.setText(attTblHeaders[0]);
 
-        TableViewerColumn attValue = new TableViewerColumn(tableViewer,
-                SWT.NONE);
-        attValue.getColumn().setWidth(attTblColWidth[1]);
-        attValue.getColumn().setText(attTblHeaders[1]);
-        attValue.setLabelProvider(new StyledCellLabelProvider() {
-            @Override
-            public void update(ViewerCell cell) {
-                Object element = cell.getElement();
-                if (element instanceof Map.Entry) {
-                    @SuppressWarnings("unchecked")
-                    Map.Entry<String, RemoteResourceAttribute> entry = (Map.Entry<String, RemoteResourceAttribute>) element;
-                    Object value = entry.getValue().getAttributeValue();
-                    if (null == value) {
-                        cell.setText("");
-                    } else {
-                        cell.setText(String.valueOf(value));
-                    }
-                }
-            }
-        });
+        TreeColumn attValue = new TreeColumn(tree, SWT.NONE);
+        attValue.setWidth(attTblColWidth[1]);
+        attValue.setText(attTblHeaders[1]);
     }
 
     private void setUIListeners() {
@@ -568,10 +474,8 @@ public class AttributeView extends ViewPart {
                                             "PUT Automation is in progress. Please wait or stop the automation.");
                             return;
                         }
-                        List<PutPostAttributeModel> putPostModelList;
-                        putPostModelList = resourceInSelection
-                                .getPutPostModel();
-                        if (null == putPostModelList) {
+                        if (resourceInSelection.getResourceRepresentation()
+                                .getAttributes().size() < 1) {
                             MessageDialog
                                     .openInformation(Display.getDefault()
                                             .getActiveShell(), "PUT Request",
@@ -579,12 +483,12 @@ public class AttributeView extends ViewPart {
                             return;
                         }
                         PutRequestDialog putDialog = new PutRequestDialog(
-                                Display.getDefault().getActiveShell(),
-                                putPostModelList);
+                                Display.getDefault().getActiveShell());
                         if (putDialog.open() == Window.OK) {
                             // Call the native PUT method
                             resourceManager.sendPutRequest(resourceInSelection,
-                                    putPostModelList);
+                                    putDialog.getUpdatedRepresentation()
+                                            .getModel());
                         }
                     }
                 });
@@ -604,24 +508,24 @@ public class AttributeView extends ViewPart {
                                             "POST Automation is in progress. Please wait or stop the automation.");
                             return;
                         }
-                        List<PutPostAttributeModel> putPostModelList;
-                        putPostModelList = resourceInSelection
-                                .getPutPostModel();
-                        if (null == putPostModelList) {
+                        if (resourceInSelection.getResourceRepresentation()
+                                .getAttributes().size() < 1) {
                             MessageDialog
                                     .openInformation(Display.getDefault()
-                                            .getActiveShell(), "PUT Request",
+                                            .getActiveShell(), "POST Request",
                                             "No attributes exist in the resource model.");
                             return;
                         }
 
                         PostRequestDialog postDialog = new PostRequestDialog(
-                                Display.getDefault().getActiveShell(),
-                                putPostModelList);
+                                Display.getDefault().getActiveShell());
                         if (postDialog.open() == Window.OK) {
                             // Call the native POST method
+                            ResourceRepresentation representation = postDialog
+                                    .getUpdatedRepresentation();
                             resourceManager.sendPostRequest(
-                                    resourceInSelection, putPostModelList);
+                                    resourceInSelection,
+                                    representation.getSelectedModel());
                         }
                     }
                 });
@@ -631,12 +535,29 @@ public class AttributeView extends ViewPart {
         observeResButton.addSelectionListener(new SelectionAdapter() {
             @Override
             public void widgetSelected(SelectionEvent e) {
-                boolean checked = observeResButton.getSelection();
-                if (checked) {
-                    resourceManager.sendObserveRequest(resourceInSelection);
+                boolean result;
+                if (observeResButton.getText().equals(Constants.OBSERVE)) {
+                    result = resourceManager
+                            .sendObserveRequest(resourceInSelection);
+                    if (result) {
+                        observeResButton.setText(Constants.STOP_OBSERVE);
+                    } else {
+                        MessageDialog.openError(Display.getDefault()
+                                .getActiveShell(), "Observe failed",
+                                "Failed to observe the resource. Try again.");
+                    }
                 } else {
-                    resourceManager
-                            .sendCancelObserveRequest(resourceInSelection);
+                    result = resourceManager.sendCancelObserveRequest(
+                            resourceInSelection, true);
+                    if (result) {
+                        observeResButton.setText(Constants.OBSERVE);
+                    } else {
+                        MessageDialog
+                                .openError(Display.getDefault()
+                                        .getActiveShell(),
+                                        "Cancel Observe failed",
+                                        "Failed to stop observing the resource. Try again.");
+                    }
                 }
             }
         });
@@ -657,15 +578,123 @@ public class AttributeView extends ViewPart {
                         if (null == autoStatus) {
                             return;
                         }
+
+                        int startCount = 0;
+                        int stopCount = 0;
+                        boolean startGet, startPut, startPost;
+                        boolean stopGet, stopPut, stopPost;
+                        startGet = startPut = startPost = false;
+                        stopGet = stopPut = stopPost = false;
+                        String status = null;
+                        String startMsg = "Verification will be started for: ";
+                        String stopMsg = "Verification will be stopped for: ";
                         VerificationDialog ad = new VerificationDialog(Display
                                 .getDefault().getActiveShell(), autoStatus);
-                        ad.open();
+                        if (ad.open() == Window.OK) {
+                            Map<String, Boolean> oldStatus = resourceManager
+                                    .getAutomationStatus(resource);
+                            if (null == oldStatus || oldStatus.size() < 1) {
+                                status = "Failed to perform the requested operation.";
+                            } else {
+                                // GET
+                                if (oldStatus.get(Constants.GET) != autoStatus
+                                        .get(Constants.GET)) {
+                                    if (autoStatus.get(Constants.GET)) {
+                                        startMsg += Constants.GET;
+                                        startCount++;
+                                        startGet = true;
+                                    } else {
+                                        stopMsg += Constants.GET;
+                                        stopCount++;
+                                        stopGet = true;
+                                    }
+                                }
+                                // PUT
+                                if (oldStatus.get(Constants.PUT) != autoStatus
+                                        .get(Constants.PUT)) {
+                                    if (autoStatus.get(Constants.PUT)) {
+                                        if (startCount == 1) {
+                                            startMsg += ", ";
+                                        }
+                                        startMsg += Constants.PUT;
+                                        startCount++;
+                                        startPut = true;
+                                    } else {
+                                        if (stopCount == 1) {
+                                            stopMsg += ", ";
+                                        }
+                                        stopMsg += Constants.PUT;
+                                        stopCount++;
+                                        stopPut = true;
+                                    }
+
+                                }
+                                // POST
+                                if (oldStatus.get(Constants.POST) != autoStatus
+                                        .get(Constants.POST)) {
+                                    if (autoStatus.get(Constants.POST)) {
+                                        if (startCount > 0) {
+                                            startMsg += ", ";
+                                        }
+                                        startMsg += Constants.POST;
+                                        startCount++;
+                                        startPost = true;
+                                    } else {
+                                        if (stopCount > 0) {
+                                            stopMsg += ", ";
+                                        }
+                                        stopMsg += Constants.POST;
+                                        stopCount++;
+                                        stopPost = true;
+                                    }
+                                }
+                                if (startCount > 0) {
+                                    status = startMsg + ".";
+                                }
+                                if (stopCount > 0) {
+                                    if (startCount <= 0) {
+                                        status = stopMsg;
+                                    } else {
+                                        status += "\n" + stopMsg + ".";
+                                    }
+                                }
+                            }
+                            if (startCount == 0 && stopCount == 0) {
+                                MessageDialog.openInformation(Display
+                                        .getDefault().getActiveShell(),
+                                        "Verification", "No New Changes.");
+                            } else {
+                                boolean answer = MessageDialog.openQuestion(
+                                        Display.getDefault().getActiveShell(),
+                                        "Verification", status
+                                                + "\nDo you want to proceed?");
+                                if (answer) {
+                                    if (startGet || stopGet)
+                                        automate(VerificationType.GET,
+                                                autoStatus.get(Constants.GET));
+                                    if (startPut || stopPut)
+                                        automate(VerificationType.PUT,
+                                                autoStatus.get(Constants.PUT));
+                                    if (startPost || stopPost)
+                                        automate(VerificationType.POST,
+                                                autoStatus.get(Constants.POST));
+                                }
+                            }
+                        }
                     }
                 });
             }
         });
     }
 
+    private void automate(VerificationType type, boolean start) {
+        if (start) {
+            resourceManager.startAutomationRequest(type, resourceInSelection);
+        } else {
+            resourceManager.stopAutomationRequest(type, resourceInSelection);
+        }
+    }
+
     private void addManagerListeners() {
         resourceManager
                 .addResourceSelectionChangedUIListener(resourceSelectionChangedListener);
@@ -696,21 +725,103 @@ public class AttributeView extends ViewPart {
             observeResButton.setEnabled(visibility);
     }
 
-    class AttributeContentProvider implements IStructuredContentProvider {
+    class AttributeContentProvider implements ITreeContentProvider {
+
+        @Override
+        public void dispose() {
+        }
+
+        @Override
+        public void inputChanged(Viewer viewer, Object oldAttribute,
+                Object newAttribute) {
+        }
+
+        @Override
+        public Object[] getChildren(Object attribute) {
+            if (attribute instanceof AttributeElement) {
+                return ((AttributeElement) attribute).getChildren().values()
+                        .toArray();
+            }
+
+            return new Object[0];
+        }
+
+        @Override
+        public Object getParent(Object attribute) {
+            if (attribute instanceof AttributeElement)
+                return ((AttributeElement) attribute).getParent();
+            return null;
+        }
+
+        @Override
+        public boolean hasChildren(Object attribute) {
+            if (attribute instanceof AttributeElement)
+                return ((AttributeElement) attribute).hasChildren();
+            return false;
+        }
+
+        @Override
+        public Object[] getElements(Object resourceModel) {
+            if (resourceModel instanceof ResourceRepresentation) {
+                return ((ResourceRepresentation) resourceModel).getAttributes()
+                        .values().toArray();
+            }
+
+            return new Object[0];
+        }
+    }
+
+    class AttributeLabelProvider implements ITableLabelProvider {
+
+        @Override
+        public void addListener(ILabelProviderListener arg0) {
+        }
 
         @Override
         public void dispose() {
         }
 
         @Override
-        public void inputChanged(Viewer viewer, Object arg1, Object arg2) {
+        public boolean isLabelProperty(Object arg0, String arg1) {
+            return false;
+        }
+
+        @Override
+        public void removeListener(ILabelProviderListener arg0) {
+
         }
 
         @Override
-        public Object[] getElements(Object element) {
-            return (Object[]) element;
+        public Image getColumnImage(Object element, int col) {
+            return null;
         }
 
+        @Override
+        public String getColumnText(Object element, int column) {
+            if (element instanceof AttributeElement) {
+                AttributeElement attrElement = (AttributeElement) element;
+                switch (column) {
+                    case 0: // Attribute name column
+                    {
+                        SimulatorResourceAttribute attribute = attrElement
+                                .getSimulatorResourceAttribute();
+                        return attribute.name();
+                    }
+
+                    case 1: // Attribute value column
+                    {
+                        SimulatorResourceAttribute attribute = attrElement
+                                .getSimulatorResourceAttribute();
+
+                        if (attribute.value().typeInfo().mBaseType != ValueType.RESOURCEMODEL)
+                            return Utility.getAttributeValueAsString(attribute
+                                    .value());
+                        return null;
+                    }
+                }
+            }
+            return null;
+        }
     }
 
     @Override