Skip to content

Commit

Permalink
bumping version
Browse files Browse the repository at this point in the history
  • Loading branch information
Horváth Dávid committed May 14, 2021
2 parents a94901f + bdeb2de commit 98838e5
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;

import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;

import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.sed.ifl.control.score.filter.Rule;
import org.eclipse.sed.ifl.control.score.filter.StringRule;
Expand Down Expand Up @@ -111,15 +115,33 @@ public void widgetDefaultSelected(SelectionEvent e) {

}

@Override
public Rule getRule() {
private boolean isInputValid(String input) {
//checking if input is empty or consists of only whitespace chars
String validation = text.getText().trim();
validation.replaceAll("\\s+","");
if(!validation.equals("")) {
return new StringRule(this.domain, text.getText(), matchingButton.getSelection(), caseButton.getSelection(), regexButton.getSelection());
} else {
if(validation.equals("")) {
MessageDialog.open(MessageDialog.ERROR, null, "Empty string input", "The provided input is an empty string."
+ " Please enter a string that is not empty.", SWT.NONE);
return false;
}
//checking if regex is valid
if (regexButton.getSelection()) {
try {
Pattern.compile(input);
} catch (PatternSyntaxException e) {
MessageDialog.open(MessageDialog.ERROR, null, "Invalid regular expression", "The provided regular expression is invalid."
+ " Please enter a valid regular expression.", SWT.NONE);
return false;
}
}
return true;
}

@Override
public Rule getRule() {
if(isInputValid(text.getText())) {
return new StringRule(this.domain, text.getText(), matchingButton.getSelection(), caseButton.getSelection(), regexButton.getSelection());
} else {
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feature
id="org.eclipse.sed.ifl.feature"
label="iFL for Eclipse"
version="3.3.0.0"
version="3.4.0.0"
provider-name="University of Szeged Department of Software Engineering">

<description url="https://github.com/sed-szeged/iFL4Eclipse">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature url="features/org.eclipse.sed.ifl.feature_3.1.0.0.jar" id="org.eclipse.sed.ifl.feature" version="3.3.0.0">
<feature url="features/org.eclipse.sed.ifl.feature_3.1.0.0.jar" id="org.eclipse.sed.ifl.feature" version="3.4.0.0">
<category name="iFL for Eclipse"/>
</feature>
<category-def name="iFL for Eclipse" label="iFL for Eclipse"/>
Expand Down

0 comments on commit 98838e5

Please sign in to comment.