Java Code Examples for org.eclipse.ui.IMemento#putString()
The following examples show how to use
org.eclipse.ui.IMemento#putString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReferenceManagerPersister.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
private static void persistReferenceLocation(IReferenceLocation location, IMemento memento) throws PersistenceException { memento.putString(KEY_CLASS, location.getClass().getSimpleName()); if (location instanceof ClasspathRelativeFileReferenceLocation) { memento.putString( KEY_CLASSPATH_RELATIVE_PATH, ((ClasspathRelativeFileReferenceLocation) location).getClasspathRelativePath().toPortableString()); } else if (location instanceof LogicalJavaElementReferenceLocation) { persistLogicalJavaElement( ((LogicalJavaElementReferenceLocation) location).getLogicalJavaElement(), memento.createChild(KEY_LOGICAL_JAVA_ELEMENT)); } else { throw new PersistenceException("Could not persist " + location.getClass().getName()); } }
Example 2
Source File: JavaRefIndex.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
private void saveIndex(XMLMemento memento) { for (Entry<IPath, Set<IIndexedJavaRef>> fileEntry : fileIndex.entrySet()) { for (IIndexedJavaRef ref : fileEntry.getValue()) { IMemento refNode = memento.createChild(TAG_JAVA_REF); /* * Embed the Java reference class name into the index. This ends up * making the resulting index file larger than it really needs to be * (around 100 KB for the index containing gwt-user, gwt-lang, and all * the gwt-dev projects), but it still loads in around 50 ms on average * on my system, so it doesn't seem to be a bottleneck. */ String refClassName = ref.getClass().getName(); refNode.putString(TAG_JAVA_REF_CLASS, refClassName); // The implementation of IIndexedJavaRef serializes itself ref.save(refNode); } } }
Example 3
Source File: JavaBrowsingPart.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private void saveSelectionState(IMemento memento) { Object elements[]= ((IStructuredSelection) fViewer.getSelection()).toArray(); if (elements.length > 0) { IMemento selectionMem= memento.createChild(TAG_SELECTED_ELEMENTS); for (int i= 0; i < elements.length; i++) { IMemento elementMem= selectionMem.createChild(TAG_SELECTED_ELEMENT); Object o= elements[i]; if (o instanceof IJavaElement) elementMem.putString(TAG_SELECTED_ELEMENT_PATH, ((IJavaElement) elements[i]).getHandleIdentifier()); else if (o instanceof LogicalPackage) { IPackageFragment[] packages=((LogicalPackage)o).getFragments(); for (int j= 0; j < packages.length; j++) { IMemento packageMem= elementMem.createChild(TAG_LOGICAL_PACKAGE); packageMem.putString(TAG_SELECTED_ELEMENT_PATH, packages[j].getHandleIdentifier()); } } } } }
Example 4
Source File: OpenTypeSelectionDialog.java From n4js with Eclipse Public License 1.0 | 5 votes |
@Override protected void storeItemToMemento(final Object item, final IMemento memento) { if (item instanceof IEObjectDescription) { final URI uri = ((IEObjectDescription) item).getEObjectURI(); memento.putString(MEMENTO_URI_KEY, uri.toString()); } }
Example 5
Source File: WorkingSetFilterActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Saves the state of the filter actions in a memento. * * @param memento the memento */ public void saveState(IMemento memento) { if (fWorkingSet != null) memento.putString(TAG_WORKING_SET_NAME, fWorkingSet.getName()); else memento.putString(TAG_WORKING_SET_NAME, ""); //$NON-NLS-1$ }
Example 6
Source File: IndexedJsniJavaRef.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
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()); }
Example 7
Source File: InfoFactory.java From Pydev with Eclipse Public License 1.0 | 5 votes |
public void saveState(IMemento memento) { if (info.info == null) { return; } String declaringModuleName = info.info.getDeclaringModuleName(); if (declaringModuleName == null) { declaringModuleName = ""; } memento.putString(TAG_MODULE_NAME, declaringModuleName); String path = info.info.getPath(); if (path == null) { path = ""; } memento.putString(TAG_PATH, path); String name = info.info.getName(); if (name == null) { name = ""; } memento.putString(TAG_NAME, name); memento.putString(TAG_TYPE, info.info.getType() + ""); if (info.additionalInfo instanceof AdditionalProjectInterpreterInfo) { AdditionalProjectInterpreterInfo projectInterpreterInfo = (AdditionalProjectInterpreterInfo) info.additionalInfo; memento.putString(TAG_PROJECT_NAME, projectInterpreterInfo.getProject().getName()); } else if (info.additionalInfo instanceof AdditionalSystemInterpreterInfo) { AdditionalSystemInterpreterInfo systemInterpreterInfo = (AdditionalSystemInterpreterInfo) info.additionalInfo; IInterpreterManager manager = systemInterpreterInfo.getManager(); memento.putInteger(TAG_MANAGER_INTERPRETER_TYPE, manager.getInterpreterType()); memento.putString(TAG_MANAGER_INTERPRETER, systemInterpreterInfo.getAdditionalInfoInterpreter()); } }
Example 8
Source File: SdkManager.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
private static void saveTools(IMemento memento, Sdk sdk) { List<SdkTool> tools = sdk.getTools(); IMemento toolsMemento = memento.createChild(TAG_TOOL_COLLECTION); for (SdkTool tool : tools) { IMemento toolMemento = toolsMemento.createChild(TAG_TOOL); if (tool.isSeparator()) { toolMemento.putBoolean("isSeprator", true); //$NON-NLS-1$ toolMemento.putString(SdkTool.Property.MENU_GROUP.tag, tool.getPropertyValue(SdkTool.Property.MENU_GROUP)); } else { for (SdkTool.Property property: SdkTool.Property.values()) { toolMemento.putString(property.tag, tool.getPropertyValue(property)); } } } }
Example 9
Source File: SdkManager.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
private void saveSdkRegistry(XMLMemento memento, SdkRegistry sdkRegistry) { String actSdk = (sdkRegistry.getDefaultSdk() != null) ? sdkRegistry.getDefaultSdk().getName() : ""; //$NON-NLS-1$ IPreferenceStore store = XdsCorePlugin.getDefault().getPreferenceStore(); store.setValue(KEY_ACTIVE_SDK_NAME, actSdk); WorkspacePreferencesManager.getInstance().flush(); for (Sdk sdk : sdkRegistry.getRegisteredSDKs()) { IMemento mementoSdk = memento.createChild(TAG_SDK); for (Sdk.Property property: Sdk.Property.values()) { mementoSdk.putString(property.xmlKey, sdk.getPropertyValue(property)); for (Sdk.Tag tag : property.possibleTags) { String val = sdk.getTag(property, tag); if (val != null) { String key = property.xmlKey + "_" + tag.xmlTagName; //$NON-NLS-1$ mementoSdk.putString(key, val); } } } Map<String, String> environmentVariables = sdk.getEnvironmentVariablesRaw(); if (!environmentVariables.isEmpty()) { for (Map.Entry<String, String> entry : environmentVariables.entrySet()) { IMemento mementoEnvVar = mementoSdk.createChild(TAG_ENVIRONMENT_VARIABLE); mementoEnvVar.putString(TAG_ENVIRONMENT_VARIABLE_NAME, entry.getKey()); mementoEnvVar.putString(TAG_ENVIRONMENT_VARIABLE_VALUE, entry.getValue()); } } saveTools(mementoSdk, sdk); } }
Example 10
Source File: CustomFiltersActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Saves the state of the custom filters in a memento. * * @param memento the memento into which the state is saved */ public void saveState(IMemento memento) { IMemento customFilters= memento.createChild(TAG_CUSTOM_FILTERS); customFilters.putString(TAG_USER_DEFINED_PATTERNS_ENABLED, Boolean.toString(fUserDefinedPatternsEnabled)); saveUserDefinedPatterns(customFilters); saveXmlDefinedFilters(customFilters); saveLRUFilters(customFilters); }
Example 11
Source File: CustomFiltersActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Stores the last recently used filter Ids into * the given memento * * @param memento the memento into which to store the LRU filter Ids * @since 3.0 */ private void saveLRUFilters(IMemento memento) { if(fLRUFilterIdsStack != null && !fLRUFilterIdsStack.isEmpty()) { IMemento lruFilters= memento.createChild(TAG_LRU_FILTERS); Iterator<String> iter= fLRUFilterIdsStack.iterator(); while (iter.hasNext()) { String id= iter.next(); IMemento child= lruFilters.createChild(TAG_CHILD); child.putString(TAG_FILTER_ID, id); } } }
Example 12
Source File: MemberFilterActionGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Saves the state of the filter actions in a memento. * * @param memento the memento to which the state is saved */ public void saveState(IMemento memento) { memento.putString(TAG_HIDEFIELDS, String.valueOf(hasMemberFilter(FILTER_FIELDS))); memento.putString(TAG_HIDESTATIC, String.valueOf(hasMemberFilter(FILTER_STATIC))); memento.putString(TAG_HIDENONPUBLIC, String.valueOf(hasMemberFilter(FILTER_NONPUBLIC))); memento.putString(TAG_HIDELOCALTYPES, String.valueOf(hasMemberFilter(FILTER_LOCALTYPES))); }
Example 13
Source File: ScriptEditorInputFactory.java From birt with Eclipse Public License 1.0 | 5 votes |
/**Save the memento. * @param memento * @param input */ public static void saveState( IMemento memento, DebugJsInput input ) { File file = input.getFile( ); memento.putString( TAG_PATH, file.getAbsolutePath( ) ); memento.putString( TAG_ID, input.getId( ) ); }
Example 14
Source File: Mementos.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public static void saveItem(IMemento memento, IAdaptable element) { IPersistableElement persistable= (IPersistableElement)element.getAdapter(IPersistableElement.class); if (persistable != null) { memento.putString( TAG_FACTORY_ID, persistable.getFactoryId()); persistable.saveState(memento); } }
Example 15
Source File: WorkingSetActionProvider.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
public void saveState(IMemento aMemento) { super.saveState(aMemento); if (aMemento != null) { int showWorkingSets = extensionStateModel .getBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS) ? 1 : 0; aMemento.putInteger(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS, showWorkingSets); if (workingSet != null) { aMemento.putString(TAG_CURRENT_WORKING_SET_NAME, workingSet.getName()); } } }
Example 16
Source File: UiBinderSubtypeToOwnerIndex.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 4 votes |
public void persist(IMemento memento) { memento.putString(KEY_OWNER_TYPE_NAME, ownerTypeName); memento.putString(KEY_UIBINDER_SUBTYPE, uiBinderType.getHandleIdentifier()); }
Example 17
Source File: MonitorsView.java From neoscada with Eclipse Public License 1.0 | 4 votes |
@Override public void saveState ( final IMemento memento ) { memento.putString ( "columnSettings", this.gson.toJson ( this.monitorsTable.getColumnSettings () ) ); //$NON-NLS-1$ super.saveState ( memento ); }
Example 18
Source File: EventHistoryView.java From neoscada with Eclipse Public License 1.0 | 4 votes |
@Override public void saveState ( final IMemento memento ) { memento.putString ( "columnSettings", this.gson.toJson ( this.eventsTable.getColumnSettings () ) ); //$NON-NLS-1$ super.saveState ( memento ); }
Example 19
Source File: ClassFileEditorInputFactory.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public static void saveState(IMemento memento, InternalClassFileEditorInput input) { IClassFile c= input.getClassFile(); memento.putString(KEY, c.getHandleIdentifier()); }
Example 20
Source File: ReportEditorInputFactory.java From birt with Eclipse Public License 1.0 | 2 votes |
/** * Saves the state of the given file editor input into the given memento. * * @param memento * the storage area for element state * @param input * the file editor input */ public static void saveState( IMemento memento, ReportEditorInput input ) { File file = input.getFile( ); memento.putString( TAG_PATH, file.getAbsolutePath( ) ); }