Skip to content

Commit

Permalink
Quickfix for #700: FeatureProject will check problems on build
Browse files Browse the repository at this point in the history
  • Loading branch information
Kogoro committed Feb 9, 2018
1 parent a42dbbd commit 0ac3ba6
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,6 @@ public interface IFeatureProject extends IBuilderMarkerHandler {
Collection<String> getFalseOptionalConfigurationFeatures();

Collection<String> getUnusedConfigurationFeatures();

void checkForProblems();
}
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ protected IProject[] build(int kind, Map args, IProgressMonitor monitor) {
composerExtension.performFullBuild(configFile);

featureProject.built();
featureProject.checkForProblems();
try {
featureProject.getProject().refreshLocal(IResource.DEPTH_INFINITE, monitor);
CorePlugin.getDefault().fireBuildUpdated(featureProject);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import static de.ovgu.featureide.fm.core.localization.StringTable.REFESH_CONFIGURATION_FOLER;
import static de.ovgu.featureide.fm.core.localization.StringTable.REFRESH_COLLABORATION_VIEW;
import static de.ovgu.featureide.fm.core.localization.StringTable.SYNCHRONIZE_FEATURE_MODEL_AND_FEATURE_MODULES;
import static de.ovgu.featureide.fm.core.localization.StringTable.THE_FEATURE_MODEL_IS_VOID_COMMA__I_E__COMMA__IT_CONTAINS_NO_PRODUCTS;
import static de.ovgu.featureide.fm.core.localization.StringTable.THE_FEATURE_MODULE_IS_EMPTY__YOU_EITHER_SHOULD_IMPLEMENT_IT_COMMA__MARK_THE_FEATURE_AS_ABSTRACT_COMMA__OR_REMOVE_THE_FEATURE_FROM_THE_FEATURE_MODEL_;

import java.io.File;
Expand Down Expand Up @@ -78,6 +79,7 @@
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.osgi.service.prefs.BackingStoreException;
import org.sat4j.specs.TimeoutException;

import de.ovgu.featureide.core.CorePlugin;
import de.ovgu.featureide.core.IFeatureProject;
Expand Down Expand Up @@ -148,6 +150,7 @@ public void propertyChange(FeatureIDEEvent evt) {
renameFeature((IFeatureModel) evt.getSource(), oldName, newName);
break;
case MODEL_DATA_SAVED:
case MODEL_DATA_OVERRIDDEN:
try {
checkFeatureCoverage();
checkConfigurations(getAllConfigurations());
Expand Down Expand Up @@ -1570,4 +1573,32 @@ protected IStatus run(IProgressMonitor monitor) {
break;
}
}

/**
* Checks for problems in feature model, configurations, feature coverage and feature folders
*/
@Override
public void checkForProblems() {
checkFeatureCoverage();
checkConfigurations(getAllConfigurations());
modelFile.deleteAllModelMarkers();
for (final Problem warning : featureModelManager.getLastProblems()) {
modelFile.createModelMarker(warning.message, warning.severity.getLevel(), warning.line);
}
if (!featureModelManager.getLastProblems().containsError()) {
try {
if (!getFeatureModel().getAnalyser().isValid()) {
modelFile.createModelMarker(THE_FEATURE_MODEL_IS_VOID_COMMA__I_E__COMMA__IT_CONTAINS_NO_PRODUCTS, IMarker.SEVERITY_ERROR, 0);
}
} catch (final TimeoutException e) {
// do nothing, assume the model is correct
}
}
try {
createAndDeleteFeatureFolders();
} catch (final CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ protected void readDocument(Document doc, List<Problem> warnings) throws Unsuppo
line = 0;
object.reset();
buildFModelRec(doc);
object.handleModelDataLoaded();
}

private int line;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1275,6 +1275,7 @@ public boolean allowPageChange(int newPageIndex) {

protected void createTooltip(TreeItem item, MouseEvent e) {
final Object data = item.getData();

if (data instanceof SelectableFeature) {
final SelectableFeature feature = (SelectableFeature) item.getData();
final String relConst = FeatureUtils.getRelevantConstraintsString(feature.getFeature());
Expand Down

0 comments on commit 0ac3ba6

Please sign in to comment.