diff --git a/cucumber.eclipse.editor/src/main/java/cucumber/eclipse/editor/properties/CucumberPropertiesPage.java b/cucumber.eclipse.editor/src/main/java/cucumber/eclipse/editor/properties/CucumberPropertiesPage.java deleted file mode 100644 index c9fb1e6d..00000000 --- a/cucumber.eclipse.editor/src/main/java/cucumber/eclipse/editor/properties/CucumberPropertiesPage.java +++ /dev/null @@ -1,36 +0,0 @@ -package cucumber.eclipse.editor.properties; - -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.dialogs.PropertyPage; - -public class CucumberPropertiesPage extends PropertyPage { - - public CucumberPropertiesPage() { - super(); - } - - - /** - * @see PreferencePage#createContents(Composite) - */ - protected Control createContents(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); - composite.setLayout(new GridLayout()); - GridData data = new GridData(GridData.FILL); - data.grabExcessHorizontalSpace = true; - composite.setLayoutData(data); - Label label = new Label(composite, SWT.WRAP); - label.setText("You can configure Cucumber related properties for your project here"); - label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - return composite; - } - - - -} \ No newline at end of file diff --git a/examples/java-datatable/src/test/resources/cucumber/examples/datatable2.feature b/examples/java-datatable/src/test/resources/cucumber/examples/datatable2.feature new file mode 100644 index 00000000..0a4a7db0 --- /dev/null +++ b/examples/java-datatable/src/test/resources/cucumber/examples/datatable2.feature @@ -0,0 +1,47 @@ +#language: en +#This Feature has no validator enabled in the feature file but in the project preferences! +Feature: Connection between DataTable Key and a specific Step Value + + + Scenario: All Keys are related to a Step Value. Example 1 + Given the animal "Cat" + | Key | Value | + | Color | Black | + | Lifespan | 3 | + | Whiskers | 24 | + + Then the food is "fish" + + + Scenario: All Keys are related to a Step Value. Example 2 + Given the animal "Elephant" + | Key | Value | + | Color | Grey | + | Lifespan | 70 | + | Trunk | 1.8 | + | Tusk | 1.3 | + + Then the food is "leaves" + + + Scenario: There are some unrelated Keys to a Step Value. This Keys are available for other Step Value + Given the animal "Cat" + | Key | Value | + | Color | Black | + | Lifespan | 3 | + | Whiskers | 24 | + | Trunk | 1.8 | + + Then the food is "fish" + + + Scenario: There are some unrelated Keys to a Step Value. This Keys are not available for each Step Value + Given the animal "Cat" + | Key | Value | + | Color | Black | + | Lifespan | 3 | + | Whiskers | 24 | + | Wings | 2 | + + Then the food is "fish" + diff --git a/io.cucumber.eclipse.editor/plugin.xml b/io.cucumber.eclipse.editor/plugin.xml index cb437a59..41f94a91 100644 --- a/io.cucumber.eclipse.editor/plugin.xml +++ b/io.cucumber.eclipse.editor/plugin.xml @@ -323,6 +323,14 @@ - + + + + diff --git a/io.cucumber.eclipse.editor/src/io/cucumber/eclipse/editor/properties/CucumberPropertiesPage.java b/io.cucumber.eclipse.editor/src/io/cucumber/eclipse/editor/properties/CucumberPropertiesPage.java new file mode 100644 index 00000000..58f5299c --- /dev/null +++ b/io.cucumber.eclipse.editor/src/io/cucumber/eclipse/editor/properties/CucumberPropertiesPage.java @@ -0,0 +1,72 @@ +package io.cucumber.eclipse.editor.properties; + +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ProjectScope; +import org.eclipse.core.runtime.preferences.IEclipsePreferences; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.dialogs.PropertyPage; +import org.osgi.service.prefs.BackingStoreException; + +import io.cucumber.eclipse.editor.Images; + +public class CucumberPropertiesPage extends PropertyPage { + + private static final String NAMESPACE = "io.cucumber.eclipse.editor"; + private static final String KEY_VALIDATION_PLUGINS = "validationPlugins"; + private Text validationPlugins; + + public CucumberPropertiesPage() { + setTitle("Cucumber"); + setDescription("You can configure Cucumber related properties for your project here"); + setImageDescriptor(Images.getCukesIconDescriptor()); + noDefaultAndApplyButton(); + } + + /** + * @see PreferencePage#createContents(Composite) + */ + @Override + protected Control createContents(Composite parent) { + Composite composite = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.numColumns = 2; + composite.setLayout(layout); + Label label = new Label(composite, SWT.NONE); + label.setText("Validation Plugins "); + label.setToolTipText( + "Add a comma seperated list of plugins that should be used for validation regardless of feature settings"); + validationPlugins = new Text(composite, SWT.BORDER); + GridData data = new GridData(GridData.FILL_HORIZONTAL); + validationPlugins.setLayoutData(data); + return composite; + } + + @Override + public boolean performOk() { + IEclipsePreferences node = getNode(getResource()); + node.put(KEY_VALIDATION_PLUGINS, validationPlugins.getText()); + try { + node.flush(); + } catch (BackingStoreException e) { + } + return true; + } + + private IResource getResource() { + return getElement().getAdapter(IResource.class); + } + + public static IEclipsePreferences getNode(IResource resource) { + ProjectScope scope = new ProjectScope(resource.getProject()); + IEclipsePreferences node = scope.getNode(NAMESPACE); + return node; + } + +} \ No newline at end of file