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.core.commands.AbstractHandler;
13: import org.eclipse.core.commands.ExecutionEvent;
14: import org.eclipse.core.commands.ExecutionException;
15: import org.eclipse.ui.IWorkbenchPage;
16: import org.eclipse.ui.IWorkbenchPart;
17: import org.eclipse.ui.PartInitException;
18: import org.eclipse.ui.handlers.HandlerUtil;
19:
20: /**
21: * OpenMarkersViewHandler is used to open another markers view.
22: *
23: * @since 3.4
24: *
25: */
26: public class OpenMarkersViewHandler extends AbstractHandler {
27:
28: /*
29: * (non-Javadoc)
30: *
31: * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
32: */
33: public Object execute(ExecutionEvent event)
34: throws ExecutionException {
35: IWorkbenchPart part = HandlerUtil.getActivePart(event);
36: if (part == null)
37: return null;
38: try {
39: part.getSite().getPage().showView(part.getSite().getId(),
40: ExtendedMarkersView.newSecondaryID(),
41: IWorkbenchPage.VIEW_ACTIVATE);
42: } catch (PartInitException e) {
43: throw new ExecutionException(e.getLocalizedMessage(), e);
44: }
45: return this;
46:
47: }
48: }
|