Search in sources :

Example 6 with CheckConfigurationWorkingCopy

use of net.sf.eclipsecs.core.config.CheckConfigurationWorkingCopy in project eclipse-cs by checkstyle.

the class CheckConfigurationWorkingSetEditor method addCheckConfig.

/**
 * Create a new Check configuration.
 */
private void addCheckConfig() {
    CheckConfigurationPropertiesDialog dialog = new CheckConfigurationPropertiesDialog(getShell(), null, mWorkingSet);
    dialog.setBlockOnOpen(true);
    if (Window.OK == dialog.open()) {
        CheckConfigurationWorkingCopy newConfig = dialog.getCheckConfiguration();
        mWorkingSet.addCheckConfiguration(newConfig);
        mViewer.setInput(mWorkingSet.getWorkingCopies());
        mViewer.refresh(true);
    }
}
Also used : CheckConfigurationWorkingCopy(net.sf.eclipsecs.core.config.CheckConfigurationWorkingCopy)

Example 7 with CheckConfigurationWorkingCopy

use of net.sf.eclipsecs.core.config.CheckConfigurationWorkingCopy in project eclipse-cs by checkstyle.

the class CheckConfigurationWorkingSetEditor method removeCheckConfig.

/**
 * Remove a config.
 */
private void removeCheckConfig() {
    IStructuredSelection selection = (IStructuredSelection) mViewer.getSelection();
    CheckConfigurationWorkingCopy checkConfig = (CheckConfigurationWorkingCopy) selection.getFirstElement();
    if (checkConfig == null || !checkConfig.isEditable()) {
        // 
        return;
    }
    boolean confirm = MessageDialog.openQuestion(getShell(), Messages.CheckstylePreferencePage_titleDelete, NLS.bind(Messages.CheckstylePreferencePage_msgDelete, checkConfig.getName()));
    if (confirm) {
        // 
        if (mWorkingSet.removeCheckConfiguration(checkConfig)) {
            mViewer.setInput(mWorkingSet.getWorkingCopies());
            mViewer.refresh();
        } else {
            MessageDialog.openInformation(getShell(), Messages.CheckstylePreferencePage_titleCantDelete, NLS.bind(Messages.CheckstylePreferencePage_msgCantDelete, checkConfig.getName()));
            return;
        }
    }
}
Also used : CheckConfigurationWorkingCopy(net.sf.eclipsecs.core.config.CheckConfigurationWorkingCopy) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Aggregations

CheckConfigurationWorkingCopy (net.sf.eclipsecs.core.config.CheckConfigurationWorkingCopy)7 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 ICheckConfiguration (net.sf.eclipsecs.core.config.ICheckConfiguration)2 CheckstylePluginException (net.sf.eclipsecs.core.util.CheckstylePluginException)2 GlobalCheckConfigurationWorkingSet (net.sf.eclipsecs.core.config.GlobalCheckConfigurationWorkingSet)1 FileMatchPattern (net.sf.eclipsecs.core.projectconfig.FileMatchPattern)1 FileSet (net.sf.eclipsecs.core.projectconfig.FileSet)1