use of net.sf.eclipsecs.core.config.ICheckConfigurationWorkingSet in project eclipse-cs by checkstyle.
the class ProjectConfigurationEditor method getEditedWorkingCopy.
/**
* {@inheritDoc}
*/
@Override
public CheckConfigurationWorkingCopy getEditedWorkingCopy() throws CheckstylePluginException {
mWorkingCopy.setName(mConfigName.getText());
mWorkingCopy.setDescription(mDescription.getText());
mWorkingCopy.getAdditionalData().put(ExternalFileConfigurationType.KEY_PROTECT_CONFIG, // $NON-NLS-1$
"" + mChkProtectConfig.getSelection());
try {
mWorkingCopy.setLocation(mLocation.getText());
} catch (CheckstylePluginException e) {
String location = mLocation.getText();
if (Strings.emptyToNull(location) == null) {
throw e;
}
ICheckConfigurationWorkingSet ws = mCheckConfigDialog.getCheckConfigurationWorkingSet();
IPath tmp = new Path(location);
boolean isFirstPartProject = ResourcesPlugin.getWorkspace().getRoot().getProject(tmp.segment(0)).exists();
if (ws instanceof LocalCheckConfigurationWorkingSet && !isFirstPartProject) {
location = ((LocalCheckConfigurationWorkingSet) ws).getProject().getFullPath().append(location).toString();
mLocation.setText(location);
} else if (ws instanceof GlobalCheckConfigurationWorkingSet && !isFirstPartProject) {
throw new CheckstylePluginException(NLS.bind(Messages.ProjectConfigurationEditor_msgNoProjectInWorkspace, tmp.segment(0)));
}
if (ensureFileExists(location)) {
mWorkingCopy.setLocation(mLocation.getText());
} else {
throw e;
}
}
return mWorkingCopy;
}
Aggregations