01: /*******************************************************************************
02: * Copyright (c) 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: ******************************************************************************/package org.eclipse.ui.internal.provisional.views.markers;
11:
12: import org.eclipse.ui.IWorkbenchPage;
13: import org.eclipse.ui.IWorkbenchPart;
14: import org.eclipse.ui.IWorkbenchWindow;
15: import org.eclipse.ui.PlatformUI;
16: import org.eclipse.ui.actions.CompoundContributionItem;
17:
18: /**
19: * MarkersContribution is the abstract superclass of the compound contribution
20: * items used in the Markers views.
21: *
22: * @since 3.4
23: *
24: */
25: abstract class MarkersContribution extends CompoundContributionItem {
26:
27: /**
28: * Create a new instance of the receiver.
29: */
30: public MarkersContribution() {
31: super ();
32: }
33:
34: /**
35: * Create a new instance of the receiver.
36: *
37: * @param id
38: */
39: public MarkersContribution(String id) {
40: super (id);
41: }
42:
43: /**
44: * Get the view this contribution is working on.
45: *
46: * @return ExtendedMarkersView
47: */
48: ExtendedMarkersView getView() {
49: IWorkbenchWindow active = PlatformUI.getWorkbench()
50: .getActiveWorkbenchWindow();
51: if (active == null)
52: return null;
53: IWorkbenchPage page = active.getActivePage();
54: if (page == null)
55: return null;
56: IWorkbenchPart part = page.getActivePart();
57: if (part == null)
58: return null;
59:
60: return (ExtendedMarkersView) part;
61: }
62:
63: }
|