use of org.omegat.filters2.Instance in project omegat by omegat-org.
the class FilterEditor method removeButtonActionPerformed.
// </editor-fold>//GEN-END:initComponents
private void removeButtonActionPerformed(java.awt.event.ActionEvent evt) {
// GEN-FIRST:event_removeButtonActionPerformed
int row = instances.getSelectedRow();
Files instance = filter.getFiles().get(row);
if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(this, StringUtil.format(OStrings.getString("FILTEREDITOR_really_delete_filter_instance"), instance.getSourceFilenameMask()), OStrings.getString("FILTEREDITOR_Confirm_deletion_TITLE"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE)) {
filter.getFiles().remove(row);
instances.setModel(new OneFilterTableModel(filter));
}
}
use of org.omegat.filters2.Instance in project TOSCAna by StuPro-TOSCAna.
the class CloudFormationModule method build.
/**
* Build the template
* 1. Add CFNInit to corresponding instance resource
* 2. Check if EC2 instances need access to S3. If yes, then
* 2a. Add necessary IAM resources to the module
* 2b. Add <tt>Authentication<tt> and <tt>IamInstanceProfile<tt> to corresponding instance resource
*/
@Override
public void build() {
for (Map.Entry<String, CFNInit> pair : cfnInitMap.entrySet()) {
Resource res = this.getResource(pair.getKey());
if (res instanceof Instance) {
Instance instance = (Instance) res;
if (!pair.getValue().getConfigs().isEmpty()) {
instance.addCFNInit(pair.getValue()).userData(new UserData(getUserDataFn(pair.getKey(), CONFIG_SETS, this)));
}
}
}
if (!fileUploadList.isEmpty()) {
Role instanceRole = getS3InstanceRole(this);
getS3Policy(this).roles(instanceRole);
getS3InstanceProfile(this).roles(instanceRole);
Authentication s3authentication = getS3Authentication(bucketName);
for (String instanceName : authenticationSet) {
Resource res = this.getResource(instanceName);
if (res instanceof Instance) {
Instance instance = (Instance) res;
instance.authentication(s3authentication).iamInstanceProfile(ref(INSTANCE_PROFILE));
}
}
}
if (this.hasKeyPair()) {
strParam(KEYNAME).type(KEYNAME_TYPE).description(KEYNAME_DESCRIPTION).constraintDescription(KEYNAME_CONSTRAINT_DESCRIPTION);
}
}
use of org.omegat.filters2.Instance in project omegat by omegat-org.
the class FilterMaster method getDefaultSettingsFromFilter.
/**
* Create default filter's config.
*
* @param filterClassname
* filter's classname
* @return default filter's config
*/
public static Filter getDefaultSettingsFromFilter(final String filterClassname) {
IFilter f = getFilterInstance(filterClassname);
if (f == null) {
return null;
}
Filter fc = new Filter();
fc.setClassName(f.getClass().getName());
fc.setEnabled(true);
for (Instance ins : f.getDefaultInstances()) {
Files ff = new Files();
ff.setSourceEncoding(ins.getSourceEncoding());
ff.setSourceFilenameMask(ins.getSourceFilenameMask());
ff.setTargetEncoding(ins.getTargetEncoding());
ff.setTargetFilenamePattern(ins.getTargetFilenamePattern());
fc.getFiles().add(ff);
}
return fc;
}
use of org.omegat.filters2.Instance in project omegat by omegat-org.
the class FilterMaster method cloneConfig.
/**
* Clone config for editing
*
* @return new config instance
*/
public static Filters cloneConfig(Filters orig) {
Filters c = new Filters();
c.setRemoveTags(orig.isRemoveTags());
c.setRemoveSpacesNonseg(orig.isRemoveSpacesNonseg());
c.setPreserveSpaces(orig.isPreserveSpaces());
c.setIgnoreFileContext(orig.isIgnoreFileContext());
for (Filter f : orig.getFilters()) {
c.getFilters().add(cloneFilter(f));
}
return c;
}
Aggregations