kchong | 38cbf17 | 2006-03-29 03:38:21 +0000 | [diff] [blame] | 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2001, 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 | *******************************************************************************/ |
kchong | 2be71b3 | 2006-04-11 16:32:03 +0000 | [diff] [blame] | 11 | package org.eclipse.wst.xsd.ui.internal.adt.actions; |
kchong | 38cbf17 | 2006-03-29 03:38:21 +0000 | [diff] [blame] | 12 | |
| 13 | import org.eclipse.jface.resource.ImageDescriptor; |
| 14 | import org.eclipse.ui.IWorkbenchPart; |
| 15 | import org.eclipse.ui.PartInitException; |
kchong | 83beb0b | 2006-04-12 21:55:41 +0000 | [diff] [blame] | 16 | import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages; |
kchong | 2be71b3 | 2006-04-11 16:32:03 +0000 | [diff] [blame] | 17 | import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin; |
kchong | 38cbf17 | 2006-03-29 03:38:21 +0000 | [diff] [blame] | 18 | |
| 19 | |
| 20 | /** |
| 21 | * Show the properties view in the current perspective. |
| 22 | */ |
| 23 | public class ShowPropertiesViewAction extends BaseSelectionAction |
| 24 | { |
kchong | 2be71b3 | 2006-04-11 16:32:03 +0000 | [diff] [blame] | 25 | public static final String ID = "org.eclipse.wst.xsd.ui.internal.adt.actions.ShowPropertiesViewAction"; //$NON-NLS-1$ |
kchong | 38cbf17 | 2006-03-29 03:38:21 +0000 | [diff] [blame] | 26 | public static final String PROPERTIES_VIEW_ID = "org.eclipse.ui.views.PropertySheet"; //$NON-NLS-1$ |
| 27 | |
| 28 | protected static ImageDescriptor enabledImage, disabledImage; |
| 29 | |
| 30 | public ShowPropertiesViewAction(IWorkbenchPart part) |
| 31 | { |
| 32 | super(part); |
| 33 | setId(ID); |
kchong | 83beb0b | 2006-04-12 21:55:41 +0000 | [diff] [blame] | 34 | setText(Messages._UI_ACTION_SHOW_PROPERTIES); |
kchong | 38cbf17 | 2006-03-29 03:38:21 +0000 | [diff] [blame] | 35 | setToolTipText(getText()); |
kchong | 83beb0b | 2006-04-12 21:55:41 +0000 | [diff] [blame] | 36 | setImageDescriptor(XSDEditorPlugin.getImageDescriptor("icons/elcl16/showproperties_obj.gif") ); //$NON-NLS-1$ |
| 37 | setDisabledImageDescriptor(XSDEditorPlugin.getImageDescriptor("icons/dlcl16/showproperties_obj.gif") ); //$NON-NLS-1$ |
kchong | 38cbf17 | 2006-03-29 03:38:21 +0000 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | protected boolean calculateEnabled() |
| 41 | { |
| 42 | return true; |
| 43 | } |
| 44 | |
| 45 | public void run() |
| 46 | { |
| 47 | try |
| 48 | { |
| 49 | getWorkbenchPart().getSite().getPage().showView(PROPERTIES_VIEW_ID); |
| 50 | } |
| 51 | catch (PartInitException pie) |
| 52 | { |
| 53 | |
| 54 | } |
| 55 | } |
| 56 | } |