01: /*******************************************************************************
02: * Copyright (c) 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: * Remy Chi Jian Suen <remy.suen@gmail.com> - bug 201342
11: *******************************************************************************/package org.eclipse.pde.internal.ui.views.plugins;
12:
13: import java.lang.reflect.InvocationTargetException;
14:
15: import org.eclipse.core.runtime.IProgressMonitor;
16: import org.eclipse.jface.operation.IRunnableWithProgress;
17: import org.eclipse.pde.core.plugin.IPluginModelBase;
18: import org.eclipse.pde.internal.core.PDECore;
19: import org.eclipse.pde.internal.core.SearchablePluginsManager;
20:
21: public class JavaSearchOperation implements IRunnableWithProgress {
22:
23: private IPluginModelBase[] fModels;
24: private boolean fAdd;
25:
26: public JavaSearchOperation(IPluginModelBase[] models, boolean add) {
27: fModels = models;
28: fAdd = add;
29: }
30:
31: public void run(IProgressMonitor monitor)
32: throws InvocationTargetException {
33: try {
34: SearchablePluginsManager manager = PDECore.getDefault()
35: .getSearchablePluginsManager();
36: if (fAdd)
37: manager.addToJavaSearch(fModels);
38: else
39: manager.removeFromJavaSearch(fModels);
40: } finally {
41: monitor.done();
42: }
43: }
44:
45: }
|