Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="lib/jakarta-oro-2.0.6.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
Expand Down
5 changes: 0 additions & 5 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
4 changes: 4 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

Changes since 1.4:
----------------------------------
- Fix enabled state for Remove All button on Edit this watcher
- Find dialog set initial text as selected from log window
- Replace jakata oro with java.util.regex
- NPE on multiple ignore filters
- Upgrade to eclipse 4.6 Neon
- Upgrade to eclipse 4.4 Luna

Expand Down
9 changes: 4 additions & 5 deletions META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Logwatcher
Bundle-SymbolicName: org.graysky.eclipse.logwatcher;singleton:=true
Bundle-Version: 1.4.0.3
Bundle-Version: 1.4.0.5
Bundle-Activator: org.graysky.eclipse.logwatcher.LogwatcherPlugin
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui.ide,
Expand All @@ -14,8 +14,9 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.help,
org.eclipse.jface.text
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: lib/jakarta-oro-2.0.6.jar,
plugins/org.graysky.eclipse.logwatcher_1.4.0.3.jar
Bundle-Vendor: Graysky.org
Plugin-Class: org.graysky.eclipse.logwatcher.LogwatcherPlugin
Bundle-ClassPath: plugins/org.graysky.eclipse.logwatcher_1.4.0.5.jar
Export-Package: org.graysky.eclipse.logwatcher,
org.graysky.eclipse.logwatcher.actions,
org.graysky.eclipse.logwatcher.dialogs,
Expand All @@ -25,5 +26,3 @@ Export-Package: org.graysky.eclipse.logwatcher,
org.graysky.eclipse.logwatcher.watchers,
org.graysky.eclipse.logwatcher.wizards,
org.graysky.eclipse.util
Bundle-Vendor: Graysky.org
Plugin-Class: org.graysky.eclipse.logwatcher.LogwatcherPlugin
13 changes: 6 additions & 7 deletions build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ bin.includes = toc_LogWatcher.xml,\
book.xml,\
about.html,\
CHANGELOG.txt,\
lib/jakarta-oro-2.0.6.jar,\
META-INF/
META-INF/,\
OSGI-INF/l10n/bundle.properties,\
plugins/org.graysky.eclipse.logwatcher_1.4.0.5.jar
src.includes = toc_LogWatcher.xml,\
src/,\
plugin.xml,\
Expand All @@ -19,8 +20,6 @@ src.includes = toc_LogWatcher.xml,\
book.xml,\
about.html,\
CHANGELOG.txt
jars.compile.order = plugins/org.graysky.eclipse.logwatcher_1.4.0.3.jar
output.plugins/org.graysky.eclipse.logwatcher_1.4.0.3.jar = bin/
source.plugins/org.graysky.eclipse.logwatcher_1.4.0.3.jar = src/


jars.compile.order = plugins/org.graysky.eclipse.logwatcher_1.4.0.5.jar
output.plugins/org.graysky.eclipse.logwatcher_1.4.0.5.jar = bin/
source.plugins/org.graysky.eclipse.logwatcher_1.4.0.5.jar = src/
Binary file removed lib/jakarta-oro-2.0.6.jar
Binary file not shown.
14 changes: 13 additions & 1 deletion src/org/graysky/eclipse/logwatcher/dialogs/FindDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ protected Control createDialogArea(Composite parent)
new Label(composite, SWT.NONE).setText("Find:");
m_findText = new Text(composite, SWT.BORDER);
m_findText.setTextLimit(200);
// Add text selection from log window
if(!m_target.getSelectionText().isEmpty()) {
m_findText.setText(m_target.getSelectionText());
// Cursor to end
m_findText.setSelection(m_findText.getText().length());
}
gridData = new GridData();
gridData.widthHint = 160;
m_findText.setLayoutData(gridData);
Expand Down Expand Up @@ -138,7 +144,13 @@ public void widgetSelected(SelectionEvent evt)
}
}
});
m_findButton.setEnabled(false);
// Set button enabled state
if(m_findText.getText().isEmpty()) {
m_findButton.setEnabled(false);
}
else {
m_findButton.setEnabled(true);
}
getShell().setDefaultButton(m_findButton);

GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,17 +442,19 @@ public void widgetSelected(SelectionEvent evt)
public void widgetSelected(SelectionEvent evt)
{
if (m_filterList.getSelectionCount() == 1) {
saveButton.setEnabled(true);
saveButton.setEnabled(true);
}
else {
saveButton.setEnabled(false);
}

if (m_filterList.getSelectionCount() > 0) {
removeButton.setEnabled(true);
removeAllButton.setEnabled(true);
}
else {
removeButton.setEnabled(false);
removeAllButton.setEnabled(false);
}
}
});
Expand Down
21 changes: 9 additions & 12 deletions src/org/graysky/eclipse/logwatcher/filters/Filter.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

