/**
 * @author tyl
 * @Action  ini
 * 2011-3-16
 */
package cn.com.origin.autocode;

import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;

import cn.com.origin.autocode.common.IsShowAutocodePerspective;
import cn.com.origin.autocodemanager.common.AutoCodeConstants;

import com.teamcenter.rac.aifrcp.perspective.AbstractRACPerspective;
import com.teamcenter.rac.util.MessageBox;

public class AutoCodePerspective extends AbstractRACPerspective {
	/** The perspective ID */
	public static final String ID = "cn.com.origin.autocode.views.AutoCodePerspective";

	@Override
	public void createInitialLayout(IPageLayout layout) {
		layout.setEditorAreaVisible(false);
		layout.setFixed(false);
		String editorArea = layout.getEditorArea();
		if (new IsShowAutocodePerspective().getValue()) {
			layout.addStandaloneView(AutoCodeConstants.AutoCodeItemTypeView_ID, true, IPageLayout.LEFT, 0.24f, editorArea);
			IFolderLayout middleFolder = layout.createFolder("编码视图", IPageLayout.LEFT, 0.68f, editorArea);

			middleFolder.addView(AutoCodeConstants.AutoCodeCodeView_ID);
			middleFolder.addView(AutoCodeConstants.AutoCodeGroupView_ID);

			layout.getViewLayout(AutoCodeConstants.AutoCodeItemTypeView_ID).setCloseable(false);
			layout.getViewLayout(AutoCodeConstants.AutoCodeItemTypeView_ID).setMoveable(false);

			layout.getViewLayout(AutoCodeConstants.AutoCodeCodeView_ID).setCloseable(false);
			layout.getViewLayout(AutoCodeConstants.AutoCodeCodeView_ID).setMoveable(false);

			layout.getViewLayout(AutoCodeConstants.AutoCodeGroupView_ID).setCloseable(false);
			layout.getViewLayout(AutoCodeConstants.AutoCodeGroupView_ID).setMoveable(false);
		} else {
			MessageBox.post("您没有权限!", "INFO", MessageBox.WARNING);
		}
	}
}
