MCPcopy
hub / github.com/zaproxy/zaproxy / init

Method init

zap/src/main/java/org/zaproxy/zap/GuiBootstrap.java:131–219  ·  view source on GitHub ↗

Initialises the Model, View and Control.

()

Source from the content-addressed store, hash-verified

129
130 /** Initialises the {@code Model}, {@code View} and {@code Control}. */
131 private void init() {
132 try {
133 initModel();
134 setupLookAndFeel();
135 } catch (Exception e) {
136 setupLookAndFeel();
137 if (e instanceof FileNotFoundException) {
138 JOptionPane.showMessageDialog(
139 null,
140 Constant.messages.getString("start.db.error"),
141 Constant.messages.getString("start.title.error"),
142 JOptionPane.ERROR_MESSAGE);
143 }
144 LOGGER.fatal("Failed to initialise: {}", e.getMessage(), e);
145 System.err.println(e.getMessage());
146 System.exit(1);
147 }
148
149 UIManager.put("PasswordField.showRevealButton", true);
150
151 OptionsParam options = Model.getSingleton().getOptionsParam();
152 OptionsParamView viewParam = options.getViewParam();
153
154 for (FontUtils.FontType fontType : FontUtils.FontType.values()) {
155 FontUtils.setDefaultFont(
156 fontType, viewParam.getFontName(fontType), viewParam.getFontSize(fontType));
157 }
158
159 setupLocale(options);
160
161 if (viewParam.isUseSystemsLocaleForFormat()) {
162 Locale.setDefault(Locale.Category.FORMAT, Constant.getSystemsLocale());
163 }
164
165 View.getSingleton().showSplashScreen();
166
167 Thread bootstrap =
168 new Thread(
169 new Runnable() {
170
171 @Override
172 public void run() {
173 try {
174 initControlAndPostViewInit();
175
176 } catch (IllegalStateException e) {
177 JOptionPane.showMessageDialog(
178 View.getSingleton().getSplashScreen(),
179 Constant.messages.getString(
180 "start.gui.dialog.fatal.error.init"),
181 Constant.PROGRAM_NAME,
182 JOptionPane.ERROR_MESSAGE);
183 System.exit(1);
184 } catch (Throwable e) {
185 if (!Constant.isDevMode()) {
186 ErrorInfo errorInfo =
187 new ErrorInfo(
188 Constant.messages.getString(

Callers 1

startImplMethod · 0.95

Calls 15

setupLookAndFeelMethod · 0.95
getSingletonMethod · 0.95
getViewParamMethod · 0.95
setDefaultFontMethod · 0.95
getFontNameMethod · 0.95
getFontSizeMethod · 0.95
setupLocaleMethod · 0.95
getSystemsLocaleMethod · 0.95
getSingletonMethod · 0.95
showSplashScreenMethod · 0.80
initModelMethod · 0.65

Tested by

no test coverage detected