public void fromString (String data) { super.fromString(data); boolean tmpBool1 = buffer.getBoolean(USELD, locDir.useLD()); boolean tmpBool2 = buffer.getBoolean(LOCALIZEOUTSIDE, locDir.localizeOutside()); locDir.setOptions(tmpBool1, tmpBool2); codeFinder.fromString(buffer.getGroup(CODEFINDERRULES, "")); }
@Override public String toString () { buffer.setBoolean(USELD, localizationDirectives.useLD()); buffer.setBoolean(LOCALIZEOUTSIDE, localizationDirectives.localizeOutside()); buffer.setInteger("ruleCount", rules.size()); for ( int i=0; i<rules.size(); i++ ) { buffer.setGroup(String.format("rule%d", i), rules.get(i).toString()); } return super.toString(); }
params.locDir.process(tmp); skel.append(textLine); skel.append(lineBreak); if (params.locDir.isWithinScope()) { extract = params.locDir.isLocalizable(true); } else { // Check for key condition if (keyConditionPattern != null) { extract = params.locDir.localizeOutside();
/** * Resets this localization directives processor. */ public void reset () { context = new Stack<Context>(); setOptions(true, true); }
params.getLocalizationDirectives().process(result.group(rule.sourceGroup)); if ( !params.getLocalizationDirectives().isLocalizable(true) ) {
public void reset () { super.reset(); setRegexOptions(Pattern.DOTALL | Pattern.MULTILINE); setStartString("\""); setEndString("\""); setExtractOuterStrings(false); setUseBSlashEscape(true); setUseDoubleCharEscape(false); setMimeType("text/plain"); setOneLevelGroups(false); rules = new ArrayList<Rule>(); localizationDirectives = new LocalizationDirectives(); setSimplifierRules(null); }
@Override public String toString () { buffer.setBoolean(USELD, locDir.useLD()); buffer.setBoolean(LOCALIZEOUTSIDE, locDir.localizeOutside()); buffer.setGroup(CODEFINDERRULES, codeFinder.toString()); return super.toString(); }
private boolean saveData () { String tmp = pnlCodeFinder.getRules(); if ( tmp == null ) { return false; } else { params.codeFinder.fromString(tmp); } params.locDir.setOptions(pnlLD.getUseLD(), pnlLD.getLocalizeOutside()); params.setUseKeyCondition(chkUseKeyFilter.getSelection()); params.setKeyCondition(edKeyCondition.getText()); params.setExtractOnlyMatchingKey(rdExtractOnlyMatchingKey.getSelection()); params.setExtraComments(chkExtraComments.getSelection()); params.setCommentsAreNotes(chkCommentsAreNotes.getSelection()); params.setEscapeExtendedChars(chkEscapeExtendedChars.getSelection()); params.setIdLikeResname(chkIdLikeResname.getSelection()); params.setUseCodeFinder(chkUseCodeFinder.getSelection()); params.setConvertLFandTab(chkConvertLFAndTab.getSelection()); params.setSubfilter(edSubFilter.getText().trim()); return true; }
public void reset () { super.reset(); locDir = new LocalizationDirectives(); setEscapeExtendedChars(true); setConvertLFandTab(true); setUseKeyCondition(false);; setExtractOnlyMatchingKey(true); setKeyCondition(".*text.*"); setExtraComments(false); setCommentsAreNotes(true); setSubfilter(null); setIdLikeResname(false); setUseCodeFinder(true); codeFinder = new InlineCodeFinder(); codeFinder.setSample("%s, %d, {1}, \\n, \\r, \\t, etc."); codeFinder.setUseAllRulesWhenTesting(true); // Default in-line codes: special escaped-chars and printf-style variable codeFinder.addRule("%(([-0+#]?)[-0+#]?)((\\d\\$)?)(([\\d\\*]*)(\\.[\\d\\*]*)?)[dioxXucsfeEgGpn]"); codeFinder.addRule("(\\\\r\\\\n)|\\\\a|\\\\b|\\\\f|\\\\n|\\\\r|\\\\t|\\\\v"); //TODO: Add Java-style variables. this is too basic codeFinder.addRule("\\{\\d[^\\\\]*?\\}"); // Basic HTML/XML codeFinder.addRule("\\<(/?)\\w+[^>]*?>"); setSimplifierRules(null); }
public void fromString (String data) { super.fromString(data); boolean tmpBool1 = buffer.getBoolean(USELD, localizationDirectives.useLD()); boolean tmpBool2 = buffer.getBoolean(LOCALIZEOUTSIDE, localizationDirectives.localizeOutside()); localizationDirectives.setOptions(tmpBool1, tmpBool2); Rule rule; int count = buffer.getInteger("ruleCount", 0); for ( int i=0; i<count; i++ ) { rule = new Rule(); rule.fromString(buffer.getGroup(String.format("rule%d", i), null)); rules.add(rule); } }
private void setData () { pnlLD.setOptions(params.locDir.useLD(), params.locDir.localizeOutside()); edKeyCondition.setText(params.getKeyCondition()); rdExtractOnlyMatchingKey.setSelection(params.isExtractOnlyMatchingKey()); rdExcludeMatchingKey.setSelection(!params.isExtractOnlyMatchingKey()); chkUseKeyFilter.setSelection(params.isUseKeyCondition()); chkExtraComments.setSelection(params.isExtraComments()); chkCommentsAreNotes.setSelection(params.isCommentsAreNotes()); chkEscapeExtendedChars.setSelection(params.isEscapeExtendedChars()); chkIdLikeResname.setSelection(params.isIdLikeResname()); chkUseCodeFinder.setSelection(params.isUseCodeFinder()); pnlCodeFinder.setRules(params.codeFinder.toString()); chkConvertLFAndTab.setSelection(params.isConvertLFandTab()); String tmp = params.getSubfilter(); edSubFilter.setText(Util.isEmpty(tmp) ? "" : tmp); updateInlineCodes(); pnlCodeFinder.updateDisplay(); pnlLD.updateDisplay(); updateKeyFilter(); }
private void saveData () { saveRuleData(ruleIndex); //TODO: validation params.getLocalizationDirectives().setOptions(pnlLD.getUseLD(), pnlLD.getLocalizeOutside()); // params.setExtractOuterStrings(chkExtractOuterStrings.getSelection()); params.setStartString(edStartString.getText()); params.setEndString(edEndString.getText()); params.setUseBSlashEscape(chkUseBSlashEscape.getSelection()); params.setUseDoubleCharEscape(chkUseDoubleCharEscape.getSelection()); params.setMimeType(edMimeType.getText()); ArrayList<Rule> paramRules = params.getRules(); paramRules.clear(); for ( Rule rule : rules ) { paramRules.add(rule); } params.setOneLevelGroups(chkOneLevelGroups.getSelection()); params.setRegexOptions(getRegexOptions()); result = true; }
private void setData () { pnlLD.setOptions(params.getLocalizationDirectives().useLD(), params.getLocalizationDirectives().localizeOutside()); // chkExtractOuterStrings.setSelection(params.getExtractOuterStrings()); edStartString.setText(params.getStartString()); edEndString.setText(params.getEndString()); chkUseBSlashEscape.setSelection(params.getUseBSlashEscape()); chkUseDoubleCharEscape.setSelection(params.getUseDoubleCharEscape()); edMimeType.setText(params.getMimeType()); for ( Rule rule : rules ) { lbRules.add(rule.getRuleName()); } chkOneLevelGroups.setSelection(params.getOneLevelGroups()); int tmp = params.getRegexOptions(); chkDotAll.setSelection((tmp & Pattern.DOTALL)==Pattern.DOTALL); chkIgnoreCase.setSelection((tmp & Pattern.CASE_INSENSITIVE)==Pattern.CASE_INSENSITIVE); chkMultiline.setSelection((tmp & Pattern.MULTILINE)==Pattern.MULTILINE); pnlLD.updateDisplay(); if ( lbRules.getItemCount() > 0 ) lbRules.select(0); updateRule(); updateRuleButtons(); }