Java SDK and Eclipse plugin for simulator.
[platform/upstream/iotivity.git] / service / simulator / java / eclipse-plugin / ServiceProviderPlugin / src / oic / simulator / serviceprovider / perspective / PerspectiveFactory.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.perspective;
18
19 import oic.simulator.serviceprovider.view.AttributeView;
20 import oic.simulator.serviceprovider.view.LogView;
21 import oic.simulator.serviceprovider.view.MetaPropertiesView;
22 import oic.simulator.serviceprovider.view.MultiResourceOrchestrationView;
23 import oic.simulator.serviceprovider.view.ResourceManagerView;
24 import oic.simulator.serviceprovider.view.ResourceObserverView;
25
26 import org.eclipse.ui.IFolderLayout;
27 import org.eclipse.ui.IPageLayout;
28 import org.eclipse.ui.IPerspectiveFactory;
29
30 /**
31  * This class creates a new eclipse perspective for service provider and
32  * positions the different views inside.
33  */
34 public class PerspectiveFactory implements IPerspectiveFactory {
35
36     public static final String PERSPECTIVE_ID = "oic.simulator.serviceprovider.perspective";
37     private IPageLayout        factory;
38
39     @Override
40     public void createInitialLayout(IPageLayout factory) {
41         this.factory = factory;
42         factory.setEditorAreaVisible(false);
43         addViews();
44         factory.setFixed(false);
45     }
46
47     private void addViews() {
48         factory.addView(ResourceManagerView.VIEW_ID, IPageLayout.LEFT, 0.3f,
49                 factory.getEditorArea());
50
51         IFolderLayout folder = factory.createFolder(
52                 "oic.simulator.serviceprovider.perspective.folder",
53                 IPageLayout.BOTTOM, 0.65f, ResourceManagerView.VIEW_ID);
54         folder.addView(MetaPropertiesView.VIEW_ID);
55         folder.addView(ResourceObserverView.VIEW_ID);
56
57         factory.addView(AttributeView.VIEW_ID, IPageLayout.LEFT, 0.7f,
58                 factory.getEditorArea());
59         factory.addView(LogView.VIEW_ID, IPageLayout.BOTTOM, 0.65f,
60                 AttributeView.VIEW_ID);
61         factory.addView(MultiResourceOrchestrationView.VIEW_ID,
62                 IPageLayout.RIGHT, 0.6f, AttributeView.VIEW_ID);
63     }
64 }