Search in sources :

Example 96 with IStorage

use of org.eclipse.core.resources.IStorage in project jbosstools-hibernate by jbosstools.

the class CriteriaEditorInputFactory method saveState.

public static void saveState(IMemento memento, CriteriaEditorInput input) {
    // Save the editor input type.
    memento.putString(KEY_EDITOR_INPUT_TYPE, ID_STORAGE_EDITOR_INPUT);
    String storageName = null;
    // $NON-NLS-1$
    String storageContent = "";
    // $NON-NLS-1$
    String configurationName = "";
    IStorage storage = input.getStorage();
    if (storage != null) {
        storageName = storage.getName();
        if (storage instanceof CriteriaEditorStorage) {
            CriteriaEditorStorage criteriaEditorStorage = (CriteriaEditorStorage) storage;
            storageContent = criteriaEditorStorage.getContentsString();
            configurationName = criteriaEditorStorage.getConfigurationName();
        }
    }
    // Save the storage content name in the memento.
    memento.putString(KEY_STORAGE_NAME, storageName);
    // Save the storage content string in the memento.
    memento.putString(KEY_STORAGE_CONTENT, storageContent);
    memento.putString(KEY_CONFIGURATION_NAME, configurationName);
}
Also used : IStorage(org.eclipse.core.resources.IStorage)

Aggregations

IStorage (org.eclipse.core.resources.IStorage)96 URI (org.eclipse.emf.common.util.URI)32 IFile (org.eclipse.core.resources.IFile)31 IProject (org.eclipse.core.resources.IProject)27 CoreException (org.eclipse.core.runtime.CoreException)25 IResource (org.eclipse.core.resources.IResource)20 Pair (org.eclipse.xtext.util.Pair)16 Test (org.junit.Test)15 IPackageFragmentRoot (org.eclipse.jdt.core.IPackageFragmentRoot)13 IStorageEditorInput (org.eclipse.ui.IStorageEditorInput)12 IPath (org.eclipse.core.runtime.IPath)11 IJavaProject (org.eclipse.jdt.core.IJavaProject)10 IOException (java.io.IOException)7 WrappedException (org.eclipse.emf.common.util.WrappedException)7 ByteArrayInputStream (java.io.ByteArrayInputStream)6 InputStream (java.io.InputStream)6 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)6 GitSynchronizeData (org.eclipse.egit.core.synchronize.dto.GitSynchronizeData)6 GitSynchronizeDataSet (org.eclipse.egit.core.synchronize.dto.GitSynchronizeDataSet)6 Storage2UriMapperJavaImpl (org.eclipse.xtext.ui.resource.Storage2UriMapperJavaImpl)6