1 11 12 package org.eclipse.ui.internal.menus; 13 14 import org.eclipse.core.expressions.Expression; 15 import org.eclipse.ui.ISources; 16 import org.eclipse.ui.internal.services.EvaluationResultCache; 17 18 35 final class MenuContribution extends EvaluationResultCache implements 36 IMenuContribution { 37 38 42 private final MenuElement menuElement; 43 44 48 private final IMenuService menuService; 49 50 65 public MenuContribution(final MenuElement menuElement, 66 final Expression expression, final IMenuService menuService) { 67 super(expression); 68 69 if (menuElement == null) { 70 throw new NullPointerException ( 71 "The menu element for a contribution cannot be null"); } 73 74 if (menuService == null) { 75 throw new NullPointerException ( 76 "The menu service for a contribution cannot be null"); } 78 79 this.menuElement = menuElement; 80 this.menuService = menuService; 81 } 82 83 public final MenuElement getMenuElement() { 84 return menuElement; 85 } 86 87 public final IMenuService getMenuService() { 88 return menuService; 89 } 90 91 public final String toString() { 92 final StringBuffer buffer = new StringBuffer (); 93 94 buffer.append("MenuContribution(menuElement="); buffer.append(menuElement); 96 buffer.append(",menuService="); buffer.append(menuService); 98 buffer.append(",sourcePriority="); buffer.append(getSourcePriority()); 100 buffer.append(')'); 101 102 return buffer.toString(); 103 } 104 } 105 | Popular Tags |