Gridarta Editor
ErrorViewCollectorErrorHandler.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2023 The Gridarta Developers.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 package net.sf.gridarta.model.errorview;
21 
22 import org.jetbrains.annotations.NotNull;
23 import org.xml.sax.ErrorHandler;
24 import org.xml.sax.SAXParseException;
25 
31 public class ErrorViewCollectorErrorHandler implements ErrorHandler {
32 
36  @NotNull
38 
43  @NotNull
45 
54  this.errorViewCollector = errorViewCollector;
55  this.errorViewCategory = errorViewCategory;
56  }
57 
58  @Override
59  public void warning(final SAXParseException exception) {
60  errorViewCollector.addWarning(errorViewCategory, exception.getMessage());
61  }
62 
63  @Override
64  public void error(final SAXParseException exception) {
65  errorViewCollector.addError(errorViewCategory, exception.getMessage());
66  }
67 
68  @Override
69  public void fatalError(final SAXParseException exception) {
70  errorViewCollector.addError(errorViewCategory, exception.getMessage());
71  }
72 
73 }
net.sf.gridarta.model.errorview.ErrorViewCollector.addWarning
void addWarning(@NotNull final ErrorViewCategory category)
Adds a warning message.
Definition: ErrorViewCollector.java:68
net.sf.gridarta.model.errorview.ErrorViewCollectorErrorHandler
An ErrorHandler that adds all reported problems to an {} instance.
Definition: ErrorViewCollectorErrorHandler.java:31
net.sf.gridarta.model.errorview.ErrorViewCollectorErrorHandler.warning
void warning(final SAXParseException exception)
Definition: ErrorViewCollectorErrorHandler.java:59
net.sf.gridarta.model.errorview.ErrorViewCollectorErrorHandler.errorViewCollector
final ErrorViewCollector errorViewCollector
The ErrorViewCollector instance for adding messages.
Definition: ErrorViewCollectorErrorHandler.java:37
net.sf.gridarta.model.errorview.ErrorViewCollectorErrorHandler.error
void error(final SAXParseException exception)
Definition: ErrorViewCollectorErrorHandler.java:64
net.sf.gridarta.model.errorview.ErrorViewCollector
Convenience class for adding messages to a ErrorView instance using a fixed category name.
Definition: ErrorViewCollector.java:31
net.sf.gridarta.model.errorview.ErrorViewCategory
Defines possible error categories for ErrorView instances.
Definition: ErrorViewCategory.java:28
net.sf.gridarta.model.errorview.ErrorViewCollectorErrorHandler.ErrorViewCollectorErrorHandler
ErrorViewCollectorErrorHandler(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final ErrorViewCategory errorViewCategory)
Creates a new instance.
Definition: ErrorViewCollectorErrorHandler.java:53
net.sf.gridarta.model.errorview.ErrorViewCollectorErrorHandler.fatalError
void fatalError(final SAXParseException exception)
Definition: ErrorViewCollectorErrorHandler.java:69
net.sf.gridarta.model.errorview.ErrorViewCollectorErrorHandler.errorViewCategory
final ErrorViewCategory errorViewCategory
The ErrorViewCategory to use when adding messages to {}.
Definition: ErrorViewCollectorErrorHandler.java:44
net.sf.gridarta.model.errorview.ErrorViewCollector.addError
void addError(@NotNull final ErrorViewCategory category)
Adds an error message.
Definition: ErrorViewCollector.java:95