blob: 9e989bf873b12a7c134770c10abae37e1af5ef3b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/*******************************************************************************
* Copyright (c) 2015 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
package org.eclipse.cdt.internal.core.build;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.core.resources.ISaveContext;
import org.eclipse.core.resources.ISaveParticipant;
import org.eclipse.core.runtime.CoreException;
public class ScannerInfoSaveParticipant implements ISaveParticipant {
private static ScannerInfoSaveParticipant instance;
private Set<ScannerInfoData> toBeSaved = new HashSet<>();
public ScannerInfoSaveParticipant() {
assert instance == null;
instance = this;
}
public static ScannerInfoSaveParticipant getInstance() {
return instance;
}
public void save(ScannerInfoData info) {
toBeSaved.add(info);
}
@Override
public void doneSaving(ISaveContext context) {
}
@Override
public void prepareToSave(ISaveContext context) throws CoreException {
}
@Override
public void rollback(ISaveContext context) {
// TODO Auto-generated method stub
}
@Override
public void saving(ISaveContext context) throws CoreException {
for (ScannerInfoData info : toBeSaved) {
info.save();
}
toBeSaved.clear();
}
}
|