本文整理匯總了Java中org.eclipse.ui.IMemento.getChildren方法的典型用法代碼示例。如果您正苦於以下問題:Java IMemento.getChildren方法的具體用法?Java IMemento.getChildren怎麽用?Java IMemento.getChildren使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.ui.IMemento
的用法示例。
在下文中一共展示了IMemento.getChildren方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: loadReferences
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
private static Set<IReference> loadReferences(IMemento memento)
throws PersistenceException {
Set<IReference> references = new HashSet<IReference>();
boolean hadException = false;
for (IMemento childMemento : memento.getChildren(KEY_REFERENCE)) {
try {
IReference loadedReference = loadReference(childMemento);
if (loadedReference != null) {
references.add(loadedReference);
}
} catch (PersistenceException e) {
CorePluginLog.logError(e, "Error loading persisted reference.");
hadException = true;
}
}
if (hadException) {
throw new PersistenceException(
"Error loading all the references, check log for more details.");
}
return references;
}
示例3: load
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
public static UiBinderSubtypeToOwnerIndex load(IMemento memento)
throws PersistenceException {
UiBinderSubtypeToOwnerIndex index = new UiBinderSubtypeToOwnerIndex();
boolean hadException = false;
for (IMemento childMemento : memento.getChildren(KEY_UIBINDER_SUBTYPE_AND_OWNER_ENTRY)) {
try {
UiBinderSubtypeAndOwner subtypeAndOwner = UiBinderSubtypeAndOwner.load(childMemento);
if (subtypeAndOwner != null) {
index.setOwnerType(subtypeAndOwner);
}
} catch (PersistenceException e) {
CorePluginLog.logError(e, "Error loading persisted index entry.");
hadException = true;
}
}
if (hadException) {
throw new PersistenceException(
"Error loading all the references, check log for more details.");
}
return index;
}
示例4: load
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
public static UiXmlReferencedFieldIndex load(IMemento memento)
throws PersistenceException {
UiXmlReferencedFieldIndex index = new UiXmlReferencedFieldIndex();
boolean hadException = false;
for (IMemento childMemento : memento.getChildren(KEY_UI_FIELD_REF)) {
try {
loadFieldRef(childMemento, index);
} catch (PersistenceException e) {
CorePluginLog.logError(e, "Error loading persisted index entry.");
hadException = true;
}
}
if (hadException) {
throw new PersistenceException(
"Error loading all the references, check log for more details.");
}
return index;
}
示例5: load
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
public static UiBinderSubtypeToUiXmlIndex load(IMemento memento)
throws PersistenceException {
UiBinderSubtypeToUiXmlIndex index = new UiBinderSubtypeToUiXmlIndex();
boolean hadException = false;
for (IMemento childMemento : memento.getChildren(KEY_UIBINDER_SUBTYPE_AND_UI_XML_ENTRY)) {
try {
loadEntry(childMemento, index);
} catch (PersistenceException e) {
CorePluginLog.logError(e, "Error loading persisted index entry.");
hadException = true;
}
}
if (hadException) {
throw new PersistenceException(
"Error loading all the references, check log for more details.");
}
return index;
}
示例6: restoreState
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
protected void restoreState() {
if (isRestored()) {
return;
}
IMemento memento = createMemento();
if (memento == null) {
String content = getClipboardContent();
if(content == null) {
return;
}
addFilesFromPlainText(content);
setRestored(true);
} else {
IMemento[] mementos = memento.getChildren("editor");
for (int i = 0; i < mementos.length; i++) {
EditorInfo item = new EditorInfo(mementos[i]);
if (item.isConsistent()) {
add(item);
}
}
setRestored(true);
}
}
示例7: restoreState
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
/**
* Restore the most-recently-used history from the given memento.
*/
protected void restoreState() {
if (isRestored()) {
return;
}
IMemento memento = createMemento();
if (memento == null) {
PresentationPlugin.log("Couldn't restore session " + getName(), null);
return;
}
IMemento[] mementos = memento.getChildren("editor");
for (int i = 0; i < mementos.length; i++) {
EditorInfo item = new EditorInfo(mementos[i]);
if (item.isConsistent()) {
add(item);
}
}
setRestored(true);
}
示例8: 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);
}
示例9: 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 ) );
}
}
示例10: loadCuDependencies
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
private void loadCuDependencies(IMemento cuNode) {
String cuHandle = cuNode.getString(ATTR_COMPILATION_UNIT);
if (cuHandle == null) {
CorePluginLog.logError("Loading index {0}: Missing attribute {1}",
indexName, ATTR_COMPILATION_UNIT);
return;
}
ICompilationUnit cu = (ICompilationUnit) JavaCore.create(cuHandle);
// Verify the compilation unit still exists
if (cu == null || !cu.exists()) {
CorePluginLog.logError(
"Loading index {0}: compilation unit no longer exists ({1})",
indexName, cuHandle);
return;
}
Set<IPath> resourcePaths = new HashSet<IPath>();
for (IMemento resNode : cuNode.getChildren(TAG_RESOURCE)) {
IPath resourcePath = getResourcePath(resNode);
if (resourcePath == null) {
CorePluginLog.logError("Loading index {0}: missing attribute {1}",
indexName, ATTR_RESOURCE_PATH);
continue;
}
resourcePaths.add(resourcePath);
}
// Now add these dependencies to the index
index.putLeftToManyRights(cu, resourcePaths);
}
示例11: loadList
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
private final void loadList() {
IMemento memento = getMemento();
if (memento == null) {
return;
}
IMemento[] list = memento.getChildren(URL);
for(int i = 0; i < list.length; ++i) {
combo.add(list[i].getTextData());
}
}
示例12: 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;
}
示例13: fromXml
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
@Override
public ZooKeeperConnectionDescriptor fromXml(XMLMemento memento) {
String name = memento.getString(XML_TAG_NAME);
int sessionTimeout = Integer.parseInt(memento.getString(XML_TAG_SESSION_TIMEOUT));
String rootPath = memento.getString(XML_TAG_ROOT_PATH);
ZooKeeperConnectionDescriptor connectionDescriptor = new ZooKeeperConnectionDescriptor(name, sessionTimeout);
if (rootPath != null) {
rootPath = rootPath.trim();
if (rootPath.length() > 0 && !rootPath.equals(Znode.ROOT_PATH)) {
connectionDescriptor.setRootPath(rootPath);
}
}
IMemento[] serverMementos = memento.getChild(XML_TAG_ZOO_KEEPER_SERVERS).getChildren(
XML_TAG_ZOO_KEEPER_SERVER);
for (IMemento serverMemento : serverMementos) {
String host = serverMemento.getString(XML_TAG_ZOO_KEEPER_SERVER_HOST);
int port = Integer.parseInt(serverMemento.getString(XML_TAG_ZOO_KEEPER_SERVER_PORT));
ZooKeeperServerDescriptor severDescriptor = new ZooKeeperServerDescriptor(host, port);
String jmxConnectionDescriptorName = serverMemento.getString(XML_TAG_ZOO_KEEPER_SERVER_JMX_CONNECTION);
if (jmxConnectionDescriptorName != null) {
JmxConnectionDescriptor jmxConnectionDescriptor = _JmxConnectionDescriptorFiles
.load(jmxConnectionDescriptorName);
severDescriptor.setJmxConnectionDescriptor(jmxConnectionDescriptor);
}
connectionDescriptor.getServers().add(severDescriptor);
}
IMemento authInfosMemento = memento.getChild(XML_TAG_AUTH_INFOS);
if (authInfosMemento != null) {
IMemento[] authInfoMementos = authInfosMemento.getChildren(XML_TAG_AUTH_INFO);
ArrayList<AuthInfo> authInfos = new ArrayList<AuthInfo>(authInfoMementos.length);
for (IMemento authInfoMemento : authInfoMementos) {
String typeName = authInfoMemento.getString(XML_TAG_AUTH_INFO_TYPE);
String scheme = authInfoMemento.getString(XML_TAG_AUTH_INFO_SCHEME);
String authString = authInfoMemento.getString(XML_TAG_AUTH_INFO_AUTH);
AuthInfo authInfo = new AuthInfo(Type.valueOf(typeName), scheme, authString);
authInfos.add(authInfo);
}
if (authInfos.size() > 0) {
connectionDescriptor.setAuthInfos(authInfos);
}
}
return connectionDescriptor;
}
示例14: restoreViewerInput
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
/**
* Restore the viewer content that was persisted
*
* @param memento
* the memento containing the persisted viewer content
*/
private void restoreViewerInput(IMemento memento) {
IMemento[] projects = memento.getChildren(TAG_PROJECT);
if (projects.length < 1) {
return;
}
for (int i = 0; i < projects.length; i++) {
IMemento projectMemento = projects[i];
String pathString = projectMemento.getString(KEY_PATH);
IFile file = ResourcesPlugin.getWorkspace().getRoot()
.getFile(new Path(pathString));
if (!file.exists()) {
// If the file no longer exists, don't add it.
continue;
}
String factoryId = projectMemento.getString(KEY_FACTORY_ID);
IJSBuildFile buildFile = JSBuildFileFactoryManager.create(file,
factoryId);
if (buildFile != null) {
internalAddBuildFile(buildFile);
}
/*
* String nameString = projectMemento.getString(KEY_NAME); String
* defaultTarget = projectMemento.getString(KEY_DEFAULT); String
* errorString = projectMemento.getString(KEY_ERROR); String
* warningString = projectMemento.getString(KEY_WARNING);
*
* AntProjectNodeProxy project = null; if (nameString == null) {
* nameString = IAntCoreConstants.EMPTY_STRING; } project = new
* AntProjectNodeProxy(nameString, pathString); if (errorString !=
* null && Boolean.valueOf(errorString).booleanValue()) {
* project.setProblemSeverity(AntModelProblem.SEVERITY_ERROR); }
* else if (warningString != null &&
* Boolean.valueOf(warningString).booleanValue()) {
* project.setProblemSeverity(AntModelProblem.SEVERITY_WARNING); }
* if (defaultTarget != null) {
* project.setDefaultTargetName(defaultTarget); }
* fInput.add(project);
*/
}
}
示例15: readColors_10_MapColors
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
private static ArrayList<Map3ColorDefinition> readColors_10_MapColors(final XMLMemento xmlRoot) {
final ArrayList<Map3ColorDefinition> colorDefinitions = new ArrayList<Map3ColorDefinition>();
final IMemento[] xmlColorDefinitions = xmlRoot.getChildren(TAG_COLOR_DEFINITION);
for (final IMemento xmlColorDef : xmlColorDefinitions) {
final String xmlGraphId = xmlColorDef.getString(ATTR_GRAPH_ID);
if (xmlGraphId == null) {
continue;
}
MapGraphId graphId;
try {
graphId = MapGraphId.valueOf(xmlGraphId);
} catch (final Exception e) {
// unknown graph id
continue;
}
final Map3ColorDefinition colorDef = new Map3ColorDefinition(graphId);
colorDefinitions.add(colorDef);
final IMemento[] xmlProfiles = xmlColorDef.getChildren(TAG_COLOR_PROFILE);
for (final IMemento xmlProfile : xmlProfiles) {
final Map3ColorProfile colorProfile = new Map3ColorProfile();
colorDef.addProfile(colorProfile);
colorProfile.setProfileName(Util.getXmlString(xmlProfile, ATTR_NAME, UI.EMPTY_STRING));
colorProfile.setIsActiveColorProfile(Util.getXmlBoolean(xmlProfile, ATTR_IS_ACTIVE_PROFILE, false));
colorProfile.setIsAbsoluteValues(Util.getXmlBoolean(xmlProfile, ATTR_IS_ABSOLUTE_VALUES, false));
colorProfile.setIsOverwriteLegendValues(Util.getXmlBoolean(xmlProfile,//
ATTR_IS_OVERWRITE_LEGEND_VALUES,
true));
readColors_20_Brightness(xmlProfile, colorProfile);
readColors_30_Vertices(xmlProfile, colorProfile);
}
}
return colorDefinitions;
}