blob: cbd19958accde71dff46e2b3003d63ab47cad1ca (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
/*******************************************************************************
* Copyright (c) 2004, 2007 Boeing.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
package org.eclipse.osee.define.navigate;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.osee.define.DefinePlugin;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
import org.eclipse.osee.framework.ui.skynet.ats.IActionable;
import org.eclipse.osee.framework.ui.skynet.ats.OseeAts;
import org.eclipse.osee.framework.ui.skynet.util.DbConnectionExceptionComposite;
import org.eclipse.osee.framework.ui.skynet.widgets.xnavigate.XNavigateComposite;
import org.eclipse.osee.framework.ui.skynet.widgets.xnavigate.XNavigateItem;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;
/**
* Insert the type's description here.
*
* @see ViewPart
*/
public class DefineNavigateView extends ViewPart implements IActionable {
public static final String VIEW_ID = "org.eclipse.osee.define.DefineNavigateView";
public static final String HELP_CONTEXT_ID = "defineNavigator";
private XNavigateComposite xNavComp;
/**
* The constructor.
*/
public DefineNavigateView() {
}
public void setFocus() {
}
/*
* @see IWorkbenchPart#createPartControl(Composite)
*/
public void createPartControl(Composite parent) {
if (!DbConnectionExceptionComposite.dbConnectionIsOk(parent)) return;
xNavComp = new XNavigateComposite(new DefineNavigateViewItems(), parent, SWT.NONE);
xNavComp.getFilteredTree().getViewer().setSorter(new DefineNavigateViewerSorter());
DefinePlugin.getInstance().setHelp(xNavComp, HELP_CONTEXT_ID);
createActions();
xNavComp.refresh();
}
protected void createActions() {
Action refreshAction = new Action("Refresh") {
public void run() {
xNavComp.refresh();
}
};
refreshAction.setImageDescriptor(SkynetGuiPlugin.getInstance().getImageDescriptor("refresh.gif"));
refreshAction.setToolTipText("Refresh");
OseeAts.addBugToViewToolbar(this, this, DefinePlugin.getInstance(), VIEW_ID, "Define Navigator");
}
public String getActionDescription() {
IStructuredSelection sel = (IStructuredSelection) xNavComp.getFilteredTree().getViewer().getSelection();
if (sel.iterator().hasNext()) return String.format("Currently Selected - %s",
((XNavigateItem) sel.iterator().next()).getName());
return "";
}
}
|