亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? launcherplugin.java

?? eclipse建立工程 org.eclipse.swt.examples.launcher.rar
?? JAVA
字號:
/*******************************************************************************
 * Copyright (c) 2000, 2004 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.swt.examples.launcher;


import java.io.*;
import java.net.*;
import java.text.*;
import java.util.*;

import org.eclipse.core.runtime.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.ui.plugin.*;
import org.osgi.framework.*;

/**
 * The main plugin class to be used in the desktop.
 */
public class LauncherPlugin extends AbstractUIPlugin {
	//The shared instance.
	private static LauncherPlugin plugin;
	private static ResourceBundle resourceBundle;

	public static final String
		LAUNCH_ITEMS_POINT_ID = "org.eclipse.swt.examples.launcher.launchItems",
		LAUNCH_ITEMS_XML_CATEGORY = "category",
		LAUNCH_ITEMS_XML_ITEM = "item",
		LAUNCH_ITEMS_XML_ITEM_ICON = "icon",
		LAUNCH_ITEMS_XML_ITEM_DESCRIPTION = "description",
		LAUNCH_ITEMS_XML_PROGRAM = "program",
		LAUNCH_ITEMS_XML_PROGRAM_PLUGIN = "pluginId",
		LAUNCH_ITEMS_XML_PROGRAM_CLASS = "mainClass",
		LAUNCH_ITEMS_XML_VIEW = "view",
		LAUNCH_ITEMS_XML_VIEW_VIEWID = "viewId",
		LAUNCH_ITEMS_XML_ATTRIB_ID = "id",
		LAUNCH_ITEMS_XML_ATTRIB_NAME = "name",
		LAUNCH_ITEMS_XML_ATTRIB_ENABLED = "enabled",
		LAUNCH_ITEMS_XML_ATTRIB_CATEGORY = "category",
		LAUNCH_ITEMS_XML_VALUE_TRUE = "true",
		LAUNCH_ITEMS_XML_VALUE_FALSE = "false";		

	static final int
		liClosedFolder = 0,
		liOpenFolder = 1,
		liGenericExample = 2;
	static final String[] imageLocations = {
		"icons/closedFolder.gif",
		"icons/openFolder.gif",
		"icons/generic_example.gif" };
	static Image images[];

	/**
	 * Constructs the LauncherPlugin.
	 */
	public LauncherPlugin() {
		super();
		plugin = this;
	}

    public void start(BundleContext context) throws Exception {
        super.start(context);
        resourceBundle = Platform.getResourceBundle(getBundle());
    }
    
	/**
	 * Clean up
	 */
	public void stop(BundleContext context) throws Exception {
		freeResources();
		super.stop(context);
	}

	/**
	 * Returns the shared instance.
	 */
	public static LauncherPlugin getDefault() {
		return plugin;
	}

	/**
	 * Loads the resources
	 */
	public static void initResources() {
		if (images == null) {
			images = new Image[imageLocations.length];
				
			for (int i = 0; i < imageLocations.length; ++i) {
				images[i] = getImageFromPlugin(plugin.getBundle(), imageLocations[i]);
				if (images[i] == null) {
					freeResources();
					logError(getResourceString("error.CouldNotLoadResources"), null);
					throw new IllegalStateException();
				}
			}
		}	
	}

	/**
	 * Frees the resources
	 */
	public static void freeResources() {
		if (images != null) {
			for (int i = 0; i < images.length; ++i) {
				final Image image = images[i];
				if (image != null) image.dispose();
			}
			images = null;
		}
	}

	/**
	 * Log an error to the ILog for this plugin
	 * 
	 * @param message the localized error message text
	 * @param exception the associated exception, or null
	 */
	public static void logError(String message, Throwable exception) {
		plugin.getLog().log(new Status(
			IStatus.ERROR, plugin.getBundle().getSymbolicName(), 0, message, exception));
	}

	/**
	 * Returns a string from the resource bundle.
	 * We don't want to crash because of a missing String.
	 * Returns the key if not found.
	 */
	public static String getResourceString(String key) {
		try {
			return resourceBundle.getString(key);
		} catch (MissingResourceException e) {
			return key;
		} catch (NullPointerException e) {
			return "!" + key + "!";
		}			
	}