import java.util.Iterator;
import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;

import org.apache.oro.text.regex.MalformedPatternException;
import org.apache.oro.text.regex.Pattern;
import org.apache.oro.text.regex.Perl5Compiler;
import org.apache.oro.text.regex.Perl5Matcher;
import org.eclipse.swt.custom.LineStyleEvent;
import org.graysky.eclipse.util.XmlUtils;
import org.w3c.dom.Document;
Expand All @@ -23,20 +22,19 @@ public class Filter
private Vector m_actions = new Vector();
private boolean m_contains = true;
private Pattern m_regexp = null;
private Perl5Matcher m_matcher = new Perl5Matcher();
private String m_description;

/**
* Test if the given string is matched by this filter.
*/
public boolean matches(String str)
{
boolean match = m_matcher.contains(str, m_regexp);
Matcher matcher = m_regexp.matcher(str);
if (m_contains) {
return match;
return matcher.find();
}
else {
return !match;
return !matcher.find();
}
}

Expand Down Expand Up @@ -89,16 +87,15 @@ public String getPattern()
return m_pattern;
}

public void setPattern(String pattern, boolean caseSensitive) throws MalformedPatternException
public void setPattern(String pattern, boolean caseSensitive) throws PatternSyntaxException
{
m_pattern = pattern;
m_caseSensitive = caseSensitive;
Perl5Compiler compiler = new Perl5Compiler();
if (!m_caseSensitive) {
m_regexp = compiler.compile(m_pattern, Perl5Compiler.CASE_INSENSITIVE_MASK);
m_regexp = Pattern.compile(m_pattern, Pattern.CASE_INSENSITIVE);
}
else {
m_regexp = compiler.compile(m_pattern);
m_regexp = Pattern.compile(m_pattern);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/org/graysky/eclipse/logwatcher/filters/FilterLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import java.io.Reader;
import java.util.Vector;
import java.util.regex.PatternSyntaxException;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.apache.oro.text.regex.MalformedPatternException;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Display;
import org.graysky.eclipse.logwatcher.LogwatcherPlugin;
Expand Down Expand Up @@ -67,7 +67,7 @@ else if (name.equals("action")) {
try {
f.setPattern(pattern, caseSensitive);
}
catch (MalformedPatternException ignore) {
catch (PatternSyntaxException ignore) {
}
return f;
}
Expand Down
13 changes: 11 additions & 2 deletions src/org/graysky/eclipse/logwatcher/watchers/TextFileWatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,17 @@ else if (!m_file.exists()) {
// Apply each filter
for (Iterator iter = m_filters.iterator(); iter.hasNext();) {
Filter f = (Filter) iter.next();
if (f.matches(line)) {
line = f.handleWatcherMatch(line, firstUpdate);
try {
if (f.matches(line)) {
line = f.handleWatcherMatch(line, firstUpdate);
}
// Skip rest of filters as for an ignore will be null
if (line == null) {
break;
}
} catch (Exception e) {
// just log
LogwatcherPlugin.getDefault().logError("Error applying filter", e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package org.graysky.eclipse.logwatcher.wizards;

import org.apache.oro.text.regex.MalformedPatternException;
import org.apache.oro.text.regex.Perl5Compiler;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
Expand All @@ -28,7 +29,7 @@ public class NewFilterWizardStart extends WizardPage
private Combo m_actionsCombo;
private Combo m_containsCombo;
private Button m_caseSensitiveBox;
private Perl5Compiler m_regExpCompiler = new Perl5Compiler();
//private Perl5Compiler m_regExpCompiler = new Perl5Compiler();

/**
* Constructor for FilterWizardStartPage.
Expand Down Expand Up @@ -145,7 +146,7 @@ public Filter getFilter()
f.setContains(m_containsCombo.getSelectionIndex() == 0 ? true : false);
return f;
}
catch (MalformedPatternException e) {
catch (PatternSyntaxException e) {
// Shouldn't happen - we have already compiled the pattern.
return null;
}
Expand Down Expand Up @@ -174,11 +175,11 @@ protected boolean validatePage()
if (m_filterText.getText().length() > 0) {

try {
m_regExpCompiler.compile(m_filterText.getText());
Pattern.compile(m_filterText.getText());
setErrorMessage(null);
return true;
}
catch (MalformedPatternException e) {
catch (PatternSyntaxException e) {
setErrorMessage("Invalid regular expression: " + e.getMessage());
return false;
}
Expand Down