189964bc1087c160d73769cacae4fcf96c0c471f
1 /**********************************************************************
2 * Copyright (c) 2012, 2014 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
12 package org
.eclipse
.linuxtools
.internal
.lttng2
.control
.stubs
.dialogs
;
14 import java
.util
.ArrayList
;
15 import java
.util
.HashSet
;
16 import java
.util
.Iterator
;
17 import java
.util
.List
;
20 import org
.eclipse
.linuxtools
.internal
.lttng2
.control
.ui
.views
.dialogs
.IAddContextDialog
;
23 * Add Context dialog stub.
25 @SuppressWarnings("javadoc")
26 public class AddContextDialogStub
implements IAddContextDialog
{
28 private Set
<String
> fAvailableContexts
= null;
29 private List
<String
> fContexts
= null;
37 public void setAvalibleContexts(List
<String
> contexts
) {
38 fAvailableContexts
= new HashSet
<>();
39 fAvailableContexts
.addAll(contexts
);
43 public List
<String
> getContexts() {
44 List
<String
> ret
= new ArrayList
<>();
45 ret
.addAll(fContexts
);
49 public void setContexts(List
<String
> contexts
) throws IllegalArgumentException
{
50 fContexts
= new ArrayList
<>();
51 fContexts
.addAll(contexts
);
52 // If availableContexts are null we cannot verify
53 if (fAvailableContexts
!= null) {
54 for (Iterator
<String
> iterator
= fContexts
.iterator(); iterator
.hasNext();) {
55 String string
= iterator
.next();
56 if (!fAvailableContexts
.contains(string
)) {
57 throw new IllegalArgumentException();
This page took 0.031928 seconds and 4 git commands to generate.