1// BEGIN LICENSE BLOCK 2// Version: CMPL 1.1 3// 4// The contents of this file are subject to the Cisco-style Mozilla Public 5// License Version 1.1 (the "License"); you may not use this file except 6// in compliance with the License. You may obtain a copy of the License 7// at www.eclipse-clp.org/license. 8// 9// Software distributed under the License is distributed on an "AS IS" 10// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 11// the License for the specific language governing rights and limitations 12// under the License. 13// 14// The Original Code is The ECLiPSe Constraint Logic Programming System. 15// The Initial Developer of the Original Code is Cisco Systems, Inc. 16// Portions created by the Initial Developer are 17// Copyright (C) 2006 Cisco Systems, Inc. All Rights Reserved. 18// 19// Contributor(s): 20// 21// END LICENSE BLOCK 22 23package com.parctechnologies.eclipse.visualisation; 24import java.util.List; 25 26/** 27 * A command to set the buildable views in the default policy 28 * 29 */ 30public class PolicySelectedCommand extends RecordableCommand implements ImmediateCommand { 31 List keys; 32 33 String viewableName; 34 35 public PolicySelectedCommand(String viewableName, List keys) { 36 this.viewableName = viewableName; 37 this.keys = keys; 38 } 39 40 public String getViewableName() { 41 return viewableName ; 42 } 43 44 public void postRecordIssue() { 45 try { 46 DefaultViewerBuildingPolicy policy = 47 (DefaultViewerBuildingPolicy) 48 ScenarioManager.getInstance().getVisClientStateModel(). 49 getVisClient().getViewerManager().getViewerBuildingPolicy(); 50 policy.enableViewers(keys); 51 if (DebuggingSupport.logMessages) { 52 DebuggingSupport.logMessage(this, 53 "Policy enabled"); 54 } 55 } catch(ClassCastException e) { 56 57 if (DebuggingSupport.logMessages) { 58 DebuggingSupport.logMessage(this, 59 "Recorded command can only set viewer creation preferences on DefaultViewerBuildingPolicy object"); 60 } 61 62 } 63 } 64} 65