blob: dbcbbb5962a2ff8c85e7d58670daa77c5dffe610 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2009, 2011 Mia-Software.
* 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:
* Nicolas Bros (Mia-Software)
*******************************************************************************/
package org.eclipse.gmt.modisco.infra.browser.actions;
import org.eclipse.gmt.modisco.infra.browser.Messages;
import org.eclipse.gmt.modisco.infra.browser.MoDiscoBrowserPlugin;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
/** This action opens the "Properties" view. */
public class ShowPropertiesViewAction extends Action {
/** The ID of the "Properties" view */
private static final String PROPERTY_SHEET_ID = "org.eclipse.ui.views.PropertySheet"; //$NON-NLS-1$
public ShowPropertiesViewAction() {
super(Messages.EcoreActionBarContributor_showPropertiesView);
}
@Override
public void run() {
try {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
IWorkbenchPage activePage = window.getActivePage();
if (activePage != null) {
activePage.showView(ShowPropertiesViewAction.PROPERTY_SHEET_ID);
}
}
} catch (final PartInitException exception) {
MoDiscoBrowserPlugin.logException(exception);
}
}
}