Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Baron2009-08-10 19:01:12 +0000
committerElliott Baron2009-08-10 19:01:12 +0000
commitb1820e804f8830d6b785307765037996c74fbba2 (patch)
treeb9cd240102e721b012d43bb06a42ee5a24f39cb3 /valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src
parentcd6370ef7775dce603ed65ad1c2945d7197dc2bb (diff)
downloadorg.eclipse.linuxtools-b1820e804f8830d6b785307765037996c74fbba2.tar.gz
org.eclipse.linuxtools-b1820e804f8830d6b785307765037996c74fbba2.tar.xz
org.eclipse.linuxtools-b1820e804f8830d6b785307765037996c74fbba2.zip
Added new suppression file wizard, along with banner image.
Diffstat (limited to 'valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src')
-rw-r--r--valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/internal/valgrind/ui/editor/SuppressionsContentAssistProcessor.java50
-rw-r--r--valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/internal/valgrind/ui/editor/wizards/Messages.java10
-rw-r--r--valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/internal/valgrind/ui/editor/wizards/NewSuppressionWizard.java10
3 files changed, 32 insertions, 38 deletions
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/internal/valgrind/ui/editor/SuppressionsContentAssistProcessor.java b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/internal/valgrind/ui/editor/SuppressionsContentAssistProcessor.java
index 4bd0a3c43f..1d7ec88643 100644
--- a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/internal/valgrind/ui/editor/SuppressionsContentAssistProcessor.java
+++ b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/internal/valgrind/ui/editor/SuppressionsContentAssistProcessor.java
@@ -78,10 +78,16 @@ public class SuppressionsContentAssistProcessor implements
private String completionWord(IDocument doc, int offset)
throws BadLocationException {
String word = null;
- for (int n = offset - 1; n >= 0 && word == null; n--) {
- char c = doc.getChar(n);
- if (!Character.isLetterOrDigit(c)) {
- word = doc.get(n + 1, offset - n - 1);
+ if (offset > 0) {
+ for (int n = offset - 1; n >= 0 && word == null; n--) {
+ char c = doc.getChar(n);
+ if (!Character.isLetterOrDigit(c)) {
+ word = doc.get(n + 1, offset - n - 1);
+ }
+ else if (n == 0) {
+ // beginning of file
+ word = doc.get(0, offset - n);
+ }
}
}
return word;
@@ -89,9 +95,6 @@ public class SuppressionsContentAssistProcessor implements
private String[] getCompletionStrings(String prefix, String toolName) {
List<String> words = new ArrayList<String>();
- if (prefix == null || SuppressionsElementScanner.MEMCHECK.startsWith(prefix)) {
- words.add(SuppressionsElementScanner.MEMCHECK + ":"); //$NON-NLS-1$
- }
// If the cursor is after "Memcheck:"
if (toolName != null && toolName.equals(SuppressionsElementScanner.MEMCHECK)) {
@@ -101,10 +104,15 @@ public class SuppressionsContentAssistProcessor implements
}
}
}
-
- for (String word : SuppressionsElementScanner.CONTEXTS) {
- if (prefix == null || word.startsWith(prefix)) {
- words.add(word + ":"); //$NON-NLS-1$
+ else {
+ if (prefix == null || SuppressionsElementScanner.MEMCHECK.startsWith(prefix)) {
+ words.add(SuppressionsElementScanner.MEMCHECK + ":"); //$NON-NLS-1$
+ }
+
+ for (String word : SuppressionsElementScanner.CONTEXTS) {
+ if (prefix == null || word.startsWith(prefix)) {
+ words.add(word + ":"); //$NON-NLS-1$
+ }
}
}
return words.toArray(new String[words.size()]);
@@ -112,13 +120,19 @@ public class SuppressionsContentAssistProcessor implements
private String getToolName(IDocument doc, int offset) throws BadLocationException {
String tool = null;
- char c = doc.getChar(--offset);
- // syntax is "toolName:suppressionKind"
- if (c == ':') {
- for (int n = offset - 1; n >= 0 && tool == null; n--) {
- c = doc.getChar(n);
- if (!Character.isLetter(c)) {
- tool = doc.get(n + 1, offset - n - 1);
+ if (offset > 0) {
+ char c = doc.getChar(--offset);
+ // syntax is "toolName:suppressionKind"
+ if (c == ':' && offset > 0) {
+ for (int n = offset - 1; n >= 0 && tool == null; n--) {
+ c = doc.getChar(n);
+ if (!Character.isLetter(c)) {
+ tool = doc.get(n + 1, offset - n - 1);
+ }
+ else if (n == 0) {
+ // Beginning of file
+ tool = doc.get(0, offset - n);
+ }
}
}
}
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/internal/valgrind/ui/editor/wizards/Messages.java b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/internal/valgrind/ui/editor/wizards/Messages.java
index 656512c05b..68f9e1eff4 100644
--- a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/internal/valgrind/ui/editor/wizards/Messages.java
+++ b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/internal/valgrind/ui/editor/wizards/Messages.java
@@ -1,13 +1,3 @@
-/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
- * 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:
- * Red Hat - initial API and implementation
- *******************************************************************************/
package org.eclipse.linuxtools.internal.valgrind.ui.editor.wizards;
import java.util.MissingResourceException;
diff --git a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/internal/valgrind/ui/editor/wizards/NewSuppressionWizard.java b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/internal/valgrind/ui/editor/wizards/NewSuppressionWizard.java
index bdedb65a45..162541a8a9 100644
--- a/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/internal/valgrind/ui/editor/wizards/NewSuppressionWizard.java
+++ b/valgrind/org.eclipse.linuxtools.valgrind.ui.editor/src/org/eclipse/linuxtools/internal/valgrind/ui/editor/wizards/NewSuppressionWizard.java
@@ -1,13 +1,3 @@
-/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
- * 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:
- * Red Hat - initial API and implementation
- *******************************************************************************/
package org.eclipse.linuxtools.internal.valgrind.ui.editor.wizards;
import java.io.ByteArrayInputStream;

Back to the top