KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > MultiEditorInnerPane


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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.ui.internal;
12
13 import org.eclipse.ui.IEditorPart;
14 import org.eclipse.ui.IEditorReference;
15 import org.eclipse.ui.part.MultiEditor;
16
17 /**
18  * Implements a pane of each editor inside a MultiEditor.
19  */

20 public class MultiEditorInnerPane extends EditorPane {
21
22     EditorPane parentPane;
23
24     /**
25      * Constructor for MultiEditorInnerPane.
26      */

27     public MultiEditorInnerPane(EditorPane pane, IEditorReference ref,
28             WorkbenchPage page, EditorStack workbook) {
29         super(ref, page, workbook);
30         parentPane = pane;
31     }
32
33     /**
34      * Returns the outer editor.
35      */

36     public EditorPane getParentPane() {
37         return parentPane;
38     }
39
40     /**
41      * Update the gradient on the inner editor title bar
42      */

43     private void updateGradient() {
44         MultiEditor multiEditor = (MultiEditor) parentPane.getPartReference()
45                 .getPart(true);
46         if (multiEditor != null) {
47             IEditorPart part = (IEditorPart) this.getEditorReference().getPart(
48                     true);
49             if (part != null) {
50                 multiEditor.updateGradient(part);
51             }
52         }
53     }
54
55     /**
56      * Indicate focus in part.
57      */

58     public void showFocus(boolean inFocus) {
59         super.showFocus(inFocus);
60         updateGradient();
61     }
62
63     /* (non-Javadoc)
64      * Method declared on PartPane.
65      */

66     /* package */void shellDeactivated() {
67         super.shellDeactivated();
68         updateGradient();
69     }
70
71     /* (non-Javadoc)
72      * Method declared on PartPane.
73      */

74     /* package */void shellActivated() {
75         super.shellActivated();
76         updateGradient();
77     }
78
79 }
80
Popular Tags