blob: fe0e6daf7f7b30cc2accf02368ac8da747ed42ab (
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
58
59
60
61
|
/*******************************************************************************
* Copyright (c) 2006 IBM Corporation 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
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.ua.tests.cheatsheet.util;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.cheatsheets.ICompositeCheatSheetTask;
import org.eclipse.ui.cheatsheets.ITaskEditor;
import org.eclipse.ui.forms.widgets.FormToolkit;
// Task Editor used in the persistence tests
public class MockTaskEditor implements ITaskEditor {
public static final String NO_MEMENTO = "No Memento";
private String value;
private static final String KEY = "key";
public Control getControl() {
// Not used by tests
return null;
}
public void setInput(ICompositeCheatSheetTask task, IMemento memento) {
if (memento == null) {
setValue(NO_MEMENTO);
} else {
setValue(memento.getString(KEY));
}
}
public void saveState(IMemento memento) {
memento.putString(KEY, getValue());
}
public void createControl(Composite parent, FormToolkit toolkit) {
// TODO Auto-generated method stub
}
public void setValue(String value) {
this.value = value;
}
public String getValue() {
return value;
}
}
|