⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 treeimages.java

📁 基于eclipse|rcp的浏览器,另完成加入了收藏夹功能
💻 JAVA
字号:
/*******************************************************************************
 * Copyright (c) 2006 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 ******************************************************************************/

package org.eclipse.rcp.browser;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;

/**
 * @since 3.2
 * 
 */
public class TreeImages {
	private final static String ICONS_PATH = "icons/";

	private final static String FLOWDER = "FLOWDER";

	private final static String URLIMAGE = "URLIMAGE";
	
	

	private static ImageRegistry imageRegistry;

	/**
	 * @return imageRegistry
	 */
	public static ImageRegistry getImageRegistry() {
		if (imageRegistry == null) {
			imageRegistry = new ImageRegistry();
			declareImages();// 注册图像

		}
		return imageRegistry;
	}

	/**
	 * 
	 */
	private final static void declareImages() {
		// TODO Auto-generated method stub
		declareRegistryImage(FLOWDER, ICONS_PATH + "fldr_obj.gif");
		declareRegistryImage(URLIMAGE, ICONS_PATH + "gel_sc_obj.gif");

	}

	/**
	 * 
	 */
	private static void declareRegistryImage(String key, String path) {
		// TODO Auto-generated method stub
		ImageDescriptor desc = ImageDescriptor.createFromFile(
				TreeImages.class, path);
		imageRegistry.put(key, desc);
	}

	/**
	 * @param key
	 * @return Image
	 */
	public static Image getImage(String key){
		return getImageRegistry().get(key);
	}
	/**
	 * @param key
	 * @return ImageDescriptor
	 */
	public static ImageDescriptor getImageDescriptor(String key){
		return getImageRegistry().getDescriptor(key);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -