Merge branch 'master' into simulator
[platform/upstream/iotivity.git] / service / simulator / java / eclipse-plugin / ServiceProviderPlugin / src / oic / simulator / serviceprovider / view / dialogs / CreateResourceWizard.java
1 /*
2  * Copyright 2015 Samsung Electronics All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package oic.simulator.serviceprovider.view.dialogs;
18
19 import java.net.URL;
20
21 import oic.simulator.serviceprovider.Activator;
22
23 import org.eclipse.core.runtime.FileLocator;
24 import org.eclipse.core.runtime.IPath;
25 import org.eclipse.core.runtime.Path;
26 import org.eclipse.jface.resource.ImageDescriptor;
27 import org.eclipse.jface.wizard.Wizard;
28
29 /**
30  * This class creates a UI wizard for create resource operation.
31  */
32 public class CreateResourceWizard extends Wizard {
33
34     private CreateResourcePage page;
35
36     public CreateResourceWizard() {
37         setWindowTitle("Create resources");
38         IPath path = new Path("/icons/oic_logo_64x64.png");
39         URL find = FileLocator.find(Activator.getDefault().getBundle(), path,
40                 null);
41         setDefaultPageImageDescriptor(ImageDescriptor.createFromURL(find));
42     }
43
44     @Override
45     public void addPages() {
46         page = new CreateResourcePage();
47         addPage(page);
48     }
49
50     public String getConfigFilePath() {
51         if (null == page) {
52             return null;
53         }
54         return page.getConfigFilePath();
55     }
56
57     public int getResourceCount() {
58         if (null == page) {
59             return 0;
60         }
61         return page.getResourceCount();
62     }
63
64     @Override
65     public boolean performFinish() {
66         return true;
67     }
68 }