本文整理匯總了Java中org.eclipse.ui.IMemento.getInteger方法的典型用法代碼示例。如果您正苦於以下問題:Java IMemento.getInteger方法的具體用法?Java IMemento.getInteger怎麽用?Java IMemento.getInteger使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.ui.IMemento
的用法示例。
在下文中一共展示了IMemento.getInteger方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: load
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
public static JsniJavaRefParamType load(IMemento memento) {
// Extract the string representing the reference itself
String refString = memento.getTextData();
if (refString == null) {
return null;
}
// Set the source property (the file containing the reference)
String sourceString = memento.getString(TAG_SOURCE);
if (sourceString == null) {
return null;
}
// Set the offset property (the location within the containing file)
Integer offset = memento.getInteger(TAG_OFFSET);
if (offset == null) {
return null;
}
// Parse the reference string into an actual JsniJavaRefParamType
return JsniJavaRefParamType.parse(new Path(sourceString),
offset.intValue(), refString);
}
示例2: restoreState
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
public void restoreState(IPresentationSerializer context, IMemento memento) {
if (PresentationPlugin.DEBUG_STATE) {
System.out.println(getDebugPartName() + ":restoreState");
}
/*
* we do not use setFlag() here to prevent layout and redraw on startup
*/
Integer flag = memento.getInteger("toolbarVisible");
if (flag != null) {
stackFlags.set(F_TOOLBAR_VISIBLE, flag.intValue() == 1);
} else {
// TODO read from theme setting
stackFlags.set(F_TOOLBAR_VISIBLE, true);
}
flag = memento.getInteger("tabAreaVisible");
if (flag != null) {
stackFlags.set(F_TAB_AREA_VISIBLE, flag.intValue() == 1);
} else {
// TODO read from theme setting
stackFlags.set(F_TAB_AREA_VISIBLE, true);
}
tabArea.restoreState(context, memento, this);
}
示例3: loadFrom
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
public void loadFrom ( final IMemento memento )
{
if ( memento == null )
{
return;
}
try
{
{
this.initialColWidth = new LinkedList<Integer> ();
final IMemento tableMemento = memento.getChild ( "tableCols" ); //$NON-NLS-1$
if ( tableMemento != null )
{
int i = 0;
Integer w;
while ( ( w = tableMemento.getInteger ( "col_" + i ) ) != null ) //$NON-NLS-1$
{
this.initialColWidth.add ( w );
i++;
}
}
}
for ( final IMemento child : memento.getChildren ( "item" ) ) //$NON-NLS-1$
{
final Item item = Item.loadFrom ( child );
if ( item != null )
{
this.list.add ( item );
}
}
}
catch ( final Exception e )
{
Activator.getDefault ().getLog ().log ( new Status ( IStatus.ERROR, Activator.PLUGIN_ID, Messages.RealTimeListViewer_ErrorLoadingData, e ) );
}
}
示例4: getInt
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
private int getInt(IMemento memento, String key, int preset) {
if (memento == null) {
return preset;
} else {
Integer i = memento.getInteger(key);
return i == null ? preset : i.intValue();
}
}
示例5: restoreState
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
@Override
public void restoreState(IMemento memento) {
if (getSash() != null && memento != null && memento.getInteger(FIRST_SASH_CONTROL_WEIGHT) != null
&& memento.getInteger(SECOND_SASH_CONTROL_WEIGHT) != null) {
getSash().setWeights(new int[]{memento.getInteger(FIRST_SASH_CONTROL_WEIGHT),
memento.getInteger(SECOND_SASH_CONTROL_WEIGHT)});
previousWidths = getSash().getWeights();
isDefinitionSectionExpanded = getExpandState(memento);
}
super.setMemento(memento);
}
示例6: restoreState
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
private void restoreState() {
if (memento == null)
return;
IMemento m = memento.getChild(ID);
if(m == null)
return;
int objHash = m.getInteger("objHash");
String objName = m.getString("objName");
int serverId = CastUtil.cint(m.getInteger("serverId"));
setInput(objHash, objName, serverId);
}
示例7: load
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
public static IndexedJsniJavaRef load(IMemento memento) {
// Extract the string representing the reference itself
String refString = memento.getTextData();
if (refString == null) {
return null;
}
// Parse the reference string into an actual JsniJavaRef
JsniJavaRef ref = JsniJavaRef.parse(refString);
if (ref == null) {
return null;
}
// Set the source property (the file containing the reference)
String sourceString = memento.getString(TAG_SOURCE);
if (sourceString == null) {
return null;
} else {
ref.setSource(new Path(sourceString));
}
// Set the offset property (the location within the containing file)
Integer offset = memento.getInteger(TAG_OFFSET);
if (offset == null) {
return null;
} else {
ref.setOffset(offset.intValue());
}
return new IndexedJsniJavaRef(ref);
}
示例8: restoreSashWeight
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
/**
* Restore the sash weight from a memento
*
* @param sash
* @param fMemento
* @param weightKey
* @param sashDefaultWeight
*/
public static void restoreSashWeight( final SashForm sash,
final IMemento fMemento,
final String weightKey,
final int[] sashDefaultWeight) {
final int[] sashWeights = sash.getWeights();
final int[] newWeights = new int[sashWeights.length];
for (int weightIndex = 0; weightIndex < sashWeights.length; weightIndex++) {
final Integer mementoWeight = fMemento.getInteger(weightKey + Integer.toString(weightIndex));
if (mementoWeight == null) {
try {
newWeights[weightIndex] = sashDefaultWeight[weightIndex];
} catch (final ArrayIndexOutOfBoundsException e) {
newWeights[weightIndex] = 100;
}
} else {
newWeights[weightIndex] = mementoWeight;
}
}
sash.setWeights(newWeights);
}
示例9: restoreState
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
/**
* Restores the object state from the memento.
*/
private void restoreState(IMemento memento) {
if (memento == null) {
return;
}
String factoryId = memento.getString("factoryID");
if (factoryId == null) {
PresentationPlugin.log("Couldn't restore editor info from memento: "
+ memento.getID() + ", 'factoryID' is null", null);
return;
}
IMemento persistableMemento = memento.getChild("persistable");
if (persistableMemento == null) {
PresentationPlugin.log("Couldn't restore editor info from memento: "
+ memento.getID() + ", 'persistable' element is null", null);
return;
}
IElementFactory factory = PlatformUI.getWorkbench().getElementFactory(factoryId);
if (factory == null) {
// try to use default file factory, it would work if the memento contains a path to file
String path = persistableMemento.getString("path");
if (path == null) {
PresentationPlugin.log("Couldn't find factory for id: "
+ factoryId + ", I give up now...", null);
return;
}
factory = PlatformUI.getWorkbench().getElementFactory(
FileEditorInputFactory.getFactoryId());
PresentationPlugin.log("Couldn't find factory for id: "
+ factoryId + ", will try to use default file factory", null);
}
IAdaptable adaptable = factory.createElement(persistableMemento);
if (adaptable == null || (adaptable instanceof IEditorInput) == false) {
return;
}
input = (IEditorInput) adaptable;
editorId = memento.getString("id");
Integer intNumber = memento.getInteger("number");
number = intNumber == null? 0 : intNumber.intValue();
}
示例10: restoreState_CustomColors_Colors
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
private void restoreState_CustomColors_Colors(final XMLMemento xmlMemento) {
final Integer xmlNumberOfHorizontalColors = xmlMemento.getInteger(ATTR_NUMBER_OF_HORIZONTAL_COLORS);
final Integer xmlNumberOfVerticalColors = xmlMemento.getInteger(ATTR_NUMBER_OF_VERTICAL_COLORS);
boolean useSavedColorPosition = true;
if (xmlNumberOfHorizontalColors == null //
|| xmlNumberOfVerticalColors == null
|| NUMBER_OF_HORIZONTAL_COLORS != xmlNumberOfHorizontalColors
|| NUMBER_OF_VERTICAL_COLORS != xmlNumberOfVerticalColors) {
/*
* The save colors have another structure than the current color structure -> sort
* colors by sequence and not by previous position.
*/
useSavedColorPosition = false;
}
int colorPosCounter = 0;
for (final IMemento colorMomento : xmlMemento.getChildren()) {
final Integer red = colorMomento.getInteger(ATTR_RED);
final Integer green = colorMomento.getInteger(ATTR_GREEN);
final Integer blue = colorMomento.getInteger(ATTR_BLUE);
Integer hPos = colorMomento.getInteger(ATTR_POSITION_HORIZONTAL);
Integer vPos = colorMomento.getInteger(ATTR_POSITION_VERTICAL);
if (red == null || green == null || blue == null || hPos == null || vPos == null) {
// ignore
continue;
}
if (useSavedColorPosition == false) {
// use sequential positioning
hPos = colorPosCounter % NUMBER_OF_HORIZONTAL_COLORS;
vPos = colorPosCounter / NUMBER_OF_HORIZONTAL_COLORS;
}
setColorInColorLabel(_customColors[vPos][hPos], new RGB(red, green, blue));
colorPosCounter++;
}
// fillup to show tooltips
fillupCustomColorsWithDefaultColors();
}
示例11: getXmlInteger
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
public static int getXmlInteger(final IMemento xmlMemento, final String key, final Integer defaultValue) {
Integer value = xmlMemento.getInteger(key);
if (value == null) {
value = defaultValue;
}
return value;
}