本文整理匯總了Java中org.eclipse.ui.IMemento.putTextData方法的典型用法代碼示例。如果您正苦於以下問題:Java IMemento.putTextData方法的具體用法?Java IMemento.putTextData怎麽用?Java IMemento.putTextData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.ui.IMemento
的用法示例。
在下文中一共展示了IMemento.putTextData方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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 );
}
}
示例2: snapshot
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
/**
* Snapshot the projects currently associated with the repository
* <p>
* The memento returned can be later passed to {@link #save(IMemento)} to
* persist it
*
* @see #save(IMemento)
* @return memento, will be null on failures
*/
public IMemento snapshot() {
String branch = getBranch();
if (branch == null)
return null;
IProject[] projects;
try {
projects = ProjectUtil.getValidOpenProjects(repository);
} catch (CoreException e) {
return null;
}
XMLMemento memento = XMLMemento.createWriteRoot(KEY_PROJECTS);
memento.putString(KEY_BRANCH, branch);
final String workDir = repository.getWorkTree().getAbsolutePath();
for (IProject project : projects) {
IPath path = project.getLocation();
if (path == null)
continue;
// Only remember mapped projects
if (!(RepositoryProvider.getProvider(project) instanceof GitProvider))
continue;
String fullPath = path.toOSString();
if (fullPath.startsWith(workDir)) {
String relative = fullPath.substring(workDir.length());
if (relative.length() == 0)
relative = REPO_ROOT;
IMemento child = memento.createChild(KEY_PROJECT);
child.putTextData(relative);
}
}
return memento;
}
示例3: save
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
public void save(IMemento memento) {
// We have to make sure to call super.toString() here to use JsniRef's
// toString(), which provides the literal text of the Java reference)
memento.putTextData(super.toString());
memento.putString(TAG_SOURCE, getSource().toString());
memento.putInteger(TAG_OFFSET, getOffset());
}
示例4: saveList
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
protected final void saveList(IMemento memento) {
String firstItem = combo.getText();
IMemento child = memento.createChild(URL);
child.putTextData(firstItem);
String[] list = combo.getItems();
for(int i = 0; i < list.length; ++i) {
if (list[i].equals(firstItem)) {
continue;
}
child = memento.createChild(URL);
child.putTextData(list[i]);
}
}
示例5: save
import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
public void save(IMemento memento) {
memento.putTextData(paramTypeString);
memento.putString(TAG_SOURCE, getSource().toString());
memento.putInteger(TAG_OFFSET, getOffset());
}