本文整理匯總了Java中org.eclipse.ui.IMemento.getChild方法的典型用法代碼示例。如果您正苦於以下問題:Java IMemento.getChild方法的具體用法?Java IMemento.getChild怎麽用?Java IMemento.getChild使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.ui.IMemento
的用法示例。
在下文中一共展示了IMemento.getChild方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setSavedState
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
public void setSavedState(final IMemento memento) {
servers.clear();
if (memento == null) {
return;
}
final IMemento folderControlMemento = memento.getChild(FOLDER_CONTROL_CHILD);
if (folderControlMemento == null) {
return;
}
final IMemento[] serverMementos = folderControlMemento.getChildren(SERVER_CHILDREN);
if (serverMementos != null) {
for (int i = 0; i < serverMementos.length; i++) {
if (serverMementos[i].getID() != null) {
final VSServer server = new VSServer(serverMementos[i].getID());
setSavedState(server, serverMementos[i]);
servers.put(server.guid, server);
}
}
}
}
示例2: load
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
/**
* Load history elements from memento.
*
* @param memento
* memento from which the history will be retrieved
*/
public void load(IMemento memento) {
XMLMemento historyMemento = (XMLMemento) memento
.getChild(rootNodeName);
if (historyMemento == null) {
return;
}
IMemento[] mementoElements = historyMemento
.getChildren(infoNodeName);
for (int i = 0; i < mementoElements.length; ++i) {
IMemento mementoElement = mementoElements[i];
Object object = restoreItemFromMemento(mementoElement);
if (object != null) {
historyList.add(object);
}
}
}
示例3: readColors_30_Vertices
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
private static void readColors_30_Vertices(final IMemento xmlProfile, final Map3ColorProfile colorProfile) {
final ArrayList<RGBVertex> vertices = new ArrayList<RGBVertex>();
final IMemento xmlVertices = xmlProfile.getChild(TAG_VERTICES);
if (xmlVertices == null) {
return;
}
for (final IMemento xmlVertex : xmlVertices.getChildren()) {
vertices.add(new RGBVertex(//
Util.getXmlInteger(xmlVertex, ATTR_VALUE, 0),
Util.getXmlRgb(xmlVertex, DEFAULT_RGB),
Util.getXmlFloatInt(xmlVertex, ATTR_OPACITY, OPACITY_DEFAULT, OPACITY_MIN, OPACITY_MAX)));
}
colorProfile.getProfileImage().setVertices(vertices);
}
示例4: init
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
@Override
public void init ( final IViewSite site, final IMemento memento ) throws PartInitException
{
super.init ( site, memento );
if ( memento == null )
{
return;
}
final IMemento child = memento.getChild ( CHILD_CONFIGURATION );
if ( child == null )
{
return;
}
final String data = child.getTextData ();
if ( data == null || data.isEmpty () )
{
return;
}
try
{
this.configuration = load ( new ByteArrayInputStream ( Base64.decodeBase64 ( data ) ) );
}
catch ( final Exception e )
{
StatusManager.getManager ().handle ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, e ), StatusManager.LOG );
}
}
示例5: 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 ) );
}
}
示例6: init
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
@Override
public void init(final String secondaryId, final IMemento memento) throws PartInitException {
super.init(secondaryId, memento);
// reset secondaryId -- otherwise it will persist the original
// secondaryId set by the constructor and you'll have multiple
// persisted syncs. yoinks!
setSecondaryId(secondaryId);
// load the list of resources from the last synchronization for this
// secondaryId. (usually because a synchronization state is being
// restored.)
if (memento != null) {
final IMemento settings = memento.getChild(PARTICIPANT_SETTINGS);
if (settings != null) {
setResources(settings);
}
}
// this is called when Eclipse starts with the synchronize view open,
// this is our best chance to refresh. (otherwise the synchronize view
// will always start with no changes to display.)
final RefreshSubscriberCommand refreshCommand =
new RefreshSubscriberCommand(SynchronizeSubscriber.getInstance(), getResources(), IResource.DEPTH_INFINITE);
final Job refreshJob = new JobCommandAdapter(refreshCommand);
refreshJob.setName(Messages.getString("SynchronizeParticipant.RefreshJobName")); //$NON-NLS-1$
refreshJob.setPriority(Job.LONG);
refreshJob.schedule();
try {
final ISynchronizeParticipantDescriptor descriptor =
TeamUI.getSynchronizeManager().getParticipantDescriptor(PARTICIPANT_ID);
setInitializationData(descriptor);
} catch (final CoreException e) {
throw new PartInitException(e.getMessage());
}
}
示例7: createElement
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
@Override
public IAdaptable createElement(final IMemento memento) {
final IMemento folderControlMemento = memento.getChild("folder-control"); //$NON-NLS-1$
if (folderControlMemento == null) {
return new VersionControlEditorInput();
}
return new VersionControlEditorInput(memento);
}
示例8: getChildMementoOrThrowException
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
private static IMemento getChildMementoOrThrowException(
IMemento parentMemento, String childMementoType)
throws PersistenceException {
IMemento childMemento = parentMemento.getChild(childMementoType);
if (childMemento == null) {
throw new PersistenceException("There is no child memento with type "
+ childMementoType);
}
return childMemento;
}
示例9: readColors_20_Brightness
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
private static void readColors_20_Brightness(final IMemento xmlProfile, final Map3ColorProfile colorProfile) {
final IMemento xmlBrightness = xmlProfile.getChild(GraphColorManager.MEMENTO_CHILD_BRIGHTNESS);
if (xmlBrightness == null) {
return;
}
colorProfile.setMinBrightness(Util.getXmlInteger(
xmlBrightness,
GraphColorManager.TAG_BRIGHTNESS_MIN,
MapColorProfile.BRIGHTNESS_DEFAULT));
colorProfile.setMaxBrightness(Util.getXmlInteger(
xmlBrightness,
GraphColorManager.TAG_BRIGHTNESS_MAX,
MapColorProfile.BRIGHTNESS_DEFAULT));
colorProfile.setMinBrightnessFactor(Util.getXmlInteger(
xmlBrightness,
GraphColorManager.TAG_BRIGHTNESS_MIN_FACTOR,
MapColorProfile.BRIGHTNESS_FACTOR_DEFAULT));
colorProfile.setMaxBrightnessFactor(Util.getXmlInteger(
xmlBrightness,
GraphColorManager.TAG_BRIGHTNESS_MAX_FACTOR,
MapColorProfile.BRIGHTNESS_FACTOR_DEFAULT));
}
示例10: getOldRepos
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
private static ArrayList<MetadataRepositoryElement> getOldRepos(final IMemento memento) {
final ArrayList<MetadataRepositoryElement> oldRepos = new ArrayList<MetadataRepositoryElement>();
try {
final IMemento xmlRepos = memento.getChild(TAG_REPOSITORIES);
for (final IMemento xmlRepo : xmlRepos.getChildren(TAG_REPOSITORY)) {
final String uriName = xmlRepo.getString(ATTR_URI);
final String nickName = xmlRepo.getString(ATTR_NICK_NAME);
final Boolean isEnabled = xmlRepo.getBoolean(ATTR_IS_ENABLED);
if (uriName != null && isEnabled != null) {
final MetadataRepositoryElement oldRepo = new MetadataRepositoryElement(null, //
new URI(uriName),
isEnabled);
if (nickName != null) {
oldRepo.setNickname(nickName);
}
oldRepos.add(oldRepo);
} else {
StatusUtil.handleStatus(String.format(
"Repository data is invalid - Nickname:%s - URI:%s - Enabled:%s", //$NON-NLS-1$
nickName,
uriName,
isEnabled), 0);
}
}
} catch (final Exception e) {
StatusUtil.handleStatus(e, 0);
}
return oldRepos;
}
示例11: 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();
}