本文整理汇总了Java中org.eclipse.jface.resource.StringConverter.asRectangle方法的典型用法代码示例。如果您正苦于以下问题:Java StringConverter.asRectangle方法的具体用法?Java StringConverter.asRectangle怎么用?Java StringConverter.asRectangle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.resource.StringConverter
的用法示例。
在下文中一共展示了StringConverter.asRectangle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: basicGetRectangle
import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
/**
* Helper method to construct a rectangle from the given string.
* @param value
* @return Rectangle
*/
private static Rectangle basicGetRectangle(String value) {
// We can't just return RECTANGLE_DEFAULT_DEFAULT because
// a rectangle object doesn't have value semantik.
Rectangle dr = new Rectangle(RECTANGLE_DEFAULT_DEFAULT.x,
RECTANGLE_DEFAULT_DEFAULT.y, RECTANGLE_DEFAULT_DEFAULT.width,
RECTANGLE_DEFAULT_DEFAULT.height);
if (IPreferenceStore.STRING_DEFAULT_DEFAULT.equals(value)) {
return dr;
}
return StringConverter.asRectangle(value, dr);
}
示例2: init
import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
public void init(Shell splash) {
super.init(splash);
String progressRectString = null;
String messageRectString = null;
String foregroundColorString = null;
IProduct product = Platform.getProduct();
if (product != null) {
progressRectString = product.getProperty(IProductConstants.STARTUP_PROGRESS_RECT);
messageRectString = product.getProperty(IProductConstants.STARTUP_MESSAGE_RECT);
foregroundColorString = product.getProperty(IProductConstants.STARTUP_FOREGROUND_COLOR);
}
Rectangle progressRect = StringConverter.asRectangle(progressRectString, new Rectangle(10, 10, 300, 15));
setProgressRect(progressRect);
Rectangle messageRect = StringConverter.asRectangle(messageRectString, new Rectangle(10, 35, 300, 15));
setMessageRect(messageRect);
int foregroundColorInteger;
try {
foregroundColorInteger = Integer.parseInt(foregroundColorString, 16);
} catch (Exception ex) {
foregroundColorInteger = 0xD2D7FF; // off white
}
setForeground(new RGB((foregroundColorInteger & 0xFF0000) >> 16, (foregroundColorInteger & 0xFF00) >> 8,
foregroundColorInteger & 0xFF));
// the following code will be removed for release time
String[] mappings = loadMappings(product.getDefiningBundle());
StringBuilder sbId = new StringBuilder();
if (mappings.length >= 2) {
String version = mappings[0];
String timestamp = mappings[1];
if (!version.startsWith("$") && !timestamp.startsWith("$")) {
sbId.append(version);
sbId.append(".");
sbId.append(timestamp);
} else {
sbId.append("Unknown Build");
}
} else {
sbId.append("Unknown Build");
}
String eclipseBaseVersion = "";
if (mappings.length >= 3) {
eclipseBaseVersion = mappings[2];
if (eclipseBaseVersion.startsWith("$")) {
eclipseBaseVersion = "Unknown Eclipse Base Version";
}
}
Label idLabel = new Label(getContent(), SWT.LEFT);
idLabel.setForeground(getForeground());
idLabel.setBounds(new Rectangle(390, 105, 220, 40));
idLabel.setText(sbId.toString());
idLabel.setData(CSSSWTConstants.CSS_ID_KEY, CSS_ID_SPLASH_BUILD_ID);
Label basedOnLabel = new Label(getContent(), SWT.LEFT);
basedOnLabel.setForeground(getForeground());
basedOnLabel.setBounds(new Rectangle(190, 105, 220, 40));
basedOnLabel.setText(eclipseBaseVersion);
basedOnLabel.setData(CSSSWTConstants.CSS_ID_KEY, CSS_ID_SPLASH_BUILD_ID);
toString();
}