Examples of UIInputReceiverListener


Examples of org.gudy.azureus2.plugins.ui.UIInputReceiverListener

              MessageText.getString(up_menu
                  ? "MyTorrentsView.dialog.setNumber.upload"
                  : "MyTorrentsView.dialog.setNumber.download")
            });

        entryWindow.prompt(new UIInputReceiverListener() {
          public void UIInputReceiverClosed(UIInputReceiver entryWindow) {
            if (!entryWindow.hasSubmittedInput()) {
              return;
            }
            String sReturn = entryWindow.getSubmittedInput();
View Full Code Here

Examples of org.gudy.azureus2.plugins.ui.UIInputReceiverListener

    itemPositionManual.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        SimpleTextEntryWindow entryWindow = new SimpleTextEntryWindow(
            "MyTorrentsView.dialog.setPosition.title",
            "MyTorrentsView.dialog.setPosition.text");
        entryWindow.prompt(new UIInputReceiverListener() {
          public void UIInputReceiverClosed(UIInputReceiver entryWindow) {
            if (!entryWindow.hasSubmittedInput()) {
              return;
            }
            String sReturn = entryWindow.getSubmittedInput();
View Full Code Here

Examples of org.gudy.azureus2.plugins.ui.UIInputReceiverListener

    SimpleTextEntryWindow text_entry = new SimpleTextEntryWindow();
    text_entry.setTitle(msg_key_prefix + "title");
    text_entry.setMessage(msg_key_prefix + "message");
    text_entry.setPreenteredText(suggested, false);
    text_entry.setMultiLine(true);
    text_entry.prompt(new UIInputReceiverListener() {
      public void UIInputReceiverClosed(UIInputReceiver text_entry) {
        if (text_entry.hasSubmittedInput()) {
          String value = text_entry.getSubmittedInput();
          final String value_to_set = (value.length() == 0) ? null : value;
          DMTask task = new DMTask(dms) {
View Full Code Here

Examples of org.gudy.azureus2.plugins.ui.UIInputReceiverListener

  private static void changePriorityManual(final Object[] datasources) {

    SimpleTextEntryWindow entryWindow = new SimpleTextEntryWindow(
        "FilesView.dialog.priority.title",
        "FilesView.dialog.priority.text");
    entryWindow.prompt(new UIInputReceiverListener() {
      public void UIInputReceiverClosed(UIInputReceiver entryWindow) {
        if (!entryWindow.hasSubmittedInput()) {
          return;
        }
        String sReturn = entryWindow.getSubmittedInput();
View Full Code Here

Examples of org.gudy.azureus2.plugins.ui.UIInputReceiverListener

         
          prompter.setLocalisedTitle( lu.getLocalisedMessageText( "azbuddy.ui.menu.send" ));
          prompter.setLocalisedMessage( lu.getLocalisedMessageText( "azbuddy.ui.menu.send_msg" ) );
         
          try{
            prompter.prompt(new UIInputReceiverListener() {
              public void UIInputReceiverClosed(UIInputReceiver prompter) {
                String text = prompter.getSubmittedInput();
               
                if ( text != null ){
                 
                  for (int i=0;i<selection.length;i++){
                   
                    BuddyPluginBuddy buddy = (BuddyPluginBuddy)selection[i].getData();
                   
                    plugin.getAZ2Handler().sendAZ2Message( buddy, text );
                  }
                }
              }
            });
           
          }catch( Throwable e ){
           
          }
        };
      });
   
      // chat
   
    final  MenuItem chat_item = new MenuItem(menu, SWT.PUSH);

    chat_item.setText( lu.getLocalisedMessageText( "azbuddy.ui.menu.chat" ) );

    chat_item.addSelectionListener(
      new SelectionAdapter()
      {
        public void
        widgetSelected(
          SelectionEvent event )
        {
          TableItem[] selection = buddy_table.getSelection();
         
          BuddyPluginBuddy[] buddies = new BuddyPluginBuddy[selection.length];
         
          for (int i=0;i<selection.length;i++){
           
            BuddyPluginBuddy buddy = (BuddyPluginBuddy)selection[i].getData();

            buddies[i] = buddy;
          }
               
          plugin.getAZ2Handler().createChat( buddies );
        };
      });
   
      // ping
   
    final MenuItem ping_item = new MenuItem(menu, SWT.PUSH);

    ping_item.setText( lu.getLocalisedMessageText( "azbuddy.ui.menu.ping" ) );

    ping_item.addSelectionListener(
      new SelectionAdapter()
      {
        public void
        widgetSelected(
          SelectionEvent event )
        {
          TableItem[] selection = buddy_table.getSelection();
         
          for (int i=0;i<selection.length;i++){
           
            BuddyPluginBuddy buddy = (BuddyPluginBuddy)selection[i].getData();
           
            try{         
              buddy.ping();
             
            }catch( Throwable e ){
             
              print( "Ping failed", e );
            }
          }
        };
      });
   
      // ygm
   
    final MenuItem ygm_item = new MenuItem(menu, SWT.PUSH);

    ygm_item.setText( lu.getLocalisedMessageText( "azbuddy.ui.menu.ygm" ) );

    ygm_item.addSelectionListener(
      new SelectionAdapter()
      {
        public void
        widgetSelected(
          SelectionEvent event )
        {
          TableItem[] selection = buddy_table.getSelection();
         
          for (int i=0;i<selection.length;i++){
           
            BuddyPluginBuddy buddy = (BuddyPluginBuddy)selection[i].getData();
           
            try{
              buddy.setMessagePending();
             
            }catch( Throwable e ){
             
              print( "YGM failed", e );
            }
          }
        };
      });
   
   
      // encrypt
   
    final MenuItem encrypt_item = new MenuItem(menu, SWT.PUSH);

    encrypt_item.setText( lu.getLocalisedMessageText( "azbuddy.ui.menu.enc" ) );

    encrypt_item.addSelectionListener(
      new SelectionAdapter()
      {
        public void
        widgetSelected(
          SelectionEvent event )
        {
          TableItem[] selection = buddy_table.getSelection();
         
          String  str = readFromClipboard();
         
          if( str != null ){
           
            StringBuffer sb = new StringBuffer();
           
            for (int i=0;i<selection.length;i++){
             
              BuddyPluginBuddy buddy = (BuddyPluginBuddy)selection[i].getData();
             
              try{
                byte[]  contents = str.getBytes( "UTF-8" );
               
                BuddyPlugin.cryptoResult result = buddy.encrypt( contents );
               
                sb.append( "key: " );
                sb.append( plugin.getPublicKey());
                sb.append( "\r\n" );
               
                sb.append( "hash: " );
                sb.append( Base32.encode( result.getChallenge()));
                sb.append( "\r\n" );

                sb.append( "payload: " );
                sb.append( Base32.encode( result.getPayload()));
                sb.append( "\r\n\r\n" );
               
              }catch( Throwable e ){
               
                print( "YGM failed", e );
              }
            }
           
            writeToClipboard( sb.toString());
          }
        };
      });
   
      // decrypt
   
    final MenuItem decrypt_item = new MenuItem(menu, SWT.PUSH);

    decrypt_item.setText( lu.getLocalisedMessageText( "azbuddy.ui.menu.dec" ) );

    decrypt_item.addSelectionListener(
      new SelectionAdapter()
      {
        public void
        widgetSelected(
          SelectionEvent event )
        {
          String  str = readFromClipboard();
         
          if ( str != null ){
           
            String[]   bits = str.split( "\n" );
           
            StringBuffer sb = new StringBuffer();
 
            BuddyPluginBuddy  buddy   = null;
            byte[]        hash  = null;
           
            for (int i=0;i<bits.length;i++){
             
              String  bit = bits[i].trim();
             
              if ( bit.length() > 0 ){
             
                int  pos = bit.indexOf( ':' );
               
                if ( pos == -1 ){
                 
                  continue;
                }
               
                String  lhs = bit.substring( 0, pos ).trim();
                String  rhs  = bit.substring( pos+1 ).trim();
               
                if ( lhs.equals( "key" )){
                 
                  buddy = plugin.getBuddyFromPublicKey( rhs );
                 
                }else if ( lhs.equals( "hash" )){
                 
                  hash  = Base32.decode( rhs );
                 
                }else if ( lhs.equals( "payload" )){
               
                  byte[]  payload = Base32.decode( rhs );
                 
                  if ( buddy != null ){
                   
                    try{
                      BuddyPlugin.cryptoResult result = buddy.decrypt( payload );
                     
                      byte[] sha1 = new SHA1Simple().calculateHash( result.getChallenge());
                     
                      sb.append( "key: " );
                      sb.append( buddy.getPublicKey());
                      sb.append( "\r\n" );

                      sb.append( "hash_ok: " + Arrays.equals( hash, sha1 ));
                      sb.append( "\r\n" );
                     
                      sb.append( "payload: " );
                      sb.append( new String( result.getPayload(), "UTF-8" ));
                      sb.append( "\r\n\r\n" );
                     
                    }catch( Throwable e ){
                     
                      print( "decrypt failed", e );
                    }
                  }
                }
              }
            }
           
            if ( sb.length() > 0 ){
           
              writeToClipboard( sb.toString());
            }
          }
        };
      });
   
      // sign
   
    final MenuItem sign_item = new MenuItem(menu, SWT.PUSH);

    sign_item.setText( lu.getLocalisedMessageText( "azbuddy.ui.menu.sign" ) );

    sign_item.addSelectionListener(
      new SelectionAdapter()
      {
        public void
        widgetSelected(
          SelectionEvent event )
        {
          String  str = readFromClipboard();
         
          if ( str != null ){
           
            StringBuffer sb = new StringBuffer();
           
            try{
              sb.append( "key: " );
              sb.append( plugin.getPublicKey());
              sb.append( "\r\n" );

              byte[] payload = str.getBytes( "UTF-8" );
             
              sb.append( "data: " );
              sb.append( Base32.encode( payload ));
              sb.append( "\r\n" );

              byte[]  sig = plugin.sign( payload );

              sb.append( "sig: " );
              sb.append( Base32.encode( sig ));
              sb.append( "\r\n" );

            }catch( Throwable e ){
             
              print( "sign failed", e );
            }
           
            if ( sb.length() > 0 ){
           
              writeToClipboard( sb.toString());
            }
          }
        };
      });
   
      // verify
   
    final MenuItem verify_item = new MenuItem(menu, SWT.PUSH);

    verify_item.setText( lu.getLocalisedMessageText( "azbuddy.ui.menu.verify" ) );

    verify_item.addSelectionListener(
      new SelectionAdapter()
      {
        public void
        widgetSelected(
          SelectionEvent event )
        {
          String  str = readFromClipboard();
         
          if ( str != null ){
           
            String[]   bits = str.split( "\n" );
           
            StringBuffer sb = new StringBuffer();
 
            String        pk     = null;
            byte[]        data  = null;
           
            for (int i=0;i<bits.length;i++){
             
              String  bit = bits[i].trim();
             
              if ( bit.length() > 0 ){
             
                int  pos = bit.indexOf( ':' );
               
                if ( pos == -1 ){
                 
                  continue;
                }
               
                String  lhs = bit.substring( 0, pos ).trim();
                String  rhs  = bit.substring( pos+1 ).trim();
               
                if ( lhs.equals( "key" )){
                 
                  pk = rhs;
                 
                }else if ( lhs.equals( "data" )){
                 
                  data  = Base32.decode( rhs );
                 
                }else if ( lhs.equals( "sig" )){
               
                  byte[]  sig = Base32.decode( rhs );
                 
                  if ( pk != null && data != null ){
                   
                    try{
                     
                      sb.append( "key: " );
                      sb.append( pk );
                      sb.append( "\r\n" );

                      boolean ok = plugin.verify( pk, data, sig );
                     
                      sb.append( "sig_ok: " + ok  );
                      sb.append( "\r\n" );
                     
                      sb.append( "data: " );
                      sb.append( new String( data, "UTF-8" ));
                      sb.append( "\r\n\r\n" );
                     
                    }catch( Throwable e ){
                     
                      print( "decrypt failed", e );
                    }
                  }
                }
              }
            }
           
            if ( sb.length() > 0 ){
           
              writeToClipboard( sb.toString());
            }
          }
        };
      });
       
   
      // cats
   
    Menu cat_menu = new Menu(menu.getShell(), SWT.DROP_DOWN);
    MenuItem cat_item = new MenuItem(menu, SWT.CASCADE);
    Messages.setLanguageText(cat_item, "azbuddy.ui.menu.cat" );
    cat_item.setMenu(cat_menu);

      // cats - share
   
    final MenuItem cat_share_item = new MenuItem(cat_menu, SWT.PUSH);

    cat_share_item.setText( lu.getLocalisedMessageText( "azbuddy.ui.menu.cat.share" ) );

    cat_share_item.addSelectionListener(
      new SelectionAdapter()
      {
        public void
        widgetSelected(
          SelectionEvent event )
        {
          UIInputReceiver prompter = ui_instance.getInputReceiver();
         
          prompter.setLocalisedTitle( lu.getLocalisedMessageText( "azbuddy.ui.menu.cat.set" ));
          prompter.setLocalisedMessage( lu.getLocalisedMessageText( "azbuddy.ui.menu.cat.set_msg" ));
         
          prompter.prompt(new UIInputReceiverListener() {
            public void UIInputReceiverClosed(UIInputReceiver prompter) {
              String cats = prompter.getSubmittedInput();
             
              if ( cats != null ){
               
View Full Code Here

Examples of org.gudy.azureus2.plugins.ui.UIInputReceiverListener

                  }
                  entry.setPreenteredText( req_str, true );
                  entry.maintainWhitespace(false);
                  entry.allowEmptyInput( false );
                  entry.setTitle("general.enter.cookies");
                  entry.prompt(new UIInputReceiverListener() {
                    public void UIInputReceiverClosed(UIInputReceiver entry) {
                      if (!entry.hasSubmittedInput()){
                       
                        return;
                      }

                      try {
                        String input = entry.getSubmittedInput().trim();
                       
                        if ( input.length() > 0 ){
                         
                          we.setCookies( input );
                         
                          subs.getManager().getScheduler().downloadAsync(subs, true);
                        }
                      }catch( Throwable e ){
                       
                        Debug.printStackTrace(e);
                      }
                    }
                  });
                }
              }catch( Throwable e ){
               
                Debug.printStackTrace(e);
              }
            }
          });
        }
      }
    }catch( Throwable e ){
     
      Debug.printStackTrace(e);
    }
   
      // sep
   
    menuManager.addMenuItem("sidebar." + key,"s1").setStyle( MenuItem.STYLE_SEPARATOR );

      // category
   
    menuItem = menuManager.addMenuItem("sidebar." + key, "MyTorrentsView.menu.setCategory");
    menuItem.setStyle( MenuItem.STYLE_MENU );
   
    menuItem.addFillListener(
        new MenuItemFillListener()
        {
          public void
          menuWillBeShown(
            MenuItem   menu,
            Object     data )
          {   
            addCategorySubMenu( menuManager, menu );
          }
        });
   
   
    if ( subs.isUpdateable()){
     
      menuItem = menuManager.addMenuItem("sidebar." + key,"MyTorrentsView.menu.rename");
      menuItem.addListener(new SubsMenuItemListener() {
        public void selected(MdiEntry info, final Subscription subs) {
          UISWTInputReceiver entry = new SimpleTextEntryWindow();
          entry.setPreenteredText(subs.getName(), false );
          entry.maintainWhitespace(false);
          entry.allowEmptyInput( false );
          entry.setLocalisedTitle(MessageText.getString("label.rename",
              new String[] {
                subs.getName()
              }));
          entry.prompt(new UIInputReceiverListener() {
            public void UIInputReceiverClosed(UIInputReceiver entry) {
              if (!entry.hasSubmittedInput()){
               
                return;
              }
View Full Code Here

Examples of org.gudy.azureus2.plugins.ui.UIInputReceiverListener

      menuItem = menuManager.addMenuItem(parent, "URL..");
      menuItem.addListener(new MenuItemListener() {
        public void selected(MenuItem menu, Object target) {
          SimpleTextEntryWindow entryWindow = new SimpleTextEntryWindow("", "!URL!");
          entryWindow.prompt(new UIInputReceiverListener() {
            public void UIInputReceiverClosed(UIInputReceiver entryWindow) {
              if (entryWindow.hasSubmittedInput()) {
                browserSkinObject.setURL(entryWindow.getSubmittedInput());
              }
            }
View Full Code Here

Examples of org.gudy.azureus2.plugins.ui.UIInputReceiverListener

            String msg_key_prefix = "MyTorrentsView.menu.rename.displayed.enter.";

            SimpleTextEntryWindow entryWindow = new SimpleTextEntryWindow(
                msg_key_prefix + "title", msg_key_prefix + "message");
            entryWindow.setPreenteredText(dm.getDisplayName(), false);
            entryWindow.prompt(new UIInputReceiverListener() {
              public void UIInputReceiverClosed(UIInputReceiver entryWindow) {
                if (!entryWindow.hasSubmittedInput()) {
                  return;
                }
                String value = entryWindow.getSubmittedInput();
View Full Code Here

Examples of org.gudy.azureus2.plugins.ui.UIInputReceiverListener

    MainWindow.doSearch(searchText);
  }
 
  public void promptForSearch() {
    SimpleTextEntryWindow entryWindow = new SimpleTextEntryWindow("Button.search", "search.dialog.text");
    entryWindow.prompt(new UIInputReceiverListener() {
      public void UIInputReceiverClosed(UIInputReceiver receiver) {
        if (receiver.hasSubmittedInput()) {
          doSearch(receiver.getSubmittedInput());
        }
      }
View Full Code Here

Examples of org.gudy.azureus2.plugins.ui.UIInputReceiverListener

            String msg_key_prefix = "MyTorrentsView.menu.rename.displayed.enter.";

            SimpleTextEntryWindow entryWindow = new SimpleTextEntryWindow(
                msg_key_prefix + "title", msg_key_prefix + "message");
            entryWindow.setPreenteredText(dm.getDisplayName(), false);
            entryWindow.prompt(new UIInputReceiverListener() {
              public void UIInputReceiverClosed(UIInputReceiver entryWindow) {
                if (!entryWindow.hasSubmittedInput()) {
                  return;
                }
                String value = entryWindow.getSubmittedInput();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.