Search in sources :

Example 6 with FileMatchPattern

use of net.sf.eclipsecs.core.projectconfig.FileMatchPattern in project eclipse-cs by checkstyle.

the class FileSetEditDialog method initializeControls.

/**
 * Initializes the controls with their data.
 */
private void initializeControls() {
    // init the check configuration combo
    mComboViewer.setInput(mPropertyPage.getProjectConfigurationWorkingCopy());
    this.setTitleImage(CheckstyleUIPluginImages.getImage(CheckstyleUIPluginImages.PLUGIN_LOGO));
    this.setMessage(Messages.FileSetEditDialog_message);
    if (mIsCreatingNewFileset) {
        this.setTitle(Messages.FileSetEditDialog_titleCreate);
    } else {
        this.setTitle(Messages.FileSetEditDialog_titleEdit);
    }
    // intitialize the name
    // $NON-NLS-1$
    mFileSetNameText.setText(mFileSet.getName() != null ? mFileSet.getName() : "");
    // init the check configuration combo
    if (mFileSet.getCheckConfig() != null) {
        mComboViewer.setSelection(new StructuredSelection(mFileSet.getCheckConfig()));
    }
    // init the pattern area
    mPatternViewer.setInput(mFileSet.getFileMatchPatterns());
    for (FileMatchPattern pattern : mFileSet.getFileMatchPatterns()) {
        mPatternViewer.setChecked(pattern, pattern.isIncludePattern());
    }
    getShell().getDisplay().asyncExec(new Runnable() {

        @Override
        public void run() {
            mMatchGroup.setText(Messages.FileSetEditDialog_msgBuildTestResults);
            try {
                mProjectFiles = getFiles(mProject);
            } catch (CoreException e) {
                CheckstyleLog.log(e);
            }
            // init the test area
            mMatchesViewer.setInput(mProjectFiles);
            updateMatchView();
        }
    });
}
Also used : FileMatchPattern(net.sf.eclipsecs.core.projectconfig.FileMatchPattern) CoreException(org.eclipse.core.runtime.CoreException) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection)

Example 7 with FileMatchPattern

use of net.sf.eclipsecs.core.projectconfig.FileMatchPattern in project eclipse-cs by checkstyle.

the class FileSetEditDialog method removeFileMatchPattern.

private void removeFileMatchPattern() {
    IStructuredSelection selection = (IStructuredSelection) mPatternViewer.getSelection();
    FileMatchPattern pattern = (FileMatchPattern) selection.getFirstElement();
    if (pattern == null) {
        // 
        return;
    }
    mFileSet.getFileMatchPatterns().remove(pattern);
    mPatternViewer.refresh();
}
Also used : FileMatchPattern(net.sf.eclipsecs.core.projectconfig.FileMatchPattern) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 8 with FileMatchPattern

use of net.sf.eclipsecs.core.projectconfig.FileMatchPattern in project eclipse-cs by checkstyle.

the class SimpleFileSetsEditor method setFileSets.

/**
 * {@inheritDoc}
 */
@Override
public void setFileSets(List<FileSet> fileSets) throws CheckstylePluginException {
    mFileSets = fileSets;
    ICheckConfiguration config = null;
    if (mFileSets.size() > 0) {
        config = (mFileSets.get(0)).getCheckConfig();
    }
    if (config == null) {
        CheckConfigurationWorkingCopy[] allConfigs = mPropertyPage.getProjectConfigurationWorkingCopy().getGlobalCheckConfigWorkingSet().getWorkingCopies();
        if (allConfigs.length > 0) {
            config = allConfigs[0];
        }
    }
    mDefaultFileSet = new FileSet(Messages.SimpleFileSetsEditor_nameAllFileset, config);
    // $NON-NLS-1$
    mDefaultFileSet.getFileMatchPatterns().add(new FileMatchPattern("."));
    mFileSets.clear();
    mFileSets.add(mDefaultFileSet);
}
Also used : FileMatchPattern(net.sf.eclipsecs.core.projectconfig.FileMatchPattern) FileSet(net.sf.eclipsecs.core.projectconfig.FileSet) ICheckConfiguration(net.sf.eclipsecs.core.config.ICheckConfiguration) CheckConfigurationWorkingCopy(net.sf.eclipsecs.core.config.CheckConfigurationWorkingCopy)

Aggregations

FileMatchPattern (net.sf.eclipsecs.core.projectconfig.FileMatchPattern)8 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)5 PatternSyntaxException (java.util.regex.PatternSyntaxException)1 CheckConfigurationWorkingCopy (net.sf.eclipsecs.core.config.CheckConfigurationWorkingCopy)1 ICheckConfiguration (net.sf.eclipsecs.core.config.ICheckConfiguration)1 FileSet (net.sf.eclipsecs.core.projectconfig.FileSet)1 CheckstylePluginException (net.sf.eclipsecs.core.util.CheckstylePluginException)1 CoreException (org.eclipse.core.runtime.CoreException)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1