blob: 8e692aacc5172f5af956c4e790c90081f5a42842 (
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
|
/*******************************************************************************
* Copyright (c) 2009, 2014 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
******************************************************************************/
package org.eclipse.ui.internal.e4.compatibility;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective;
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
import org.eclipse.e4.ui.model.application.ui.basic.MStackElement;
import org.eclipse.ui.IFolderLayout;
public class ModeledFolderLayout extends ModeledPlaceholderFolderLayout
implements IFolderLayout {
public ModeledFolderLayout(ModeledPageLayout layout, MApplication application,
MPartStack stackModel) {
super(layout, application, stackModel);
}
@Override
public void addView(String viewId) {
MStackElement viewModel = ModeledPageLayout.createViewModel(application, viewId, true,
layout.page,
layout.partService,
layout.createReferences);
if (viewModel != null) {
// adding a non-placeholder to this folder, make sure the folder
// will be rendered
MUIElement parent = folderModel.getParent();
while (parent != null && !(parent instanceof MPerspective)) {
parent.setToBeRendered(true);
parent = parent.getParent();
}
folderModel.setToBeRendered(true);
boolean isFiltered = layout.isViewFiltered(viewId);
if (isFiltered)
layout.addViewActivator(viewModel);
viewModel.setToBeRendered(!isFiltered);
folderModel.getChildren().add(viewModel);
}
}
}
|