	/**
	 * Returns a string from the resource bundle and binds it
	 * with the given arguments. If the key is not found,
	 * return the key.
	 */
	public static String getResourceString(String key, Object[] args) {
		try {
			return MessageFormat.format(getResourceString(key), args);
		} catch (MissingResourceException e) {
			return key;
		} catch (NullPointerException e) {
			return "!" + key + "!";
		}
	}

	/**
     * Constructs a list of available programs from registered extensions.
     * 
     * @return an ItemTreeNode representing the root of a tree of items (the root is not to be displayed)
	 */
	public static ItemTreeNode getLaunchItemTree() {
		ItemTreeNode categoryTree =
			new ItemTreeNode(new ItemDescriptor("<<Root>>", "<<Root>>", null, null, null, null, null, null));

		// get the platform's public plugin registry
		IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
		// retrieve all configuration elements registered at our launchItems extension-point
		IConfigurationElement[] configurationElements =
			extensionRegistry.getConfigurationElementsFor(LAUNCH_ITEMS_POINT_ID);
			
		if (configurationElements == null || configurationElements.length == 0) {
			logError(getResourceString("error.CouldNotFindRegisteredExtensions"), null);
			return categoryTree;
		}
		
		/* Collect all launch categories -- coalesce those with same ID */
		HashMap idMap = new HashMap();
		for (int i = 0; i < configurationElements.length; ++i) {
			final IConfigurationElement ce = configurationElements[i];
			final String ceName = ce.getName();
			final String attribId = getItemAttribute(ce, LAUNCH_ITEMS_XML_ATTRIB_ID, null);
			
			if (idMap.containsKey(attribId)) continue;
			if (ceName.equalsIgnoreCase(LAUNCH_ITEMS_XML_CATEGORY)) {
				final String attribName = getItemName(ce); 
				ItemDescriptor theDescriptor = new ItemDescriptor(attribId, attribName,
					getItemDescription(ce), null, null, null, null, ce);
				idMap.put(attribId, new ItemTreeNode(theDescriptor));
			}
		}
		
		/* Generate launch category hierarchy */
		Set tempIdSet = new HashSet(); // used to prevent duplicates from being entered into the tree
		for (int i = 0; i < configurationElements.length; ++i) {
			final IConfigurationElement ce = configurationElements[i];
			final String ceName = ce.getName();
			final String attribId = getItemAttribute(ce, LAUNCH_ITEMS_XML_ATTRIB_ID, null);
			
			if (tempIdSet.contains(attribId)) continue;
			if (ceName.equalsIgnoreCase(LAUNCH_ITEMS_XML_CATEGORY)) {
				final ItemTreeNode theNode = (ItemTreeNode) idMap.get(attribId);
				addItemByCategory(ce, categoryTree, theNode, idMap);
				tempIdSet.add(attribId);
			}
		}
		
		/* Generate program tree */
		for (int i = 0; i < configurationElements.length; ++i) {
			final IConfigurationElement ce = configurationElements[i];
			final String ceName = ce.getName();
			final String attribId = getItemAttribute(ce, LAUNCH_ITEMS_XML_ATTRIB_ID, null);

			if (idMap.containsKey(attribId)) continue;
			if (ceName.equalsIgnoreCase(LAUNCH_ITEMS_XML_CATEGORY)) {
				// ignore
			} else if (ceName.equalsIgnoreCase(LAUNCH_ITEMS_XML_ITEM)) {
				final String enabled = getItemAttribute(ce, LAUNCH_ITEMS_XML_ATTRIB_ENABLED, 
					LAUNCH_ITEMS_XML_VALUE_TRUE);
				if (enabled.equalsIgnoreCase(LAUNCH_ITEMS_XML_VALUE_FALSE)) continue;
				ItemDescriptor theDescriptor = createItemDescriptor(ce, attribId);				
			
				if (theDescriptor != null) {
					final ItemTreeNode theNode = new ItemTreeNode(theDescriptor);
					addItemByCategory(ce, categoryTree, theNode, idMap);
					idMap.put(attribId, theNode);
				}
			}
		}
		return categoryTree;
	}

				
	/**
	 * Adds an item to the category tree.
	 */
	private static void addItemByCategory(IConfigurationElement ce, ItemTreeNode root,
		ItemTreeNode theNode, HashMap idMap) {
		final String attribCategory = getItemAttribute(ce, LAUNCH_ITEMS_XML_ATTRIB_CATEGORY, null);
				
		// locate the parent node
		ItemTreeNode parentNode = null;
		if (attribCategory != null) {
			parentNode = (ItemTreeNode) idMap.get(attribCategory);
		}
		if (parentNode == null) parentNode = root;
				
		// add the item
		parentNode.addSortedNode(theNode);
	}

