Program: 170787
Project: 170787
Buggy source:
private void swt_initialize(Composite parent){
  if (cMainComposite == null || cMainComposite.isDisposed()) {
    if (parent == null || parent.isDisposed()) {
      return;
    }
    sc=new ScrolledComposite(parent,SWT.V_SCROLL);
    sc.setExpandHorizontal(true);
    sc.setExpandVertical(true);
    sc.getVerticalBar().setIncrement(16);
    Layout parentLayout=parent.getLayout();
    if (parentLayout instanceof GridLayout) {
      GridData gd=new GridData(SWT.FILL,SWT.FILL,true,true);
      Utils.setLayoutData(sc,gd);
    }
 else     if (parentLayout instanceof FormLayout) {
      Utils.setLayoutData(sc,Utils.getFilledFormData());
    }
    cMainComposite=new Composite(sc,SWT.NONE);
    sc.setContent(cMainComposite);
  }
 else {
    Utils.disposeComposite(cMainComposite,false);
  }
  if (tags == null) {
    params=null;
    cMainComposite.setLayout(new FillLayout());
    Label label=new Label(cMainComposite,SWT.NONE);
    label.setText(MessageText.getString("String_Node_Str"));
  }
 else {
    final int numTags=tags.length;
    int isTagVisible=-1;
    int canBePublic=-1;
    int[] tagColor=tags[0].getColor();
    boolean tagsAreTagFeatureRateLimit=true;
    Set<String> listTagTypes=new HashSet<>();
    for (    Tag tag : tags) {
      TagType tt=tag.getTagType();
      String s=tt.getTagTypeName(true);
      listTagTypes.add(s);
      if (tagsAreTagFeatureRateLimit && !(tag instanceof TagFeatureRateLimit)) {
        tagsAreTagFeatureRateLimit=false;
      }
      isTagVisible=updateIntBoolean(tag.isVisible(),isTagVisible);
      canBePublic=updateIntBoolean(tag.canBePublic(),canBePublic);
      if (tagColor != null) {
        int[] color=tag.getColor();
        if (!Arrays.areEqual(tagColor,color)) {
          tagColor=null;
        }
      }
    }
    String tagTypes=GeneralUtils.stringJoin(listTagTypes,"String_Node_Str");
    params=new Params();
    GridData gd;
    GridLayout gridLayout;
    gridLayout=new GridLayout(1,false);
    gridLayout.horizontalSpacing=gridLayout.verticalSpacing=0;
    gridLayout.marginHeight=gridLayout.marginWidth=0;
    cMainComposite.setLayout(gridLayout);
    Composite cSection1=new Composite(cMainComposite,SWT.NONE);
    gridLayout=new GridLayout(4,false);
    gridLayout.marginHeight=0;
    cSection1.setLayout(gridLayout);
    gd=new GridData(SWT.FILL,SWT.FILL,true,false);
    cSection1.setLayoutData(gd);
    Composite cSection2=new Composite(cMainComposite,SWT.NONE);
    gridLayout=new GridLayout(4,false);
    cSection2.setLayout(gridLayout);
    gd=new GridData(SWT.FILL,SWT.FILL,true,false);
    cSection2.setLayoutData(gd);
    Label label;
    label=new Label(cSection1,SWT.NONE);
    FontUtils.setFontHeight(label,12,SWT.BOLD);
    gd=new GridData();
    gd.horizontalSpan=4;
    Utils.setLayoutData(label,gd);
    label.setText(tagTypes);
    label=new Label(cSection1,SWT.NONE);
    Messages.setLanguageText(label,"String_Node_Str");
    gd=new GridData(SWT.BEGINNING,SWT.CENTER,false,false);
    Utils.setLayoutData(label,gd);
    if (numTags == 1 && !tags[0].getTagType().isTagTypeAuto()) {
      Text txtName=new Text(cSection1,SWT.BORDER);
      params.cName=txtName;
      gd=new GridData(SWT.FILL,SWT.CENTER,true,false);
      Utils.setLayoutData(txtName,gd);
      txtName.addModifyListener(new ModifyListener(){
        @Override public void modifyText(        ModifyEvent e){
          try {
            String newName=((Text)e.widget).getText();
            if (!tags[0].getTagName(true).equals(newName)) {
              tags[0].setTagName(newName);
            }
          }
 catch (          TagException e1) {
            Debug.out(e1);
          }
        }
      }
);
    }
 else {
      label=new Label(cSection1,SWT.WRAP);
      gd=Utils.getWrappableLabelGridData(1,GridData.GRAB_HORIZONTAL);
      Utils.setLayoutData(label,gd);
      params.cName=label;
    }
    label=new Label(cSection1,SWT.NONE);
    Messages.setLanguageText(label,"String_Node_Str");
    if (tagColor == null) {
      tagColor=new int[]{0,0,0};
    }
    params.tagColor=new ColorParameter(cSection1,null,tagColor[0],tagColor[1],tagColor[2]){
      @Override public void newColorChosen(      RGB newColor){
        for (        Tag tag : tags) {
          tag.setColor(new int[]{newColor.red,newColor.green,newColor.blue});
        }
      }
    }
;
    params.viewInSideBar=new GenericBooleanParameter(new BooleanParameterAdapter(){
      @Override public Boolean getBooleanValue(      String key){
        int isTagVisible=-1;
        for (        Tag tag : tags) {
          isTagVisible=updateIntBoolean(tag.isVisible(),isTagVisible);
        }
        return isTagVisible == 2 ? null : (isTagVisible == 1);
      }
      @Override public void setBooleanValue(      String key,      boolean value){
        for (        Tag tag : tags) {
          tag.setVisible(value);
        }
      }
    }
,cSection2,null,"String_Node_Str");
    gd=new GridData();
    gd.horizontalSpan=4;
    params.viewInSideBar.setLayoutData(gd);
    if (canBePublic == 1) {
      params.isPublic=new GenericBooleanParameter(new BooleanParameterAdapter(){
        @Override public Boolean getBooleanValue(        String key){
          int val=-1;
          for (          Tag tag : tags) {
            val=updateIntBoolean(tag.isPublic(),val);
          }
          return val == 2 ? null : (val == 1);
        }
        @Override public void setBooleanValue(        String key,        boolean value){
          for (          Tag tag : tags) {
            tag.setPublic(value);
          }
        }
      }
,cSection2,null,"String_Node_Str");
      gd=new GridData();
      gd.horizontalSpan=4;
      params.isPublic.setLayoutData(gd);
    }
    Group gTransfer=new Group(cMainComposite,SWT.NONE);
    gTransfer.setText(MessageText.getString("String_Node_Str"));
    gridLayout=new GridLayout(6,false);
    gTransfer.setLayout(gridLayout);
    gd=new GridData(SWT.FILL,SWT.NONE,false,false,4,1);
    gTransfer.setLayoutData(gd);
    if (tagsAreTagFeatureRateLimit) {
      final TagFeatureRateLimit rls[]=new TagFeatureRateLimit[tags.length];
      System.arraycopy(tags,0,rls,0,tags.length);
      boolean supportsTagDownloadLimit=true;
      boolean supportsTagUploadLimit=true;
      boolean hasTagUploadPriority=true;
      for (      TagFeatureRateLimit rl : rls) {
        supportsTagDownloadLimit&=rl.supportsTagDownloadLimit();
        supportsTagUploadLimit&=rl.supportsTagUploadLimit();
        hasTagUploadPriority&=rl.getTagUploadPriority() >= 0;
      }
      String k_unit=DisplayFormatters.getRateUnitBase10(DisplayFormatters.UNIT_KB).trim();
      int cols_used=0;
      if (supportsTagDownloadLimit) {
        gd=new GridData();
        label=new Label(gTransfer,SWT.NULL);
        Utils.setLayoutData(label,gd);
        label.setText(k_unit + "String_Node_Str" + MessageText.getString("String_Node_Str"));
        gd=new GridData();
        params.maxDownloadSpeed=new GenericIntParameter(new GenericParameterAdapter(){
          @Override public int getIntValue(          String key){
            int limit=rls[0].getTagDownloadLimit();
            if (numTags > 1) {
              for (int i=1; i < rls.length; i++) {
                int nextLimit=rls[i].getTagDownloadLimit();
                if (nextLimit != limit) {
                  return 0;
                }
              }
            }
            return limit < 0 ? limit : limit / DisplayFormatters.getKinB();
          }
          @Override public int getIntValue(          String key,          int def){
            return getIntValue(key);
          }
          @Override public void setIntValue(          String key,          int value){
            for (            TagFeatureRateLimit rl : rls) {
              if (value == -1) {
                rl.setTagDownloadLimit(-1);
              }
 else {
                rl.setTagDownloadLimit(value * DisplayFormatters.getKinB());
              }
            }
          }
          @Override public boolean resetIntDefault(          String key){
            return false;
          }
        }
,gTransfer,null,-1,Integer.MAX_VALUE);
        params.maxDownloadSpeed.setLayoutData(gd);
        params.maxDownloadSpeed.setZeroHidden(numTags > 1);
        cols_used+=2;
      }
      if (supportsTagUploadLimit) {
        gd=new GridData();
        label=new Label(gTransfer,SWT.NULL);
        Utils.setLayoutData(label,gd);
        label.setText(k_unit + "String_Node_Str" + MessageText.getString("String_Node_Str"));
        gd=new GridData();
        params.maxUploadSpeed=new GenericIntParameter(new GenericParameterAdapter(){
          @Override public int getIntValue(          String key){
            int limit=rls[0].getTagUploadLimit();
            if (numTags > 1) {
              for (int i=1; i < rls.length; i++) {
                int nextLimit=rls[i].getTagUploadLimit();
                if (nextLimit != limit) {
                  return 0;
                }
              }
            }
            return limit < 0 ? limit : limit / DisplayFormatters.getKinB();
          }
          @Override public int getIntValue(          String key,          int def){
            return getIntValue(key);
          }
          @Override public void setIntValue(          String key,          int value){
            for (            TagFeatureRateLimit rl : rls) {
              if (value == -1) {
                rl.setTagUploadLimit(value);
              }
 else {
                rl.setTagUploadLimit(value * DisplayFormatters.getKinB());
              }
            }
          }
          @Override public boolean resetIntDefault(          String key){
            return false;
          }
        }
,gTransfer,null,-1,Integer.MAX_VALUE);
        params.maxUploadSpeed.setLayoutData(gd);
        params.maxUploadSpeed.setZeroHidden(numTags > 1);
        cols_used+=2;
      }
      if (hasTagUploadPriority) {
        params.uploadPriority=new GenericBooleanParameter(new BooleanParameterAdapter(){
          @Override public Boolean getBooleanValue(          String key){
            int value=-1;
            for (            TagFeatureRateLimit rl : rls) {
              value=updateIntBoolean(rl.getTagUploadPriority() > 0,value);
            }
            return value == 2 ? null : value == 1;
          }
          @Override public void setBooleanValue(          String key,          boolean value){
            for (            TagFeatureRateLimit rl : rls) {
              rl.setTagUploadPriority(value ? 1 : 0);
            }
          }
        }
,gTransfer,null,"String_Node_Str");
        gd=new GridData();
        gd.horizontalSpan=6 - cols_used;
        params.uploadPriority.setLayoutData(gd);
      }
      if (numTags == 1 && rls[0].getTagMinShareRatio() >= 0) {
        label=new Label(gTransfer,SWT.NONE);
        Messages.setLanguageText(label,"String_Node_Str");
        gd=new GridData(SWT.BEGINNING,SWT.CENTER,false,false);
        Utils.setLayoutData(label,gd);
        params.min_sr=new GenericFloatParameter(new GenericParameterAdapter(){
          @Override public float getFloatValue(          String key){
            return rls[0].getTagMinShareRatio() / 1000f;
          }
          @Override public void setFloatValue(          String key,          float value){
            rls[0].setTagMinShareRatio((int)(value * 1000));
          }
        }
,gTransfer,null,0,Float.MAX_VALUE,true,3);
        gd=new GridData();
        gd.widthHint=75;
        params.min_sr.setLayoutData(gd);
      }
      if (numTags == 1 && rls[0].getTagMaxShareRatio() >= 0) {
        label=new Label(gTransfer,SWT.NONE);
        Messages.setLanguageText(label,"String_Node_Str");
        gd=new GridData(SWT.BEGINNING,SWT.CENTER,false,false);
        Utils.setLayoutData(label,gd);
        params.max_sr=new GenericFloatParameter(new GenericParameterAdapter(){
          @Override public float getFloatValue(          String key){
            return rls[0].getTagMaxShareRatio() / 1000f;
          }
          @Override public void setFloatValue(          String key,          float value){
            rls[0].setTagMaxShareRatio((int)(value * 1000));
            updateTagSRParams(params);
          }
        }
,gTransfer,null,0,Float.MAX_VALUE,true,3);
        gd=new GridData();
        gd.widthHint=75;
        params.max_sr.setLayoutData(gd);
        String[] ST_ACTION_VALUES={"String_Node_Str" + TagFeatureRateLimit.SR_ACTION_QUEUE,"String_Node_Str" + TagFeatureRateLimit.SR_ACTION_PAUSE,"String_Node_Str" + TagFeatureRateLimit.SR_ACTION_STOP};
        String[] ST_ACTION_LABELS={MessageText.getString("String_Node_Str"),MessageText.getString("String_Node_Str"),MessageText.getString("String_Node_Str")};
        label=new Label(gTransfer,SWT.NONE);
        Messages.setLanguageText(label,"String_Node_Str");
        gd=new GridData(SWT.BEGINNING,SWT.CENTER,false,false);
        Utils.setLayoutData(label,gd);
        params.max_sr_action=new GenericStringListParameter(new GenericParameterAdapter(){
          @Override public String getStringListValue(          String key,          String def){
            return (getStringListValue(key));
          }
          @Override public String getStringListValue(          String key){
            return ("String_Node_Str" + rls[0].getTagMaxShareRatioAction());
          }
          @Override public void setStringListValue(          String key,          String value){
            rls[0].setTagMaxShareRatioAction(Integer.parseInt(value));
          }
        }
,gTransfer,"String_Node_Str","String_Node_Str" + TagFeatureRateLimit.SR_INDIVIDUAL_ACTION_DEFAULT,ST_ACTION_LABELS,ST_ACTION_VALUES);
      }
      if (numTags == 1 && rls[0].getTagAggregateShareRatio() >= 0) {
        label=new Label(gTransfer,SWT.NONE);
        Messages.setLanguageText(label,"String_Node_Str");
        gd=new GridData(SWT.BEGINNING,SWT.CENTER,false,false);
        Utils.setLayoutData(label,gd);
        params.max_aggregate_sr=new GenericFloatParameter(new GenericParameterAdapter(){
          @Override public float getFloatValue(          String key){
            return rls[0].getTagMaxAggregateShareRatio() / 1000f;
          }
          @Override public void setFloatValue(          String key,          float value){
            rls[0].setTagMaxAggregateShareRatio((int)(value * 1000));
            updateTagSRParams(params);
          }
        }
,gTransfer,null,0,Float.MAX_VALUE,true,3);
        gd=new GridData();
        gd.widthHint=75;
        params.max_aggregate_sr.setLayoutData(gd);
        String[] ST_ACTION_VALUES={"String_Node_Str" + TagFeatureRateLimit.SR_ACTION_PAUSE,"String_Node_Str" + TagFeatureRateLimit.SR_ACTION_STOP};
        String[] ST_ACTION_LABELS={MessageText.getString("String_Node_Str"),MessageText.getString("String_Node_Str")};
        label=new Label(gTransfer,SWT.NONE);
        Messages.setLanguageText(label,"String_Node_Str");
        gd=new GridData(SWT.BEGINNING,SWT.CENTER,false,false);
        Utils.setLayoutData(label,gd);
        params.max_aggregate_sr_action=new GenericStringListParameter(new GenericParameterAdapter(){
          @Override public String getStringListValue(          String key,          String def){
            return (getStringListValue(key));
          }
          @Override public String getStringListValue(          String key){
            return ("String_Node_Str" + rls[0].getTagMaxAggregateShareRatioAction());
          }
          @Override public void setStringListValue(          String key,          String value){
            rls[0].setTagMaxAggregateShareRatioAction(Integer.parseInt(value));
          }
        }
,gTransfer,"String_Node_Str","String_Node_Str" + TagFeatureRateLimit.SR_AGGREGATE_ACTION_DEFAULT,ST_ACTION_LABELS,ST_ACTION_VALUES);
        label=new Label(gTransfer,SWT.NONE);
        Messages.setLanguageText(label,"String_Node_Str");
        gd=new GridData(SWT.BEGINNING,SWT.CENTER,false,false);
        Utils.setLayoutData(label,gd);
        params.max_aggregate_sr_priority=new GenericBooleanParameter(new BooleanParameterAdapter(){
          @Override public Boolean getBooleanValue(          String key){
            return (rls[0].getTagMaxAggregateShareRatioHasPriority());
          }
          @Override public void setBooleanValue(          String key,          boolean value){
            rls[0].setTagMaxAggregateShareRatioHasPriority(value);
          }
        }
,gTransfer,"String_Node_Str",TagFeatureRateLimit.AT_RATELIMIT_MAX_AGGREGATE_SR_PRIORITY_DEFAULT);
        updateTagSRParams(params);
      }
    }
    if (numTags == 1 && (tags[0] instanceof TagFeatureFileLocation)) {
      final TagFeatureFileLocation fl=(TagFeatureFileLocation)tags[0];
      if (fl.supportsTagCopyOnComplete() || fl.supportsTagInitialSaveFolder() || fl.supportsTagMoveOnComplete()) {
        Group gFiles=new Group(cMainComposite,SWT.NONE);
        gFiles.setText(MessageText.getString("String_Node_Str"));
        gridLayout=new GridLayout(6,false);
        gFiles.setLayout(gridLayout);
        gd=new GridData(SWT.FILL,SWT.NONE,true,false,4,1);
        Utils.setLayoutData(gFiles,gd);
        if (fl.supportsTagInitialSaveFolder()) {
          params.initalSaveFolder=new folderOption(gFiles,"String_Node_Str"){
            @Override public void setFolder(            File folder){
              params.initalSaveData.setEnabled(folder != null);
              params.initalSaveTorrent.setEnabled(folder != null);
              fl.setTagInitialSaveFolder(folder);
            }
            @Override public File getFolder(){
              File result=fl.getTagInitialSaveFolder();
              params.initalSaveData.setEnabled(result != null);
              params.initalSaveTorrent.setEnabled(result != null);
              return (result);
            }
          }
;
          params.initalSaveData=new GenericBooleanParameter(new BooleanParameterAdapter(){
            @Override public Boolean getBooleanValue(            String key){
              return ((fl.getTagInitialSaveOptions() & TagFeatureFileLocation.FL_DATA) != 0);
            }
            @Override public void setBooleanValue(            String key,            boolean value){
              long flags=fl.getTagInitialSaveOptions();
              if (value) {
                flags|=TagFeatureFileLocation.FL_DATA;
              }
 else {
                flags&=~TagFeatureFileLocation.FL_DATA;
              }
              fl.setTagInitialSaveOptions(flags);
            }
          }
,gFiles,null,"String_Node_Str");
          params.initalSaveTorrent=new GenericBooleanParameter(new BooleanParameterAdapter(){
            @Override public Boolean getBooleanValue(            String key){
              return ((fl.getTagInitialSaveOptions() & TagFeatureFileLocation.FL_TORRENT) != 0);
            }
            @Override public void setBooleanValue(            String key,            boolean value){
              long flags=fl.getTagInitialSaveOptions();
              if (value) {
                flags|=TagFeatureFileLocation.FL_TORRENT;
              }
 else {
                flags&=~TagFeatureFileLocation.FL_TORRENT;
              }
              fl.setTagInitialSaveOptions(flags);
            }
          }
,gFiles,null,"String_Node_Str");
        }
        if (fl.supportsTagMoveOnComplete()) {
          params.moveOnCompleteFolder=new folderOption(gFiles,"String_Node_Str"){
            @Override public void setFolder(            File folder){
              params.moveOnCompleteData.setEnabled(folder != null);
              params.moveOnCompleteTorrent.setEnabled(folder != null);
              fl.setTagMoveOnCompleteFolder(folder);
            }
            @Override public File getFolder(){
              File result=fl.getTagMoveOnCompleteFolder();
              params.moveOnCompleteData.setEnabled(result != null);
              params.moveOnCompleteTorrent.setEnabled(result != null);
              return (result);
            }
          }
;
          params.moveOnCompleteData=new GenericBooleanParameter(new BooleanParameterAdapter(){
            @Override public Boolean getBooleanValue(            String key){
              return ((fl.getTagMoveOnCompleteOptions() & TagFeatureFileLocation.FL_DATA) != 0);
            }
            @Override public void setBooleanValue(            String key,            boolean value){
              long flags=fl.getTagMoveOnCompleteOptions();
              if (value) {
                flags|=TagFeatureFileLocation.FL_DATA;
              }
 else {
                flags&=~TagFeatureFileLocation.FL_DATA;
              }
              fl.setTagMoveOnCompleteOptions(flags);
            }
          }
,gFiles,null,"String_Node_Str");
          params.moveOnCompleteTorrent=new GenericBooleanParameter(new BooleanParameterAdapter(){
            @Override public Boolean getBooleanValue(            String key){
              return ((fl.getTagMoveOnCompleteOptions() & TagFeatureFileLocation.FL_TORRENT) != 0);
            }
            @Override public void setBooleanValue(            String key,            boolean value){
              long flags=fl.getTagMoveOnCompleteOptions();
              if (value) {
                flags|=TagFeatureFileLocation.FL_TORRENT;
              }
 else {
                flags&=~TagFeatureFileLocation.FL_TORRENT;
              }
              fl.setTagMoveOnCompleteOptions(flags);
            }
          }
,gFiles,null,"String_Node_Str");
        }
        if (fl.supportsTagCopyOnComplete()) {
          params.copyOnCompleteFolder=new folderOption(gFiles,"String_Node_Str"){
            @Override public void setFolder(            File folder){
              params.copyOnCompleteData.setEnabled(folder != null);
              params.copyOnCompleteTorrent.setEnabled(folder != null);
              fl.setTagCopyOnCompleteFolder(folder);
            }
            @Override public File getFolder(){
              File result=fl.getTagCopyOnCompleteFolder();
              params.copyOnCompleteData.setEnabled(result != null);
              params.copyOnCompleteTorrent.setEnabled(result != null);
              return (result);
            }
          }
;
          params.copyOnCompleteData=new GenericBooleanParameter(new BooleanParameterAdapter(){
            @Override public Boolean getBooleanValue(            String key){
              return ((fl.getTagCopyOnCompleteOptions() & TagFeatureFileLocation.FL_DATA) != 0);
            }
            @Override public void setBooleanValue(            String key,            boolean value){
              long flags=fl.getTagCopyOnCompleteOptions();
              if (value) {
                flags|=TagFeatureFileLocation.FL_DATA;
              }
 else {
                flags&=~TagFeatureFileLocation.FL_DATA;
              }
              fl.setTagCopyOnCompleteOptions(flags);
            }
          }
,gFiles,null,"String_Node_Str");
          params.copyOnCompleteTorrent=new GenericBooleanParameter(new BooleanParameterAdapter(){
            @Override public Boolean getBooleanValue(            String key){
              return ((fl.getTagCopyOnCompleteOptions() & TagFeatureFileLocation.FL_TORRENT) != 0);
            }
            @Override public void setBooleanValue(            String key,            boolean value){
              long flags=fl.getTagCopyOnCompleteOptions();
              if (value) {
                flags|=TagFeatureFileLocation.FL_TORRENT;
              }
 else {
                flags&=~TagFeatureFileLocation.FL_TORRENT;
              }
              fl.setTagCopyOnCompleteOptions(flags);
            }
          }
,gFiles,null,"String_Node_Str");
        }
      }
    }
    if (numTags == 1 && tags[0].getTagType().hasTagTypeFeature(TagFeature.TF_PROPERTIES) && (tags[0] instanceof TagFeatureProperties)) {
      TagFeatureProperties tfp=(TagFeatureProperties)tags[0];
      final TagProperty propConstraint=tfp.getProperty(TagFeatureProperties.PR_CONSTRAINT);
      if (propConstraint != null) {
        Group gConstraint=new Group(cMainComposite,SWT.NONE);
        Messages.setLanguageText(gConstraint,"String_Node_Str");
        gridLayout=new GridLayout(5,false);
        gConstraint.setLayout(gridLayout);
        gd=new GridData(SWT.FILL,SWT.NONE,true,false,4,1);
        Utils.setLayoutData(gConstraint,gd);
        params.constraints=new Text(gConstraint,SWT.WRAP | SWT.BORDER | SWT.MULTI);
        gd=new GridData(SWT.FILL,SWT.NONE,true,false,5,1);
        gd.heightHint=40;
        Utils.setLayoutData(params.constraints,gd);
        params.constraints.addKeyListener(new KeyListener(){
          @Override public void keyReleased(          KeyEvent e){
          }
          @Override public void keyPressed(          KeyEvent e){
            params.constraints.setData("String_Node_Str",1);
            if (btnSaveConstraint != null && !btnSaveConstraint.isDisposed()) {
              btnSaveConstraint.setEnabled(true);
              btnResetConstraint.setEnabled(true);
            }
          }
        }
);
        params.constraintError=new Label(gConstraint,SWT.NULL);
        params.constraintError.setForeground(Colors.colorError);
        gd=new GridData(SWT.FILL,SWT.NONE,true,false,5,1);
        Utils.setLayoutData(params.constraintError,gd);
        btnSaveConstraint=new Button(gConstraint,SWT.PUSH);
        btnSaveConstraint.setEnabled(false);
        btnSaveConstraint.addListener(SWT.Selection,new Listener(){
          @Override public void handleEvent(          Event event){
            String constraint=params.constraints.getText().trim();
            String[] old_value=propConstraint.getStringList();
            if (constraint.length() == 0) {
              propConstraint.setStringList(null);
            }
 else {
              String old_options=old_value.length > 1 && old_value[1] != null ? old_value[1] : "String_Node_Str";
              if (old_options.length() == 0) {
                old_options=CM_ADD_REMOVE;
              }
              propConstraint.setStringList(new String[]{constraint,old_options});
            }
            if (btnSaveConstraint != null && !btnSaveConstraint.isDisposed()) {
              btnSaveConstraint.setEnabled(false);
              btnResetConstraint.setEnabled(false);
            }
          }
        }
);
        Messages.setLanguageText(btnSaveConstraint,"String_Node_Str");
        btnResetConstraint=new Button(gConstraint,SWT.PUSH);
        btnResetConstraint.setEnabled(false);
        btnResetConstraint.addListener(SWT.Selection,new Listener(){
          @Override public void handleEvent(          Event event){
            params.constraints.setData("String_Node_Str",null);
            swt_updateFields();
            if (btnSaveConstraint != null && !btnSaveConstraint.isDisposed()) {
              btnSaveConstraint.setEnabled(false);
              btnResetConstraint.setEnabled(false);
            }
          }
        }
);
        Messages.setLanguageText(btnResetConstraint,"String_Node_Str");
        Label constraintMode=new Label(gConstraint,SWT.NULL);
        Messages.setLanguageText(constraintMode,"String_Node_Str");
        String[] CM_VALUES={CM_ADD_REMOVE,CM_ADD_ONLY,CM_REMOVE_ONLY};
        String[] CM_LABELS={MessageText.getString("String_Node_Str"),MessageText.getString("String_Node_Str"),MessageText.getString("String_Node_Str")};
        params.constraintMode=new GenericStringListParameter(new GenericParameterAdapter(){
          @Override public String getStringListValue(          String key,          String def){
            return (getStringListValue(key));
          }
          @Override public String getStringListValue(          String key){
            String[] list=propConstraint.getStringList();
            if (list.length > 1 && list[1] != null) {
              return (list[1]);
            }
 else {
              return (CM_ADD_REMOVE);
            }
          }
          @Override public void setStringListValue(          String key,          String value){
            if (value == null || value.length() == 0) {
              value=CM_ADD_REMOVE;
            }
            String[] list=propConstraint.getStringList();
            propConstraint.setStringList(new String[]{list != null && list.length > 0 ? list[0] : "String_Node_Str",value});
          }
        }
,gConstraint,"String_Node_Str",CM_ADD_REMOVE,CM_LABELS,CM_VALUES);
        Link lblAboutConstraint=new Link(gConstraint,SWT.WRAP);
        Utils.setLayoutData(lblAboutConstraint,Utils.getWrappableLabelGridData(1,GridData.GRAB_HORIZONTAL));
        lblAboutConstraint.setText(MessageText.getString("String_Node_Str"));
        lblAboutConstraint.addListener(SWT.Selection,new Listener(){
          @Override public void handleEvent(          Event event){
            if (event.text != null && (event.text.startsWith("String_Node_Str") || event.text.startsWith("String_Node_Str"))) {
              Utils.launch(event.text);
            }
          }
        }
);
      }
    }
    if (numTags == 1 && tags[0].getTagType().hasTagTypeFeature(TagFeature.TF_LIMITS)) {
      final TagFeatureLimits tfl=(TagFeatureLimits)tags[0];
      if (tfl.getMaximumTaggables() >= 0) {
        Group gLimits=new Group(cMainComposite,SWT.NONE);
        gLimits.setText(MessageText.getString("String_Node_Str"));
        gridLayout=new GridLayout(6,false);
        gLimits.setLayout(gridLayout);
        gd=new GridData(SWT.FILL,SWT.NONE,false,false,4,1);
        gLimits.setLayoutData(gd);
        label=new Label(gLimits,SWT.NONE);
        Messages.setLanguageText(label,"String_Node_Str");
        gd=new GridData(SWT.BEGINNING,SWT.CENTER,false,false);
        Utils.setLayoutData(label,gd);
        params.tfl_max_taggables=new GenericIntParameter(new GenericParameterAdapter(){
          @Override public int getIntValue(          String key){
            return tfl.getMaximumTaggables();
          }
          @Override public int getIntValue(          String key,          int def){
            return getIntValue(key);
          }
          @Override public void setIntValue(          String key,          int value){
            tfl.setMaximumTaggables(value);
          }
        }
,gLimits,null,0,Integer.MAX_VALUE);
        params.tfl_max_taggables.disableTimedSave();
        gd=new GridData();
        gd.widthHint=50;
        params.tfl_max_taggables.setLayoutData(gd);
        label=new Label(gLimits,SWT.NONE);
        Messages.setLanguageText(label,"String_Node_Str");
        params.tfl_removal_policy=new GenericStringListParameter(new GenericParameterAdapter(){
          @Override public String getStringListValue(          String key){
            return (String.valueOf(tfl.getRemovalStrategy()));
          }
          @Override public String getStringListValue(          String key,          String def){
            return (getStringListValue(key));
          }
          @Override public void setStringListValue(          String key,          String value){
            tfl.setRemovalStrategy(value == null ? TagFeatureLimits.RS_DEFAULT : Integer.parseInt(value));
          }
        }
,gLimits,null,new String[]{"String_Node_Str",MessageText.getString("String_Node_Str"),MessageText.getString("String_Node_Str"),MessageText.getString("String_Node_Str"),MessageText.getString("String_Node_Str")},new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"});
        label=new Label(gLimits,SWT.NONE);
        Messages.setLanguageText(label,"String_Node_Str");
        params.tfl_ordering=new GenericStringListParameter(new GenericParameterAdapter(){
          @Override public String getStringListValue(          String key){
            return (String.valueOf(tfl.getOrdering()));
          }
          @Override public String getStringListValue(          String key,          String def){
            return (getStringListValue(key));
          }
          @Override public void setStringListValue(          String key,          String value){
            tfl.setOrdering(value == null ? TagFeatureLimits.OP_DEFAULT : Integer.parseInt(value));
          }
        }
,gLimits,null,new String[]{MessageText.getString("String_Node_Str"),MessageText.getString("String_Node_Str")},new String[]{"String_Node_Str","String_Node_Str"});
      }
    }
    if (numTags == 1 && tags[0].getTagType().hasTagTypeFeature(TagFeature.TF_NOTIFICATIONS)) {
      final TagFeatureNotifications tfn=(TagFeatureNotifications)tags[0];
      Group gNotifications=new Group(cMainComposite,SWT.NONE);
      gNotifications.setText(MessageText.getString("String_Node_Str"));
      gridLayout=new GridLayout(6,false);
      gNotifications.setLayout(gridLayout);
      gd=new GridData(SWT.FILL,SWT.NONE,false,false,4,1);
      gNotifications.setLayoutData(gd);
      label=new Label(gNotifications,SWT.NONE);
      label.setText(MessageText.getString("String_Node_Str") + "String_Node_Str");
      params.notification_post_add=new GenericBooleanParameter(new BooleanParameterAdapter(){
        @Override public Boolean getBooleanValue(        String key){
          return ((tfn.getPostingNotifications() & TagFeatureNotifications.NOTIFY_ON_ADD) != 0);
        }
        @Override public void setBooleanValue(        String key,        boolean value){
          int flags=tfn.getPostingNotifications();
          if (value) {
            flags|=TagFeatureNotifications.NOTIFY_ON_ADD;
          }
 else {
            flags&=~TagFeatureNotifications.NOTIFY_ON_ADD;
          }
          tfn.setPostingNotifications(flags);
        }
      }
,gNotifications,null,"String_Node_Str");
      params.notification_post_remove=new GenericBooleanParameter(new BooleanParameterAdapter(){
        @Override public Boolean getBooleanValue(        String key){
          return ((tfn.getPostingNotifications() & TagFeatureNotifications.NOTIFY_ON_REMOVE) != 0);
        }
        @Override public void setBooleanValue(        String key,        boolean value){
          int flags=tfn.getPostingNotifications();
          if (value) {
            flags|=TagFeatureNotifications.NOTIFY_ON_REMOVE;
          }
 else {
            flags&=~TagFeatureNotifications.NOTIFY_ON_REMOVE;
          }
          tfn.setPostingNotifications(flags);
        }
      }
,gNotifications,null,"String_Node_Str");
    }
    swt_updateFields();
  }
  cMainComposite.layout();
  sc.setMinSize(cMainComposite.computeSize(SWT.DEFAULT,SWT.DEFAULT));
}

Fixed version (ground truth):
private void swt_initialize(Composite parent){
  if (cMainComposite == null || cMainComposite.isDisposed()) {
    if (parent == null || parent.isDisposed()) {
      return;
    }
    sc=new ScrolledComposite(parent,SWT.V_SCROLL);
    sc.setExpandHorizontal(true);
    sc.setExpandVertical(true);
    sc.getVerticalBar().setIncrement(16);
    Layout parentLayout=parent.getLayout();
    if (parentLayout instanceof GridLayout) {
      GridData gd=new GridData(SWT.FILL,SWT.FILL,true,true);
      Utils.setLayoutData(sc,gd);
    }
 else     if (parentLayout instanceof FormLayout) {
      Utils.setLayoutData(sc,Utils.getFilledFormData());
    }
    cMainComposite=new Composite(sc,SWT.NONE);
    sc.setContent(cMainComposite);
  }
 else {
    Utils.disposeComposite(cMainComposite,false);
  }
  if (tags == null) {
    params=null;
    cMainComposite.setLayout(new FillLayout());
    Label label=new Label(cMainComposite,SWT.NONE);
    label.setText(MessageText.getString("String_Node_Str"));
  }
 else {
    final int numTags=tags.length;
    int isTagVisible=-1;
    int canBePublic=-1;
    int[] tagColor=tags[0].getColor();
    boolean tagsAreTagFeatureRateLimit=true;
    Set<String> listTagTypes=new HashSet<>();
    for (    Tag tag : tags) {
      TagType tt=tag.getTagType();
      String s=tt.getTagTypeName(true);
      listTagTypes.add(s);
      if (tagsAreTagFeatureRateLimit && !(tag instanceof TagFeatureRateLimit)) {
        tagsAreTagFeatureRateLimit=false;
      }
      isTagVisible=updateIntBoolean(tag.isVisible(),isTagVisible);
      canBePublic=updateIntBoolean(tag.canBePublic(),canBePublic);
      if (tagColor != null) {
        int[] color=tag.getColor();
        if (!Arrays.areEqual(tagColor,color)) {
          tagColor=null;
        }
      }
    }
    String tagTypes=GeneralUtils.stringJoin(listTagTypes,"String_Node_Str");
    params=new Params();
    GridData gd;
    GridLayout gridLayout;
    gridLayout=new GridLayout(1,false);
    gridLayout.horizontalSpacing=gridLayout.verticalSpacing=0;
    gridLayout.marginHeight=gridLayout.marginWidth=0;
    cMainComposite.setLayout(gridLayout);
    Composite cSection1=new Composite(cMainComposite,SWT.NONE);
    gridLayout=new GridLayout(4,false);
    gridLayout.marginHeight=0;
    cSection1.setLayout(gridLayout);
    gd=new GridData(SWT.FILL,SWT.FILL,true,false);
    cSection1.setLayoutData(gd);
    Composite cSection2=new Composite(cMainComposite,SWT.NONE);
    gridLayout=new GridLayout(4,false);
    cSection2.setLayout(gridLayout);
    gd=new GridData(SWT.FILL,SWT.FILL,true,false);
    cSection2.setLayoutData(gd);
    Label label;
    label=new Label(cSection1,SWT.NONE);
    FontUtils.setFontHeight(label,12,SWT.BOLD);
    gd=new GridData();
    gd.horizontalSpan=4;
    Utils.setLayoutData(label,gd);
    label.setText(tagTypes);
    label=new Label(cSection1,SWT.NONE);
    Messages.setLanguageText(label,"String_Node_Str");
    gd=new GridData(SWT.BEGINNING,SWT.CENTER,false,false);
    Utils.setLayoutData(label,gd);
    if (numTags == 1 && !tags[0].getTagType().isTagTypeAuto()) {
      Text txtName=new Text(cSection1,SWT.BORDER);
      params.cName=txtName;
      gd=new GridData(SWT.FILL,SWT.CENTER,true,false);
      Utils.setLayoutData(txtName,gd);
      txtName.addModifyListener(new ModifyListener(){
        @Override public void modifyText(        ModifyEvent e){
          try {
            String newName=((Text)e.widget).getText();
            if (!tags[0].getTagName(true).equals(newName)) {
              tags[0].setTagName(newName);
            }
          }
 catch (          TagException e1) {
            Debug.out(e1);
          }
        }
      }
);
    }
 else {
      label=new Label(cSection1,SWT.WRAP);
      gd=Utils.getWrappableLabelGridData(1,GridData.GRAB_HORIZONTAL);
      Utils.setLayoutData(label,gd);
      params.cName=label;
    }
    label=new Label(cSection1,SWT.NONE);
    Messages.setLanguageText(label,"String_Node_Str");
    if (tagColor == null) {
      tagColor=new int[]{0,0,0};
    }
    params.tagColor=new ColorParameter(cSection1,null,tagColor[0],tagColor[1],tagColor[2]){
      @Override public void newColorChosen(      RGB newColor){
        for (        Tag tag : tags) {
          tag.setColor(new int[]{newColor.red,newColor.green,newColor.blue});
        }
      }
    }
;
    params.viewInSideBar=new GenericBooleanParameter(new BooleanParameterAdapter(){
      @Override public Boolean getBooleanValue(      String key){
        int isTagVisible=-1;
        for (        Tag tag : tags) {
          isTagVisible=updateIntBoolean(tag.isVisible(),isTagVisible);
        }
        return isTagVisible == 2 ? null : (isTagVisible == 1);
      }
      @Override public void setBooleanValue(      String key,      boolean value){
        for (        Tag tag : tags) {
          tag.setVisible(value);
        }
      }
    }
,cSection2,null,"String_Node_Str");
    gd=new GridData();
    gd.horizontalSpan=4;
    params.viewInSideBar.setLayoutData(gd);
    if (canBePublic == 1) {
      params.isPublic=new GenericBooleanParameter(new BooleanParameterAdapter(){
        @Override public Boolean getBooleanValue(        String key){
          int val=-1;
          for (          Tag tag : tags) {
            val=updateIntBoolean(tag.isPublic(),val);
          }
          return val == 2 ? null : (val == 1);
        }
        @Override public void setBooleanValue(        String key,        boolean value){
          for (          Tag tag : tags) {
            tag.setPublic(value);
          }
        }
      }
,cSection2,null,"String_Node_Str");
      gd=new GridData();
      gd.horizontalSpan=4;
      params.isPublic.setLayoutData(gd);
    }
    Group gTransfer=new Group(cMainComposite,SWT.NONE);
    gTransfer.setText(MessageText.getString("String_Node_Str"));
    gridLayout=new GridLayout(6,false);
    gTransfer.setLayout(gridLayout);
    gd=new GridData(SWT.FILL,SWT.NONE,false,false,4,1);
    gTransfer.setLayoutData(gd);
    if (tagsAreTagFeatureRateLimit) {
      final TagFeatureRateLimit rls[]=new TagFeatureRateLimit[tags.length];
      System.arraycopy(tags,0,rls,0,tags.length);
      boolean supportsTagDownloadLimit=true;
      boolean supportsTagUploadLimit=true;
      boolean hasTagUploadPriority=true;
      for (      TagFeatureRateLimit rl : rls) {
        supportsTagDownloadLimit&=rl.supportsTagDownloadLimit();
        supportsTagUploadLimit&=rl.supportsTagUploadLimit();
        hasTagUploadPriority&=rl.getTagUploadPriority() >= 0;
      }
      String k_unit=DisplayFormatters.getRateUnitBase10(DisplayFormatters.UNIT_KB).trim();
      int cols_used=0;
      if (supportsTagDownloadLimit) {
        gd=new GridData();
        label=new Label(gTransfer,SWT.NULL);
        Utils.setLayoutData(label,gd);
        label.setText(k_unit + "String_Node_Str" + MessageText.getString("String_Node_Str"));
        gd=new GridData();
        params.maxDownloadSpeed=new GenericIntParameter(new GenericParameterAdapter(){
          @Override public int getIntValue(          String key){
            int limit=rls[0].getTagDownloadLimit();
            if (numTags > 1) {
              for (int i=1; i < rls.length; i++) {
                int nextLimit=rls[i].getTagDownloadLimit();
                if (nextLimit != limit) {
                  return 0;
                }
              }
            }
            return limit < 0 ? limit : limit / DisplayFormatters.getKinB();
          }
          @Override public int getIntValue(          String key,          int def){
            return getIntValue(key);
          }
          @Override public void setIntValue(          String key,          int value){
            for (            TagFeatureRateLimit rl : rls) {
              if (value == -1) {
                rl.setTagDownloadLimit(-1);
              }
 else {
                rl.setTagDownloadLimit(value * DisplayFormatters.getKinB());
              }
            }
          }
          @Override public boolean resetIntDefault(          String key){
            return false;
          }
        }
,gTransfer,null,-1,Integer.MAX_VALUE);
        params.maxDownloadSpeed.setLayoutData(gd);
        params.maxDownloadSpeed.setZeroHidden(numTags > 1);
        cols_used+=2;
      }
      if (supportsTagUploadLimit) {
        gd=new GridData();
        label=new Label(gTransfer,SWT.NULL);
        Utils.setLayoutData(label,gd);
        label.setText(k_unit + "String_Node_Str" + MessageText.getString("String_Node_Str"));
        gd=new GridData();
        params.maxUploadSpeed=new GenericIntParameter(new GenericParameterAdapter(){
          @Override public int getIntValue(          String key){
            int limit=rls[0].getTagUploadLimit();
            if (numTags > 1) {
              for (int i=1; i < rls.length; i++) {
                int nextLimit=rls[i].getTagUploadLimit();
                if (nextLimit != limit) {
                  return 0;
                }
              }
            }
            return limit < 0 ? limit : limit / DisplayFormatters.getKinB();
          }
          @Override public int getIntValue(          String key,          int def){
            return getIntValue(key);
          }
          @Override public void setIntValue(          String key,          int value){
            for (            TagFeatureRateLimit rl : rls) {
              if (value == -1) {
                rl.setTagUploadLimit(value);
              }
 else {
                rl.setTagUploadLimit(value * DisplayFormatters.getKinB());
              }
            }
          }
          @Override public boolean resetIntDefault(          String key){
            return false;
          }
        }
,gTransfer,null,-1,Integer.MAX_VALUE);
        params.maxUploadSpeed.setLayoutData(gd);
        params.maxUploadSpeed.setZeroHidden(numTags > 1);
        cols_used+=2;
      }
      if (hasTagUploadPriority) {
        params.uploadPriority=new GenericBooleanParameter(new BooleanParameterAdapter(){
          @Override public Boolean getBooleanValue(          String key){
            int value=-1;
            for (            TagFeatureRateLimit rl : rls) {
              value=updateIntBoolean(rl.getTagUploadPriority() > 0,value);
            }
            return value == 2 ? null : value == 1;
          }
          @Override public void setBooleanValue(          String key,          boolean value){
            for (            TagFeatureRateLimit rl : rls) {
              rl.setTagUploadPriority(value ? 1 : 0);
            }
          }
        }
,gTransfer,null,"String_Node_Str");
        gd=new GridData();
        gd.horizontalSpan=6 - cols_used;
        params.uploadPriority.setLayoutData(gd);
      }
      if (numTags == 1 && rls[0].getTagMinShareRatio() >= 0) {
        label=new Label(gTransfer,SWT.NONE);
        Messages.setLanguageText(label,"String_Node_Str");
        gd=new GridData(SWT.BEGINNING,SWT.CENTER,false,false);
        Utils.setLayoutData(label,gd);
        params.min_sr=new GenericFloatParameter(new GenericParameterAdapter(){
          @Override public float getFloatValue(          String key){
            return rls[0].getTagMinShareRatio() / 1000f;
          }
          @Override public void setFloatValue(          String key,          float value){
            rls[0].setTagMinShareRatio((int)(value * 1000));
          }
        }
,gTransfer,null,0,Float.MAX_VALUE,true,3);
        gd=new GridData();
        gd.widthHint=75;
        params.min_sr.setLayoutData(gd);
      }
      if (numTags == 1 && rls[0].getTagMaxShareRatio() >= 0) {
        label=new Label(gTransfer,SWT.NONE);
        Messages.setLanguageText(label,"String_Node_Str");
        gd=new GridData(SWT.BEGINNING,SWT.CENTER,false,false);
        Utils.setLayoutData(label,gd);
        params.max_sr=new GenericFloatParameter(new GenericParameterAdapter(){
          @Override public float getFloatValue(          String key){
            return rls[0].getTagMaxShareRatio() / 1000f;
          }
          @Override public void setFloatValue(          String key,          float value){
            rls[0].setTagMaxShareRatio((int)(value * 1000));
            updateTagSRParams(params);
          }
        }
,gTransfer,null,0,Float.MAX_VALUE,true,3);
        gd=new GridData();
        gd.widthHint=75;
        params.max_sr.setLayoutData(gd);
        String[] ST_ACTION_VALUES={"String_Node_Str" + TagFeatureRateLimit.SR_ACTION_QUEUE,"String_Node_Str" + TagFeatureRateLimit.SR_ACTION_PAUSE,"String_Node_Str" + TagFeatureRateLimit.SR_ACTION_STOP};
        String[] ST_ACTION_LABELS={MessageText.getString("String_Node_Str"),MessageText.getString("String_Node_Str"),MessageText.getString("String_Node_Str")};
        label=new Label(gTransfer,SWT.NONE);
        Messages.setLanguageText(label,"String_Node_Str");
        gd=new GridData(SWT.BEGINNING,SWT.CENTER,false,false);
        Utils.setLayoutData(label,gd);
        params.max_sr_action=new GenericStringListParameter(new GenericParameterAdapter(){
          @Override public String getStringListValue(          String key,          String def){
            return (getStringListValue(key));
          }
          @Override public String getStringListValue(          String key){
            return ("String_Node_Str" + rls[0].getTagMaxShareRatioAction());
          }
          @Override public void setStringListValue(          String key,          String value){
            rls[0].setTagMaxShareRatioAction(Integer.parseInt(value));
          }
        }
,gTransfer,"String_Node_Str","String_Node_Str" + TagFeatureRateLimit.SR_INDIVIDUAL_ACTION_DEFAULT,ST_ACTION_LABELS,ST_ACTION_VALUES);
      }
      if (numTags == 1 && rls[0].getTagAggregateShareRatio() >= 0) {
        label=new Label(gTransfer,SWT.NONE);
        Messages.setLanguageText(label,"String_Node_Str");
        gd=new GridData(SWT.BEGINNING,SWT.CENTER,false,false);
        Utils.setLayoutData(label,gd);
        params.max_aggregate_sr=new GenericFloatParameter(new GenericParameterAdapter(){
          @Override public float getFloatValue(          String key){
            return rls[0].getTagMaxAggregateShareRatio() / 1000f;
          }
          @Override public void setFloatValue(          String key,          float value){
            rls[0].setTagMaxAggregateShareRatio((int)(value * 1000));
            updateTagSRParams(params);
          }
        }
,gTransfer,null,0,Float.MAX_VALUE,true,3);
        gd=new GridData();
        gd.widthHint=75;
        params.max_aggregate_sr.setLayoutData(gd);
        String[] ST_ACTION_VALUES={"String_Node_Str" + TagFeatureRateLimit.SR_ACTION_PAUSE,"String_Node_Str" + TagFeatureRateLimit.SR_ACTION_STOP};
        String[] ST_ACTION_LABELS={MessageText.getString("String_Node_Str"),MessageText.getString("String_Node_Str")};
        label=new Label(gTransfer,SWT.NONE);
        Messages.setLanguageText(label,"String_Node_Str");
        gd=new GridData(SWT.BEGINNING,SWT.CENTER,false,false);
        Utils.setLayoutData(label,gd);
        params.max_aggregate_sr_action=new GenericStringListParameter(new GenericParameterAdapter(){
          @Override public String getStringListValue(          String key,          String def){
            return (getStringListValue(key));
          }
          @Override public String getStringListValue(          String key){
            return ("String_Node_Str" + rls[0].getTagMaxAggregateShareRatioAction());
          }
          @Override public void setStringListValue(          String key,          String value){
            rls[0].setTagMaxAggregateShareRatioAction(Integer.parseInt(value));
          }
        }
,gTransfer,"String_Node_Str","String_Node_Str" + TagFeatureRateLimit.SR_AGGREGATE_ACTION_DEFAULT,ST_ACTION_LABELS,ST_ACTION_VALUES);
        label=new Label(gTransfer,SWT.NONE);
        Messages.setLanguageText(label,"String_Node_Str");
        gd=new GridData(SWT.BEGINNING,SWT.CENTER,false,false);
        Utils.setLayoutData(label,gd);
        params.max_aggregate_sr_priority=new GenericBooleanParameter(new BooleanParameterAdapter(){
          @Override public Boolean getBooleanValue(          String key){
            return (rls[0].getTagMaxAggregateShareRatioHasPriority());
          }
          @Override public void setBooleanValue(          String key,          boolean value){
            rls[0].setTagMaxAggregateShareRatioHasPriority(value);
          }
        }
,gTransfer,"String_Node_Str",TagFeatureRateLimit.AT_RATELIMIT_MAX_AGGREGATE_SR_PRIORITY_DEFAULT);
        updateTagSRParams(params);
      }
    }
    if (numTags == 1 && (tags[0] instanceof TagFeatureFileLocation)) {
      final TagFeatureFileLocation fl=(TagFeatureFileLocation)tags[0];
      if (fl.supportsTagCopyOnComplete() || fl.supportsTagInitialSaveFolder() || fl.supportsTagMoveOnComplete()) {
        Group gFiles=new Group(cMainComposite,SWT.NONE);
        gFiles.setText(MessageText.getString("String_Node_Str"));
        gridLayout=new GridLayout(6,false);
        gFiles.setLayout(gridLayout);
        gd=new GridData(SWT.FILL,SWT.NONE,true,false,4,1);
        Utils.setLayoutData(gFiles,gd);
        if (fl.supportsTagInitialSaveFolder()) {
          params.initalSaveFolder=new folderOption(gFiles,"String_Node_Str"){
            @Override public void setFolder(            File folder){
              params.initalSaveData.setEnabled(folder != null);
              params.initalSaveTorrent.setEnabled(folder != null);
              fl.setTagInitialSaveFolder(folder);
            }
            @Override public File getFolder(){
              File result=fl.getTagInitialSaveFolder();
              params.initalSaveData.setEnabled(result != null);
              params.initalSaveTorrent.setEnabled(result != null);
              return (result);
            }
          }
;
          params.initalSaveData=new GenericBooleanParameter(new BooleanParameterAdapter(){
            @Override public Boolean getBooleanValue(            String key){
              return ((fl.getTagInitialSaveOptions() & TagFeatureFileLocation.FL_DATA) != 0);
            }
            @Override public void setBooleanValue(            String key,            boolean value){
              long flags=fl.getTagInitialSaveOptions();
              if (value) {
                flags|=TagFeatureFileLocation.FL_DATA;
              }
 else {
                flags&=~TagFeatureFileLocation.FL_DATA;
              }
              fl.setTagInitialSaveOptions(flags);
            }
          }
,gFiles,null,"String_Node_Str");
          params.initalSaveTorrent=new GenericBooleanParameter(new BooleanParameterAdapter(){
            @Override public Boolean getBooleanValue(            String key){
              return ((fl.getTagInitialSaveOptions() & TagFeatureFileLocation.FL_TORRENT) != 0);
            }
            @Override public void setBooleanValue(            String key,            boolean value){
              long flags=fl.getTagInitialSaveOptions();
              if (value) {
                flags|=TagFeatureFileLocation.FL_TORRENT;
              }
 else {
                flags&=~TagFeatureFileLocation.FL_TORRENT;
              }
              fl.setTagInitialSaveOptions(flags);
            }
          }
,gFiles,null,"String_Node_Str");
        }
        if (fl.supportsTagMoveOnComplete()) {
          params.moveOnCompleteFolder=new folderOption(gFiles,"String_Node_Str"){
            @Override public void setFolder(            File folder){
              params.moveOnCompleteData.setEnabled(folder != null);
              params.moveOnCompleteTorrent.setEnabled(folder != null);
              fl.setTagMoveOnCompleteFolder(folder);
            }
            @Override public File getFolder(){
              File result=fl.getTagMoveOnCompleteFolder();
              params.moveOnCompleteData.setEnabled(result != null);
              params.moveOnCompleteTorrent.setEnabled(result != null);
              return (result);
            }
          }
;
          params.moveOnCompleteData=new GenericBooleanParameter(new BooleanParameterAdapter(){
            @Override public Boolean getBooleanValue(            String key){
              return ((fl.getTagMoveOnCompleteOptions() & TagFeatureFileLocation.FL_DATA) != 0);
            }
            @Override public void setBooleanValue(            String key,            boolean value){
              long flags=fl.getTagMoveOnCompleteOptions();
              if (value) {
                flags|=TagFeatureFileLocation.FL_DATA;
              }
 else {
                flags&=~TagFeatureFileLocation.FL_DATA;
              }
              fl.setTagMoveOnCompleteOptions(flags);
            }
          }
,gFiles,null,"String_Node_Str");
          params.moveOnCompleteTorrent=new GenericBooleanParameter(new BooleanParameterAdapter(){
            @Override public Boolean getBooleanValue(            String key){
              return ((fl.getTagMoveOnCompleteOptions() & TagFeatureFileLocation.FL_TORRENT) != 0);
            }
            @Override public void setBooleanValue(            String key,            boolean value){
              long flags=fl.getTagMoveOnCompleteOptions();
              if (value) {
                flags|=TagFeatureFileLocation.FL_TORRENT;
              }
 else {
                flags&=~TagFeatureFileLocation.FL_TORRENT;
              }
              fl.setTagMoveOnCompleteOptions(flags);
            }
          }
,gFiles,null,"String_Node_Str");
        }
        if (fl.supportsTagCopyOnComplete()) {
          params.copyOnCompleteFolder=new folderOption(gFiles,"String_Node_Str"){
            @Override public void setFolder(            File folder){
              params.copyOnCompleteData.setEnabled(folder != null);
              params.copyOnCompleteTorrent.setEnabled(folder != null);
              fl.setTagCopyOnCompleteFolder(folder);
            }
            @Override public File getFolder(){
              File result=fl.getTagCopyOnCompleteFolder();
              params.copyOnCompleteData.setEnabled(result != null);
              params.copyOnCompleteTorrent.setEnabled(result != null);
              return (result);
            }
          }
;
          params.copyOnCompleteData=new GenericBooleanParameter(new BooleanParameterAdapter(){
            @Override public Boolean getBooleanValue(            String key){
              return ((fl.getTagCopyOnCompleteOptions() & TagFeatureFileLocation.FL_DATA) != 0);
            }
            @Override public void setBooleanValue(            String key,            boolean value){
              long flags=fl.getTagCopyOnCompleteOptions();
              if (value) {
                flags|=TagFeatureFileLocation.FL_DATA;
              }
 else {
                flags&=~TagFeatureFileLocation.FL_DATA;
              }
              fl.setTagCopyOnCompleteOptions(flags);
            }
          }
,gFiles,null,"String_Node_Str");
          params.copyOnCompleteTorrent=new GenericBooleanParameter(new BooleanParameterAdapter(){
            @Override public Boolean getBooleanValue(            String key){
              return ((fl.getTagCopyOnCompleteOptions() & TagFeatureFileLocation.FL_TORRENT) != 0);
            }
            @Override public void setBooleanValue(            String key,            boolean value){
              long flags=fl.getTagCopyOnCompleteOptions();
              if (value) {
                flags|=TagFeatureFileLocation.FL_TORRENT;
              }
 else {
                flags&=~TagFeatureFileLocation.FL_TORRENT;
              }
              fl.setTagCopyOnCompleteOptions(flags);
            }
          }
,gFiles,null,"String_Node_Str");
        }
      }
    }
    if (numTags == 1 && tags[0].getTagType().hasTagTypeFeature(TagFeature.TF_PROPERTIES) && (tags[0] instanceof TagFeatureProperties)) {
      TagFeatureProperties tfp=(TagFeatureProperties)tags[0];
      final TagProperty propConstraint=tfp.getProperty(TagFeatureProperties.PR_CONSTRAINT);
      if (propConstraint != null) {
        Group gConstraint=new Group(cMainComposite,SWT.NONE);
        Messages.setLanguageText(gConstraint,"String_Node_Str");
        gridLayout=new GridLayout(5,false);
        gConstraint.setLayout(gridLayout);
        gd=new GridData(SWT.FILL,SWT.NONE,true,false,4,1);
        Utils.setLayoutData(gConstraint,gd);
        params.constraints=new Text(gConstraint,SWT.WRAP | SWT.BORDER | SWT.MULTI);
        gd=new GridData(SWT.FILL,SWT.NONE,true,false,5,1);
        gd.heightHint=40;
        Utils.setLayoutData(params.constraints,gd);
        params.constraints.addKeyListener(new KeyListener(){
          @Override public void keyReleased(          KeyEvent e){
          }
          @Override public void keyPressed(          KeyEvent e){
            params.constraints.setData("String_Node_Str",1);
            if (btnSaveConstraint != null && !btnSaveConstraint.isDisposed()) {
              btnSaveConstraint.setEnabled(true);
              btnResetConstraint.setEnabled(true);
            }
          }
        }
);
        params.constraintError=new Label(gConstraint,SWT.NULL);
        params.constraintError.setForeground(Colors.colorError);
        gd=new GridData(SWT.FILL,SWT.NONE,true,false,5,1);
        Utils.setLayoutData(params.constraintError,gd);
        btnSaveConstraint=new Button(gConstraint,SWT.PUSH);
        btnSaveConstraint.setEnabled(false);
        btnSaveConstraint.addListener(SWT.Selection,new Listener(){
          @Override public void handleEvent(          Event event){
            String constraint=params.constraints.getText().trim();
            String[] old_value=propConstraint.getStringList();
            if (constraint.length() == 0) {
              propConstraint.setStringList(null);
            }
 else {
              String old_options=old_value.length > 1 && old_value[1] != null ? old_value[1] : "String_Node_Str";
              if (old_options.length() == 0) {
                old_options=CM_ADD_REMOVE;
              }
              propConstraint.setStringList(new String[]{constraint,old_options});
            }
            if (btnSaveConstraint != null && !btnSaveConstraint.isDisposed()) {
              btnSaveConstraint.setEnabled(false);
              btnResetConstraint.setEnabled(false);
            }
          }
        }
);
        Messages.setLanguageText(btnSaveConstraint,"String_Node_Str");
        btnResetConstraint=new Button(gConstraint,SWT.PUSH);
        btnResetConstraint.setEnabled(false);
        btnResetConstraint.addListener(SWT.Selection,new Listener(){
          @Override public void handleEvent(          Event event){
            params.constraints.setData("String_Node_Str",null);
            swt_updateFields();
            if (btnSaveConstraint != null && !btnSaveConstraint.isDisposed()) {
              btnSaveConstraint.setEnabled(false);
              btnResetConstraint.setEnabled(false);
            }
          }
        }
);
        Messages.setLanguageText(btnResetConstraint,"String_Node_Str");
        Label constraintMode=new Label(gConstraint,SWT.NULL);
        Messages.setLanguageText(constraintMode,"String_Node_Str");
        String[] CM_VALUES={CM_ADD_REMOVE,CM_ADD_ONLY,CM_REMOVE_ONLY};
        String[] CM_LABELS={MessageText.getString("String_Node_Str"),MessageText.getString("String_Node_Str"),MessageText.getString("String_Node_Str")};
        params.constraintMode=new GenericStringListParameter(new GenericParameterAdapter(){
          @Override public String getStringListValue(          String key,          String def){
            return (getStringListValue(key));
          }
          @Override public String getStringListValue(          String key){
            String[] list=propConstraint.getStringList();
            if (list.length > 1 && list[1] != null) {
              return (list[1]);
            }
 else {
              return (CM_ADD_REMOVE);
            }
          }
          @Override public void setStringListValue(          String key,          String value){
            if (value == null || value.length() == 0) {
              value=CM_ADD_REMOVE;
            }
            String[] list=propConstraint.getStringList();
            propConstraint.setStringList(new String[]{list != null && list.length > 0 ? list[0] : "String_Node_Str",value});
          }
        }
,gConstraint,"String_Node_Str",CM_ADD_REMOVE,CM_LABELS,CM_VALUES);
        Link lblAboutConstraint=new Link(gConstraint,SWT.WRAP);
        Utils.setLayoutData(lblAboutConstraint,Utils.getWrappableLabelGridData(1,GridData.GRAB_HORIZONTAL));
        lblAboutConstraint.setText(MessageText.getString("String_Node_Str"));
        lblAboutConstraint.addListener(SWT.Selection,new Listener(){
          @Override public void handleEvent(          Event event){
            if (event.text != null && (event.text.startsWith("String_Node_Str") || event.text.startsWith("String_Node_Str"))) {
              Utils.launch(event.text);
            }
          }
        }
);
      }
    }
    if (numTags == 1 && tags[0].getTagType().hasTagTypeFeature(TagFeature.TF_LIMITS)) {
      final TagFeatureLimits tfl=(TagFeatureLimits)tags[0];
      if (tfl.getMaximumTaggables() >= 0) {
        Group gLimits=new Group(cMainComposite,SWT.NONE);
        gLimits.setText(MessageText.getString("String_Node_Str"));
        gridLayout=new GridLayout(6,false);
        gLimits.setLayout(gridLayout);
        gd=new GridData(SWT.FILL,SWT.NONE,false,false,4,1);
        gLimits.setLayoutData(gd);
        label=new Label(gLimits,SWT.NONE);
        Messages.setLanguageText(label,"String_Node_Str");
        gd=new GridData(SWT.BEGINNING,SWT.CENTER,false,false);
        Utils.setLayoutData(label,gd);
        params.tfl_max_taggables=new GenericIntParameter(new GenericParameterAdapter(){
          @Override public int getIntValue(          String key){
            return tfl.getMaximumTaggables();
          }
          @Override public int getIntValue(          String key,          int def){
            return getIntValue(key);
          }
          @Override public void setIntValue(          String key,          int value){
            tfl.setMaximumTaggables(value);
          }
        }
,gLimits,null,0,Integer.MAX_VALUE);
        params.tfl_max_taggables.disableTimedSave();
        gd=new GridData();
        gd.widthHint=50;
        params.tfl_max_taggables.setLayoutData(gd);
        label=new Label(gLimits,SWT.NONE);
        Messages.setLanguageText(label,"String_Node_Str");
        params.tfl_removal_policy=new GenericStringListParameter(new GenericParameterAdapter(){
          @Override public String getStringListValue(          String key){
            return (String.valueOf(tfl.getRemovalStrategy()));
          }
          @Override public String getStringListValue(          String key,          String def){
            return (getStringListValue(key));
          }
          @Override public void setStringListValue(          String key,          String value){
            tfl.setRemovalStrategy(value == null ? TagFeatureLimits.RS_DEFAULT : Integer.parseInt(value));
          }
        }
,gLimits,null,new String[]{"String_Node_Str",MessageText.getString("String_Node_Str"),MessageText.getString("String_Node_Str"),MessageText.getString("String_Node_Str"),MessageText.getString("String_Node_Str")},new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"});
        label=new Label(gLimits,SWT.NONE);
        Messages.setLanguageText(label,"String_Node_Str");
        params.tfl_ordering=new GenericStringListParameter(new GenericParameterAdapter(){
          @Override public String getStringListValue(          String key){
            return (String.valueOf(tfl.getOrdering()));
          }
          @Override public String getStringListValue(          String key,          String def){
            return (getStringListValue(key));
          }
          @Override public void setStringListValue(          String key,          String value){
            tfl.setOrdering(value == null ? TagFeatureLimits.OP_DEFAULT : Integer.parseInt(value));
          }
        }
,gLimits,null,new String[]{MessageText.getString("String_Node_Str"),MessageText.getString("String_Node_Str")},new String[]{"String_Node_Str","String_Node_Str"});
      }
    }
    if (numTags == 1 && tags[0].getTagType().hasTagTypeFeature(TagFeature.TF_NOTIFICATIONS)) {
      final TagFeatureNotifications tfn=(TagFeatureNotifications)tags[0];
      Group gNotifications=new Group(cMainComposite,SWT.NONE);
      gNotifications.setText(MessageText.getString("String_Node_Str"));
      gridLayout=new GridLayout(6,false);
      gNotifications.setLayout(gridLayout);
      gd=new GridData(SWT.FILL,SWT.NONE,false,false,4,1);
      gNotifications.setLayoutData(gd);
      label=new Label(gNotifications,SWT.NONE);
      label.setText(MessageText.getString("String_Node_Str") + "String_Node_Str");
      params.notification_post_add=new GenericBooleanParameter(new BooleanParameterAdapter(){
        @Override public Boolean getBooleanValue(        String key){
          return ((tfn.getPostingNotifications() & TagFeatureNotifications.NOTIFY_ON_ADD) != 0);
        }
        @Override public void setBooleanValue(        String key,        boolean value){
          int flags=tfn.getPostingNotifications();
          if (value) {
            flags|=TagFeatureNotifications.NOTIFY_ON_ADD;
          }
 else {
            flags&=~TagFeatureNotifications.NOTIFY_ON_ADD;
          }
          tfn.setPostingNotifications(flags);
        }
      }
,gNotifications,null,"String_Node_Str");
      params.notification_post_remove=new GenericBooleanParameter(new BooleanParameterAdapter(){
        @Override public Boolean getBooleanValue(        String key){
          return ((tfn.getPostingNotifications() & TagFeatureNotifications.NOTIFY_ON_REMOVE) != 0);
        }
        @Override public void setBooleanValue(        String key,        boolean value){
          int flags=tfn.getPostingNotifications();
          if (value) {
            flags|=TagFeatureNotifications.NOTIFY_ON_REMOVE;
          }
 else {
            flags&=~TagFeatureNotifications.NOTIFY_ON_REMOVE;
          }
          tfn.setPostingNotifications(flags);
        }
      }
,gNotifications,null,"String_Node_Str");
    }
    swt_updateFields();
  }
  cMainComposite.layout();
  Rectangle r=sc.getClientArea();
  sc.setMinSize(cMainComposite.computeSize(r.width,SWT.DEFAULT));
}