KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > view > HistoryListAction


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.pde.internal.ui.view;
12
13 import org.eclipse.jface.action.Action;
14 import org.eclipse.jface.window.Window;
15 import org.eclipse.pde.internal.core.PDECore;
16 import org.eclipse.pde.internal.ui.IHelpContextIds;
17 import org.eclipse.pde.internal.ui.PDEPlugin;
18 import org.eclipse.pde.internal.ui.PDEPluginImages;
19 import org.eclipse.pde.internal.ui.PDEUIMessages;
20 import org.eclipse.ui.PlatformUI;
21
22 public class HistoryListAction extends Action {
23
24     private DependenciesView fView;
25
26     public HistoryListAction(DependenciesView view) {
27         fView = view;
28         setText(PDEUIMessages.HistoryListAction_label);
29         setImageDescriptor(PDEPluginImages.DESC_HISTORY_LIST);
30         setDisabledImageDescriptor(PDEPluginImages.DESC_HISTORY_LIST_DISABLED);
31         PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IHelpContextIds.HISTORY_LIST_ACTION);
32     }
33
34     /*
35      * @see IAction#run()
36      */

37     public void run() {
38         String JavaDoc[] historyEntries = fView.getHistoryEntries();
39         HistoryListDialog dialog = new HistoryListDialog(PDEPlugin
40                 .getActiveWorkbenchShell(), historyEntries);
41         if (dialog.open() == Window.OK) {
42             fView.setHistoryEntries(dialog.getRemaining());
43             String JavaDoc id = dialog.getResult();
44             if (id == null) {
45                 fView.openTo(null);
46             } else {
47                 fView.openTo(PDECore.getDefault().getModelManager().findModel(
48                         id));
49             }
50         }
51     }
52
53 }
54
Popular Tags