	/**
	 * Creates an ItemDescriptor from an XML definition.
	 * 
	 * @param ce the IConfigurationElement describing the item
	 * @param attribId the attribute id
	 * @return a new ItemDescriptor, or null if an error occurs
	 */
	private static ItemDescriptor createItemDescriptor(IConfigurationElement ce, String attribId) {
		final String attribName = getItemName(ce);
		final Image  attribIcon = getItemIcon(ce);
		final String attribDescription = getItemDescription(ce);

		IConfigurationElement viewCE = getItemElement(ce, LAUNCH_ITEMS_XML_VIEW);
		if (viewCE != null) {
			//Item is a view
			final String attribView = getItemAttribute(viewCE, LAUNCH_ITEMS_XML_VIEW_VIEWID, null);		
			if (attribView == null) {
				logError(getResourceString("error.IncompleteViewLaunchItem",
					new Object[] { attribId } ), null);
				return null;
			}
			return new ItemDescriptor(attribId, attribName, attribDescription,
					attribIcon, attribView, null, null, viewCE);
		} else {
			//Item is a standalone
			IConfigurationElement programCE = getItemElement(ce, LAUNCH_ITEMS_XML_PROGRAM);
			if (programCE != null) {
				final String attribPluginId = getItemAttribute(programCE, LAUNCH_ITEMS_XML_PROGRAM_PLUGIN, null);
				final String attribClass    = getItemAttribute(programCE, LAUNCH_ITEMS_XML_PROGRAM_CLASS, null);
				if (attribClass == null || attribPluginId == null) {
					logError(getResourceString("error.IncompleteProgramLaunchItem",
					new Object[] { attribId } ), null);
					return null;
				}
				return new ItemDescriptor(attribId, attribName, attribDescription,
					attribIcon, null, attribClass, attribPluginId, programCE);
			} else {
				logError(getResourceString("error.IncompleteLaunchItem",
					new Object[] { attribId } ), null);
				return null;
			}
		}
	}

	/**
	 * Returns the first instance of a particular child XML element.
	 * 
	 * @param ce the IConfigurationElement parent
	 * @param element the name of the element to fetch
	 * @return the element's IConfigurationElement, or null if not found
	 */
	private static IConfigurationElement getItemElement(IConfigurationElement ce, String element) {
		IConfigurationElement[] elementCEs = ce.getChildren(element);
		return (elementCEs != null && elementCEs.length != 0) ? elementCEs[0] : null;
	}

	/**
	 * Returns the value of an XML attribute for an item.
	 * 
	 * @param ce the IConfigurationElement describing the item
	 * @param attribute the attribute to fetch
	 * @param defaultValue the value to return if the attribute is not found
	 * @return the attribute value
	 */
	private static String getItemAttribute(IConfigurationElement ce, String attribute, String defaultValue) {
		String value = ce.getAttribute(attribute);
		return (value != null) ? value : defaultValue;
	}

	/**
	 * Returns the description string given the IConfigurationElement for an item.
	 * 
	 * @param ce the IConfigurationElement describing the item
	 * @return a newline-delimited string that describes this item, or null if none
	 */
	private static String getItemDescription(IConfigurationElement ce) {
		String description = getItemAttribute(ce, LAUNCH_ITEMS_XML_ITEM_DESCRIPTION, "");
		return (description.length() == 0) ? null : description;
	}

	/**
	 * Returns the name of an item.
	 * 
	 * @param ce the IConfigurationElement describing the item
	 * @return the attribute value
	 */
	private static String getItemName(IConfigurationElement ce) {
		return getItemAttribute(ce, LAUNCH_ITEMS_XML_ATTRIB_NAME,
			getResourceString("launchitem.Missing.name"));
	}


