use of net.sf.eclipsecs.core.projectconfig.FileMatchPattern in project eclipse-cs by checkstyle.
the class FileMatchPatternEditDialog method okPressed.
/**
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
*/
@Override
protected void okPressed() {
String pattern = mFileMatchPatternText.getText();
try {
//
// Try compiling the pattern using the regular expression compiler.
//
Pattern.compile(pattern);
if (mPattern == null) {
mPattern = new FileMatchPattern(pattern);
} else {
mPattern.setMatchPattern(pattern);
}
mPattern.setIsIncludePattern(mIncludeButton.getSelection());
} catch (PatternSyntaxException e) {
this.setErrorMessage(e.getLocalizedMessage());
return;
} catch (CheckstylePluginException e) {
this.setErrorMessage(e.getLocalizedMessage());
return;
}
super.okPressed();
}
use of net.sf.eclipsecs.core.projectconfig.FileMatchPattern in project eclipse-cs by checkstyle.
the class FileSetEditDialog method downFileMatchPattern.
private void downFileMatchPattern() {
IStructuredSelection selection = (IStructuredSelection) mPatternViewer.getSelection();
FileMatchPattern pattern = (FileMatchPattern) selection.getFirstElement();
if (pattern == null) {
//
return;
}
int index = mFileSet.getFileMatchPatterns().indexOf(pattern);
if ((index >= 0) && (index < mFileSet.getFileMatchPatterns().size() - 1)) {
mFileSet.getFileMatchPatterns().remove(pattern);
if (index < mFileSet.getFileMatchPatterns().size() - 1) {
mFileSet.getFileMatchPatterns().add(index + 1, pattern);
} else {
mFileSet.getFileMatchPatterns().add(pattern);
}
mPatternViewer.refresh();
}
}
use of net.sf.eclipsecs.core.projectconfig.FileMatchPattern in project eclipse-cs by checkstyle.
the class FileSetEditDialog method editFileMatchPattern.
private void editFileMatchPattern() {
IStructuredSelection selection = (IStructuredSelection) mPatternViewer.getSelection();
FileMatchPattern pattern = (FileMatchPattern) selection.getFirstElement();
if (pattern == null) {
//
return;
}
FileMatchPatternEditDialog dialog = new FileMatchPatternEditDialog(getShell(), pattern.clone());
if (Window.OK == dialog.open()) {
FileMatchPattern editedPattern = dialog.getPattern();
mFileSet.getFileMatchPatterns().set(mFileSet.getFileMatchPatterns().indexOf(pattern), editedPattern);
mPatternViewer.refresh();
mPatternViewer.setChecked(editedPattern, editedPattern.isIncludePattern());
}
}
use of net.sf.eclipsecs.core.projectconfig.FileMatchPattern in project eclipse-cs by checkstyle.
the class FileSetEditDialog method addFileMatchPattern.
private void addFileMatchPattern() {
FileMatchPatternEditDialog dialog = new FileMatchPatternEditDialog(getShell(), null);
if (Window.OK == dialog.open()) {
FileMatchPattern pattern = dialog.getPattern();
mFileSet.getFileMatchPatterns().add(pattern);
mPatternViewer.refresh();
mPatternViewer.setChecked(pattern, pattern.isIncludePattern());
}
}
use of net.sf.eclipsecs.core.projectconfig.FileMatchPattern in project eclipse-cs by checkstyle.
the class FileSetEditDialog method upFileMatchPattern.
private void upFileMatchPattern() {
IStructuredSelection selection = (IStructuredSelection) mPatternViewer.getSelection();
FileMatchPattern pattern = (FileMatchPattern) selection.getFirstElement();
if (pattern == null) {
//
return;
}
int index = mFileSet.getFileMatchPatterns().indexOf(pattern);
if (index > 0) {
mFileSet.getFileMatchPatterns().remove(pattern);
mFileSet.getFileMatchPatterns().add(index - 1, pattern);
mPatternViewer.refresh();
}
}
Aggregations