Java tutorial
/* * Copyright 2017 The Depan Project Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.devtools.depan.java.bytecode.eclipse.ui.widgets; import com.google.devtools.depan.java.bytecode.eclipse.AsmFactory; import com.google.devtools.depan.platform.eclipse.ui.widgets.MapChoiceControl; import com.google.common.collect.Maps; import org.eclipse.swt.widgets.Composite; import java.util.Map; /** * @author <a href="mailto:leeca@pnambic.com">Lee Carver</a> */ public class AsmLevelControl extends MapChoiceControl<AsmFactory> { private static final Map<String, AsmFactory> ASM_OPTIONS = buildAsmOptions(); private static Map<String, AsmFactory> buildAsmOptions() { Map<String, AsmFactory> result = Maps.newHashMap(); result.put("ASM-4", AsmFactory.ASM4_FACTORY); result.put("ASM-5", AsmFactory.ASM5_FACTORY); return result; } public AsmLevelControl(Composite parent) { super(parent); setInput(AsmFactory.ASM5_FACTORY, ASM_OPTIONS); } @Override protected AsmFactory coerceResult(Object obj) { return (AsmFactory) obj; } }