avoid NullPointerException in debug
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / wizards / html / InsertHTMLElementAction.java
1 /*
2  * $Id: InsertHTMLElementAction.java,v 1.2 2005-05-06 00:57:33 stefanbjarni 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 /**
17  * InsertTagAction
18  */
19 public class InsertHTMLElementAction implements IEditorActionDelegate {
20
21         ITextEditor targetEditor = null;
22
23         public InsertHTMLElementAction() {
24         }
25         
26         public void setActiveEditor(IAction action, IEditorPart targetEditor) {
27                 if(targetEditor instanceof ITextEditor){
28                         this.targetEditor = (ITextEditor)targetEditor;
29                 }
30         }
31
32         public void run(IAction action) {
33         
34                 WizardDialog wizDialog =
35                         new WizardDialog(
36                                 targetEditor.getSite().getShell(),
37                                 new EditElementWizard(targetEditor, null) ){
38
39                         protected int getShellStyle() {
40                                 return super.getShellStyle() | SWT.RESIZE;
41                         }
42                 };
43                 
44                 wizDialog.open();
45         }
46
47         public void selectionChanged(IAction action, ISelection selection) {
48         }
49
50 }