Merge branch 'release/2.1.2'
This commit is contained in:
commit
68660d0892
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %Bundle-Name
|
||||
Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true
|
||||
Bundle-Version: 2.1.1.qualifier
|
||||
Bundle-Version: 2.1.2.qualifier
|
||||
Bundle-Vendor: %Bundle-Vendor
|
||||
Require-Bundle: javax.inject;bundle-version="1.0.0",
|
||||
org.eclipse.core.runtime;bundle-version="3.11.1",
|
||||
|
|
|
@ -201,10 +201,14 @@ public class DesignBrowser {
|
|||
ISelection selection=event.getSelection();
|
||||
if( selection instanceof IStructuredSelection) {
|
||||
Object object= ((IStructuredSelection)selection).getFirstElement();
|
||||
if(object instanceof IHierNode&& ((IHierNode)object).getChildNodes().size()!=0){
|
||||
if(object instanceof IHierNode && ((IHierNode)object).getChildNodes().size()!=0){
|
||||
txTableViewer.setInput(object);
|
||||
updateButtons();
|
||||
}
|
||||
else { //if selection is changed but empty
|
||||
txTableViewer.setInput(null);
|
||||
updateButtons();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -250,8 +254,8 @@ public class DesignBrowser {
|
|||
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
selectionService.setSelection(event.getSelection());
|
||||
updateButtons();
|
||||
selectionService.setSelection(event.getSelection());
|
||||
updateButtons();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -249,6 +249,10 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||
});
|
||||
waveformPane = factory.createPanel(parent);
|
||||
waveformPane.setMaxTime(0);
|
||||
|
||||
//set selection to empty selection when opening a new waveformPane
|
||||
selectionService.setSelection(new StructuredSelection());
|
||||
|
||||
waveformPane.addPropertyChangeListener(IWaveformViewer.CURSOR_PROPERTY, new PropertyChangeListener() {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
|
@ -268,11 +272,13 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, waveformPane.getScaledTime(cursor - time));
|
||||
}
|
||||
});
|
||||
|
||||
waveformPane.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
if (event.getSelection() instanceof IStructuredSelection)
|
||||
if (event.getSelection() instanceof IStructuredSelection) {
|
||||
selectionService.setSelection(event.getSelection());
|
||||
}
|
||||
}
|
||||
});
|
||||
waveformPane.getWaveformControl().addMouseTrackListener(new MouseTrackListener() {
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package com.minres.scviewer.ui;
|
||||
public final class Hex {
|
||||
public static byte[] decode(final String hex) {
|
||||
if (hex.length() % 2 != 0) {
|
||||
throw new IllegalArgumentException("A hex string must contain an even number of characters: " + hex);
|
||||
}
|
||||
|
||||
byte[] out = new byte[hex.length() / 2];
|
||||
|
||||
for (int i = 0; i < hex.length(); i += 2) {
|
||||
int high = Character.digit(hex.charAt(i), 16);
|
||||
int low = Character.digit(hex.charAt(i + 1), 16);
|
||||
if (high == -1 || low == -1) {
|
||||
throw new IllegalArgumentException("A hex string can only contain the characters 0-9, A-F, a-f: " + hex);
|
||||
}
|
||||
|
||||
out[i / 2] = (byte) (high * 16 + low);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
private static final char[] UPPER_HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', };
|
||||
|
||||
public static String encode(final byte[] bytes) {
|
||||
StringBuilder stringBuilder = new StringBuilder(bytes.length * 2);
|
||||
for (byte cur : bytes) {
|
||||
stringBuilder.append(UPPER_HEX_DIGITS[(cur >> 4) & 0xF]);
|
||||
stringBuilder.append(UPPER_HEX_DIGITS[(cur & 0xF)]);
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
|
||||
private Hex() {
|
||||
}
|
||||
}
|
|
@ -71,7 +71,7 @@ public class TxEditorInputFactory implements IElementFactory {
|
|||
String listData = memento.getString(TAG_STREAMLIST);
|
||||
if (listData != null) {
|
||||
try {
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(javax.xml.bind.DatatypeConverter.parseHexBinary(listData));
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(Hex.decode(listData));
|
||||
ObjectInputStream ois = new ObjectInputStream(bais);
|
||||
Object obj = ois.readObject();
|
||||
if(obj instanceof List<?>)
|
||||
|
@ -107,8 +107,9 @@ public class TxEditorInputFactory implements IElementFactory {
|
|||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(baos);
|
||||
oos.writeObject(input.getStreamNames());
|
||||
memento.putString(TAG_STREAMLIST, javax.xml.bind.DatatypeConverter.printHexBinary(baos.toByteArray()));
|
||||
memento.putString(TAG_STREAMLIST, Hex.encode(baos.toByteArray()));
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue