public static Connection findConnection ( final MasterServer master, final String name, final Class<DataAccessConnection> clazz ) { for ( final Connection c : master.getConnections () ) { if ( !clazz.isAssignableFrom ( c.getClass () ) ) { continue; } if ( c.getName ().equals ( name ) ) { return c; } } throw new IllegalStateException ( String.format ( "Unable to find a connection named '%s' of ype %s on %s", name, clazz.getName (), master ) ); }
public static Connection findConnection ( final MasterServer master, final String name, final Class<DataAccessConnection> clazz ) { for ( final Connection c : master.getConnections () ) { if ( !clazz.isAssignableFrom ( c.getClass () ) ) { continue; } if ( c.getName ().equals ( name ) ) { return c; } } throw new IllegalStateException ( String.format ( "Unable to find a connection named '%s' of ype %s on %s", name, clazz.getName (), master ) ); }
@Override public void setMaster ( final SourceItem item, final MasterContext master ) { final Connection connection = this.connectionProvider.getConnection ( master.getImplementation () ); final String tag = connection.getTypeTag (); final String id = connection.getName (); item.setSourceName ( String.format ( this.format, tag, id ) ); } }
/** * This returns the label styled text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object getStyledText ( Object object ) { String label = ( (Connection)object ).getName (); StyledString styledLabel = new StyledString (); if ( label == null || label.length () == 0 ) { styledLabel.append ( getString ( "_UI_Connection_type" ), StyledString.Style.QUALIFIER_STYLER ); //$NON-NLS-1$ } else { styledLabel.append ( getString ( "_UI_Connection_type" ), StyledString.Style.QUALIFIER_STYLER ).append ( " " + label ); //$NON-NLS-1$ //$NON-NLS-2$ } return styledLabel; }