?? spellcheckerimages.java
字號:
/*******************************************************************************
* Copyright (c) 2003 Berthold Daum.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* Berthold Daum
*******************************************************************************/
package com.bdaum.SpellChecker;
import java.net.MalformedURLException;
import java.net.URL;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.resource.ImageDescriptor;
/**
* Compilation of the images used in com.bdaum.SpellChecker plug-in.
*/
public class SpellCheckerImages {
// Get URL for icon folder
private static URL fgIconBaseURL = SpellCheckerPlugin.getDefault()
.getBundle().getEntry("icons/");
/**
* Filenames for the images in this registry
*/
public static final String IMG_IGNORE = "ignore.gif";
public static final String IMG_IGNOREALL = "ignoreAll.gif";
public static final String IMG_CANCEL = "cancel.gif";
public static final String IMG_REPLACE = "replace.gif";
public static final String IMG_REPLACEALL = "replaceAll.gif";
public static final String IMG_ADDTODICTIONARY = "addToDictionary.gif";
public static final String IMG_CHECK = "check.gif";
/**
* Supply action with icons
*
* @param action -
* Action to be decorated
* @param type -
* icon type
* @param relPath -
* relative path of icon
*/
public static void setImageDescriptors(IAction action, String type,
String relPath) {
try {
ImageDescriptor id = ImageDescriptor.createFromURL(makeIconFileURL(
"full/d" + type, relPath));
if (id != null)
action.setDisabledImageDescriptor(id);
} catch (MalformedURLException e) {
SpellCheckerPlugin
.logError(
8,
Messages
.getString("SpellCheckerImages.Bad_URL_when_loading_disabled_image"),
e);
}
try {
ImageDescriptor id = ImageDescriptor.createFromURL(makeIconFileURL(
"full/c" + type, relPath));
if (id != null)
action.setHoverImageDescriptor(id);
} catch (MalformedURLException e) {
SpellCheckerPlugin
.logError(
9,
Messages
.getString("SpellCheckerImages.Bad_URL_when_loading_hover_image"),
e);
action.setImageDescriptor(ImageDescriptor
.getMissingImageDescriptor());
}
}
// Construct URL for icon file
private static URL makeIconFileURL(String prefix, String name)
throws MalformedURLException {
if (fgIconBaseURL == null)
throw new MalformedURLException();
return new URL(fgIconBaseURL, prefix + "/" + name);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -