Fixed: [ Issue 43 ] Allow code generation in multiple languages simultaneously https://code.google.com/p/protobuf-dt/issues/detail?id=43 Fixed bug where preference page did not validate that at least one language should be enabled.
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/ImportHyperlink.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/ImportHyperlink.java index 7ea01d6..ffcd9c4 100644 --- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/ImportHyperlink.java +++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/ImportHyperlink.java
@@ -6,7 +6,6 @@ * * http://www.eclipse.org/legal/epl-v10.html */ - package com.google.eclipse.protobuf.ui.editor; import org.eclipse.core.filesystem.EFS;
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/compiler/CompilerPreferencePage.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/compiler/CompilerPreferencePage.java index e953366..6630528 100644 --- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/compiler/CompilerPreferencePage.java +++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/compiler/CompilerPreferencePage.java
@@ -18,13 +18,16 @@ import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.*; -import org.eclipse.swt.layout.*; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.*; import org.eclipse.xtext.ui.PluginImageHelper; import org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreAccess; -import com.google.eclipse.protobuf.ui.preferences.*; +import com.google.eclipse.protobuf.ui.preferences.DataChangedListener; +import com.google.eclipse.protobuf.ui.preferences.PreferenceAndPropertyPage; import com.google.inject.Inject; /** @@ -194,6 +197,17 @@ } private void checkState() { + boolean atLeastOneEnabled = false; + for (CodeGeneration option : codeGenerationEditor.codeGenerationOptions()) { + if (option.isEnabled()) { + atLeastOneEnabled = true; + break; + } + } + if (!atLeastOneEnabled) { + pageIsNowInvalid(errorNoLanguageEnabled); + return; + } if (!customPathOptionSelectedAndEnabled()) { pageIsNowValid(); return;
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/compiler/Messages.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/compiler/Messages.java index a0bc9b7..7b1b423 100644 --- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/compiler/Messages.java +++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/compiler/Messages.java
@@ -23,6 +23,7 @@ public static String enabled; public static String errorEnterDirectoryName; public static String errorInvalidProtoc; + public static String errorNoLanguageEnabled; public static String errorNoOutputFolderName; public static String errorNoSelection; public static String generateCpp;
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/compiler/Messages.properties b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/compiler/Messages.properties index 0ab80ca..c4a7c60 100644 --- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/compiler/Messages.properties +++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/compiler/Messages.properties
@@ -6,6 +6,7 @@ enabled=Enabled errorEnterDirectoryName=Enter the name of the output directory errorInvalidProtoc=The selected file is not protoc +errorNoLanguageEnabled=Enable at least one language errorNoSelection=Select the path of protoc errorNoOutputFolderName=Enter the name of the output folder generateCode=Generated Code