use of net.sf.eclipsecs.core.config.CheckConfigurationWorkingCopy in project eclipse-cs by checkstyle.
the class CheckConfigurationWorkingSetEditor method copyCheckConfig.
/**
* Copy an existing config.
*/
private void copyCheckConfig() {
IStructuredSelection selection = (IStructuredSelection) mViewer.getSelection();
ICheckConfiguration sourceConfig = (ICheckConfiguration) selection.getFirstElement();
if (sourceConfig == null) {
//
return;
}
try {
// Open the properties dialog to change default name and description
CheckConfigurationPropertiesDialog dialog = new CheckConfigurationPropertiesDialog(getShell(), null, mWorkingSet);
dialog.setTemplateConfiguration(sourceConfig);
dialog.setBlockOnOpen(true);
if (Window.OK == dialog.open()) {
CheckConfigurationWorkingCopy newConfig = dialog.getCheckConfiguration();
// Copy the source configuration into the new internal config
CheckConfigurationFactory.copyConfiguration(sourceConfig, newConfig);
mWorkingSet.addCheckConfiguration(newConfig);
mViewer.setInput(mWorkingSet.getWorkingCopies());
mViewer.refresh();
}
} catch (CheckstylePluginException e) {
CheckstyleUIPlugin.errorDialog(getShell(), e, true);
}
}
use of net.sf.eclipsecs.core.config.CheckConfigurationWorkingCopy in project eclipse-cs by checkstyle.
the class CheckConfigurationWorkingSetEditor method configureCheckConfig.
private void configureCheckConfig() {
CheckConfigurationWorkingCopy config = (CheckConfigurationWorkingCopy) ((IStructuredSelection) mViewer.getSelection()).getFirstElement();
if (config != null) {
try {
// test if file exists
config.getCheckstyleConfiguration();
CheckConfigurationConfigureDialog dialog = new CheckConfigurationConfigureDialog(getShell(), config);
dialog.setBlockOnOpen(true);
dialog.open();
} catch (CheckstylePluginException e) {
CheckstyleUIPlugin.warningDialog(getShell(), NLS.bind(Messages.errorCannotResolveCheckLocation, config.getLocation(), config.getName()), e);
}
}
}
use of net.sf.eclipsecs.core.config.CheckConfigurationWorkingCopy in project eclipse-cs by checkstyle.
the class CheckConfigurationWorkingSetEditor method editCheckConfig.
/**
* Edit the properties of a check configuration.
*/
private void editCheckConfig() {
CheckConfigurationWorkingCopy config = (CheckConfigurationWorkingCopy) ((IStructuredSelection) mViewer.getSelection()).getFirstElement();
if (config != null) {
CheckConfigurationPropertiesDialog dialog = new CheckConfigurationPropertiesDialog(getShell(), config, mWorkingSet);
dialog.setBlockOnOpen(true);
if (Window.OK == dialog.open()) {
mViewer.refresh(true);
}
}
}
use of net.sf.eclipsecs.core.config.CheckConfigurationWorkingCopy in project eclipse-cs by checkstyle.
the class CheckConfigurationWorkingSetEditor method setDefaultCheckConfig.
private void setDefaultCheckConfig() {
IStructuredSelection selection = (IStructuredSelection) mViewer.getSelection();
CheckConfigurationWorkingCopy checkConfig = (CheckConfigurationWorkingCopy) selection.getFirstElement();
if (checkConfig == null) {
//
return;
}
if (mWorkingSet instanceof GlobalCheckConfigurationWorkingSet) {
((GlobalCheckConfigurationWorkingSet) mWorkingSet).setDefaultCheckConfig(checkConfig);
}
mViewer.refresh();
}
use of net.sf.eclipsecs.core.config.CheckConfigurationWorkingCopy 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);
}
Aggregations