1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.message.ui;
18 * Manages the log file providers.
19 * One adds log file provider to let Log View know where to find log files.
21 public class LogFilesManager {
23 private static List<ILogFileProvider> logFileProviders = new ArrayList<ILogFileProvider>();
26 * Adds log file provider.
27 * Has no effect if an identical provider is already registered.
29 public static void addLogFileProvider(ILogFileProvider provider) {
30 if (!logFileProviders.contains(provider)) {
31 logFileProviders.add(provider);
36 * Removes log file provider.
37 * Has no effect if an identical provider is already removed.
39 public static void removeLogFileProvider(ILogFileProvider provider) {
40 logFileProviders.remove(provider);
44 * Returns the list of logs.
46 static Map<String, File> getLogSources() {
47 ILogFileProvider[] providers = (ILogFileProvider[]) logFileProviders.toArray(new ILogFileProvider[logFileProviders.size()]);
48 Map<String, File> result = new HashMap<String, File>();
50 for (int i = 0; i < providers.length; i++) {
51 ILogFileProvider provider = providers[i];
53 Map<String, File> sources = provider.getLogSources();
54 result.putAll(sources);