5ca0f4a61389b3e753fe97681d78a760e01a63e9
[phpeclipse.git] /
1 /*
2  * $Id: InsertHTMLElementAction.java,v 1.3 2006-10-21 23:18:43 pombredanne Exp $
3  * Copyright Narushima Hironori. All rights reserved.
4  */
5 package net.sourceforge.phpeclipse.wizards.html;
6
7 import org.eclipse.jface.action.IAction;
8 import org.eclipse.jface.viewers.ISelection;
9 import org.eclipse.jface.wizard.WizardDialog;
10 import org.eclipse.swt.SWT;
11 import org.eclipse.ui.IEditorActionDelegate;
12 import org.eclipse.ui.IEditorPart;
13 import org.eclipse.ui.texteditor.ITextEditor;
14
15 /**
16  * InsertTagAction
17  */
18 public class InsertHTMLElementAction implements IEditorActionDelegate {
19
20         ITextEditor targetEditor = null;
21
22         public InsertHTMLElementAction() {
23         }
24
25         public void setActiveEditor(IAction action, IEditorPart targetEditor) {
26                 if (targetEditor instanceof ITextEditor) {
27                         this.targetEditor = (ITextEditor) targetEditor;
28                 }
29         }
30
31         public void run(IAction action) {
32
33                 WizardDialog wizDialog = new WizardDialog(targetEditor.getSite()
34                                 .getShell(), new EditElementWizard(targetEditor, null)) {
35
36                         protected int getShellStyle() {
37                                 return super.getShellStyle() | SWT.RESIZE;
38                         }
39                 };
40
41                 wizDialog.open();
42         }
43
44         public void selectionChanged(IAction action, ISelection selection) {
45         }
46
47 }