package cn.com.origin.autocodemanager;

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

import cn.com.origin.autocodemanager.common.AutoCodeManangerConstants;
import cn.com.origin.autocodemanager.common.IsShowAutocodeManagerPerspective;

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

public class AutoCodeManagerPerspective extends AbstractRACPerspective {
	/** The perspective ID */

	public static final String ID = "cn.com.origin.autocodemanager.AutoCodeManagerPerspective";

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

			middleFolder.addView(AutoCodeManangerConstants.AutoCodeManagerTreeCodeView_ID);
			middleFolder.addView(AutoCodeManangerConstants.AutoCodeManagerListCodeView_ID);
			
			middleFolder.addView(AutoCodeManangerConstants.AutoCodeTestView_ID);

			layout.getViewLayout(AutoCodeManangerConstants.AutoCodeManagerView_ID).setCloseable(false);
			layout.getViewLayout(AutoCodeManangerConstants.AutoCodeManagerView_ID).setMoveable(false);

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

}
