diff --git a/CHANGES.md b/CHANGES.md index 26d2f0c1..c3663317 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,6 +14,8 @@ Supported Metrics: * feature #300: testng eclipse plugin results view should allow the user to copy the test data that is displayed for test iterations * fixed #279: java.lang.SecurityException: class "org.osgi.framework.BundleException"'s signer information does not match signer information of other classes in the same package * feature #102: Template XML file should should offer workspace-related location +* feature #152: add more templates for quickly adding new method for 'setup' and 'teardown' +* feature #154: Add Eclipse Favorites - for static import of 'org.testng.Assert.*' ## 6.10 diff --git a/testng-eclipse-plugin/src/main/org/testng/eclipse/ui/preferences/PreferenceInitializer.java b/testng-eclipse-plugin/src/main/org/testng/eclipse/ui/preferences/PreferenceInitializer.java index de1cb6bb..2ce11e99 100644 --- a/testng-eclipse-plugin/src/main/org/testng/eclipse/ui/preferences/PreferenceInitializer.java +++ b/testng-eclipse-plugin/src/main/org/testng/eclipse/ui/preferences/PreferenceInitializer.java @@ -1,10 +1,19 @@ package org.testng.eclipse.ui.preferences; +import java.io.IOException; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.Set; + import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.jdt.ui.PreferenceConstants; import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.ui.preferences.ScopedPreferenceStore; import org.testng.eclipse.TestNGPlugin; import org.testng.eclipse.TestNGPluginConstants; +import com.google.common.base.Joiner; + /** * Class used to initialize default preference values. */ @@ -29,6 +38,26 @@ public void initializeDefaultPreferences() { true); store.setDefault(TestNGPluginConstants.S_VIEW_TITLE_SHOW_CASE_NAME, true); + + initializeFavoriteStatic(); } + private void initializeFavoriteStatic() { + IPreferenceStore jdtPrefStore = PreferenceConstants.getPreferenceStore(); + + Set favorites = new LinkedHashSet<>(); + String existingFavorites = jdtPrefStore.getString(PreferenceConstants.CODEASSIST_FAVORITE_STATIC_MEMBERS); + if (!existingFavorites.isEmpty()) { + favorites.addAll(Arrays.asList(existingFavorites.split(";"))); + } + + favorites.add("org.testng.Assert.*"); + + jdtPrefStore.setValue(PreferenceConstants.CODEASSIST_FAVORITE_STATIC_MEMBERS, + Joiner.on(";").join(favorites)); + try { + ((ScopedPreferenceStore) jdtPrefStore).save(); + } catch (IOException e) { + } + } }