xref: /AOO41X/test/testassistant/src/org/openoffice/test/assistant/views/VclExplorerContentProvider.java (revision e6e6073ddaad3a04a985e8f05823629a884eb203)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 package org.openoffice.test.assistant.views;
25 
26 import java.util.ArrayList;
27 
28 import org.eclipse.jface.viewers.IStructuredContentProvider;
29 import org.eclipse.jface.viewers.Viewer;
30 
31 public class VclExplorerContentProvider implements IStructuredContentProvider {
VclExplorerContentProvider()32     public VclExplorerContentProvider() {
33 
34     }
35 
inputChanged(Viewer v, Object oldInput, Object newInput)36     public void inputChanged(Viewer v, Object oldInput, Object newInput) {
37         ArrayList<ControlInfo> oldControlInfos = (ArrayList<ControlInfo>) oldInput;
38         if (oldControlInfos != null) {
39             for (ControlInfo info : oldControlInfos) {
40                 info.dispose();
41             }
42         }
43     }
44 
dispose()45     public void dispose() {
46 
47     }
48 
getElements(Object parent)49     public Object[] getElements(Object parent) {
50         ArrayList<ControlInfo> controlInfos = (ArrayList<ControlInfo>) parent;
51         if (controlInfos != null)
52             return controlInfos.toArray();
53 
54         return new Object[0];
55     }
56 }