Updates pull request from Roman Tsypuk to convert the build system from

ant to gradle.  Removes linux and windows application launch scripts and
produces an executable jar with all resources included.
This commit is contained in:
Denny
2017-12-17 07:28:03 -05:00
parent a1535c4157
commit 9316599dec
981 changed files with 8368 additions and 9049 deletions

View File

@@ -0,0 +1,114 @@
package io.github.dsheirer.controller.channel;
import io.github.dsheirer.channel.state.DecoderState;
import io.github.dsheirer.module.ProcessingChain;
import io.github.dsheirer.module.decode.event.ActivitySummaryFrame;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class ChannelUtils
{
/**
* Creates a context menu for the channel argument
*/
public static JMenu getContextMenu( final ChannelModel channelModel,
final ChannelProcessingManager channelProcessingManager,
final Channel channel,
final Component anchor )
{
if( channel != null )
{
JMenu menu = new JMenu( "Channel: " + channel.getName() );
if( channel.getEnabled() )
{
JMenuItem disable = new JMenuItem( "Disable" );
disable.addActionListener( new ActionListener()
{
@Override
public void actionPerformed( ActionEvent e )
{
channelModel.broadcast(
new ChannelEvent( channel, ChannelEvent.Event.REQUEST_DISABLE ) );
}
} );
menu.add( disable );
menu.add( new JSeparator() );
JMenuItem actySummaryItem =
new JMenuItem( "Activity Summary" );
actySummaryItem.addActionListener( new ActionListener()
{
@Override
public void actionPerformed( ActionEvent e )
{
StringBuilder sb = new StringBuilder();
ProcessingChain chain = channelProcessingManager.getProcessingChain( channel );
if( chain != null )
{
for( DecoderState decoderState: chain.getDecoderStates() )
{
sb.append( decoderState.getActivitySummary() );
}
}
new ActivitySummaryFrame( sb.toString(), anchor );
}
} );
menu.add( actySummaryItem );
}
else
{
JMenuItem enable = new JMenuItem( "Enable" );
enable.addActionListener( new ActionListener()
{
@Override
public void actionPerformed( ActionEvent e )
{
channelModel.broadcast(
new ChannelEvent( channel, ChannelEvent.Event.REQUEST_ENABLE ) );
}
} );
menu.add( enable );
}
menu.add( new JSeparator() );
JMenuItem deleteItem = new JMenuItem( "Delete" );
deleteItem.addActionListener( new ActionListener()
{
@Override
public void actionPerformed( ActionEvent e )
{
int response = JOptionPane.showConfirmDialog( anchor,
"Do you want to delete channel " + channel.getName() + "?",
"Are you sure?", JOptionPane.YES_NO_CANCEL_OPTION );
if( response == JOptionPane.YES_OPTION )
{
channelModel.broadcast(
new ChannelEvent( channel, ChannelEvent.Event.REQUEST_DELETE ) );
}
}
} );
menu.add( deleteItem );
return menu;
}
return null;
}
}