本文整理匯總了Java中org.eclipse.ui.IMemento.createChild方法的典型用法代碼示例。如果您正苦於以下問題:Java IMemento.createChild方法的具體用法?Java IMemento.createChild怎麽用?Java IMemento.createChild使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.ui.IMemento
的用法示例。
在下文中一共展示了IMemento.createChild方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: saveTo
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
public void saveTo ( final IMemento memento )
{
if ( memento == null )
{
return;
}
{
final IMemento tableMemento = memento.createChild ( "tableCols" ); //$NON-NLS-1$
for ( int i = 0; i < this.viewer.getTree ().getColumnCount (); i++ )
{
final TreeColumn col = this.viewer.getTree ().getColumn ( i );
tableMemento.putInteger ( "col_" + i, col.getWidth () ); //$NON-NLS-1$
}
}
for ( final ListEntry entry : this.list.getItems () )
{
final Item item = entry.getItem ();
item.saveTo ( memento.createChild ( "item" ) ); //$NON-NLS-1$
}
}
示例2: saveState
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
@Override
public void saveState(IMemento memento) {
// Scroll lock
memento.putBoolean("scrollLock", scrollLock);
// Limit log chars
memento.putInteger("limitLogChars", limitLogChars);
// Activate on new events
memento.putBoolean("activateOnNewEvents", activateOnNewEvents);
// Column order
memento.putString("columnOrder", Arrays.toString(tableViewer.getTable().getColumnOrder()));
// Column information
for (ColumnInfo columnInfo : columnInfos) {
IMemento columnInfoMemento = memento.createChild("columnInfo");
columnInfoMemento.putString("name", columnInfo.getName());
columnInfoMemento.putBoolean("visible", columnInfo.isVisible());
columnInfoMemento.putInteger("size", columnInfo.getSize());
}
super.saveState(memento);
}
示例3: saveCodeFolding
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
/**
* Saves the code folding state into the given memento.
*/
public void saveCodeFolding(IMemento memento) {
// The annotation model might be null if the editor opened an storage input
// instead of a file input.
if (projectionAnnotationModel == null) {
return;
}
Iterator<?> annotationIt = projectionAnnotationModel.getAnnotationIterator();
while (annotationIt.hasNext()) {
ProjectionAnnotation annotation = (ProjectionAnnotation) annotationIt.next();
IMemento annotationMemento = memento.createChild(ANNOTATION);
Position position = projectionAnnotationModel.getPosition(annotation);
annotationMemento.putBoolean(IS_COLLAPSED, annotation.isCollapsed());
annotationMemento.putInteger(OFFSET, position.offset);
annotationMemento.putInteger(LENGTH, position.length);
}
}
示例4: populateWithStateToSave
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
private void populateWithStateToSave(final VSUser user, final IMemento memento) {
for (final Iterator it = user.workspaces.keySet().iterator(); it.hasNext();) {
final String workspaceName = (String) it.next();
final VSWorkspace workspace = (VSWorkspace) user.workspaces.get(workspaceName);
final IMemento workspaceMemento = memento.createChild(WORKSPACE_CHILDREN, workspace.name);
for (final Iterator expandedPathsIt = workspace.expandedPaths.iterator(); expandedPathsIt.hasNext();) {
final String path = (String) expandedPathsIt.next();
final IMemento expandedMemento = workspaceMemento.createChild(EXPANDED_CHILDREN);
expandedMemento.putString(PATH_KEY, path);
}
if (workspace.selectedPath != null) {
final IMemento selectedMemento = workspaceMemento.createChild(SELECTED_CHILD);
selectedMemento.putString(PATH_KEY, workspace.selectedPath);
}
}
}
示例5: saveState
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
@Override
public void saveState(final IMemento memento) {
super.saveState(memento);
final IMemento settings = memento.createChild(PARTICIPANT_SETTINGS);
// persist the paths of all resources that we're currently
// synchronizing,
// we'll use these paths to restore the synchronization view
final IResource[] resources = getResources();
final StringBuffer resourceList = new StringBuffer();
for (int i = 0; i < resources.length; i++) {
if (i > 0) {
resourceList.append("|"); //$NON-NLS-1$
}
resourceList.append(resources[i].getLocation().toOSString());
if (resources[i].getType() != IResource.FILE) {
resourceList.append("/"); //$NON-NLS-1$
}
}
settings.putString(PARTICIPANT_SETTINGS_RESOURCES, resourceList.toString());
}
示例6: createXml_FromTrackConfig
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
private static void createXml_FromTrackConfig(final Map25TrackConfig config, final IMemento xmlTourTracks) {
// <Track>
final IMemento xmlConfig = xmlTourTracks.createChild(TAG_TRACK);
{
xmlConfig.putString(ATTR_ID, config.id);
xmlConfig.putString(ATTR_CONFIG_NAME, config.name);
xmlConfig.putInteger(ATTR_ANIMATION_TIME, config.animationTime);
// <Outline>
final IMemento xmlOutline = Util.setXmlRgb(xmlConfig, TAG_OUTLINE, config.outlineColor);
{
xmlOutline.putFloat(ATTR_OUTLINE_WIDTH, config.outlineWidth);
}
}
}
示例7: createLayerXml_120_Default
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
private static void createLayerXml_120_Default( final IMemento xmlCategory,
final boolean isEnabled,
final boolean canSetOpacity,
final float opacity,
final String defaultLayerId) {
final DefaultLayer mapDefaultLayer = MapDefaultLayer.getLayer(defaultLayerId);
if (mapDefaultLayer == null) {
return;
}
final IMemento xmlLayer = xmlCategory.createChild(TAG_LAYER);
xmlLayer.putString(ATTR_ID, defaultLayerId);
xmlLayer.putBoolean(ATTR_IS_ENABLED, isEnabled);
xmlLayer.putBoolean(ATTR_IS_DEFAULT_LAYER, true);
// opacity
xmlLayer.putFloat(ATTR_OPACITY, opacity);
xmlLayer.putBoolean(ATTR_CAN_SET_OPACITY, canSetOpacity);
}
示例8: saveState_URI
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
private static void saveState_URI( final URI[] location,
final IMetadataRepositoryManager metaManager,
final IMemento xmlRepositories,
final boolean isEnabled) {
for (final URI uri : location) {
final IMemento xmlRepo = xmlRepositories.createChild(TAG_REPOSITORY);
final String nickName = metaManager.getRepositoryProperty(uri, IRepository.PROP_NICKNAME);
xmlRepo.putString(ATTR_URI, uri.toASCIIString());
xmlRepo.putString(ATTR_NICK_NAME, nickName);
xmlRepo.putBoolean(ATTR_IS_ENABLED, isEnabled);
}
}
示例9: toXml
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
@Override
public void toXml(ZooKeeperConnectionDescriptor connectionDescriptor, XMLMemento memento) {
memento.putString(XML_TAG_SESSION_TIMEOUT, String.valueOf(connectionDescriptor.getSessionTimeout()));
String rootPath = connectionDescriptor.getRootPath();
if (rootPath != null) {
memento.putString(XML_TAG_ROOT_PATH, rootPath);
}
IMemento serversMemento = memento.createChild(XML_TAG_ZOO_KEEPER_SERVERS);
for (ZooKeeperServerDescriptor serverDescriptor : connectionDescriptor.getServers()) {
IMemento serverMemento = serversMemento.createChild(XML_TAG_ZOO_KEEPER_SERVER);
serverMemento.putString(XML_TAG_ZOO_KEEPER_SERVER_HOST, serverDescriptor.getHost());
serverMemento.putString(XML_TAG_ZOO_KEEPER_SERVER_PORT, String.valueOf(serverDescriptor.getPort()));
JmxConnectionDescriptor jmxConnectionDescriptor = serverDescriptor.getJmxConnectionDescriptor();
if (jmxConnectionDescriptor != null) {
serverMemento
.putString(XML_TAG_ZOO_KEEPER_SERVER_JMX_CONNECTION, jmxConnectionDescriptor.getName());
_JmxConnectionDescriptorFiles.save(jmxConnectionDescriptor);
}
}
IMemento authInfosMemento = memento.createChild(XML_TAG_AUTH_INFOS);
for (AuthInfo authInfo : connectionDescriptor.getAuthInfos()) {
IMemento authInfoMemento = authInfosMemento.createChild(XML_TAG_AUTH_INFO);
authInfoMemento.putString(XML_TAG_AUTH_INFO_TYPE, authInfo.getType().name());
authInfoMemento.putString(XML_TAG_AUTH_INFO_SCHEME, authInfo.getScheme());
authInfoMemento.putString(XML_TAG_AUTH_INFO_AUTH, authInfo.getAuthString());
}
}
示例10: saveState
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
@Override
public void saveState ( final IMemento memento )
{
super.saveState ( memento );
if ( memento == null )
{
return;
}
final Resource resource = new XMIResourceFactoryImpl ().createResource ( null );
resource.getContents ().add ( this.configuration );
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream ();
final Map<?, ?> options = new HashMap<Object, Object> ();
try
{
resource.save ( outputStream, options );
final IMemento child = memento.createChild ( CHILD_CONFIGURATION );
child.putTextData ( StringUtils.newStringUtf8 ( Base64.encodeBase64 ( outputStream.toByteArray (), true ) ) );
}
catch ( final Exception e )
{
StatusManager.getManager ().handle ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, e ), StatusManager.LOG );
}
}
示例11: save
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
/**
* Save history elements to memento.
*
* @param memento
* memento to which the history will be added
*/
public void save(IMemento memento) {
IMemento historyMemento = memento.createChild(rootNodeName);
Object[] items = getHistoryItems();
for (int i = 0; i < items.length; i++) {
Object item = items[i];
IMemento elementMemento = historyMemento
.createChild(infoNodeName);
storeItemToMemento(item, elementMemento);
}
}
示例12: saveState
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
public void saveState(IMemento memento) {
super.saveState(memento);
memento = memento.createChild(ID);
memento.putInteger("objHash", objHash);
memento.putString("objName", objName);
memento.putInteger("serverId", serverId);
}
示例13: saveState
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
public void saveState(IMemento memento) {
super.saveState(memento);
memento = memento.createChild(ID);
memento.putString("objType", objType);
memento.putString("counter", counter);
memento.putInteger("objHash", objHash);
memento.putInteger("serverId", serverId);
}
示例14: saveColors_20_Brightness
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
/**
* Brightness
*/
private static void saveColors_20_Brightness(final IMemento xmlColor, final Map3ColorProfile colorProfile) {
final IMemento xmlBrightness = xmlColor.createChild(GraphColorManager.MEMENTO_CHILD_BRIGHTNESS);
xmlBrightness.putInteger(GraphColorManager.TAG_BRIGHTNESS_MIN, colorProfile.getMinBrightness());
xmlBrightness.putInteger(GraphColorManager.TAG_BRIGHTNESS_MIN_FACTOR, colorProfile.getMinBrightnessFactor());
xmlBrightness.putInteger(GraphColorManager.TAG_BRIGHTNESS_MAX, colorProfile.getMaxBrightness());
xmlBrightness.putInteger(GraphColorManager.TAG_BRIGHTNESS_MAX_FACTOR, colorProfile.getMaxBrightnessFactor());
}
示例15: saveState
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
public void saveState(IMemento memento) {
super.saveState(memento);
memento = memento.createChild(ID);
memento.putString("stime", String.valueOf(this.stime));
memento.putString("etime", String.valueOf(this.etime));
memento.putString("objType", objType);
}