@Override public void dockStationRegistered( final DockController controller, DockStation station ){ controller.getHierarchyLock().onRelease( new Runnable(){ public void run(){ testAll( controller ); } }); } }
@Override public StationChildHandle convert( ConvertedPlaceholderListItem item ){ final int id = item.getInt( "id" ); final Dockable dockable = children.get( id ); if( dockable != null ) { DockUtilities.ensureTreeValidity( ToolbarDockStation.this, dockable ); token = DockHierarchyLock.acquireLinking( ToolbarDockStation.this, dockable ); listeners.fireDockableAdding( dockable ); return new StationChildHandle( ToolbarDockStation.this, displayers, dockable, title ); } return null; }
/** * The same as calling {@link #acquire(DockStation)} with the {@link DockHierarchyLock} of * the {@link DockController} of <code>station</code>. Returns a fake {@link Token} if <code>station</code> has * no {@link DockController}. * @param station the station to lock * @return the acquired token to release the lock * @throws IllegalStateException if a lock has already been acquired */ public static Token acquiring( DockStation station ){ DockController controller = station.getController(); if( controller == null ){ return new Token( null, station ); } else{ return controller.getHierarchyLock().acquire( station ); } }
/** * Acquires a lock describing the entire contents of <code>station</code>. This * method is intended in situations where the layout of <code>station</code> gets * modified and this modification must not be interrupted. * @param station the station for which a lock is requested * @return the acquired token to release the lock * @throws IllegalStateException if the lock is already acquired */ public synchronized Token acquire( DockStation station ){ if( isConcurrent() ){ return new Token( this, station ); } if( token != null ){ throwException( new IllegalStateException( defaultMessage() ) ); } token = new Token( this, station ); return token; }
/** * Allows <code>station</code> to become the new parent of <code>dockable</code>. * @param station the station which wants to be the new parent of <code>dockable</code> * @param dockable a dockable with no parent * @return the acquired token to release the lock * @throws IllegalStateException if <code>dockable</code> has a parent or <code>station</code> * thinks that <code>dockable</code> is one of its children */ public synchronized Token acquireLink( DockStation station, Dockable dockable ){ if( station == null ){ throw new IllegalArgumentException( "station is null" ); } if( dockable == null ){ throw new IllegalArgumentException( "dockable is null" ); } ensureUnlinked( station, dockable ); if( isConcurrent() ){ return new Token( this, station, dockable, true ); } if( token != null ){ throwException( new IllegalStateException( defaultMessage() ) ); } token = new Token( this, station, dockable, true ); return token; }
/** * Allows <code>station</code> to remove itself as parent from <code>dockable</code>. * @param station the current parent of <code>dockable</code> * @param dockable a dockable with <code>station</code> as parent * @return the acquired token to release the lock * @throws IllegalStateException if <code>dockable</code> is not a child of * <code>station</code> */ public synchronized Token acquireUnlink( DockStation station, Dockable dockable ){ if( station == null ){ throw new IllegalArgumentException( "station is null" ); } if( dockable == null ){ throw new IllegalArgumentException( "dockable is null" ); } ensureLinked( station, dockable ); if( isConcurrent() ){ return new Token( this, station, dockable, false ); } if( token != null ){ throwException( new IllegalStateException( defaultMessage() ) ); } token = new Token( this, station, dockable, false ); return token; }
DockHierarchyLock.Token token = DockHierarchyLock.acquireUnlinking( this, current ); try{ listeners.fireDockableRemoving( current ); token = DockHierarchyLock.acquireLinking( this, other ); try{ listeners.fireDockableAdding( other );
token = DockHierarchyLock.acquireUnlinking( this, dockable );
/** * The same as calling {@link #acquireLink(DockStation, Dockable)} with the {@link DockHierarchyLock} of * the {@link DockController} of <code>station</code>. Returns a fake {@link Token} if <code>station</code> has * no {@link DockController}. * @param station the station which wants to be the new parent of <code>dockable</code> * @param dockable a dockable with no parent * @return the acquired token to release the lock * @throws IllegalStateException if <code>dockable</code> has a parent or <code>station</code> * thinks that <code>dockable</code> is one of its children */ public static Token acquireLinking( DockStation station, Dockable dockable ){ DockController controller = station.getController(); if( controller == null ){ return new Token( null, station, dockable, true ); } else{ return controller.getHierarchyLock().acquireLink( station, dockable ); } }
/** * The same as calling {@link #acquireUnlink(DockStation, Dockable)} with the {@link DockHierarchyLock} of * the {@link DockController} of <code>station</code>. Returns a fake {@link Token} if <code>station</code> has * no {@link DockController}. * @param station the current parent of <code>dockable</code> * @param dockable a dockable with <code>station</code> as parent * @return the acquired token to release the lock * @throws IllegalStateException if <code>dockable</code> is not a child of * <code>station</code> */ public static Token acquireUnlinking( DockStation station, Dockable dockable ){ DockController controller = station.getController(); if( controller == null ){ return new Token( null, station, dockable, true ); } else{ return controller.getHierarchyLock().acquireUnlink( station, dockable ); } }
leaf.delete(true); drop( DockHierarchyLock.acquireFake(), putInfo, item );
final PlaceholderMap map = item.getPlaceholderMap(); DockHierarchyLock.Token token = DockHierarchyLock.acquireUnlinking( this, lower ); try{ listeners.fireDockableRemoving( lower ); token = DockHierarchyLock.acquireLinking( this, valid ); try{ listeners.fireDockableAdding( valid );
/** * Allows <code>station</code> to become the new parent of <code>dockable</code>. * @param station the station which wants to be the new parent of <code>dockable</code> * @param dockable a dockable with no parent * @return the acquired token to release the lock * @throws IllegalStateException if <code>dockable</code> has a parent or <code>station</code> * thinks that <code>dockable</code> is one of its children */ public synchronized Token acquireLink( DockStation station, Dockable dockable ){ if( station == null ){ throw new IllegalArgumentException( "station is null" ); } if( dockable == null ){ throw new IllegalArgumentException( "dockable is null" ); } ensureUnlinked( station, dockable ); if( isConcurrent() ){ return new Token( this, station, dockable, true ); } if( token != null ){ throwException( new IllegalStateException( defaultMessage() ) ); } token = new Token( this, station, dockable, true ); return token; }
/** * Allows <code>station</code> to remove itself as parent from <code>dockable</code>. * @param station the current parent of <code>dockable</code> * @param dockable a dockable with <code>station</code> as parent * @return the acquired token to release the lock * @throws IllegalStateException if <code>dockable</code> is not a child of * <code>station</code> */ public synchronized Token acquireUnlink( DockStation station, Dockable dockable ){ if( station == null ){ throw new IllegalArgumentException( "station is null" ); } if( dockable == null ){ throw new IllegalArgumentException( "dockable is null" ); } ensureLinked( station, dockable ); if( isConcurrent() ){ return new Token( this, station, dockable, false ); } if( token != null ){ throwException( new IllegalStateException( defaultMessage() ) ); } token = new Token( this, station, dockable, false ); return token; }
token = DockHierarchyLock.acquireUnlinking( this, dockable );
/** * Acquires a lock describing the entire contents of <code>station</code>. This * method is intended in situations where the layout of <code>station</code> gets * modified and this modification must not be interrupted. * @param station the station for which a lock is requested * @return the acquired token to release the lock * @throws IllegalStateException if the lock is already acquired */ public synchronized Token acquire( DockStation station ){ if( isConcurrent() ){ return new Token( this, station ); } if( token != null ){ throwException( new IllegalStateException( defaultMessage() ) ); } token = new Token( this, station ); return token; }
/** * The same as calling {@link #acquireLink(DockStation, Dockable)} with the {@link DockHierarchyLock} of * the {@link DockController} of <code>station</code>. Returns a fake {@link Token} if <code>station</code> has * no {@link DockController}. * @param station the station which wants to be the new parent of <code>dockable</code> * @param dockable a dockable with no parent * @return the acquired token to release the lock * @throws IllegalStateException if <code>dockable</code> has a parent or <code>station</code> * thinks that <code>dockable</code> is one of its children */ public static Token acquireLinking( DockStation station, Dockable dockable ){ DockController controller = station.getController(); if( controller == null ){ return new Token( null, station, dockable, true ); } else{ return controller.getHierarchyLock().acquireLink( station, dockable ); } }
/** * The same as calling {@link #acquireUnlink(DockStation, Dockable)} with the {@link DockHierarchyLock} of * the {@link DockController} of <code>station</code>. Returns a fake {@link Token} if <code>station</code> has * no {@link DockController}. * @param station the current parent of <code>dockable</code> * @param dockable a dockable with <code>station</code> as parent * @return the acquired token to release the lock * @throws IllegalStateException if <code>dockable</code> is not a child of * <code>station</code> */ public static Token acquireUnlinking( DockStation station, Dockable dockable ){ DockController controller = station.getController(); if( controller == null ){ return new Token( null, station, dockable, true ); } else{ return controller.getHierarchyLock().acquireUnlink( station, dockable ); } }
leaf.delete(true); drop( DockHierarchyLock.acquireFake(), putInfo, item );
DockHierarchyLock.Token token = DockHierarchyLock.acquireUnlinking( this, oldDockable ); try{ dockStationListeners.fireDockableRemoving( oldDockable ); DockHierarchyLock.Token token = DockHierarchyLock.acquireLinking( this, combination ); try{ dockStationListeners.fireDockableAdding(combination);