Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * This is an Eclipse plugin fixing an issue with the built-in eclipse.ini file and
- * the option -plugincustomization /path/to/plugincustomization.ini where a few option
- * are not read properly.
- * You can now store Eclipse perspectives properly, code cleanups, formatters aswell, maven M2E external install
- * Also take cares to recurse into configuration nodes
- *
- * More infos or have questions use this link : https://bugs.eclipse.org/bugs/show_bug.cgi?id=281487
- */
- public class Main implements IStartup {
- @SuppressWarnings("serial")
- private final Map<String, String> buggedNameSpace = new HashMap<String, String>() {
- {
- // this.put("org.eclipse.jdt.ui",
- // "sp_cleanup|java_|semanticHighlighting|editor_save_participant_org|formatter_|org.eclipse.jdt.ui.formatterprofiles");
- this.put("org.eclipse.jdt.ui", "sp_cleanup|java_|semanticHighlighting|editor_save_participant_org");
- this.put("org.eclipse.e4.ui.css.swt.theme", null);
- this.put("org.eclipse.e4.ui.workbench.renderers.swt", null);
- this.put("org.eclipse.wst.jsdt.ui", "java_|semanticHighlighting");
- this.put("org.eclipse.jst.jsp.ui", null);
- this.put("org.eclipse.wst.dtd.ui", null);
- this.put("org.eclipse.wst.xml.ui", null);
- this.put("org.eclipse.wst.xsl.ui", null);
- this.put("org.eclipse.wst.css.ui", null);
- this.put("org.eclipse.wst.html.ui", null);
- this.put("org.eclipse.ant.ui", "org.eclipse.ant.ui");
- this.put("org.eclipse.ui.workbench", "SDR");
- this.put("org.eclipse.m2e.core", null);
- }
- };
- @Override
- public void earlyStartup() {
- final Iterator<Entry<String, String>> it = this.buggedNameSpace.entrySet().iterator();
- while (it.hasNext()) {
- final Map.Entry<String, String> pair = it.next();
- final String nameSpace = pair.getKey();
- final String[] filters = StringUtils.split(pair.getValue(), "|");
- this.start(nameSpace, filters);
- it.remove();
- }
- }
- private void start(final String nameSpace, final String[] filters) {
- final Preferences pluginCustomizationPreferences = DefaultScope.INSTANCE.getNode(nameSpace);
- final Preferences workspacePreferences = InstanceScope.INSTANCE.getNode(nameSpace);
- try {
- if (pluginCustomizationPreferences.childrenNames() != null && pluginCustomizationPreferences.childrenNames().length > 0) {
- for (int i = 0; i < pluginCustomizationPreferences.childrenNames().length; i++) {
- final String newNameSpace = nameSpace + "/" + pluginCustomizationPreferences.childrenNames()[i];
- if (StringUtils.isNotBlank(newNameSpace)) {
- this.start(newNameSpace, filters);
- }
- }
- }
- } catch (final BackingStoreException e1) {
- e1.printStackTrace();
- }
- try {
- for (final String key : pluginCustomizationPreferences.keys()) {
- final String defaultPluginCustomizationValue = pluginCustomizationPreferences.get(key, StringUtils.EMPTY);
- if (StringUtils.isNotBlank(defaultPluginCustomizationValue) && (filters == null || StringUtils.startsWithAny(key, filters))) {
- workspacePreferences.put(key, defaultPluginCustomizationValue);
- }
- }
- workspacePreferences.flush();
- } catch (final Exception e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement