| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||||
| NewSchemaValidatorAction |
|
| 1.3333333333333333;1.333 |
| 1 | /* |
|
| 2 | * $Id$ |
|
| 3 | * |
|
| 4 | * The contents of this file are subject to the Mozilla Public License |
|
| 5 | * Version 1.1 (the "License"); you may not use this file except in |
|
| 6 | * compliance with the License. You may obtain a copy of the License at |
|
| 7 | * http://www.mozilla.org/MPL/ |
|
| 8 | * |
|
| 9 | * Software distributed under the License is distributed on an "AS IS" basis, |
|
| 10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
|
| 11 | * for the specific language governing rights and limitations under the License. |
|
| 12 | * |
|
| 13 | * The Original Code is XML Hammer code. (org.xmlhammer.*) |
|
| 14 | * |
|
| 15 | * The Initial Developer of the Original Code is Edwin Dankert. Portions created |
|
| 16 | * by the Initial Developer are Copyright (C) 2005 - 2006 the Initial Developer. |
|
| 17 | * All Rights Reserved. |
|
| 18 | * |
|
| 19 | * Contributor(s): Edwin Dankert <edankert@gmail.com> |
|
| 20 | */ |
|
| 21 | package org.xmlhammer.gui.schemavalidator; |
|
| 22 | ||
| 23 | import javax.swing.ImageIcon; |
|
| 24 | ||
| 25 | import org.bounce.RunnableAction; |
|
| 26 | import org.xmlhammer.gui.XMLHammer; |
|
| 27 | import org.xmlhammer.gui.wizard.NewSchemaValidatorWizard; |
|
| 28 | ||
| 29 | ||
| 30 | /** |
|
| 31 | * An action that can be used to create a new XML Hammer project. |
|
| 32 | * |
|
| 33 | * @version $Revision$, $Date$ |
|
| 34 | * @author Edwin Dankert <edankert@gmail.com> |
|
| 35 | */ |
|
| 36 | public class NewSchemaValidatorAction extends RunnableAction { |
|
| 37 | private static final long serialVersionUID = -1438716057457615978L; |
|
| 38 | ||
| 39 | 220 | private XMLHammer parent = null; |
| 40 | ||
| 41 | /** |
|
| 42 | * The constructor for the action which creates a new |
|
| 43 | * document. |
|
| 44 | * |
|
| 45 | * @param parent the parent frame. |
|
| 46 | */ |
|
| 47 | public NewSchemaValidatorAction( XMLHammer parent) { |
|
| 48 | 220 | super( "Schema Validator"); |
| 49 | ||
| 50 | 220 | this.parent = parent; |
| 51 | ||
| 52 | 220 | putValue( SMALL_ICON, new ImageIcon( getClass().getResource("/org/xmlhammer/gui/icons/etool16/newschemavalidator.gif"))); |
| 53 | 220 | putValue( SHORT_DESCRIPTION, "New Schema Validator"); |
| 54 | 220 | } |
| 55 | ||
| 56 | /** |
|
| 57 | * The implementation of the new document action. |
|
| 58 | */ |
|
| 59 | public void run() { |
|
| 60 | // init the project. |
|
| 61 | 0 | NewSchemaValidatorWizard wizard = new NewSchemaValidatorWizard(parent); |
| 62 | 0 | wizard.setVisible(true); |
| 63 | ||
| 64 | 0 | if (!wizard.isCancelled()) { |
| 65 | 0 | parent.openProject(null, wizard.getProject()); |
| 66 | } |
|
| 67 | 0 | } |
| 68 | ||
| 69 | // testing only! |
|
| 70 | public void runWithoutWizard() { |
|
| 71 | // init the project. |
|
| 72 | 22 | NewSchemaValidatorWizard wizard = new NewSchemaValidatorWizard(parent); |
| 73 | 22 | parent.openProject(null, wizard.getProject()); |
| 74 | 22 | } |
| 75 | } |