2 * Copyright 2015 Samsung Electronics All Rights Reserved.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package oic.simulator.serviceprovider.view;
19 import org.eclipse.jface.dialogs.MessageDialog;
20 import org.eclipse.jface.viewers.ILabelProviderListener;
21 import org.eclipse.jface.viewers.IStructuredSelection;
22 import org.eclipse.jface.viewers.ITableLabelProvider;
23 import org.eclipse.jface.viewers.ITreeContentProvider;
24 import org.eclipse.jface.viewers.StructuredSelection;
25 import org.eclipse.jface.viewers.TreeViewer;
26 import org.eclipse.jface.viewers.TreeViewerColumn;
27 import org.eclipse.jface.viewers.Viewer;
28 import org.eclipse.jface.window.Window;
29 import org.eclipse.swt.SWT;
30 import org.eclipse.swt.events.MenuAdapter;
31 import org.eclipse.swt.events.MenuEvent;
32 import org.eclipse.swt.events.SelectionAdapter;
33 import org.eclipse.swt.events.SelectionEvent;
34 import org.eclipse.swt.graphics.Color;
35 import org.eclipse.swt.graphics.Image;
36 import org.eclipse.swt.layout.GridData;
37 import org.eclipse.swt.layout.GridLayout;
38 import org.eclipse.swt.widgets.Composite;
39 import org.eclipse.swt.widgets.Display;
40 import org.eclipse.swt.widgets.Group;
41 import org.eclipse.swt.widgets.Menu;
42 import org.eclipse.swt.widgets.MenuItem;
43 import org.eclipse.swt.widgets.MessageBox;
44 import org.eclipse.swt.widgets.Tree;
45 import org.eclipse.swt.widgets.TreeColumn;
46 import org.eclipse.swt.widgets.TreeItem;
47 import org.eclipse.ui.part.ViewPart;
49 import java.util.ArrayList;
50 import java.util.Collections;
51 import java.util.Date;
52 import java.util.HashMap;
53 import java.util.List;
56 import org.oic.simulator.ArrayProperty;
57 import org.oic.simulator.AttributeProperty;
58 import org.oic.simulator.AttributeValue;
59 import org.oic.simulator.AttributeValue.TypeInfo;
60 import org.oic.simulator.AttributeValue.ValueType;
61 import org.oic.simulator.ILogger.Level;
62 import org.oic.simulator.ModelProperty;
63 import org.oic.simulator.SimulatorResourceAttribute;
64 import org.oic.simulator.SimulatorResourceModel;
66 import oic.simulator.serviceprovider.Activator;
67 import oic.simulator.serviceprovider.listener.IAutomationListener;
68 import oic.simulator.serviceprovider.listener.IDataChangeListener;
69 import oic.simulator.serviceprovider.listener.ISelectionChangedListener;
70 import oic.simulator.serviceprovider.manager.ResourceManager;
71 import oic.simulator.serviceprovider.manager.UiListenerHandler;
72 import oic.simulator.serviceprovider.model.AttributeElement;
73 import oic.simulator.serviceprovider.model.Resource;
74 import oic.simulator.serviceprovider.model.ResourceRepresentation;
75 import oic.simulator.serviceprovider.model.SingleResource;
76 import oic.simulator.serviceprovider.utils.Constants;
77 import oic.simulator.serviceprovider.utils.Utility;
78 import oic.simulator.serviceprovider.view.dialogs.ModelArrayAddItemDialog;
81 * This class manages and shows the attribute view in the perspective.
83 public class AttributeView extends ViewPart {
85 public static final String VIEW_ID = "oic.simulator.serviceprovider.view.attribute";
87 private TreeViewer attViewer;
89 private AttributeEditingSupport attributeEditor;
91 private ISelectionChangedListener resourceSelectionChangedListener;
92 private IAutomationListener automationUIListener;
93 private IDataChangeListener dataChangeListener;
95 private final String[] attTblHeaders = { "Name", "Value",
97 private final Integer[] attTblColWidth = { 150, 190, 150 };
99 private ResourceManager resourceManager;
101 public AttributeView() {
103 resourceManager = Activator.getDefault().getResourceManager();
105 resourceSelectionChangedListener = new ISelectionChangedListener() {
108 public void onResourceSelectionChange(final Resource resource) {
109 Display.getDefault().asyncExec(new Runnable() {
112 if (null != attViewer) {
113 Tree tree = attViewer.getTree();
114 if (null == tree || tree.isDisposed()) {
118 // Enabling/disabling the tree based on the resource
119 // and automation status.
120 if (resource instanceof SingleResource)
121 if (((SingleResource) resource)
122 .isResourceAutomationInProgress())
123 tree.setEnabled(false);
125 tree.setEnabled(true);
129 .getResourceRepresentation()) {
130 attViewer.setInput(resource
131 .getResourceRepresentation());
132 attViewer.expandAll();
133 tree.setLinesVisible(true);
136 attViewer.setInput(null);
137 tree.setLinesVisible(false);
145 dataChangeListener = new IDataChangeListener() {
148 public void add(final AttributeElement attribute) {
149 Display.getDefault().asyncExec(new Runnable() {
152 attViewer.refresh(attribute.getParent());
153 attViewer.expandAll();
159 public void remove(final AttributeElement attribute) {
160 Display.getDefault().asyncExec(new Runnable() {
163 attViewer.refresh(attribute.getParent());
164 attViewer.expandAll();
170 public void update(final AttributeElement attribute) {
171 Display.getDefault().asyncExec(new Runnable() {
174 attViewer.update(attribute, null);
175 attViewer.expandAll();
181 automationUIListener = new IAutomationListener() {
184 public void onResourceAutomationStart(final SingleResource resource) {
185 Display.getDefault().asyncExec(new Runnable() {
189 if (null == resource || null == attViewer) {
192 Resource resourceInSelection = resourceManager
193 .getCurrentResourceInSelection();
194 if (null == resourceInSelection) {
197 // Checking whether attributes view is currently
198 // displaying the attributes of the
199 // resource whose automation has just started
200 if (resource == resourceInSelection) {
202 tree = attViewer.getTree();
203 if (!tree.isDisposed()) {
204 // Disabling the table to prevent interactions
205 // during the automation
206 tree.setEnabled(false);
215 public void onAutomationComplete(final SingleResource resource,
216 final String attName) {
217 // This method notifies the completion of attribute level
219 Display.getDefault().asyncExec(new Runnable() {
223 if (null == resource) {
226 // Check if the given resourceURI is the uri of the
227 // resource whose attributes are currently being
228 // displayed by this view.
229 Resource resourceInSelection = resourceManager
230 .getCurrentResourceInSelection();
231 if (resource != resourceInSelection) {
235 tree = attViewer.getTree();
236 if (!tree.isDisposed()) {
237 tree.setEnabled(true);
246 public void createPartControl(Composite parent) {
247 Color color = Display.getDefault().getSystemColor(SWT.COLOR_WHITE);
249 parent.setLayout(new GridLayout());
250 GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
251 parent.setLayoutData(gd);
253 Group attGroup = new Group(parent, SWT.NONE);
254 attGroup.setLayout(new GridLayout());
255 gd = new GridData(SWT.FILL, SWT.FILL, true, true);
256 attGroup.setLayoutData(gd);
257 attGroup.setText("Attributes");
258 attGroup.setBackground(color);
260 Tree addressTree = new Tree(attGroup, SWT.SINGLE | SWT.BORDER
261 | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
262 addressTree.setHeaderVisible(true);
264 attViewer = new TreeViewer(addressTree);
266 createAttributeColumns(attViewer);
268 // make lines and header visible
269 Tree tree = attViewer.getTree();
270 tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
271 tree.setHeaderVisible(true);
272 tree.setLinesVisible(true);
274 attViewer.setContentProvider(new AttributeContentProvider());
275 attViewer.setLabelProvider(new AttributeLabelProvider());
277 addManagerListeners();
279 // Check whether there is any resource selected already
280 Resource resource = resourceManager.getCurrentResourceInSelection();
281 if (resource != null) {
282 attViewer.setInput(resource.getResourceRepresentation());
286 public void createAttributeColumns(TreeViewer viewer) {
287 Tree tree = viewer.getTree();
289 attributeEditor = new AttributeEditingSupport();
291 TreeColumn attName = new TreeColumn(tree, SWT.NONE);
292 attName.setWidth(attTblColWidth[0]);
293 attName.setText(attTblHeaders[0]);
295 TreeColumn attValue = new TreeColumn(tree, SWT.NONE);
296 attValue.setWidth(attTblColWidth[1]);
297 attValue.setText(attTblHeaders[1]);
299 TreeViewerColumn attValueVwrCol = new TreeViewerColumn(attViewer,
301 attValueVwrCol.setEditingSupport(attributeEditor
302 .createAttributeValueEditor(attViewer, true));
304 TreeColumn automation = new TreeColumn(tree, SWT.NONE);
305 automation.setWidth(attTblColWidth[2]);
306 automation.setText(attTblHeaders[2]);
307 TreeViewerColumn automationVwrCol = new TreeViewerColumn(attViewer,
309 automationVwrCol.setEditingSupport(attributeEditor
310 .createAutomationEditor(attViewer));
312 addColumnListeners();
317 private void addColumnListeners() {
318 TreeColumn[] columns = attViewer.getTree().getColumns();
319 for (TreeColumn column : columns) {
320 column.addSelectionListener(new SelectionAdapter() {
322 public void widgetSelected(SelectionEvent e) {
323 // Refreshing the viewer. If combo list is open,
324 // then click events on other parts of the view or outside
325 // the combo should hide the editor.
326 // Refreshing the viewer hides the combo and other editors
334 private void addMenuItems() {
335 if (null != attViewer) {
336 final Tree resourceTreeHead = attViewer.getTree();
337 if (null != resourceTreeHead) {
338 // Below code creates menu entries and shows them on right
339 // clicking a resource
340 final Menu menu = new Menu(resourceTreeHead);
341 resourceTreeHead.setMenu(menu);
342 menu.addMenuListener(new MenuAdapter() {
344 public void menuShown(MenuEvent e) {
345 // Clear existing menu items
346 MenuItem[] items = menu.getItems();
347 for (int index = 0; index < items.length; index++) {
348 items[index].dispose();
351 IStructuredSelection selection = ((IStructuredSelection) attViewer
353 final AttributeElement attElement = (AttributeElement) selection
355 if (null == attElement) {
359 // Check the type of attribute.
360 SimulatorResourceAttribute attribute = attElement
361 .getSimulatorResourceAttribute();
362 if (null == attribute) {
366 AttributeValue value = attribute.value();
367 if (null == value || null == value.get()) {
371 TypeInfo type = value.typeInfo();
373 final Object parent = attElement.getParent();
375 if ((type.mType == ValueType.ARRAY
376 && type.mBaseType == ValueType.RESOURCEMODEL && type.mDepth == 1)
377 && (null == parent || parent instanceof ResourceRepresentation)) {
378 addMenuToOneDimensionalTopLevelModelAttributes(menu);
383 && parent instanceof AttributeElement) {
384 Object grandParent = ((AttributeElement) parent)
386 if (null == grandParent
387 || grandParent instanceof ResourceRepresentation) {
388 AttributeElement parentElement = (AttributeElement) parent;
390 // Check the type of attribute.
391 SimulatorResourceAttribute parentAttribute = parentElement
392 .getSimulatorResourceAttribute();
393 if (null != parentAttribute
394 && null != parentAttribute.value()
395 && null != parentAttribute.value()
397 AttributeValue parentValue = parentAttribute
400 TypeInfo parentType = parentValue
402 if (parentType.mType == ValueType.ARRAY
403 && parentType.mBaseType == ValueType.RESOURCEMODEL
404 && parentType.mDepth == 1) {
405 addDeleteMenuToArrayItemsOfOneDimensionalModelAttribute(
406 menu, attElement, parentElement);
419 private void addMenuToOneDimensionalTopLevelModelAttributes(Menu menu) {
420 // Menu to add items to the array.
421 MenuItem addItems = new MenuItem(menu, SWT.NONE);
422 addItems.setText("Add Items");
423 addItems.addSelectionListener(new SelectionAdapter() {
425 public void widgetSelected(SelectionEvent e) {
426 // Get the attributes.
427 ResourceRepresentation representation;
428 representation = getRepresentationForOneDimensionTopLevelAttribute();
429 if (null == representation) {
431 .openError(Display.getDefault().getActiveShell(),
432 "Unable to perform the operation.",
433 "Failed to obtain the required data. Operation cannot be performed.");
435 // Check whether a new item can be added to the array by
437 // the array property of the current attribute in
438 // selection(Model Array type attribute).
439 AttributeElement attElement = getSelectedElement();
440 if (null == attElement) {
442 .openError(Display.getDefault()
444 "Unable to perform the operation.",
445 "Failed to obtain the required data. Operation cannot be performed.");
449 SimulatorResourceAttribute attribute = attElement
450 .getSimulatorResourceAttribute();
452 AttributeValue attValue = attribute.value();
453 AttributeProperty attProperty = attribute.property();
454 if (null != attProperty
455 && attProperty instanceof ArrayProperty) {
456 ArrayProperty prop = attProperty.asArray();
457 if (null != prop && !prop.isVariable()) {
458 SimulatorResourceModel[] model = (SimulatorResourceModel[]) attValue
461 && model.length >= prop.maxItems()) {
466 "Unable to perform the operation.",
467 "Exceeding the maximum number of array elements allowed for this attribute.\n"
468 + "Maximum number of allowed array element(s): "
475 ModelArrayAddItemDialog dialog = new ModelArrayAddItemDialog(
476 Display.getDefault().getActiveShell(),
478 if (Window.OK == dialog.open()) {
479 // Add the new item to the local resource
481 AttributeElement newElement = (AttributeElement) representation
482 .getAttributes().values().toArray()[0];
483 SimulatorResourceAttribute newAttribute = newElement
484 .getSimulatorResourceAttribute();
485 SimulatorResourceModel newModel = (SimulatorResourceModel) newAttribute
488 SimulatorResourceModel[] modelArray = (SimulatorResourceModel[]) attribute
490 SimulatorResourceModel[] newModelArray = new SimulatorResourceModel[modelArray.length + 1];
493 for (i = 0; i < modelArray.length; i++) {
494 newModelArray[i] = modelArray[i];
496 newModelArray[i] = newModel;
498 AttributeValue newValue = new AttributeValue(
501 newAttribute.setValue(newValue);
503 newAttribute.setProperty(attribute.property());
505 attElement.update(newAttribute);
507 boolean updated = resourceManager.attributeValueUpdated(
508 (SingleResource) resourceManager
509 .getCurrentResourceInSelection(),
510 attribute.name(), newValue);
513 attribute.setValue(new AttributeValue(modelArray));
514 attElement.update(newAttribute);
517 .openInformation(Display.getDefault()
520 "Failed to insert a new item in the array.");
522 // Highlight the newly added item.
523 if (attElement.hasChildren()) {
524 AttributeElement addedElement = attElement
525 .getChildren().get("[" + i + "]");
526 attViewer.setSelection(new StructuredSelection(
527 addedElement), true);
536 private void addDeleteMenuToArrayItemsOfOneDimensionalModelAttribute(
537 final Menu menu, final AttributeElement elementToDelete,
538 final AttributeElement parentElement) {
539 // Menu to add items to the array.
540 MenuItem addItems = new MenuItem(menu, SWT.NONE);
541 addItems.setText("Delete Item");
542 addItems.addSelectionListener(new SelectionAdapter() {
544 public void widgetSelected(SelectionEvent e) {
545 // Check whether any existing item can be removed from the array
547 // the array property of the current attribute in
548 // selection(Model Array type attribute).
549 SimulatorResourceAttribute parentSRA = parentElement
550 .getSimulatorResourceAttribute();
551 AttributeValue value = parentSRA.value();
552 AttributeProperty attProperty = parentSRA.property();
553 if (null != attProperty && attProperty instanceof ArrayProperty) {
554 ArrayProperty prop = attProperty.asArray();
556 SimulatorResourceModel[] model = (SimulatorResourceModel[]) value
558 if (null != model && model.length <= prop.minItems()) {
563 "Unable to perform the operation.",
564 "Violating the minimum number of array elements allowed for this attribute.\n"
565 + "Minimum number of allowed array element(s): "
572 MessageBox dialog = new MessageBox(menu.getShell(),
573 SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
574 dialog.setText("Confirm action");
575 dialog.setMessage("Do you want to delete this item from the array?");
576 int retval = dialog.open();
577 if (retval != SWT.OK) {
581 // Removing the element from the attribute value.
582 SimulatorResourceModel[] modelArray = (SimulatorResourceModel[]) value
585 String elementIndexName = elementToDelete
586 .getSimulatorResourceAttribute().name();
587 int elementIndex = Integer.parseInt(elementIndexName.substring(
588 elementIndexName.indexOf('[') + 1,
589 elementIndexName.indexOf(']')));
591 SimulatorResourceModel[] newModelArray = new SimulatorResourceModel[modelArray.length - 1];
592 int sIndex = 0, dIndex = 0;
593 for (SimulatorResourceModel model : modelArray) {
594 if (sIndex != elementIndex)
595 newModelArray[dIndex++] = model;
599 // Setting the new model array in the attribute.
600 AttributeValue newValue = new AttributeValue(newModelArray);
601 parentSRA.setValue(newValue);
603 // Removing the element from the child map.
604 Map<String, AttributeElement> elements = parentElement
606 if (null == elements) {
608 .openError(Display.getDefault().getActiveShell(),
610 "There is an error while removing the array items.");
614 List<AttributeElement> attElementList = new ArrayList<AttributeElement>();
615 attElementList.addAll(elements.values());
616 Collections.sort(attElementList, Utility.attributeComparator);
618 // Renaming the index of the elements.
619 AttributeElement[] attElementArray = attElementList
620 .toArray(new AttributeElement[0]);
621 boolean deleted = false;
623 for (index = 0, newIndex = 0; index < attElementArray.length; index++) {
624 if (index == elementIndex) {
625 elements.remove(elementIndexName);
629 AttributeElement element = attElementArray[index];
630 String curIndexStr = "[" + index + "]";
631 String newIndexStr = "[" + newIndex + "]";
633 element.getSimulatorResourceAttribute().setName(
636 elements.remove(curIndexStr);
637 elements.put(newIndexStr, element);
643 resourceManager.attributeValueUpdated(
644 (SingleResource) resourceManager
645 .getCurrentResourceInSelection(), parentSRA
648 attViewer.refresh(parentElement);
653 private ResourceRepresentation getRepresentationForOneDimensionTopLevelAttribute() {
654 ResourceRepresentation representation;
656 AttributeValue value = null;
657 ModelProperty property = null;
658 SimulatorResourceAttribute attribute;
660 AttributeElement element = getSelectedElement();
664 SimulatorResourceAttribute modelArrayAtt = element
665 .getSimulatorResourceAttribute();
666 if (null == modelArrayAtt) {
670 AttributeValue attValue = modelArrayAtt.value();
671 if (null == attValue) {
675 TypeInfo type = attValue.typeInfo();
677 if (!(type.mType == ValueType.ARRAY
678 && type.mBaseType == ValueType.RESOURCEMODEL && type.mDepth == 1)) {
682 SimulatorResourceModel[] modelValue = (SimulatorResourceModel[]) attValue
684 if (null == modelValue || modelValue.length < 0) {
688 // Clone an instance of model value.
690 value = Utility.cloneAttributeValue(new AttributeValue(
692 } catch (Exception e) {
696 .log(Level.ERROR.ordinal(),
698 "There is an error while creating an instance of the model element.\n"
699 + Utility.getSimulatorErrorString(e, null));
706 // Get the model property of the model value instance.
707 AttributeProperty attProperty = modelArrayAtt.property();
708 if (null != attProperty && attProperty instanceof ArrayProperty) {
709 ArrayProperty prop = attProperty.asArray();
711 AttributeProperty elementProperty = prop.getElementProperty();
712 if (null != elementProperty && elementProperty.isModel()) {
713 property = elementProperty.asModel();
718 attribute = new SimulatorResourceAttribute(modelArrayAtt.name(), value,
721 Map<String, SimulatorResourceAttribute> attributes = new HashMap<String, SimulatorResourceAttribute>();
722 attributes.put(attribute.name(), attribute);
724 representation = new ResourceRepresentation(attributes);
726 return representation;
729 private AttributeElement getSelectedElement() {
730 IStructuredSelection selection = (IStructuredSelection) attViewer
732 if (null == selection) {
736 Object obj = selection.getFirstElement();
741 Tree t = attViewer.getTree();
742 TreeItem item = t.getSelection()[0];
747 if (!(item.getData() instanceof AttributeElement)) {
751 return (AttributeElement) item.getData();
754 private void addManagerListeners() {
755 UiListenerHandler.getInstance().addResourceSelectionChangedUIListener(
756 resourceSelectionChangedListener);
757 UiListenerHandler.getInstance().addDataChangeListener(
759 UiListenerHandler.getInstance().addAutomationUIListener(
760 automationUIListener);
763 private static class AttributeContentProvider implements
764 ITreeContentProvider {
767 public void dispose() {
771 public void inputChanged(Viewer viewer, Object oldAttribute,
772 Object newAttribute) {
776 public Object[] getChildren(Object attribute) {
777 if (attribute instanceof AttributeElement) {
778 List<AttributeElement> attElementList = new ArrayList<AttributeElement>();
779 Map<String, AttributeElement> children = ((AttributeElement) attribute)
781 if (null != children) {
782 attElementList.addAll(children.values());
783 Collections.sort(attElementList,
784 Utility.attributeComparator);
785 return attElementList.toArray();
789 return new Object[0];
793 public Object getParent(Object attribute) {
794 if (attribute instanceof AttributeElement)
795 return ((AttributeElement) attribute).getParent();
800 public boolean hasChildren(Object attribute) {
801 if (attribute instanceof AttributeElement)
802 return ((AttributeElement) attribute).hasChildren();
807 public Object[] getElements(Object resourceModel) {
808 if (resourceModel instanceof ResourceRepresentation) {
809 return ((ResourceRepresentation) resourceModel).getAttributes()
813 return new Object[0];
817 class AttributeLabelProvider implements ITableLabelProvider {
820 public void addListener(ILabelProviderListener arg0) {
824 public void dispose() {
828 public boolean isLabelProperty(Object arg0, String arg1) {
833 public void removeListener(ILabelProviderListener arg0) {
838 public Image getColumnImage(Object element, int col) {
840 if (element instanceof AttributeElement) {
841 // Ignore for non-single resource
842 Resource res = resourceManager
843 .getCurrentResourceInSelection();
844 if (res instanceof SingleResource) {
845 AttributeElement attrElement = (AttributeElement) element;
846 if (attrElement.isAutoUpdateSupport()
847 && !attrElement.isReadOnly()) {
848 if (attrElement.isAutoUpdateInProgress()) {
849 return Activator.getDefault()
851 .get(Constants.CHECKED);
853 return Activator.getDefault()
855 .get(Constants.UNCHECKED);
865 public String getColumnText(Object element, int column) {
866 if (element instanceof AttributeElement) {
867 AttributeElement attrElement = (AttributeElement) element;
869 case 0: // Attribute name column
871 SimulatorResourceAttribute attribute = attrElement
872 .getSimulatorResourceAttribute();
873 return attribute.name();
876 case 1: // Attribute value column
878 SimulatorResourceAttribute attribute = attrElement
879 .getSimulatorResourceAttribute();
881 if (attribute.value().typeInfo().mBaseType != ValueType.RESOURCEMODEL) {
882 String value = Utility
883 .getAttributeValueAsString(attribute
894 // Ignore for non-single resource
895 Resource res = resourceManager
896 .getCurrentResourceInSelection();
897 if (res instanceof SingleResource) {
898 SimulatorResourceAttribute attribute = attrElement
899 .getSimulatorResourceAttribute();
900 TypeInfo type = attribute.value().typeInfo();
901 if (type.mType == AttributeValue.ValueType.ARRAY) {
902 if (type.mBaseType != AttributeValue.ValueType.RESOURCEMODEL) {
905 } else if (type.mType != AttributeValue.ValueType.RESOURCEMODEL) {
906 Object parent = attrElement.getParent();
908 && !(parent instanceof ResourceRepresentation)) {
910 } else if (attrElement.isReadOnly()) {
912 } else if (attrElement.isAutoUpdateSupport()) {
913 if (attrElement.isAutoUpdateInProgress())
914 return Constants.ENABLED;
916 return Constants.DISABLED;
932 public void dispose() {
933 // Unregister the selection listener
934 if (null != resourceSelectionChangedListener) {
935 UiListenerHandler.getInstance()
936 .removeResourceSelectionChangedUIListener(
937 resourceSelectionChangedListener);
940 // Unregister the data model change listener
941 if (null != dataChangeListener) {
942 UiListenerHandler.getInstance().removeDataChangeListener(
946 // Unregister the automation complete listener
947 if (null != automationUIListener) {
948 UiListenerHandler.getInstance().removeAutomationUIListener(
949 automationUIListener);
956 public void setFocus() {