Package org.gudy.azureus2.plugins.ui.config

Examples of org.gudy.azureus2.plugins.ui.config.BooleanParameter


        cfg.addBooleanParameter2(_PluginActive, _BaseConfigName + "." + _PluginActive, false);
        cfg.addIntParameter2(_IntervalSearch, _BaseConfigName + "." + _IntervalSearch, _IntervalSearchDefault);
        cfg.addStringParameter2(_ExcludeFilesRegex, _BaseConfigName + "." + _ExcludeFilesRegex, "");

        BooleanParameter useLanguageOnSubTitle =
                cfg.addBooleanParameter2(_UseLanguageOnSubtitle, _BaseConfigName + "." + _UseLanguageOnSubtitle, false);
        String[] subTitleValues = SubTitleLanguage.getValues();
        String[] subTitleLabels = SubTitleLanguage.getDescriptions();
        StringListParameter languageOnSubtitle =
                cfg.addStringListParameter2(_LanguageOnSubtitle, _BaseConfigName + "." + _LanguageOnSubtitle, subTitleValues, subTitleLabels, "");
        useLanguageOnSubTitle.addEnabledOnSelection(languageOnSubtitle);

        // Configuração dos Handlers
        final List<IDownloadHandler> handlersList = SubTitleManager.getExistingHandlers();
        for (IDownloadHandler handler : handlersList) {
            try {
                DownloadHandlerVO handlerVO = (DownloadHandlerVO) handler.getHandlerVOType().newInstance();
                Method[] metodos = handlerVO.getClass().getMethods();

                int paramCount = 2;
                for (Method metodo : metodos)
                    if (metodo.getName().startsWith("set"))
                        paramCount++;

                String nomeHandle = handler.getClass().getSimpleName();
                addLocalisedMessage(localeUtil, nomeHandle, handler.getDescription());
                addLocalisedMessage(localeUtil, handler.getSiteUrl(), handler.getSiteUrl());

                Parameter[] parametros = new Parameter[paramCount];
                parametros[0] = cfg.addHyperlinkParameter2(handler.getSiteUrl(), handler.getSiteUrl());
                parametros[1] = cfg.addBooleanParameter2(nomeHandle, _BaseConfigName + ".Active", false);

                paramCount = 2;
                for (Method metodo : metodos) {
                    if (metodo.getName().startsWith("set")) {
                        Class<?> typeParam = metodo.getParameterTypes()[0];
                        String nomeProp = metodo.getName().substring(3);
                        String nomePropPlugin = handler.getClass().getSimpleName() + "." + nomeProp;
                        String resourceMessage = _BaseConfigName + "." + handlerVO.getClass().getSimpleName() + "." + nomeProp;

                        if ((handler.getLogonType() == IDownloadHandler.LogonType.None) &
                                ((metodo.getName().equals("setUserName")) || (metodo.getName().equals("setPassword"))))
                            continue;

                        if (typeParam == SubTitleLanguage.class) {
                            // Na lista de idiomas coloco só os que o Handler suporta
                            SubTitleLanguage[] enumValores = handler.getSupportedLanguages();
                            String[] valores = SubTitleLanguage.getValues(enumValores);
                            String[] labels = SubTitleLanguage.getDescriptions(enumValores);
                            parametros[paramCount] = cfg.addStringListParameter2(nomePropPlugin, resourceMessage, valores, labels, "");
                        } else if (typeParam == FileUtils.SubTitleExtensions.class) {
                            // Na lista de extensões coloca só as que o Handler suporta
                            FileUtils.SubTitleExtensions[] enumValores = handler.getSupportedSubTitleExtensions();
                            if (enumValores.length > 0) {
                                String[] valores = new String[enumValores.length];
                                for (int j = 0; j < enumValores.length; j++)
                                    valores[j] = enumValores[j].toString();
                                parametros[paramCount] = cfg.addStringListParameter2(nomePropPlugin, resourceMessage, valores, "");
                            }
                        } else if (typeParam == int.class) {
                            parametros[paramCount] = cfg.addIntParameter2(nomePropPlugin, resourceMessage, 0);
                        } else if (typeParam == String.class) {
                            if (nomeProp.equalsIgnoreCase("Password"))
                                parametros[paramCount] = cfg.addPasswordParameter2(nomePropPlugin, resourceMessage, PasswordParameter.ET_PLAIN, new byte[0]);
                            else
                                parametros[paramCount] = cfg.addStringParameter2(nomePropPlugin, resourceMessage, "");
                        } else if (typeParam.isEnum()) {
                            Object[] enumValores = typeParam.getEnumConstants();
                            String[] valores = new String[enumValores.length];
                            for (int j = 0; j < enumValores.length; j++)
                                valores[j] = enumValores[j].toString();
                            parametros[paramCount] = cfg.addStringListParameter2(nomePropPlugin, resourceMessage, valores, "");
                        }
                        ((BooleanParameter) parametros[1]).addEnabledOnSelection(parametros[paramCount]);
                        paramCount++;
                    }
                }
                cfg.createGroup(nomeHandle, parametros);
            } catch (Exception e) {
                throw new RuntimeException(e.getMessage());
            }
        }

        // Configuração das Categorias
        String[] existingCategories = getExistingCategories(pluginInterface);
        Parameter[] parametros = new Parameter[existingCategories.length];
        BooleanParameter paramCatAll = cfg.addBooleanParameter2(_CategoryAll, _BaseConfigName + "." + _CategoryAll, true);
        int paramCount = 0;
        for (String category : existingCategories) {
            String nomeCfgCategory = _CategoryList + "." + category;
            String nomeResMessage = _BaseConfigName + "." + nomeCfgCategory;
            addLocalisedMessage(localeUtil, nomeResMessage, category);
            parametros[paramCount] = cfg.addBooleanParameter2(nomeCfgCategory, nomeResMessage, false);
            paramCatAll.addDisabledOnSelection(parametros[paramCount]);
            paramCount++;
        }
        cfg.createGroup(_BaseConfigName + "." + _CategoryList, parametros);
    }
