mirror of https://github.com/mchr3k/org.intrace
More release 14 work
This commit is contained in:
parent
d033c7f6ff
commit
350b0d65cb
Binary file not shown.
|
|
@ -7,7 +7,9 @@ import java.io.OutputStreamWriter;
|
|||
import java.io.Writer;
|
||||
import java.net.InetAddress;
|
||||
import java.net.Socket;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.miginfocom.swt.MigLayout;
|
||||
|
|
@ -15,6 +17,7 @@ import net.miginfocom.swt.MigLayout;
|
|||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.CTabFolder;
|
||||
import org.eclipse.swt.custom.CTabItem;
|
||||
import org.eclipse.swt.custom.ST;
|
||||
import org.eclipse.swt.custom.StyledText;
|
||||
import org.eclipse.swt.events.MenuDetectEvent;
|
||||
import org.eclipse.swt.events.MenuDetectListener;
|
||||
|
|
@ -437,9 +440,10 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
|
|||
listClasses.setAlignment(SWT.CENTER);
|
||||
listClasses.setLayoutData("gapy 5px");
|
||||
|
||||
final String helpText = "Enter pattern in the form "
|
||||
+ "\"mypack.mysubpack.MyClass\" or using wildcards "
|
||||
+ "\"mypack.*.MyClass\" or \"*MyClass\" etc";
|
||||
final String helpText = "Enter complete or partial class names.\n\n "
|
||||
+ "e.g.\n"
|
||||
+ "\"mypack.mysubpack.MyClass\"\n"
|
||||
+ "\"MyClass\"";
|
||||
classRegex
|
||||
.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter()
|
||||
{
|
||||
|
|
@ -450,18 +454,18 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
|
|||
"Classes to Instrument", helpText, mode,
|
||||
new PatternInputCallback()
|
||||
{
|
||||
private String includePattern = null;
|
||||
private String excludePattern = null;
|
||||
private List<String> includePattern = null;
|
||||
private List<String> excludePattern = null;
|
||||
|
||||
@Override
|
||||
public void setIncludePattern(String newIncludePattern)
|
||||
public void setIncludePattern(List<String> newIncludePattern)
|
||||
{
|
||||
includePattern = newIncludePattern;
|
||||
savePatterns();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExcludePattern(String newExcludePattern)
|
||||
public void setExcludePattern(List<String> newExcludePattern)
|
||||
{
|
||||
excludePattern = newExcludePattern;
|
||||
savePatterns();
|
||||
|
|
@ -471,10 +475,13 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
|
|||
{
|
||||
if ((includePattern != null) && (excludePattern != null))
|
||||
{
|
||||
setRegex(includePattern, excludePattern);
|
||||
setRegex(getStringFromList(includePattern),
|
||||
getStringFromList(excludePattern));
|
||||
}
|
||||
}
|
||||
}, settingsData.classRegex, settingsData.classExcludeRegex);
|
||||
},
|
||||
getListFromString(settingsData.classRegex),
|
||||
getListFromString(settingsData.classExcludeRegex));
|
||||
placeDialogInCenter(sWindow.getBounds(), regexInput.sWindow);
|
||||
}
|
||||
});
|
||||
|
|
@ -490,6 +497,34 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
|
|||
|
||||
}
|
||||
|
||||
private List<String> getListFromString(String pattern)
|
||||
{
|
||||
List<String> items = new ArrayList<String>();
|
||||
String[] patternParts = pattern.split("\\|");
|
||||
for (String part : patternParts)
|
||||
{
|
||||
items.add(part);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
private String getStringFromList(List<String> list)
|
||||
{
|
||||
StringBuilder str = new StringBuilder();
|
||||
|
||||
for (int ii = 0; ii < list.size(); ii++)
|
||||
{
|
||||
String item = list.get(ii);
|
||||
str.append(item);
|
||||
if (ii < (list.size() - 1))
|
||||
{
|
||||
str.append("|");
|
||||
}
|
||||
}
|
||||
|
||||
return str.toString();
|
||||
}
|
||||
|
||||
private void setStatus(int instruClasses, int totalClasses)
|
||||
{
|
||||
if (!sRoot.isDisposed())
|
||||
|
|
@ -773,7 +808,9 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
|
|||
textOutput.setEditable(false);
|
||||
textOutput.setLayoutData("spanx,grow,wmin 0,hmin 0,wrap");
|
||||
textOutput.setBackground(Display.getCurrent().getSystemColor(
|
||||
SWT.COLOR_WHITE));
|
||||
SWT.COLOR_WHITE));
|
||||
textOutput.setKeyBinding(SWT.PAGE_UP, ST.PAGE_UP);
|
||||
textOutput.setKeyBinding(SWT.PAGE_DOWN, ST.PAGE_DOWN);
|
||||
|
||||
textOutput.addMenuDetectListener(new MenuDetectListener()
|
||||
{
|
||||
|
|
@ -793,16 +830,16 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
|
|||
@Override
|
||||
public void widgetSelected(SelectionEvent e)
|
||||
{
|
||||
String existingIncludePattern = lastEnteredIncludeFilterPattern + "|";
|
||||
if (lastEnteredIncludeFilterPattern == TraceFilterThread.MATCH_ALL)
|
||||
List<String> newIncludePattern = new ArrayList<String>(lastEnteredIncludeFilterPattern);
|
||||
if (lastEnteredIncludeFilterPattern.equals(TraceFilterThread.MATCH_ALL))
|
||||
{
|
||||
existingIncludePattern = "";
|
||||
newIncludePattern.clear();
|
||||
}
|
||||
String newPattern = selectedText;
|
||||
if (!existingIncludePattern.contains(newPattern))
|
||||
if (!newIncludePattern.contains(newPattern))
|
||||
{
|
||||
String newIncludePatternStr = existingIncludePattern + newPattern;
|
||||
lastEnteredIncludeFilterPattern = newIncludePatternStr;
|
||||
newIncludePattern.add(newPattern);
|
||||
lastEnteredIncludeFilterPattern = newIncludePattern;
|
||||
if (enableFilter.getSelection())
|
||||
{
|
||||
applyPatterns(lastEnteredIncludeFilterPattern,
|
||||
|
|
@ -819,16 +856,13 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
|
|||
@Override
|
||||
public void widgetSelected(SelectionEvent e)
|
||||
{
|
||||
String existingExcludePattern = lastEnteredExcludeFilterPattern + "|";
|
||||
if (lastEnteredExcludeFilterPattern == TraceFilterThread.MATCH_NONE)
|
||||
{
|
||||
existingExcludePattern = "";
|
||||
}
|
||||
List<String> newExcludePattern = new ArrayList<String>(lastEnteredExcludeFilterPattern);
|
||||
|
||||
String newPattern = selectedText;
|
||||
if (!existingExcludePattern.contains(newPattern))
|
||||
if (!newExcludePattern.contains(newPattern))
|
||||
{
|
||||
String newExcludePatternStr = existingExcludePattern + newPattern;
|
||||
lastEnteredExcludeFilterPattern = newExcludePatternStr;
|
||||
newExcludePattern.add(newPattern);
|
||||
lastEnteredExcludeFilterPattern = newExcludePattern;
|
||||
if (enableFilter.getSelection())
|
||||
{
|
||||
applyPatterns(lastEnteredIncludeFilterPattern,
|
||||
|
|
@ -967,23 +1001,25 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
|
|||
}
|
||||
});
|
||||
|
||||
final String helpText = "Enter pattern in the form "
|
||||
+ "\"text\" or using wildcards " + "\"tex*\" or \"*ext\" etc";
|
||||
|
||||
final String helpText = "Enter text to match against trace lines. " +
|
||||
"You can match any part of the line. " +
|
||||
"\n\nYou can also select some text and right click the " +
|
||||
"selection to quickly add an include or exclude filter.\n";
|
||||
|
||||
final PatternInputCallback patternCallback = new PatternInputCallback()
|
||||
{
|
||||
private String includePattern = null;
|
||||
private String excludePattern = null;
|
||||
private List<String> includePattern = null;
|
||||
private List<String> excludePattern = null;
|
||||
|
||||
@Override
|
||||
public void setIncludePattern(String newIncludePattern)
|
||||
public void setIncludePattern(List<String> newIncludePattern)
|
||||
{
|
||||
includePattern = newIncludePattern;
|
||||
savePatterns();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExcludePattern(String newExcludePattern)
|
||||
public void setExcludePattern(List<String> newExcludePattern)
|
||||
{
|
||||
excludePattern = newExcludePattern;
|
||||
savePatterns();
|
||||
|
|
@ -1180,15 +1216,16 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
|
|||
}
|
||||
}
|
||||
|
||||
private void applyPatterns(String newIncludePattern,
|
||||
String newExcludePattern,
|
||||
private void applyPatterns(List<String> newIncludePattern,
|
||||
List<String> newExcludePattern,
|
||||
final boolean isToggle)
|
||||
{
|
||||
if (newIncludePattern.equals(activeIncludeFilterPattern)
|
||||
&& newExcludePattern.equals(activeExcludeFilterPattern))
|
||||
{
|
||||
return;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
oldIncludeFilterPattern = activeIncludeFilterPattern;
|
||||
oldExcludeFilterPattern = activeExcludeFilterPattern;
|
||||
|
|
@ -1221,8 +1258,8 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
|
|||
|
||||
cancelButton.addSelectionListener(cancelListener);
|
||||
|
||||
final String newIncludePattern = activeIncludeFilterPattern;
|
||||
final String newExcludePattern = activeExcludeFilterPattern;
|
||||
final List<String> newIncludePattern = activeIncludeFilterPattern;
|
||||
final List<String> newExcludePattern = activeExcludeFilterPattern;
|
||||
|
||||
final TraceFilterProgressHandler progressHandler = new TraceFilterProgressHandler()
|
||||
{
|
||||
|
|
@ -1262,13 +1299,13 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getIncludePattern()
|
||||
public List<String> getIncludePattern()
|
||||
{
|
||||
return newIncludePattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getExcludePattern()
|
||||
public List<String> getExcludePattern()
|
||||
{
|
||||
return newExcludePattern;
|
||||
}
|
||||
|
|
@ -1363,13 +1400,13 @@ public class InTraceUI implements ISocketCallback, IControlConnectionListener
|
|||
private ParsedSettingsData settingsData = new ParsedSettingsData(
|
||||
new HashMap<String, String>());
|
||||
|
||||
private String lastEnteredIncludeFilterPattern = TraceFilterThread.MATCH_ALL;
|
||||
private String activeIncludeFilterPattern = TraceFilterThread.MATCH_ALL;
|
||||
private String oldIncludeFilterPattern = TraceFilterThread.MATCH_ALL;
|
||||
private List<String> lastEnteredIncludeFilterPattern = TraceFilterThread.MATCH_ALL;
|
||||
private List<String> activeIncludeFilterPattern = TraceFilterThread.MATCH_ALL;
|
||||
private List<String> oldIncludeFilterPattern = TraceFilterThread.MATCH_ALL;
|
||||
|
||||
private String lastEnteredExcludeFilterPattern = TraceFilterThread.MATCH_NONE;
|
||||
private String activeExcludeFilterPattern = TraceFilterThread.MATCH_NONE;
|
||||
private String oldExcludeFilterPattern = TraceFilterThread.MATCH_NONE;
|
||||
private List<String> lastEnteredExcludeFilterPattern = TraceFilterThread.MATCH_NONE;
|
||||
private List<String> activeExcludeFilterPattern = TraceFilterThread.MATCH_NONE;
|
||||
private List<String> oldExcludeFilterPattern = TraceFilterThread.MATCH_NONE;
|
||||
|
||||
private boolean autoScroll = true;
|
||||
private boolean fixedConnection = false;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package org.intrace.client.gui.helper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.miginfocom.swt.MigLayout;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
|
|
@ -12,8 +14,10 @@ import org.eclipse.swt.graphics.Point;
|
|||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Group;
|
||||
import org.eclipse.swt.widgets.List;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.TabFolder;
|
||||
import org.eclipse.swt.widgets.TabItem;
|
||||
|
|
@ -35,8 +39,9 @@ public class IncludeExcludeWindow
|
|||
|
||||
public IncludeExcludeWindow(String windowTitle, String helpText,
|
||||
UIMode mode,
|
||||
PatternInputCallback callback, String initIncludePatterns,
|
||||
String initExcludePatterns)
|
||||
PatternInputCallback callback,
|
||||
java.util.List<String> initIncludePatterns,
|
||||
java.util.List<String> initExcludePatterns)
|
||||
{
|
||||
this.callback = callback;
|
||||
MigLayout windowLayout = new MigLayout("fill", "[grow][100][100][grow]",
|
||||
|
|
@ -52,7 +57,17 @@ public class IncludeExcludeWindow
|
|||
sWindow.setLayout(windowLayout);
|
||||
sWindow.setSize(new Point(400, 400));
|
||||
sWindow.setMinimumSize(new Point(400, 400));
|
||||
|
||||
sWindow.addListener(SWT.Traverse, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
switch (event.detail) {
|
||||
case SWT.TRAVERSE_ESCAPE:
|
||||
sWindow.close();
|
||||
event.detail = SWT.TRAVERSE_NONE;
|
||||
event.doit = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (mode == UIMode.STANDALONE)
|
||||
{
|
||||
|
|
@ -72,10 +87,14 @@ public class IncludeExcludeWindow
|
|||
}
|
||||
|
||||
saveCancelButtons = new SaveCancelButtons(sWindow);
|
||||
|
||||
|
||||
// Focus on text input
|
||||
patterns.newPattern.patternInput.setFocus();
|
||||
}
|
||||
|
||||
private void fillTabs(TabFolder tabFolder, String initIncludePatterns, String initExcludePatterns, String helpText)
|
||||
private void fillTabs(TabFolder tabFolder,
|
||||
java.util.List<String> initIncludePatterns,
|
||||
java.util.List<String> initExcludePatterns, String helpText)
|
||||
{
|
||||
TabItem patternsTabItem = new TabItem(tabFolder, SWT.NONE);
|
||||
patternsTabItem.setText("Include/Exclude");
|
||||
|
|
@ -88,7 +107,9 @@ public class IncludeExcludeWindow
|
|||
helpTabItem.setControl(helpOutputTab.composite);
|
||||
}
|
||||
|
||||
private void fillCTabs(CTabFolder tabFolder, String initIncludePatterns, String initExcludePatterns, String helpText)
|
||||
private void fillCTabs(CTabFolder tabFolder,
|
||||
java.util.List<String> initIncludePatterns,
|
||||
java.util.List<String> initExcludePatterns, String helpText)
|
||||
{
|
||||
CTabItem patternsTabItem = new CTabItem(tabFolder, SWT.NONE);
|
||||
patternsTabItem.setText("Include/Exclude");
|
||||
|
|
@ -135,8 +156,8 @@ public class IncludeExcludeWindow
|
|||
private int excludeIndex = -1;
|
||||
|
||||
public PatternInput(Composite parent,
|
||||
String initIncludePatterns,
|
||||
String initExcludePatterns)
|
||||
java.util.List<String> initIncludePatterns,
|
||||
java.util.List<String> initExcludePatterns)
|
||||
{
|
||||
patternInputComp = new Composite(parent, SWT.NONE);
|
||||
MigLayout inputLayout = new MigLayout("fill", "[grow]", "[25][grow]");
|
||||
|
|
@ -223,8 +244,8 @@ public class IncludeExcludeWindow
|
|||
private final List patternSet;
|
||||
|
||||
private PatternList(Composite parent,
|
||||
String initIncludePatterns,
|
||||
String initExcludePatterns)
|
||||
java.util.List<String> initIncludePatterns,
|
||||
java.util.List<String> initExcludePatterns)
|
||||
{
|
||||
Group patternGroup = new Group(parent, SWT.SHADOW_ETCHED_IN);
|
||||
patternGroup.setLayoutData("grow");
|
||||
|
|
@ -248,10 +269,10 @@ public class IncludeExcludeWindow
|
|||
parsePatternSet(false, initExcludePatterns);
|
||||
}
|
||||
|
||||
private void parsePatternSet(boolean xiInclude, String initPattern)
|
||||
private void parsePatternSet(boolean xiInclude,
|
||||
java.util.List<String> initPattern)
|
||||
{
|
||||
String[] initPatterns = initPattern.split("\\|");
|
||||
for (String pattern : initPatterns)
|
||||
for (String pattern : initPattern)
|
||||
{
|
||||
parsePattern(xiInclude, pattern);
|
||||
}
|
||||
|
|
@ -277,63 +298,60 @@ public class IncludeExcludeWindow
|
|||
|
||||
private void addItem(boolean xiInclude, String newItem)
|
||||
{
|
||||
if (!newItem.equals(TraceFilterThread.MATCH_NONE))
|
||||
boolean addItem = true;
|
||||
|
||||
// Add headers
|
||||
if (xiInclude && (includeIndex == -1))
|
||||
{
|
||||
boolean addItem = true;
|
||||
|
||||
// Add headers
|
||||
if (xiInclude && (includeIndex == -1))
|
||||
patternSet.add(INCLUDE_TITLE, 0);
|
||||
includeIndex = 0;
|
||||
}
|
||||
else if (!xiInclude && (excludeIndex == -1))
|
||||
{
|
||||
patternSet.add("");
|
||||
patternSet.add(EXCLUDE_TITLE);
|
||||
excludeIndex = patternSet.getItemCount() - 1;
|
||||
}
|
||||
|
||||
String[] currentItems = patternSet.getItems();
|
||||
int startItem, endItem;
|
||||
if (xiInclude)
|
||||
{
|
||||
startItem = 1;
|
||||
if (excludeIndex == -1)
|
||||
{
|
||||
patternSet.add(INCLUDE_TITLE, 0);
|
||||
includeIndex = 0;
|
||||
}
|
||||
else if (!xiInclude && (excludeIndex == -1))
|
||||
{
|
||||
patternSet.add("");
|
||||
patternSet.add(EXCLUDE_TITLE);
|
||||
excludeIndex = patternSet.getItemCount() - 1;
|
||||
}
|
||||
|
||||
String[] currentItems = patternSet.getItems();
|
||||
int startItem, endItem;
|
||||
if (xiInclude)
|
||||
{
|
||||
startItem = 1;
|
||||
if (excludeIndex == -1)
|
||||
{
|
||||
endItem = currentItems.length;
|
||||
}
|
||||
else
|
||||
{
|
||||
endItem = excludeIndex - 1;
|
||||
}
|
||||
endItem = currentItems.length;
|
||||
}
|
||||
else
|
||||
{
|
||||
startItem = excludeIndex + 1;
|
||||
endItem = currentItems.length;
|
||||
}
|
||||
|
||||
for (int ii = startItem; ii < endItem; ii++)
|
||||
{
|
||||
String item = currentItems[ii].trim();
|
||||
if (item.equals(newItem))
|
||||
{
|
||||
addItem = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (addItem)
|
||||
{
|
||||
patternSet.add(" " + newItem, endItem);
|
||||
|
||||
if ((excludeIndex != -1) && (endItem < excludeIndex))
|
||||
{
|
||||
excludeIndex++;
|
||||
}
|
||||
endItem = excludeIndex - 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
startItem = excludeIndex + 1;
|
||||
endItem = currentItems.length;
|
||||
}
|
||||
|
||||
for (int ii = startItem; ii < endItem; ii++)
|
||||
{
|
||||
String item = currentItems[ii].trim();
|
||||
if (item.equals(newItem))
|
||||
{
|
||||
addItem = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (addItem)
|
||||
{
|
||||
patternSet.add(" " + newItem, endItem);
|
||||
|
||||
if ((excludeIndex != -1) && (endItem < excludeIndex))
|
||||
{
|
||||
excludeIndex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void removeItem()
|
||||
|
|
@ -421,10 +439,9 @@ public class IncludeExcludeWindow
|
|||
}
|
||||
}
|
||||
|
||||
private String getIncludePattern()
|
||||
private java.util.List<String> getIncludePattern()
|
||||
{
|
||||
StringBuffer pattern = new StringBuffer("");
|
||||
String patternStr = pattern.toString();
|
||||
java.util.List<String> includes = new ArrayList<String>();
|
||||
|
||||
if (includeIndex != -1)
|
||||
{
|
||||
|
|
@ -437,8 +454,7 @@ public class IncludeExcludeWindow
|
|||
for (int ii = 1; ii < endIndex; ii++)
|
||||
{
|
||||
String item = items[ii].trim();
|
||||
pattern.append(item);
|
||||
pattern.append("|");
|
||||
includes.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -447,24 +463,16 @@ public class IncludeExcludeWindow
|
|||
String newPatternStr = newPattern.patternInput.getText();
|
||||
if (newPatternStr.length() > 0)
|
||||
{
|
||||
pattern.append(newPatternStr);
|
||||
pattern.append("|");
|
||||
includes.add(newPatternStr);
|
||||
}
|
||||
}
|
||||
|
||||
patternStr = pattern.toString();
|
||||
if (patternStr.length() > 0)
|
||||
{
|
||||
patternStr = patternStr.substring(0, patternStr.length() - 1);
|
||||
}
|
||||
|
||||
return patternStr;
|
||||
return includes;
|
||||
}
|
||||
|
||||
private String getExcludePattern()
|
||||
private java.util.List<String> getExcludePattern()
|
||||
{
|
||||
StringBuffer pattern = new StringBuffer("");
|
||||
String patternStr = pattern.toString();
|
||||
java.util.List<String> excludes = new ArrayList<String>();
|
||||
|
||||
if (excludeIndex != -1)
|
||||
{
|
||||
|
|
@ -473,8 +481,7 @@ public class IncludeExcludeWindow
|
|||
for (int ii = (excludeIndex + 1); ii < endIndex; ii++)
|
||||
{
|
||||
String item = items[ii].trim();
|
||||
pattern.append(item);
|
||||
pattern.append("|");
|
||||
excludes.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -483,18 +490,11 @@ public class IncludeExcludeWindow
|
|||
String newPatternStr = newPattern.patternInput.getText();
|
||||
if (newPatternStr.length() > 0)
|
||||
{
|
||||
pattern.append(newPatternStr);
|
||||
pattern.append("|");
|
||||
excludes.add(newPatternStr);
|
||||
}
|
||||
}
|
||||
|
||||
patternStr = pattern.toString();
|
||||
if (patternStr.length() > 0)
|
||||
{
|
||||
patternStr = patternStr.substring(0, patternStr.length() - 1);
|
||||
}
|
||||
|
||||
return patternStr;
|
||||
return excludes;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -520,13 +520,7 @@ public class IncludeExcludeWindow
|
|||
@Override
|
||||
public void widgetSelected(SelectionEvent arg0)
|
||||
{
|
||||
String includePattern = patterns.getIncludePattern();
|
||||
if (includePattern.length() == 0)
|
||||
{
|
||||
includePattern = TraceFilterThread.MATCH_ALL;
|
||||
}
|
||||
callback.setIncludePattern(includePattern);
|
||||
|
||||
callback.setIncludePattern(patterns.getIncludePattern());
|
||||
callback.setExcludePattern(patterns.getExcludePattern());
|
||||
|
||||
sWindow.close();
|
||||
|
|
@ -546,8 +540,8 @@ public class IncludeExcludeWindow
|
|||
|
||||
public static interface PatternInputCallback
|
||||
{
|
||||
public void setIncludePattern(String newIncludePattern);
|
||||
public void setIncludePattern(java.util.List<String> newIncludePattern);
|
||||
|
||||
public void setExcludePattern(String newExcludePattern);
|
||||
public void setExcludePattern(java.util.List<String> newExcludePattern);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,9 +36,9 @@ public class TraceFilterThread implements Runnable
|
|||
{
|
||||
boolean setProgress(int percent);
|
||||
|
||||
String getIncludePattern();
|
||||
List<String> getIncludePattern();
|
||||
|
||||
String getExcludePattern();
|
||||
List<String> getExcludePattern();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -51,15 +51,24 @@ public class TraceFilterThread implements Runnable
|
|||
*/
|
||||
private static final String LOW_MEMORY = "Warning: Low memory - no further trace will be collected. StdOut or File output will continue if enabled.";
|
||||
|
||||
/**
|
||||
* Match all val
|
||||
*/
|
||||
public static final String MATCH_ALL_VAL = "*";
|
||||
|
||||
/**
|
||||
* Pattern which matches anything
|
||||
*/
|
||||
public static final String MATCH_ALL = "*";
|
||||
public static final List<String> MATCH_ALL = new ArrayList<String>(1);
|
||||
static
|
||||
{
|
||||
MATCH_ALL.add(MATCH_ALL_VAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pattern which matches nothing
|
||||
*/
|
||||
public static final String MATCH_NONE = "";
|
||||
public static final List<String> MATCH_NONE = new ArrayList<String>(0);
|
||||
|
||||
/**
|
||||
* Queue of filters to apply - this should usually only contain zero or one
|
||||
|
|
@ -107,6 +116,9 @@ public class TraceFilterThread implements Runnable
|
|||
*/
|
||||
private boolean clearTrace = false;
|
||||
|
||||
/**
|
||||
* UIMode being used
|
||||
*/
|
||||
private final UIMode mode;
|
||||
|
||||
/**
|
||||
|
|
@ -185,8 +197,8 @@ public class TraceFilterThread implements Runnable
|
|||
boolean doClearTrace = false;
|
||||
boolean lowMemorySignalled = false;
|
||||
TraceFilterProgressHandler patternProgress = null;
|
||||
String[] activeIncludePattern = MATCH_ALL.split("\\|");
|
||||
String[] activeExcludePattern = MATCH_NONE.split("\\|");
|
||||
List<String> activeIncludePattern = MATCH_ALL;
|
||||
List<String> activeExcludePattern = MATCH_NONE;
|
||||
try
|
||||
{
|
||||
while (true)
|
||||
|
|
@ -195,8 +207,8 @@ public class TraceFilterThread implements Runnable
|
|||
{
|
||||
if (patternProgress != null)
|
||||
{
|
||||
activeIncludePattern = patternProgress.getIncludePattern().split("\\|");
|
||||
activeExcludePattern = patternProgress.getExcludePattern().split("\\|");
|
||||
activeIncludePattern = patternProgress.getIncludePattern();
|
||||
activeExcludePattern = patternProgress.getExcludePattern();
|
||||
applyPattern(patternProgress);
|
||||
patternProgress = null;
|
||||
}
|
||||
|
|
@ -278,16 +290,12 @@ public class TraceFilterThread implements Runnable
|
|||
System.out.println("Filter thread quitting");
|
||||
}
|
||||
|
||||
private boolean matches(String[] strs, String target)
|
||||
private boolean matches(List<String> strs, String target)
|
||||
{
|
||||
for (String str : strs)
|
||||
{
|
||||
if (str.equals(MATCH_NONE))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (str.equals(MATCH_ALL) ||
|
||||
target.contains(str))
|
||||
if (str.equals(MATCH_ALL_VAL) ||
|
||||
target.contains(str))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -297,8 +305,8 @@ public class TraceFilterThread implements Runnable
|
|||
|
||||
private void applyPattern(TraceFilterProgressHandler progressCallback)
|
||||
{
|
||||
String[] includePattern = progressCallback.getIncludePattern().split("\\|");
|
||||
String[] excludePattern = progressCallback.getExcludePattern().split("\\|");
|
||||
List<String> includePattern = progressCallback.getIncludePattern();
|
||||
List<String> excludePattern = progressCallback.getExcludePattern();
|
||||
int numLines = traceLines.size();
|
||||
int handledLines = 0;
|
||||
double lastPercentage = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue