1 2 25 26 package org.aspectj.ajde.ui.swing; 27 28 import javax.swing.*; 29 import java.util.*; 30 import java.net.URL ; 31 import org.aspectj.asm.*; 32 import org.aspectj.ajde.ui.*; 33 34 39 public class IconRegistry extends AbstractIconRegistry { 40 41 protected String RESOURCE_PATH = "org/aspectj/ajde/resources/"; 43 44 private final Icon START_AJDE = makeIcon("actions/startAjde.gif"); 45 private final Icon STOP_AJDE = makeIcon("actions/stopAjde.gif"); 46 private final Icon BUILD = makeIcon("actions/build.gif"); 47 private final Icon DEBUG = makeIcon("actions/debug.gif"); 48 private final Icon EXECUTE = makeIcon("actions/execute.gif"); 49 private final Icon AJBROWSER = makeIcon("structure/advice.gif"); 50 private final Icon AJBROWSER_ENABLED = makeIcon("actions/browserEnabled.gif"); 51 private final Icon AJBROWSER_DISABLED = makeIcon("actions/browserDisabled.gif"); 52 private final Icon STRUCTURE_VIEW = makeIcon("actions/structureView.gif"); 53 54 private final Icon HIDE_ASSOCIATIONS = makeIcon("actions/hideAssociations.gif"); 55 private final Icon HIDE_NON_AJ = makeIcon("actions/hideNonAJ.gif"); 56 private final Icon GRANULARITY = makeIcon("actions/granularity.gif"); 57 private final Icon AJDE_SMALL = makeIcon("actions/ajdeSmall.gif"); 58 59 private final Icon ERROR = makeIcon("structure/error.gif"); 60 private final Icon WARNING = makeIcon("structure/warning.gif"); 61 private final Icon INFO = makeIcon("structure/info.gif"); 62 63 private final Icon POPUP = makeIcon("actions/popup.gif"); 64 private final Icon FILTER = makeIcon("actions/filter.gif"); 65 private final Icon RELATIONS = makeIcon("actions/relations.gif"); 66 private final Icon ORDER = makeIcon("actions/order.gif"); 67 68 private final Icon ZOOM_STRUCTURE_TO_FILE_MODE = makeIcon("actions/zoomStructureToFileMode.gif"); 69 private final Icon ZOOM_STRUCTURE_TO_GLOBAL_MODE = makeIcon("actions/zoomStructureToGlobalMode.gif"); 70 private final Icon SPLIT_STRUCTURE_VIEW = makeIcon("actions/splitStructureView.gif"); 71 private final Icon MERGE_STRUCTURE_VIEW = makeIcon("actions/mergeStructureView.gif"); 72 73 private final Icon BACK = makeIcon("actions/back.gif"); 74 private final Icon FORWARD = makeIcon("actions/forward.gif"); 75 private final Icon SEARCH = makeIcon("actions/search.gif"); 76 private final Icon OPEN_CONFIG = makeIcon("actions/openConfig.gif"); 77 private final Icon CLOSE_CONFIG = makeIcon("actions/closeConfig.gif"); 78 private final Icon SAVE = makeIcon("actions/save.gif"); 79 private final Icon SAVE_ALL = makeIcon("actions/saveAll.gif"); 80 private final Icon BROWSER_OPTIONS = makeIcon("actions/browseroptions.gif"); 81 82 private final Icon ACCESSIBILITY_PUBLIC = makeIcon("structure/accessibility-public.gif"); 83 private final Icon ACCESSIBILITY_PACKAGE = makeIcon("structure/accessibility-package.gif"); 84 private final Icon ACCESSIBILITY_PROTECTED = makeIcon("structure/accessibility-protected.gif"); 85 private final Icon ACCESSIBILITY_PRIVATE = makeIcon("structure/accessibility-private.gif"); 86 private final Icon ACCESSIBILITY_PRIVILEGED = makeIcon("structure/accessibility-privileged.gif"); 87 88 public Icon getAjdeSmallIcon() { return AJDE_SMALL; } 89 public Icon getHideAssociationsIcon() { return HIDE_ASSOCIATIONS; } 90 public Icon getHideNonAJIcon() { return HIDE_NON_AJ; } 91 public Icon getGranularityIcon() { return GRANULARITY; } 92 public Icon getErrorIcon() { return ERROR; } 93 public Icon getWarningIcon() { return WARNING; } 94 public Icon getInfoIcon() { return INFO; } 95 public Icon getAJBrowserIcon() { return AJBROWSER; } 96 public Icon getAJBrowserEnabledIcon() { return AJBROWSER_ENABLED; } 97 public Icon getAJBrowserDisabledIcon() { return AJBROWSER_DISABLED; } 98 public Icon getPopupIcon() { return POPUP; } 99 public Icon getFilterIcon() { return FILTER; } 100 public Icon getOrderIcon() { return ORDER; } 101 public Icon getRelationsIcon() { return RELATIONS; } 102 public Icon getStartAjdeIcon() { return START_AJDE; } 103 public Icon getStopAjdeIcon() { return STOP_AJDE; } 104 public Icon getBackIcon() { return BACK; } 105 public Icon getForwardIcon() { return FORWARD; } 106 public Icon getSearchIcon() { return SEARCH; } 107 public Icon getBuildIcon() { return BUILD; } 108 public Icon getDebugIcon() { return DEBUG; } 109 public Icon getExecuteIcon() { return EXECUTE; } 110 public Icon getOpenConfigIcon() { return OPEN_CONFIG; } 111 public Icon getCloseConfigIcon() { return CLOSE_CONFIG; } 112 public Icon getOpenIcon() { return OPEN_CONFIG; } 113 public Icon getSaveIcon() { return SAVE; } 114 public Icon getSaveAllIcon() { return SAVE_ALL; } 115 public Icon getBrowserOptionsIcon() { return BROWSER_OPTIONS; } 116 public Icon getZoomStructureToFileModeIcon() { return ZOOM_STRUCTURE_TO_FILE_MODE; } 117 public Icon getZoomStructureToGlobalModeIcon() { return ZOOM_STRUCTURE_TO_GLOBAL_MODE; } 118 public Icon getSplitStructureViewIcon() { return SPLIT_STRUCTURE_VIEW; } 119 public Icon getMergeStructureViewIcon() { return MERGE_STRUCTURE_VIEW; } 120 public Icon getStructureViewIcon() { return STRUCTURE_VIEW; } 121 122 public Icon getAssociationSwingIcon(Relation relation) { 123 return convertToSwingIcon(getRelationIcon(relation)); 124 } 125 126 protected AbstractIcon getStructureIcon(ProgramElementNode.Kind kind, ProgramElementNode.Accessibility accessibility) { 127 return getStructureIcon(kind); 128 } 129 130 public Icon getStructureSwingIcon(ProgramElementNode.Kind kind, ProgramElementNode.Accessibility accessibility) { 131 return convertToSwingIcon(getStructureIcon(kind, accessibility)); 132 } 133 134 public Icon getStructureSwingIcon(ProgramElementNode.Kind kind) { 135 return convertToSwingIcon(getStructureIcon(kind)); 136 } 137 138 public Icon getAccessibilitySwingIcon(ProgramElementNode.Accessibility accessibility) { 139 if (accessibility == ProgramElementNode.Accessibility.PUBLIC) { 140 return ACCESSIBILITY_PUBLIC; 141 } else if (accessibility == ProgramElementNode.Accessibility.PACKAGE) { 142 return ACCESSIBILITY_PACKAGE; 143 } else if (accessibility == ProgramElementNode.Accessibility.PROTECTED) { 144 return ACCESSIBILITY_PROTECTED; 145 } else if (accessibility == ProgramElementNode.Accessibility.PRIVATE) { 146 return ACCESSIBILITY_PRIVATE; 147 } else if (accessibility == ProgramElementNode.Accessibility.PRIVILEGED) { 148 return ACCESSIBILITY_PRIVILEGED; 149 } else { 150 return null; 151 } 152 } 153 154 public Icon convertToSwingIcon(AbstractIcon iconAdapter) { 155 if (iconAdapter != null) { 156 return (Icon)iconAdapter.getIconResource(); 157 } else { 158 return null; 159 } 160 } 161 162 protected AbstractIcon createIcon(String path) { 163 return new AbstractIcon(new ImageIcon(ClassLoader.getSystemResource(path))); 164 } 165 166 protected Icon makeIcon(String iconPath) { 167 return new ImageIcon(ClassLoader.getSystemResource(RESOURCE_PATH + iconPath)); 168 } 169 } | Popular Tags |