Squashed commit of the following:
commit dccd2c524c1c00ab3998546276b7244e6d0f389c Author: eyck <eyck@minres.com> Date: Fri Nov 27 08:52:58 2020 +0100 re-layout sashes commit d932367a67e081307c49fd248c54c057357a96d2 Author: eyck <eyck@minres.com> Date: Fri Nov 27 08:47:50 2020 +0100 fix string filter and layout commit 7f4bf0a64d4d685390e9a7af61f377a512d5332d Author: eyck <eyck@minres.com> Date: Fri Nov 27 08:46:30 2020 +0100 set single clock selection commit 972e3ce9267c9cd2b9437e5f7403b3ff69d2928f Author: eyck <eyck@minres.com> Date: Fri Nov 27 08:45:49 2020 +0100 apply filter only to attributes commit 13a25692bd7909bad98169648edabd01872a7ecb Author: eyck <eyck@minres.com> Date: Fri Nov 27 08:45:22 2020 +0100 re-layout elements
This commit is contained in:
parent
a06b888365
commit
67818ff4dd
@ -41,8 +41,6 @@ public class SearchHandler {
|
||||
public void execute(Shell shell, MPart activePart){
|
||||
Object obj = activePart.getObject();
|
||||
if(obj instanceof WaveformViewer){
|
||||
WaveformViewer wfv = (WaveformViewer)obj;
|
||||
wfv.showSearch();
|
||||
// ISelection sel = wfv.getSelection();
|
||||
// if(sel instanceof StructuredSelection) {
|
||||
// TrackEntry e = findTrackEntry(((StructuredSelection)sel).toArray());
|
||||
|
@ -22,7 +22,7 @@ StatusBarControl_2=\nLast task:
|
||||
StatusBarControl_3=Currently running:
|
||||
StatusBarControl_4=No background progress running.
|
||||
SWTResourceManager_0=Wrong decorate corner
|
||||
TransactionDetails_0=Enter text to filter
|
||||
TransactionDetails_0=Enter text to filter attributes
|
||||
TransactionDetails_1=Name
|
||||
TransactionDetails_10=Properties
|
||||
TransactionDetails_11=Attributes
|
||||
|
@ -48,6 +48,7 @@ import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.layout.FillLayout;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
@ -114,6 +115,7 @@ public class TransactionDetails {
|
||||
*/
|
||||
@PostConstruct
|
||||
public void createComposite(final Composite parent, @Optional WaveformViewer waveformViewerPart) {
|
||||
parent.setLayout(new FillLayout());
|
||||
this.waveformViewerPart=waveformViewerPart;
|
||||
|
||||
top = new Composite(parent, SWT.NONE);
|
||||
@ -378,6 +380,7 @@ public class TransactionDetails {
|
||||
}
|
||||
|
||||
private void setTopItemFromHier(List<String> names, TreeItem [] items) {
|
||||
if(names.size()==0) return;
|
||||
for (TreeItem item : items) { // find item from category
|
||||
if(item.getText(0).equals(names.get(0))) {
|
||||
if(names.size()==1 || item.getItemCount()==0) {
|
||||
|
@ -13,8 +13,10 @@ import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider;
|
||||
import org.eclipse.jface.viewers.DoubleClickEvent;
|
||||
import org.eclipse.jface.viewers.IDoubleClickListener;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.LabelProvider;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.jface.viewers.TableViewer;
|
||||
import org.eclipse.jface.viewers.TableViewerColumn;
|
||||
@ -23,6 +25,7 @@ import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
import org.eclipse.swt.layout.FillLayout;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
@ -98,6 +101,8 @@ public class TransactionList extends Composite {
|
||||
*/
|
||||
public TransactionList(Composite parent, int style, WaveformViewer waveformViewer) {
|
||||
super(parent, style);
|
||||
parent.setLayout(new FillLayout());
|
||||
|
||||
setLayout(new GridLayout(5, false));
|
||||
txFilter = new TxFilter();
|
||||
|
||||
@ -186,10 +191,10 @@ public class TransactionList extends Composite {
|
||||
}
|
||||
});
|
||||
tableViewer.addFilter(txFilter);
|
||||
tableViewer.addDoubleClickListener(new IDoubleClickListener() {
|
||||
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||
@Override
|
||||
public void doubleClick(DoubleClickEvent event) {
|
||||
ISelection treeSelection = tableViewer.getSelection();
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
ISelection treeSelection = event.getSelection();
|
||||
if(treeSelection instanceof IStructuredSelection) {
|
||||
Object selected = ((IStructuredSelection)treeSelection).getFirstElement();
|
||||
if(selected instanceof ITx){
|
||||
@ -230,11 +235,6 @@ public class TransactionList extends Composite {
|
||||
// Turn on the header and the lines
|
||||
table.setHeaderVisible(true);
|
||||
table.setLinesVisible(true);
|
||||
new Label(this, SWT.NONE);
|
||||
new Label(this, SWT.NONE);
|
||||
new Label(this, SWT.NONE);
|
||||
new Label(this, SWT.NONE);
|
||||
new Label(this, SWT.NONE);
|
||||
}
|
||||
|
||||
public void setInput(TrackEntry trackEntry) {
|
||||
|
@ -181,9 +181,6 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
/** The waveform pane. */
|
||||
private IWaveformView waveformPane;
|
||||
|
||||
private CTabFolder tabFolder;
|
||||
|
||||
private CTabItem tbtmSearchResults;
|
||||
/** get UISynchronize injected as field */
|
||||
@Inject UISynchronize sync;
|
||||
|
||||
@ -278,44 +275,32 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
}
|
||||
});
|
||||
parent.setLayout(new FillLayout(SWT.HORIZONTAL));
|
||||
SashForm sashFormTop = new SashForm(parent, SWT.BORDER | SWT.SMOOTH);
|
||||
|
||||
Composite left = new Composite(sashFormTop, SWT.NONE);
|
||||
|
||||
IEclipseContext ctx = myPart.getContext();
|
||||
ctx.set(WaveformViewer.class, this);
|
||||
ctx.set(IWaveformDb.class, database);
|
||||
ctx.set(Composite.class, left);
|
||||
|
||||
SashForm topSash = new SashForm(parent, SWT.BORDER | SWT.SMOOTH | SWT.HORIZONTAL);
|
||||
Composite left = new Composite(topSash, SWT.NONE);
|
||||
SashForm middleSash = new SashForm(topSash, SWT.BORDER | SWT.SMOOTH | SWT.VERTICAL);
|
||||
Composite right = new Composite(topSash, SWT.NONE);
|
||||
topSash.setWeights(new int[] {20, 60, 20});
|
||||
|
||||
Composite middleTop = new Composite(middleSash, SWT.NONE);
|
||||
Composite middleBottom = new Composite(middleSash, SWT.NONE);
|
||||
middleSash.setWeights(new int[] {75, 25});
|
||||
|
||||
ctx.set(Composite.class, left);
|
||||
browser = ContextInjectionFactory.make(DesignBrowser.class, ctx);
|
||||
|
||||
//Composite right = new Composite(sashFormTop, SWT.NONE);
|
||||
SashForm sashFormRight = new SashForm(sashFormTop, SWT.BORDER | SWT.SMOOTH | SWT.VERTICAL);
|
||||
sashFormTop.setWeights(new int[] {25, 75});
|
||||
|
||||
Composite rightTop = new Composite(sashFormRight, SWT.NONE);
|
||||
|
||||
waveformPane = factory.createPanel(rightTop);
|
||||
|
||||
tabFolder = new CTabFolder(sashFormRight, SWT.BORDER);
|
||||
tabFolder.setSelectionBackground(Display.getCurrent().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT));
|
||||
|
||||
CTabItem tbtmDetails = new CTabItem(tabFolder, SWT.NONE);
|
||||
tbtmDetails.setText("Transaction Details");
|
||||
|
||||
ctx.set(Composite.class, tabFolder);
|
||||
ctx.set(Composite.class, right);
|
||||
detailsView = ContextInjectionFactory.make(TransactionDetails.class, ctx);
|
||||
tbtmDetails.setControl(detailsView.getControl());
|
||||
|
||||
tbtmSearchResults = new CTabItem(tabFolder, SWT.NONE);
|
||||
tbtmSearchResults.setText("Search Results");
|
||||
|
||||
transactionList = ContextInjectionFactory.make(TransactionListView.class, ctx);
|
||||
tbtmSearchResults.setControl(transactionList.getControl());
|
||||
|
||||
sashFormRight.setWeights(new int[] {75, 25});
|
||||
tabFolder.setSelection(0);
|
||||
|
||||
waveformPane = factory.createPanel(middleTop);
|
||||
|
||||
ctx.set(Composite.class, middleBottom);
|
||||
transactionList = ContextInjectionFactory.make(TransactionListView.class, ctx);
|
||||
|
||||
waveformPane.setMaxTime(0);
|
||||
setupColors();
|
||||
//set selection to empty selection when opening a new waveformPane
|
||||
@ -1314,16 +1299,11 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, null);
|
||||
}
|
||||
}
|
||||
|
||||
public void showSearch() {
|
||||
tabFolder.setSelection(tbtmSearchResults);
|
||||
}
|
||||
|
||||
public void search(String propName, DataType type, String propValue) {
|
||||
// StructuredSelection sel = (StructuredSelection) getSelection();
|
||||
// TrackEntry e = findTrackEntry((sel).toArray());
|
||||
// if(e==null) return;
|
||||
tabFolder.setSelection(tbtmSearchResults);
|
||||
transactionList.getControl().setSearchProps(propName, type, propValue);
|
||||
}
|
||||
}
|
@ -43,13 +43,14 @@ public class TxAttributeFilter extends ViewerFilter {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(element instanceof Object[]) {
|
||||
try {
|
||||
return (((Object[])element)[0]).toString().toLowerCase().matches(searchString.toLowerCase());
|
||||
} catch (PatternSyntaxException e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
// if(element instanceof Object[]) {
|
||||
// try {
|
||||
// return (((Object[])element)[0]).toString().toLowerCase().matches(searchString.toLowerCase());
|
||||
// } catch (PatternSyntaxException e) {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
return true;
|
||||
}
|
||||
}
|
@ -2,6 +2,8 @@ package com.minres.scviewer.e4.application.parts.txTableTree;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -23,6 +25,8 @@ public class TxFilter extends ViewerFilter {
|
||||
private DataType searchType;
|
||||
/** The search string. */
|
||||
private String searchValue;
|
||||
|
||||
private Pattern pattern=null;
|
||||
|
||||
/**
|
||||
* Sets the search text.
|
||||
@ -41,6 +45,14 @@ public class TxFilter extends ViewerFilter {
|
||||
*/
|
||||
public void setSearchValue(String s) {
|
||||
this.searchValue = s;
|
||||
if(searchType==DataType.STRING) {
|
||||
try {
|
||||
//pattern = Pattern.compile(searchValue, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
|
||||
pattern = Pattern.compile(searchValue);
|
||||
} catch (PatternSyntaxException e) {
|
||||
pattern = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@ -70,9 +82,10 @@ public class TxFilter extends ViewerFilter {
|
||||
BigInteger sval = parseBigInteger(searchValue);
|
||||
return lval.equals(sval);
|
||||
case STRING:
|
||||
try {
|
||||
return (((ITxAttribute) element).getName().toLowerCase().matches(searchValue.toLowerCase()));
|
||||
} catch (PatternSyntaxException e) {
|
||||
if(pattern!=null) {
|
||||
Matcher matcher = pattern.matcher( attr.getValue().toString());
|
||||
return matcher.find();
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user