public void initialisation() { if (eventAdminName != null) { eventAdmin = Finder.getInstance().find(eventAdminName); } property.addPropertyChangeListener(this); if (eventAdmin != null) { eventAdmin.addIObserver(this); } if (property.getPropertyName().equals(LocalProperties.GDA_DATAWRITER_DIR)) { String currentPath = PathConstructor.createFromProperty(LocalProperties.GDA_DATAWRITER_DIR); viewer.setSelection(new StructuredSelection(currentPath)); } else { viewer.setSelection(new StructuredSelection(LocalProperties.get(property.getPropertyName()))); } currentSelection = (IStructuredSelection) (viewer.getSelection()); }
@Override public void dispose() { property.removePropertyChangeListener(this); if (eventAdmin != null) { eventAdmin.deleteIObserver(this); } super.dispose(); }
/** handling distributed event - i.e property change on the server side. */ @Override public void update(Object source, Object arg) { // implement property changed by a server component if (source instanceof String && ((String) source).equals(property.getPropertyName())) { logger.debug("Update property {} value to {} by the server", (String) source, (String) arg); viewer.setSelection(new StructuredSelection((String) arg)); currentSelection = (IStructuredSelection) viewer.getSelection(); } }
@Override public void propertyChange(PropertyChangeEvent evt) { // implement property changed by other client component if (evt.getSource() != this && evt != null) { if (evt.getPropertyName().equals(property.getPropertyName())) { for (String item : list) { if (item.equals(evt.getNewValue().toString())) { logger.debug( "Update property {} value to {} by component {}", evt.getPropertyName(), evt.getNewValue(), evt.getSource()); viewer.setSelection(new StructuredSelection(evt.getNewValue())); currentSelection = (IStructuredSelection) viewer.getSelection(); } } } } }