/** * Returns the acquisition result data. * * @return the acquisition data, never <code>null</code>. */ protected final AcquisitionResult getData() { return this.context.getData(); }
/** * {@inheritDoc} */ @Override public int getEnabledChannels() { return this.toolContext.getEnabledChannels(); }
/** * {@inheritDoc} */ @Override public int getEndSampleIndex() { return this.toolContext.getEndSampleIndex(); }
final AcquisitionResult data = this.context.getData(); this.progressListener.setProgress( 0 ); this.progressListener.setProgress( getPercentage( i, startSampleIdx, endSampleIdx ) );
/** * {@inheritDoc} */ @Override public int getStartSampleIndex() { return this.toolContext.getStartSampleIndex(); }
/** * @param aProgress */ protected final void setProgress( final int aProgress ) { if ( this.progressListener != null ) { this.progressListener.setProgress( aProgress ); } } }
/** * Adds a given tool to this controller. * <p> * This method is called by the dependency manager. * </p> * * @param aTool * the tool to add, cannot be <code>null</code>. */ public void addTool( final Tool<?> aTool ) { if ( this.tools.putIfAbsent( aTool.getName(), aTool ) == null ) { this.actionManager.add( new RunToolAction( this, aTool.getName(), aTool.getCategory() ) ); } }
/** * {@inheritDoc} */ @Override public int getChannels() { return this.toolContext.getChannels(); }
/** * Returns the action identifier for the given tool. * * @param aTool * a tool instance, cannot be <code>null</code>. * @return a tool action identifier, never <code>null</code>. */ public static final String getID( final Tool<?> aTool ) { if ( aTool == null ) { throw new IllegalArgumentException( "Tool cannot be null!" ); } return getID( aTool.getName() ); }
/** * {@inheritDoc} */ @Override public Cursor getCursor( final int aSelectedIndex ) { return this.toolContext.getCursor( aSelectedIndex ); }
/** * {@inheritDoc} */ @Override public int getLength() { return this.toolContext.getLength(); }
/** * Runs the tool denoted by the given name. * * @param aToolName * the name of the tool to run, cannot be <code>null</code>; * @param aParent * the parent window to use, can be <code>null</code>. */ public void invokeTool( final String aToolName, final Window aParent ) { if ( LOG.isLoggable( Level.INFO ) ) { LOG.log( Level.INFO, "Running tool: \"{0}\" ...", aToolName ); } final Tool<?> tool = getTool( aToolName ); if ( tool == null ) { JOptionPane.showMessageDialog( aParent, "No such tool found: " + aToolName, "Error ...", JOptionPane.ERROR_MESSAGE ); } else { final ToolContext context = createToolContext(); tool.invoke( aParent, context ); } updateActionsOnEDT(); }
/** * {@inheritDoc} */ @Override public final boolean invokeTool() throws IllegalStateException { if ( this.toolFutureTask != null ) { throw new IllegalStateException( "Tool is already running!" ); } boolean settingsValid = validateToolSettings(); if ( settingsValid ) { this.toolTask = this.tool.createToolTask( this.context, this.toolProgressListener, this.annotationListener ); prepareToolTask( this.toolTask ); this.toolFutureTask = this.taskExecutionService.execute( this.toolTask ); } return settingsValid; }
/** * {@inheritDoc} */ @Override public AcquisitionResult getData() { return this.toolContext.getData(); }
/** * {@inheritDoc} */ @Override protected boolean validateToolSettings() { boolean result = super.validateToolSettings(); if ( result && ( getContext().getChannels() != Ols.MAX_CHANNELS ) ) { JErrorDialog.showDialog( getOwner(), "Cannot start analysis!", "Not enough channels!", "For the Asm45 decoder, you need to have 32 channels enabled." ); result = false; } return result; }
/** * Creates a new {@link BaseToolDialog} instance that is document modal. * * @param aOwner * the owning window of this dialog; * @param aTitle * the title of this dialog; * @param aContext * the tool context to use in this dialog. */ protected BaseToolDialog( final Window aOwner, final ToolContext aContext, final BundleContext aBundleContext, final Tool<RESULT_TYPE> aTool ) { super( aTool.getName() ); this.context = aContext; this.bundleContext = aBundleContext; this.tool = aTool; setModalExclusionType( ModalExclusionType.NO_EXCLUDE ); this.taskExecutionService = new TaskExecutionServiceTracker( aBundleContext ); this.annotationListener = new AnnotationListenerServiceTracker( aBundleContext ); this.toolProgressListener = new ToolProgressListenerServiceTracker( aBundleContext ); }
/** * Creates a new {@link AsyncSerialDataDecoder} instance. * * @param aConfiguration * the configuration to use, cannot be <code>null</code>; * @param aContext * the tool context to use, cannot be <code>null</code>. */ public AsyncSerialDataDecoder( final SerialConfiguration aConfiguration, final ToolContext aContext ) { this.configuration = aConfiguration; this.context = aContext; this.dataSet = aContext.getData(); }
final AcquisitionResult data = this.context.getData(); final int[] values = data.getValues();
/** * @param aDataSet * @param aChannelIndex * @param aByteValue * @param aType * @param aTimestamp */ private void reportBusError( final OneWireDataSet aDataSet, final long aStartTimestamp ) { final AcquisitionResult data = this.context.getData(); final int startSampleIdx = Math.max( data.getSampleIndex( aStartTimestamp ), 0 ); aDataSet.reportBusError( this.owLineIndex, startSampleIdx ); this.annotationListener.onAnnotation( new SampleDataAnnotation( this.owLineIndex, aStartTimestamp, aStartTimestamp, OneWireDataSet.OW_BUS_ERROR ) ); }
/** * @param aDataSet * @param aChannelIndex * @param aByteValue * @param aType * @param aTimestamp */ private void reportReset( final OneWireDataSet aDataSet, final long aStartTimestamp, final long aEndTimestamp, final boolean aSlaveIsPresent ) { final AcquisitionResult data = this.context.getData(); final int startSampleIdx = Math.max( data.getSampleIndex( aStartTimestamp ), 0 ); final int endSampleIdx = Math.min( data.getSampleIndex( aEndTimestamp ) - 1, data.getTimestamps().length - 1 ); aDataSet.reportReset( this.owLineIndex, startSampleIdx, endSampleIdx, aSlaveIsPresent ); final String annotation = String.format( "Master reset, slave %s present", aSlaveIsPresent ? "is" : "is NOT" ); this.annotationListener.onAnnotation( new SampleDataAnnotation( this.owLineIndex, aStartTimestamp, aEndTimestamp, annotation ) ); } }