KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > presentations > SystemMenuSizeFastView


1 /*******************************************************************************
2  * Copyright (c) 2004, 2005 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.presentations;
12
13 import org.eclipse.jface.action.ContributionItem;
14 import org.eclipse.swt.SWT;
15 import org.eclipse.swt.events.SelectionAdapter;
16 import org.eclipse.swt.events.SelectionEvent;
17 import org.eclipse.swt.widgets.Menu;
18 import org.eclipse.swt.widgets.MenuItem;
19 import org.eclipse.ui.internal.FastViewPane;
20 import org.eclipse.ui.internal.WorkbenchMessages;
21
22 public class SystemMenuSizeFastView extends ContributionItem {
23
24     private FastViewPane fastViewPane;
25
26     public SystemMenuSizeFastView(FastViewPane fastViewPane) {
27         this.fastViewPane = fastViewPane;
28     }
29
30     public void dispose() {
31         fastViewPane = null;
32     }
33
34     public void fill(Menu menu, int index) {
35         MenuItem item = new MenuItem(menu, SWT.NONE, index);
36         item.setText(WorkbenchMessages.PartPane_size);
37         item.addSelectionListener(new SelectionAdapter() {
38
39             public void widgetSelected(SelectionEvent e) {
40                 fastViewPane.moveSash();
41             }
42         });
43         item.setEnabled(fastViewPane.getCurrentPane() != null);
44     }
45
46     public boolean isDynamic() {
47         return true;
48     }
49 }
50
Popular Tags