private StyledString getConnectionString(final ConnectionHolder holder) { final ConnectionService service = holder.getConnectionService(); final ConnectionDescriptor desc = holder.getConnectionInformation(); final StyledString str = new StyledString(makeLabel(desc.getConnectionInformation())); if (service != null) { str.append(" [", StyledString.DECORATIONS_STYLER); // $NON-NLS-1$ final Connection connection = service.getConnection(); if (connection != null) { str.append( String.format("%s", holder.getConnectionState()), StyledString.DECORATIONS_STYLER); // $NON-NLS-1$ } str.append("]", StyledString.DECORATIONS_STYLER); // $NON-NLS-1$ } if (desc.getServiceId() != null) { str.append( String.format(" (%s)", desc.getServiceId()), StyledString.QUALIFIER_STYLER); // $NON-NLS-1$ } return str; }
@Override protected void removeListenerFrom(final Object next) { if (next instanceof ConnectionHolder) { ((ConnectionHolder) next).removePropertyChangeListener(this); } super.removeListenerFrom(next); }
@Override protected void addListenerTo(final Object next) { super.addListenerTo(next); if (next instanceof ConnectionHolder) { ((ConnectionHolder) next).addPropertyChangeListener(this); } }