View Full Code Here


    config_model.addIntParameter2("AzTrackerFind_port3","AzTrackerFind.port3",0);
    config_model.addStringParameter2( "AzTrackerFind_url_user","AzTrackerFind.url.user","username");
    config_model.addStringParameter2("AzTrackerFind_url_password", "AzTrackerFind.url.password", "password");
    config_model.addBooleanParameter2("AzTrackerFind_autoinsert","AzTrackerFind.autoinsert",false);
    config_model.addBooleanParameter2("MilitaryTime", "AzTrackerFind.military.time", false);
    BooleanParameter enable = config_model.addBooleanParameter2("AutoDownload","AzTrackerFind.auto.download",false);
    String default_dir = pluginInterface.getPluginDirectoryName() + System.getProperty("file.separator") + "torrents";
    DirectoryParameter enabled_dir = config_model.addDirectoryParameter2("AutoDownload_dir","AzTrackerFind.autodownload.dir",default_dir);
    enable.addEnabledOnSelection( enabled_dir );
    if (utils.isLinux())
        {
      config_model.addStringParameter2("AzTrackerFind_url_commandline", "AzTrackerFind.url.commandline","firefox");
        }
        else if (utils.isOSX())
View Full Code Here

      // slip the non-standard "plugins" initialisation inbetween the internal ones
      // and the plugin ones so plugin ones can be children of it
     
      boolean  plugin_section = i >= internalSections.length;
     
      ConfigSection section = pluginSections.get(i);
     
      if (section instanceof ConfigSectionSWT || section instanceof UISWTConfigSection ) {
        String name;
        try {
          name = section.configSectionGetName();
         } catch (Exception e) {
           Logger.log(new LogEvent(LOGID, "A ConfigSection plugin caused an "
              + "error while trying to call its "
              + "configSectionGetName function", e));
          name = "Bad Plugin";
        }

         String  section_key = name;
        
         if ( plugin_section ){
             // if resource exists without prefix then use it as plugins don't
             // need to start with the prefix
          
           if ( !MessageText.keyExists(section_key)){
            
             section_key = sSectionPrefix + name;
           }
          
         }else{
          
           section_key = sSectionPrefix + name;
         }
        
         String  section_name = MessageText.getString( section_key );
        
         try {
          TreeItem treeItem;
          String location = section.configSectionGetParentSection();
 
          if ( location.length() == 0 || location.equalsIgnoreCase(ConfigSection.SECTION_ROOT)){
            //int position = findInsertPointFor(section_name, tree);
            //if ( position == -1 ){
              treeItem = new TreeItem(tree, SWT.NULL);
View Full Code Here

  private void ensureSectionBuilt(TreeItem treeSection, boolean recreateIfAlreadyThere) {
    ScrolledComposite item = (ScrolledComposite)treeSection.getData("Panel");

    if (item != null) {
     
      ConfigSection configSection = (ConfigSection)treeSection.getData("ConfigSectionSWT");
     
      if (configSection != null) {
       
        Control previous = item.getContent();
        if (previous instanceof Composite) {
          if (!recreateIfAlreadyThere) {
            return;
          }
          configSection.configSectionDelete();
          sectionsCreated.remove(configSection);     
          Utils.disposeComposite((Composite)previous,true);
        }
       
        Composite c;
View Full Code Here

   
    int userMode = COConfigurationManager.getIntParameter("User Mode");
    int maxUsermode = 0;
    try
    {
      ConfigSection sect = sections.get(section);
      if (sect instanceof UISWTConfigSection)
      {
        maxUsermode = ((UISWTConfigSection) sect).maxUserMode();
      }
    } catch (Error e)
View Full Code Here

   
    for (int i=0;i<items.length;i++){
     
      TreeItem  item = items[i];
             
      ConfigSection section = (ConfigSection)item.getData("ConfigSectionSWT");
       
      if ( section != null && section.getClass() == config_section_class ){
         
        tree.setSelection( new TreeItem[]{ item });
       
        showSection( item );
       
View Full Code Here

            && (!(currentContent[0] instanceof ISelectedVuzeFileContent))
            && currentContent[0].getDownloadManager() == null
            && (currentContent[0].getHash() != null || currentContent[0].getDownloadInfo() != null));
 
      if (tv != null) {
        TableColumn tc = tv.getTableColumn(RankItem.COLUMN_ID);
        if (tc != null && !tc.isVisible()) {
          mapNewToolbarStates.put("up", false);
          mapNewToolbarStates.put("down", false);
        }
      }
     
View Full Code Here

    start();
  }

  private void start() {
    for (int i = 0; i < updates.length; i++) {
      Update update = updates[i];
      ResourceDownloader[] rds = update.getDownloaders();
      for (int j = 0; j < rds.length; j++) {
        ResourceDownloader rd = rds[j];
        downloaders.add(rd);
      }
    }
View Full Code Here

  private void allDownloadsComplete() {
    boolean bRequiresRestart = false;
    boolean bHadMandatoryUpdates = false;
   
    for (int i = 0; i < updates.length; i++) {
      Update update = updates[i];
        // updates with no downloaders exist for admin purposes only
      if ( update.getDownloaders().length > 0){
        if (update.getRestartRequired() != Update.RESTART_REQUIRED_NO) {
          bRequiresRestart = true;
        }
        if ( update.isMandatory()){
          bHadMandatoryUpdates = true;
        }
      }
    }
View Full Code Here

          handleEvent(Event event)
          {
            try{
              PluginInterface pi = AzureusCoreFactory.getSingleton().getPluginManager().getDefaultPluginInterface();
             
              UpdateInstaller installer = pi.getUpdateManager().createInstaller();
           
              installer.addMoveAction(
                "C:\\temp\\file1", "C:\\temp\\file2" );
           
              installer.installNow(
                new UpdateInstallerListener()
                {
                  public void
                  reportProgress(
                    String    str )
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.plugins.ui.config.BooleanParameter

Copyright © 2018 www.massapicom. 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.