Painter base waveform canvas implemented
Fixed Copyright information
This commit is contained in:
@ -1,3 +1,13 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.ui;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
@ -21,13 +31,18 @@ public class TxEditorInputFactory implements IElementFactory {
|
||||
* with the "org.eclipse.ui.elementFactories" extension point.
|
||||
*/
|
||||
private static final String ID_FACTORY = "com.minres.scviewer.ui.TxEditorInputFactory"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Tag for the IFile.fullPath of the file resource.
|
||||
*/
|
||||
private static final String TAG_PATH = "path"; //$NON-NLS-1$
|
||||
|
||||
private static final String STREAMLIST_PATH = "stream_list"; //$NON-NLS-1$
|
||||
/**
|
||||
* Tag for the secondaryLoade of the resource.
|
||||
*/
|
||||
private static final String TAG_SECONDARY = "secondary"; //$NON-NLS-1$
|
||||
/**
|
||||
* Tag for the streamList of the resource.
|
||||
*/
|
||||
private static final String TAG_STREAMLIST = "stream_list"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Creates a new factory.
|
||||
@ -45,13 +60,15 @@ public class TxEditorInputFactory implements IElementFactory {
|
||||
if (fileName == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Get a handle to the IFile...which can be a handle
|
||||
// to a resource that does not exist in workspace
|
||||
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(fileName));
|
||||
if (file != null) {
|
||||
TxEditorInput tei = new TxEditorInput(file);
|
||||
String listData = memento.getString(STREAMLIST_PATH);
|
||||
Boolean isSecondaryLoaded = memento.getBoolean(TAG_SECONDARY);
|
||||
if(isSecondaryLoaded!=null)
|
||||
tei.setSecondaryLoaded(isSecondaryLoaded);
|
||||
String listData = memento.getString(TAG_STREAMLIST);
|
||||
if (listData != null) {
|
||||
try {
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(javax.xml.bind.DatatypeConverter.parseHexBinary(listData));
|
||||
@ -85,11 +102,12 @@ public class TxEditorInputFactory implements IElementFactory {
|
||||
public static void saveState(IMemento memento, TxEditorInput input) {
|
||||
IFile file = input.getFile();
|
||||
memento.putString(TAG_PATH, file.getFullPath().toString());
|
||||
if(input.isSecondaryLoaded()!=null) memento.putBoolean(TAG_SECONDARY, input.isSecondaryLoaded());
|
||||
try {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(baos);
|
||||
oos.writeObject(input.getStreamNames());
|
||||
memento.putString(STREAMLIST_PATH, javax.xml.bind.DatatypeConverter.printHexBinary(baos.toByteArray()));
|
||||
memento.putString(TAG_STREAMLIST, javax.xml.bind.DatatypeConverter.printHexBinary(baos.toByteArray()));
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user