	/**
	 * Returns the icon for an item.
	 * 
	 * @param ce the IConfigurationElement describing the item
	 * @return an icon
	 */
	private static Image getItemIcon(IConfigurationElement ce) {
		String iconPath = getItemAttribute(ce, LAUNCH_ITEMS_XML_ITEM_ICON, "");
		if (iconPath.length() != 0) {
			String symbolicName = ce.getDeclaringExtension().getContributor().getName();
			Bundle bundle = Platform.getBundle(symbolicName);
			Image icon = getImageFromPlugin(bundle, iconPath);
			if (icon != null) {
				Image[] newImages = new Image[images.length + 1];
				System.arraycopy(images, 0, newImages, 0, images.length);
				newImages[images.length] = icon;
				images = newImages;
				return icon;
			}
		}
		return images[liGenericExample];
	}

	/**
	 * Gets an image from a path relative to the plugin install directory.
	 *
	 * @param bundle the plugin descriptor for the plugin with the image
	 * @param iconPath the path relative to the install directory
	 * @return the image, or null if not found
	 */
	private static Image getImageFromPlugin(Bundle bundle, String iconPath) {
		InputStream is = null;
		try {
			URL installUrl = bundle.getEntry("/");
			URL url = new URL(installUrl, iconPath);
			is = url.openConnection().getInputStream();
			ImageData source = new ImageData(is);
			ImageData mask = source.getTransparencyMask();
			Image image = new Image(null, source, mask);
			return image;
		} catch (Throwable ex) {
			return null;
		} finally {
			try {
				if (is != null) is.close();
			} catch (IOException e) {
			}
		}
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区视频在线播放| 琪琪一区二区三区| 91精品国产入口| 成人国产精品视频| 精品无人码麻豆乱码1区2区 | 久久99最新地址| 久久精品国产亚洲5555| 色哟哟精品一区| 色综合久久综合网97色综合| 欧美一级在线视频| 亚洲午夜精品17c| 亚洲精品美腿丝袜| 一区二区三区电影在线播| 一级中文字幕一区二区| 国产成人h网站| av影院午夜一区| 91香蕉视频黄| 欧美夫妻性生活| 日韩区在线观看| 久久精品视频一区| 亚洲欧美日韩国产另类专区| 亚洲精品欧美激情| 成人黄色综合网站| 久久婷婷综合激情| 国产无一区二区| 经典三级视频一区| 欧美电影免费观看高清完整版 | 久久九九国产精品| 韩国女主播一区二区三区| 国产激情偷乱视频一区二区三区| 欧美mv日韩mv国产网站app| 中文字幕不卡一区| 亚洲午夜免费电影| 在线观看视频一区二区| 欧美一区二区日韩一区二区| 亚洲成人在线观看视频| 粗大黑人巨茎大战欧美成人| 欧美色精品在线视频| 精品国产一区二区在线观看| 亚洲另类色综合网站| 色呦呦一区二区三区| 一区二区三区在线观看视频| 欧美日韩一级二级三级| 亚洲成人福利片| 日韩欧美中文字幕精品| 久久99精品国产麻豆婷婷洗澡| www国产精品av| 成人性生交大片免费看视频在线 | 伦理电影国产精品| 日韩精品资源二区在线| 国产一区二区免费在线| 欧美精三区欧美精三区| 日本午夜精品视频在线观看| 91片黄在线观看| 亚洲国产裸拍裸体视频在线观看乱了| 欧美性感一区二区三区| 国产精品久久久久久久久搜平片 | 国产午夜精品福利| 99精品国产91久久久久久| 日韩免费电影网站| 国产高清不卡二三区| 亚洲人成精品久久久久久| 欧美精品乱码久久久久久按摩| 精品一区二区av| 一区二区三区在线观看国产| www.欧美日韩国产在线| 日产精品久久久久久久性色| 久久久久久99精品| 久久狠狠亚洲综合| 日韩美女视频19| 成人黄页在线观看| 天堂蜜桃一区二区三区| 欧美日韩一区久久| 国产剧情一区二区| xnxx国产精品| 欧美日韩一区 二区 三区 久久精品| 美女视频网站久久| 精品国产一区二区三区久久影院 | 国产精品一区二区免费不卡 | 亚洲一区二区综合| 色婷婷综合久色| 麻豆国产精品777777在线| 一区二区三区在线影院| 精品国产乱码91久久久久久网站| 99视频精品免费视频| 久久66热re国产| 天天做天天摸天天爽国产一区| 91.com视频| 激情小说亚洲一区| 亚洲18影院在线观看| 亚洲日穴在线视频| 国产日韩欧美电影| 91在线高清观看| 国产一区二区三区美女| 日本特黄久久久高潮| 亚洲自拍偷拍欧美| 亚洲精品免费电影| 国产精品国产馆在线真实露脸| 久久久99精品免费观看不卡| 日韩久久久久久| 日韩欧美国产成人一区二区| 精品视频一区三区九区| 91国产丝袜在线播放| 日韩精品欧美成人高清一区二区| 亚洲精品综合在线| 亚洲美女屁股眼交| 一区二区三区日韩在线观看| 亚洲欧美综合色| 中文字幕在线观看不卡视频| 中文字幕一区二区三区视频| 国产精品美女久久久久高潮| 欧美久久久久久久久中文字幕| 欧美私模裸体表演在线观看| 91黄色在线观看| 91久久奴性调教| 欧美视频完全免费看| 欧美三级电影网站| 欧美日本一区二区在线观看| 国产一区二区免费视频| 激情六月婷婷久久| 狠狠狠色丁香婷婷综合久久五月| 精品亚洲国内自在自线福利| 国内不卡的二区三区中文字幕| 国产一区欧美一区| 大美女一区二区三区| 不卡免费追剧大全电视剧网站| 99re这里只有精品视频首页| 欧日韩精品视频| 欧美精品日韩一区| 精品国产乱码久久久久久夜甘婷婷| 精品国产免费人成在线观看| 欧美—级在线免费片| 一区二区三区丝袜| 日韩二区在线观看| 国内精品久久久久影院一蜜桃| 国产在线看一区| 成人app网站| 欧美三级日韩在线| 精品国产成人系列| 亚洲啪啪综合av一区二区三区| 一区二区三区成人在线视频| 婷婷中文字幕综合| 国产精品69毛片高清亚洲| 95精品视频在线| 91 com成人网| 国产精品色婷婷| 亚洲成a人片综合在线| 国产一区二区三区日韩| 色婷婷精品大在线视频| 日韩视频免费观看高清完整版| 国产精品午夜免费| 亚洲国产一区二区视频| 国产福利不卡视频| 91精品福利视频| 久久久久综合网| 亚洲自拍偷拍麻豆| 国产精品一区免费视频| 欧美最新大片在线看| 久久久777精品电影网影网| 亚洲黄色小视频| 成人涩涩免费视频| 欧美日韩一二三| 中国av一区二区三区| 日韩av一区二区三区| 99精品热视频| 国产亚洲精品资源在线26u| 亚洲成av人片一区二区三区| 成人精品小蝌蚪| 精品日产卡一卡二卡麻豆| 亚洲成人在线网站| 99久久精品国产观看| 久久蜜桃av一区二区天堂| 亚洲大片一区二区三区| av不卡一区二区三区| 久久免费偷拍视频| 蜜臀va亚洲va欧美va天堂| 欧美伊人精品成人久久综合97 | 粉嫩绯色av一区二区在线观看 | 色哟哟欧美精品| 亚洲国产成人午夜在线一区| 久久精工是国产品牌吗| 欧美人妖巨大在线| 亚洲免费在线视频一区 二区| 国产91丝袜在线观看| 日本sm残虐另类| 国产揄拍国内精品对白| 91精品欧美久久久久久动漫 | 欧美视频在线播放| 中文无字幕一区二区三区| 美腿丝袜亚洲三区| 日韩一卡二卡三卡四卡| 午夜精品福利在线| 欧美日韩三级一区| 一区二区三区在线观看视频| 99re这里都是精品| 亚洲免费av网站| 91高清视频在线| 亚洲高清不卡在线观看| 欧美喷潮久久久xxxxx| 亚洲成人自拍一区|