KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > compare > internal > CompareContainer


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.compare.internal;
12
13 import java.lang.reflect.InvocationTargetException JavaDoc;
14
15 import org.eclipse.compare.ICompareContainer;
16 import org.eclipse.compare.ICompareNavigator;
17 import org.eclipse.compare.structuremergeviewer.ICompareInput;
18 import org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener;
19 import org.eclipse.jface.action.MenuManager;
20 import org.eclipse.jface.operation.IRunnableWithProgress;
21 import org.eclipse.jface.viewers.ISelectionProvider;
22 import org.eclipse.ui.*;
23 import org.eclipse.ui.services.IServiceLocator;
24
25 public class CompareContainer implements ICompareContainer {
26     
27     private WorkerJob worker;
28
29     /* (non-Javadoc)
30      * @see org.eclipse.compare.ICompareContainer#setStatusMessage(java.lang.String)
31      */

32     public void setStatusMessage(String JavaDoc message) {
33         // Do nothing, by default
34
}
35     
36     /* (non-Javadoc)
37      * @see org.eclipse.compare.ICompareContainer#addCompareInputChangeListener(org.eclipse.compare.structuremergeviewer.ICompareInput, org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener)
38      */

39     public void addCompareInputChangeListener(ICompareInput input,
40             ICompareInputChangeListener listener) {
41         input.addCompareInputChangeListener(listener);
42     }
43     
44     /* (non-Javadoc)
45      * @see org.eclipse.compare.ICompareContainer#removeCompareInputChangeListener(org.eclipse.compare.structuremergeviewer.ICompareInput, org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener)
46      */

47     public void removeCompareInputChangeListener(ICompareInput input,
48             ICompareInputChangeListener listener) {
49         input.removeCompareInputChangeListener(listener);
50     }
51     
52     /* (non-Javadoc)
53      * @see org.eclipse.compare.ICompareContainer#registerContextMenu(org.eclipse.jface.action.MenuManager, org.eclipse.jface.viewers.ISelectionProvider)
54      */

55     public void registerContextMenu(MenuManager menu,
56             ISelectionProvider selectionProvider) {
57         // Nothing to do
58
}
59     
60     /* (non-Javadoc)
61      * @see org.eclipse.compare.ICompareContainer#getServiceLocator()
62      */

63     public IServiceLocator getServiceLocator() {
64         return null;
65     }
66     
67     /* (non-Javadoc)
68      * @see org.eclipse.compare.ICompareContainer#getActionBars()
69      */

70     public IActionBars getActionBars() {
71         return null;
72     }
73
74     /* (non-Javadoc)
75      * @see org.eclipse.jface.operation.IRunnableContext#run(boolean, boolean, org.eclipse.jface.operation.IRunnableWithProgress)
76      */

77     public void run(boolean fork, boolean cancelable,
78             IRunnableWithProgress runnable)
79             throws InvocationTargetException JavaDoc, InterruptedException JavaDoc {
80         PlatformUI.getWorkbench().getProgressService().run(fork, cancelable, runnable);
81     }
82     
83     /* (non-Javadoc)
84      * @see org.eclipse.compare.ICompareContainer#getNavigator()
85      */

86     public ICompareNavigator getNavigator() {
87         return null;
88     }
89
90     /* (non-Javadoc)
91      * @see org.eclipse.compare.ICompareContainer#runAsynchronously(org.eclipse.jface.operation.IRunnableWithProgress)
92      */

93     public synchronized void runAsynchronously(IRunnableWithProgress runnable) {
94         if (worker == null)
95             worker = createWorkerJob();
96         worker.add(runnable);
97     }
98
99     protected WorkerJob createWorkerJob() {
100         WorkerJob workerJob = new WorkerJob(getWorkerJobName());
101         return workerJob;
102     }
103
104     protected String JavaDoc getWorkerJobName() {
105         return CompareMessages.CompareContainer_0;
106     }
107
108     public IWorkbenchPart getWorkbenchPart() {
109         return null;
110     }
111
112 }
113
Popular Tags