• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

devonfw / IDEasy / 25721470472

12 May 2026 07:59AM UTC coverage: 70.666% (+0.04%) from 70.624%
25721470472

Pull #1891

github

web-flow
Merge ec5525ac8 into e6efbbdff
Pull Request #1891: #1880: Allow reset of installed plugins when launching IDE in force mode

4427 of 6920 branches covered (63.97%)

Branch coverage included in aggregate %.

11405 of 15484 relevant lines covered (73.66%)

3.12 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

77.53
cli/src/main/java/com/devonfw/tools/ide/context/IdeStartContextImpl.java
1
package com.devonfw.tools.ide.context;
2

3
import java.util.Locale;
4

5
import com.devonfw.tools.ide.log.IdeLogArgFormatter;
6
import com.devonfw.tools.ide.log.IdeLogLevel;
7
import com.devonfw.tools.ide.log.IdeLogListener;
8
import com.devonfw.tools.ide.log.IdeLogListenerBuffer;
9

10
/**
11
 * Implementation of {@link IdeStartContext}.
12
 */
13
public class IdeStartContextImpl implements IdeStartContext {
14

15
  private static IdeStartContextImpl instance;
16

17
  protected final IdeLogListener logListener;
18

19
  protected final IdeLogListenerBuffer logListenerBuffer;
20

21
  private IdeLogLevel logLevelConsole;
22

23
  private IdeLogLevel logLevelLogger;
24

25
  private IdeLogArgFormatter argFormatter;
26

27
  private boolean skipUpdatesMode;
28

29
  private boolean offlineMode;
30

31
  private boolean forceMode;
32

33
  private boolean forcePull;
34

35
  private boolean forcePlugins;
36

37
  private boolean forcePluginReinstall;
38

39
  private boolean forceRepositories;
40

41
  private boolean batchMode;
42

43
  private boolean quietMode;
44

45
  private boolean privacyMode;
46

47
  private boolean noColorsMode;
48

49
  private boolean writeLogfile;
50

51
  private Locale locale;
52

53
  /**
54
   * @param logLevelConsole the minimum enabled {@link #getLogLevelConsole() log level}.
55
   * @param logListener the {@link #getLogListener() logListener}.
56
   */
57
  public IdeStartContextImpl(IdeLogLevel logLevelConsole, IdeLogListener logListener) {
58

59
    super();
2✔
60
    this.logLevelConsole = logLevelConsole;
3✔
61
    this.logListener = logListener;
3✔
62
    this.argFormatter = IdeLogArgFormatter.DEFAULT;
3✔
63
    IdeStartContextImpl.instance = this;
2✔
64
    if (logListener instanceof IdeLogListenerBuffer buffer) {
6!
65
      this.logListenerBuffer = buffer;
4✔
66
    } else {
67
      this.logListenerBuffer = null;
×
68
    }
69
  }
1✔
70

71
  @Override
72
  public IdeLogListener getLogListener() {
73

74
    return this.logListener;
3✔
75
  }
76

77
  @Override
78
  public IdeLogLevel getLogLevelConsole() {
79

80
    return this.logLevelConsole;
3✔
81
  }
82

83
  /**
84
   * @param logLevelConsole the new {@link IdeLogLevel} for the console.
85
   * @return the previous set logLevel {@link IdeLogLevel}
86
   */
87
  public IdeLogLevel setLogLevelConsole(IdeLogLevel logLevelConsole) {
88

89
    IdeLogLevel previousLogLevel = this.logLevelConsole;
×
90
    if ((previousLogLevel == null) || (previousLogLevel.ordinal() > IdeLogLevel.INFO.ordinal())) {
×
91
      previousLogLevel = IdeLogLevel.INFO;
×
92
    }
93
    this.logLevelConsole = logLevelConsole;
×
94
    return previousLogLevel;
×
95
  }
96

97
  @Override
98
  public IdeLogLevel getLogLevelLogger() {
99

100
    if (this.logLevelLogger == null) {
3!
101
      if ((this.logListenerBuffer != null) && (this.logListenerBuffer.isBuffering())) {
7!
102
        return IdeLogLevel.TRACE;
2✔
103
      }
104
      return this.logLevelConsole;
3✔
105
    }
106
    return this.logLevelLogger;
×
107
  }
108

109
  /**
110
   * @param logLevelLogger the new {@link #getLogLevelLogger() loglevel for the logger}.
111
   */
112
  public void setLogLevelLogger(IdeLogLevel logLevelLogger) {
113

114
    this.logLevelLogger = logLevelLogger;
×
115
  }
×
116

117
  /**
118
   * @return the {@link IdeLogArgFormatter}.
119
   */
120
  public IdeLogArgFormatter getArgFormatter() {
121

122
    return this.argFormatter;
3✔
123
  }
124

125
  /**
126
   * Internal method to set the {@link IdeLogArgFormatter}.
127
   *
128
   * @param argFormatter the new {@link IdeLogArgFormatter}.
129
   */
130
  public void setArgFormatter(IdeLogArgFormatter argFormatter) {
131

132
    this.argFormatter = argFormatter;
3✔
133
  }
1✔
134

135
  /**
136
   * Ensure the logging system is initialized.
137
   */
138
  public void activateLogging() {
139

140
    if (this.logListener instanceof IdeLogListenerBuffer buffer) {
9!
141
      // https://github.com/devonfw/IDEasy/issues/754
142
      buffer.flushAndEndBuffering();
2✔
143
    }
144
  }
1✔
145

146
  /**
147
   * Disables the logging system (temporary).
148
   *
149
   * @param threshold the {@link IdeLogLevel} acting as threshold.
150
   * @see com.devonfw.tools.ide.context.IdeContext#runWithoutLogging(Runnable, IdeLogLevel)
151
   */
152
  public void deactivateLogging(IdeLogLevel threshold) {
153

154
    if (this.logListener instanceof IdeLogListenerBuffer buffer) {
9!
155
      buffer.startBuffering(threshold);
4✔
156
    } else {
157
      throw new IllegalStateException();
×
158
    }
159
  }
1✔
160

161
  @Override
162
  public boolean isQuietMode() {
163

164
    return this.quietMode;
3✔
165
  }
166

167
  /**
168
   * @param quietMode new value of {@link #isQuietMode()}.
169
   */
170
  public void setQuietMode(boolean quietMode) {
171

172
    this.quietMode = quietMode;
3✔
173
  }
1✔
174

175
  @Override
176
  public boolean isBatchMode() {
177

178
    return this.batchMode;
3✔
179
  }
180

181
  /**
182
   * @param batchMode new value of {@link #isBatchMode()}.
183
   */
184
  public void setBatchMode(boolean batchMode) {
185

186
    this.batchMode = batchMode;
3✔
187
  }
1✔
188

189
  @Override
190
  public boolean isForceMode() {
191

192
    return this.forceMode;
3✔
193
  }
194

195
  /**
196
   * @param forceMode new value of {@link #isForceMode()}.
197
   */
198
  public void setForceMode(boolean forceMode) {
199

200
    this.forceMode = forceMode;
3✔
201
  }
1✔
202

203
  @Override
204
  public boolean isPrivacyMode() {
205
    return this.privacyMode;
3✔
206
  }
207

208
  /**
209
   * @param privacyMode new value of {@link #isPrivacyMode()}.
210
   */
211
  public void setPrivacyMode(boolean privacyMode) {
212
    this.privacyMode = privacyMode;
3✔
213
  }
1✔
214

215
  @Override
216
  public boolean isForcePull() {
217

218
    return this.forcePull;
3✔
219
  }
220

221
  /**
222
   * @param forcePull new value of {@link #isForcePull()}.
223
   */
224
  public void setForcePull(boolean forcePull) {
225

226
    this.forcePull = forcePull;
3✔
227
  }
1✔
228

229
  @Override
230
  public boolean isForcePlugins() {
231

232
    return this.forcePlugins;
3✔
233
  }
234

235
  /**
236
   * @param forcePlugins new value of {@link #isForcePlugins()}.
237
   */
238
  public void setForcePlugins(boolean forcePlugins) {
239

240
    this.forcePlugins = forcePlugins;
3✔
241
  }
1✔
242

243
  @Override
244
  public boolean isForcePluginReinstall() {
245

246
    return this.forcePluginReinstall;
3✔
247
  }
248

249
  /**
250
   * @param forcePluginReinstall new value of {@link #isForcePluginReinstall()}.
251
   */
252
  public void setForcePluginReinstall(boolean forcePluginReinstall) {
253

254
    this.forcePluginReinstall = forcePluginReinstall;
3✔
255
  }
1✔
256

257
  @Override
258
  public boolean isForceRepositories() {
259

260
    return this.forceRepositories;
3✔
261
  }
262

263
  /**
264
   * @param forceRepositories new value of {@link #isForceRepositories()}.
265
   */
266
  public void setForceRepositories(boolean forceRepositories) {
267

268
    this.forceRepositories = forceRepositories;
3✔
269
  }
1✔
270

271
  @Override
272
  public boolean isOfflineMode() {
273

274
    return this.offlineMode;
3✔
275
  }
276

277
  /**
278
   * @param offlineMode new value of {@link #isOfflineMode()}.
279
   */
280
  public void setOfflineMode(boolean offlineMode) {
281

282
    this.offlineMode = offlineMode;
3✔
283
  }
1✔
284

285
  @Override
286
  public boolean isSkipUpdatesMode() {
287

288
    return this.skipUpdatesMode;
3✔
289
  }
290

291
  /**
292
   * @param skipUpdatesMode new value of {@link #isSkipUpdatesMode()}.
293
   */
294
  public void setSkipUpdatesMode(boolean skipUpdatesMode) {
295

296
    this.skipUpdatesMode = skipUpdatesMode;
3✔
297
  }
1✔
298

299
  @Override
300
  public Locale getLocale() {
301

302
    return this.locale;
3✔
303
  }
304

305
  /**
306
   * @param locale new value of {@link #getLocale()}.
307
   */
308
  public void setLocale(Locale locale) {
309

310
    this.locale = locale;
3✔
311
  }
1✔
312

313
  @Override
314
  public boolean isNoColorsMode() {
315

316
    return this.noColorsMode;
3✔
317
  }
318

319
  /**
320
   * @param noColoursMode new value of {@link #isNoColorsMode()}.
321
   */
322
  public void setNoColorsMode(boolean noColoursMode) {
323

324
    this.noColorsMode = noColoursMode;
3✔
325
  }
1✔
326

327
  /**
328
   * @return {@code true} to write a logfile to disc, {@code false} otherwise.
329
   */
330
  public boolean isWriteLogfile() {
331

332
    return this.writeLogfile;
×
333
  }
334

335
  /**
336
   * @param writeLogfile new value of {@link #isWriteLogfile()}.
337
   */
338
  public void setWriteLogfile(boolean writeLogfile) {
339
    this.writeLogfile = writeLogfile;
3✔
340
  }
1✔
341

342
  /**
343
   * @return the current {@link IdeStartContextImpl} instance.
344
   */
345
  public static IdeStartContextImpl get() {
346

347
    return instance;
2✔
348
  }
349

350
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc