Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2013, 2014 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at Contributors: IBM Corporation - initial API and implementation Lars Vogel <> - Bug 429421 /
package org.eclipse.e4.ui.workbench.addons.swt;
import  org.eclipse.e4.core.di.annotations.Execute;
import  org.eclipse.e4.ui.model.application.MAddon;
import  org.eclipse.e4.ui.model.application.MApplication;
import  org.eclipse.e4.ui.workbench.modeling.EModelService;

Model processors which adds the cleanup add-on to the application model
public class CleanupProcessor {
	void addCleanupAddon(MApplication app, EModelService modelService) {
		List<MAddon> addons = app.getAddons();
		// prevent multiple copies
		for (MAddon addon : addons) {
			if (addon.getContributionURI()
					.contains("ui.workbench.addons.cleanupaddon.CleanupAddon")) //$NON-NLS-1$
		// adds the add-on to the application model
		MAddon cleanupAddon = modelService.createModelElement(MAddon.class);
		cleanupAddon.setElementId("CleanupAddon"); //$NON-NLS-1$
				.setContributionURI("bundleclass://org.eclipse.e4.ui.workbench.addons.swt/org.eclipse.e4.ui.workbench.addons.cleanupaddon.CleanupAddon"); //$NON-NLS-1$
New to GrepCode? Check out our FAQ X