1 24 package org.objectweb.clif.scenario.util.isac.gui.action; 25 26 import java.net.URL ; 27 28 import org.apache.log4j.Category; 29 import org.eclipse.jface.action.Action; 30 import org.eclipse.jface.resource.ImageDescriptor; 31 import org.eclipse.jface.window.ApplicationWindow; 32 import org.objectweb.clif.scenario.util.isac.FileName; 33 import org.objectweb.clif.scenario.util.isac.gui.ScenarioGUIEditor; 34 40 public class SwitchLoadProfileOrBehaviorsModeAction extends Action { 41 44 ScenarioGUIEditor window; 45 static Category cat = Category 46 .getInstance(SwitchLoadProfileOrBehaviorsModeAction.class.getName()); 47 48 private static final String fullBehaviorsModeText = "Full behaviors mode"; 49 private static final String fullLoadProfileModeText = "Full load profile mode"; 50 private static final String fullBehaviorsModeToolTipText = "Full behaviors mode"; 51 private static final String fullLoadProfileModeToolTipText = "Full load profile mode"; 52 private static final String splitModeText = "Split mode"; 53 private static final String splitModeToolTipText = "Split mode"; 54 private int typeMode ; 55 61 public SwitchLoadProfileOrBehaviorsModeAction(ApplicationWindow w, int type) { 62 cat.debug("-> constructor"); 63 this.window = (ScenarioGUIEditor) w; 64 this.typeMode = type ; 65 try { 66 switch (type) { 68 case ScenarioGUIEditor.FULL_BEHAVIORS_MODE : 69 setText(fullBehaviorsModeText); 70 setToolTipText(fullBehaviorsModeToolTipText) ; 71 this.setImageDescriptor(ImageDescriptor 72 .createFromURL(new URL ("file:" 73 + FileName.FULL_ICON))); 74 break; 75 case ScenarioGUIEditor.FULL_LOAD_PROFILE_MODE : 76 setText(fullLoadProfileModeText); 77 setToolTipText(fullLoadProfileModeToolTipText) ; 78 this.setImageDescriptor(ImageDescriptor 79 .createFromURL(new URL ("file:" 80 + FileName.FULL_ICON))); 81 break; 82 case ScenarioGUIEditor.SPLIT_MODE : 83 setText(splitModeText); 84 setToolTipText(splitModeToolTipText) ; 85 this.setImageDescriptor(ImageDescriptor 86 .createFromURL(new URL ("file:" 87 + FileName.SPLIT_ICON))); 88 break; 89 default : 90 } 92 } catch (Exception e) { 93 cat.warn("Unable to find Switch MODE icon file"); 94 } 95 } 96 97 public void run() { 98 this.window.changeSplitMode(typeMode) ; 99 } 100 } | Popular Tags |