Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 97228 | Differences between
and this patch

Collapse All | Expand All

(-)ui/org/eclipse/jdt/internal/ui/javaeditor/NLSKeyHyperlink.java 6 May 2008 09:43:45 -0000 1.23 (+14 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.ui.javaeditor;
11
package org.eclipse.jdt.internal.ui.javaeditor;
12
12
13
import java.util.regex.Pattern;
14
13
import org.eclipse.core.runtime.Assert;
15
import org.eclipse.core.runtime.Assert;
14
16
15
import org.eclipse.core.resources.IStorage;
17
import org.eclipse.core.resources.IStorage;
Lines 21-26 Link Here
21
import org.eclipse.jface.text.FindReplaceDocumentAdapter;
23
import org.eclipse.jface.text.FindReplaceDocumentAdapter;
22
import org.eclipse.jface.text.IDocument;
24
import org.eclipse.jface.text.IDocument;
23
import org.eclipse.jface.text.IDocumentExtension3;
25
import org.eclipse.jface.text.IDocumentExtension3;
26
import org.eclipse.jface.text.IFindReplaceTarget;
27
import org.eclipse.jface.text.IFindReplaceTargetExtension3;
24
import org.eclipse.jface.text.IRegion;
28
import org.eclipse.jface.text.IRegion;
25
import org.eclipse.jface.text.ITypedRegion;
29
import org.eclipse.jface.text.ITypedRegion;
26
import org.eclipse.jface.text.hyperlink.IHyperlink;
30
import org.eclipse.jface.text.hyperlink.IHyperlink;
Lines 163-168 Link Here
163
    showErrorInStatusLine(editor, Messages.format(JavaEditorMessages.Editor_OpenPropertiesFile_error_keyNotFound, fKeyName));
167
    showErrorInStatusLine(editor, Messages.format(JavaEditorMessages.Editor_OpenPropertiesFile_error_keyNotFound, fKeyName));
164
   }
168
   }
165
  }
169
  }
170
  else {
171
   // for non-text editors, use IFindReplaceTargetExtension3, if present
172
   // search for a line beginning with <keyName>\s*=
173
   IFindReplaceTarget findReplace= (IFindReplaceTarget) editor.getAdapter(IFindReplaceTarget.class);
174
   if (findReplace instanceof IFindReplaceTargetExtension3) {
175
    String search= "^\\s*" + Pattern.quote(PropertyFileDocumentModel.unwindEscapeChars(fKeyName)) + "\\s*="; //$NON-NLS-1$ //$NON-NLS-2$
176
    IFindReplaceTargetExtension3 findReplaceExt= (IFindReplaceTargetExtension3) findReplace;
177
    findReplaceExt.findAndSelect(0, search, true, true, false, true);
178
   }
179
  }
166
 }
180
 }
167
181
168
 private void showErrorInStatusLine(IEditorPart editor, final String message) {
182
 private void showErrorInStatusLine(IEditorPart editor, final String message) {

Return to bug 97228