| /******************************************************************************* |
| * Copyright (c) 2000, 2004 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.compare.internal; |
| |
| import org.eclipse.ui.IActionBars; |
| import org.eclipse.ui.views.contentoutline.IContentOutlinePage; |
| |
| import org.eclipse.swt.SWT; |
| import org.eclipse.swt.widgets.*; |
| |
| import org.eclipse.jface.util.ListenerList; |
| import org.eclipse.jface.viewers.*; |
| |
| import org.eclipse.compare.CompareEditorInput; |
| |
| /** |
| */ |
| public class CompareOutlinePage implements IContentOutlinePage { |
| |
| private Control fControl; |
| private ListenerList fListeners= new ListenerList(); |
| private ISelection fSelection; |
| //private IActionBars fActionBars; |
| private CompareEditorInput fCompareEditorInput; |
| |
| CompareOutlinePage(CompareEditorInput input) { |
| fCompareEditorInput= input; |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite) |
| */ |
| public void createControl(Composite parent) { |
| if (fCompareEditorInput != null) { |
| fControl= fCompareEditorInput.createOutlineContents(parent, SWT.VERTICAL); |
| } |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.ui.part.IPage#dispose() |
| */ |
| public void dispose() { |
| if (fControl != null) |
| fControl.dispose(); |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.ui.part.IPage#getControl() |
| */ |
| public Control getControl() { |
| return fControl; |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.ui.part.IPage#setActionBars(org.eclipse.ui.IActionBars) |
| */ |
| public void setActionBars(IActionBars actionBars) { |
| //fActionBars= actionBars; |
| //if (fControl != null) |
| // fControl.setData("actionBars", actionBars); |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.ui.part.IPage#setFocus() |
| */ |
| public void setFocus() { |
| if (fControl != null) |
| fControl.setFocus(); |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) |
| */ |
| public void addSelectionChangedListener(ISelectionChangedListener listener) { |
| fListeners.add(listener); |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection() |
| */ |
| public ISelection getSelection() { |
| return fSelection; |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) |
| */ |
| public void removeSelectionChangedListener(ISelectionChangedListener listener) { |
| fListeners.remove(listener); |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection) |
| */ |
| public void setSelection(ISelection selection) { |
| fSelection= selection; |
| } |
| } |