diff options
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSModelElement.java')
-rw-r--r-- | bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSModelElement.java | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSModelElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSModelElement.java deleted file mode 100644 index 5fb8cfb18..000000000 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSModelElement.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ccvs.ui.model; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.operation.IRunnableContext; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin; -import org.eclipse.ui.IWorkingSet; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.model.IWorkbenchAdapter; -import org.eclipse.ui.progress.IDeferredWorkbenchAdapter; - -public abstract class CVSModelElement implements IWorkbenchAdapter, IAdaptable { - - private IRunnableContext runnableContext; - private IWorkingSet workingSet; - - public IWorkingSet getWorkingSet() { - return workingSet; - } - - public void setWorkingSet(IWorkingSet workingSet) { - this.workingSet = workingSet; - } - - public Object getAdapter(Class adapter) { - if (adapter == IWorkbenchAdapter.class) - return this; - if ((adapter == IDeferredWorkbenchAdapter.class) && this instanceof IDeferredWorkbenchAdapter) - return this; - return null; - } - - /** - * Returns the runnableContext. - * @return IRunnableContext - */ - public IRunnableContext getRunnableContext() { - if (runnableContext == null) { - return PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - } - return runnableContext; - } - - /** - * Sets the runnableContext. - * @param runnableContext The runnableContext to set - */ - public void setRunnableContext(IRunnableContext runnableContext) { - this.runnableContext = runnableContext; - } - - public Object[] getChildren(Object o) { - return getChildren(o, true); - } - - /** - * Gets the children of the receiver by invoking the <code>internalGetChildren</code>. - * A appropriate progress indicator will be used if requested. - */ - protected Object[] getChildren(final Object o, boolean needsProgress) { - try { - if (needsProgress) { - final Object[][] result = new Object[1][]; - IRunnableWithProgress runnable = new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - try { - result[0] = CVSModelElement.this.fetchChildren(o, monitor); - } catch (TeamException e) { - throw new InvocationTargetException(e); - } - } - }; - getRunnableContext().run(true /*fork*/, true /*cancelable*/, runnable); - return result[0]; - } else { - return fetchChildren(o, null); - } - } catch (InterruptedException e) { - } catch (InvocationTargetException e) { - handle(e); - } catch (TeamException e) { - handle(e); - } - return new Object[0]; - } - - abstract protected Object[] fetchChildren(Object o, IProgressMonitor monitor) throws TeamException; - - /** - * Handles exceptions that occur in CVS model elements. - */ - protected void handle(Throwable t) { - CVSUIPlugin.openError(null, null, null, t, CVSUIPlugin.LOG_NONTEAM_EXCEPTIONS); - } -}
\ No newline at end of file |