Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHoda Amer2003-11-11 18:25:56 +0000
committerHoda Amer2003-11-11 18:25:56 +0000
commit757922dcc272f718c6a977c5f42fb0cb5bd7304b (patch)
tree4037a798a3b07ac94d8f0e4bca987083412a8630
parentd655eed87759e0592026e472dbb3b10b59e93746 (diff)
downloadorg.eclipse.cdt-757922dcc272f718c6a977c5f42fb0cb5bd7304b.tar.gz
org.eclipse.cdt-757922dcc272f718c6a977c5f42fb0cb5bd7304b.tar.xz
org.eclipse.cdt-757922dcc272f718c6a977c5f42fb0cb5bd7304b.zip
Patch for Bogdan
-rw-r--r--core/org.eclipse.cdt.core/dependency/ChangeLog122
-rw-r--r--core/org.eclipse.cdt.core/dependency/org/eclipse/cdt/internal/core/sourcedependency/UpdateDependency.java4
-rw-r--r--core/org.eclipse.cdt.ui/ChangeLog3
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OpenDeclarationsAction.java46
4 files changed, 114 insertions, 61 deletions
diff --git a/core/org.eclipse.cdt.core/dependency/ChangeLog b/core/org.eclipse.cdt.core/dependency/ChangeLog
index 5f4d18ef0c..fc524c19ee 100644
--- a/core/org.eclipse.cdt.core/dependency/ChangeLog
+++ b/core/org.eclipse.cdt.core/dependency/ChangeLog
@@ -1,60 +1,64 @@
-2003-10-23 Bogdan Gheorghe
- - Added UpdateDependency job
-
-2003-09-25 Bogdan Gheorghe
- - As a result of folding the dependency service into the indexer
- have removed the following files:
-
- * src/org/eclipse/cdt/internal/core/sourcedependency/AddFileToDependencyTree.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/DependencyManager.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/DependencyRequest.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/DependencyRequestor.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/DependencySelector.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/DependencyTree.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/EntireProjectDependencyTree.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/IDependencyTree.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/IPreprocessorOutput.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/ISourceDependency.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/PreprocessorOutput.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/RemoveFromDependencyTree.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/impl/IncludeEntry.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/impl/IncludeEntryHashedArray.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/impl/InMemoryTree.java
-
-
-
-2003-09-22 Bogdan Gheorghe
- - Took out enable section for DependencyManager
-
-2003-09-11 Bogdan Gheorghe
- - Added null guard to DependencyManager.getDependencyTree(),
- DependencyTree.getFileDependencies()
-
-2003-09-08 Andrew Niefer
- - Modified calls to ParserFactory to specify which language to use
- - Modified IDependencyTree.add to take ParserLanguage as a parameter so that it can
- be passed on when creating the preprocessor
-
-2003-07-23 Bogdan Gheorghe
-
- Added initial dependency implementation
-
- * src/org/eclipse/cdt/internal/core/sourcedependency/AddFileToDependencyTree.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/DependencyManager.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/DenpendencyQueryJob.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/DependencyRequest.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/DependencyRequestor.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/DependencyTree.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/EntireProjectDependencyTree.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/IDependencyTree.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/IPreprocessorOutput.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/ISourceDependency.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/PreprocessorOutput.java
-
- * src/org/eclipse/cdt/internal/core/sourcedependency/impl/IncludeEntry.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/impl/IncludeEntryHashedArray.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/impl/InMemoryTree.java
- * src/org/eclipse/cdt/internal/core/sourcedependency/impl/Node.java
-
--
+2003-11-10 Bogdan Gheorghe
+ - Added a null resource check in UpdateDependency to fix up
+ a potential NPE in the test suite
+
+2003-10-23 Bogdan Gheorghe
+ - Added UpdateDependency job
+
+2003-09-25 Bogdan Gheorghe
+ - As a result of folding the dependency service into the indexer
+ have removed the following files:
+
+ * src/org/eclipse/cdt/internal/core/sourcedependency/AddFileToDependencyTree.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/DependencyManager.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/DependencyRequest.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/DependencyRequestor.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/DependencySelector.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/DependencyTree.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/EntireProjectDependencyTree.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/IDependencyTree.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/IPreprocessorOutput.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/ISourceDependency.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/PreprocessorOutput.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/RemoveFromDependencyTree.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/impl/IncludeEntry.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/impl/IncludeEntryHashedArray.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/impl/InMemoryTree.java
+
+
+
+2003-09-22 Bogdan Gheorghe
+ - Took out enable section for DependencyManager
+
+2003-09-11 Bogdan Gheorghe
+ - Added null guard to DependencyManager.getDependencyTree(),
+ DependencyTree.getFileDependencies()
+
+2003-09-08 Andrew Niefer
+ - Modified calls to ParserFactory to specify which language to use
+ - Modified IDependencyTree.add to take ParserLanguage as a parameter so that it can
+ be passed on when creating the preprocessor
+
+2003-07-23 Bogdan Gheorghe
+
+ Added initial dependency implementation
+
+ * src/org/eclipse/cdt/internal/core/sourcedependency/AddFileToDependencyTree.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/DependencyManager.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/DenpendencyQueryJob.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/DependencyRequest.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/DependencyRequestor.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/DependencyTree.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/EntireProjectDependencyTree.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/IDependencyTree.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/IPreprocessorOutput.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/ISourceDependency.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/PreprocessorOutput.java
+
+ * src/org/eclipse/cdt/internal/core/sourcedependency/impl/IncludeEntry.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/impl/IncludeEntryHashedArray.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/impl/InMemoryTree.java
+ * src/org/eclipse/cdt/internal/core/sourcedependency/impl/Node.java
+
+-
\ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/dependency/org/eclipse/cdt/internal/core/sourcedependency/UpdateDependency.java b/core/org.eclipse.cdt.core/dependency/org/eclipse/cdt/internal/core/sourcedependency/UpdateDependency.java
index bfd02ab052..d3cc599589 100644
--- a/core/org.eclipse.cdt.core/dependency/org/eclipse/cdt/internal/core/sourcedependency/UpdateDependency.java
+++ b/core/org.eclipse.cdt.core/dependency/org/eclipse/cdt/internal/core/sourcedependency/UpdateDependency.java
@@ -58,7 +58,9 @@ public class UpdateDependency implements IJob {
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.search.processing.IJob#execute(org.eclipse.core.runtime.IProgressMonitor)
*/
- public boolean execute(IProgressMonitor progress) {
+ public boolean execute(IProgressMonitor progress) {
+ if (resource == null) return false;
+
PathCollector pathCollector = new PathCollector();
//SubProgressMonitor subMonitor = (progressMonitor == null ) ? null : new SubProgressMonitor( progressMonitor, 5 );
ICSearchScope scope = SearchEngine.createWorkspaceScope();
diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog
index 4242725922..62afe3f562 100644
--- a/core/org.eclipse.cdt.ui/ChangeLog
+++ b/core/org.eclipse.cdt.ui/ChangeLog
@@ -1,3 +1,6 @@
+2003-11-10 Bogdan Gheorghe
+ fix bug 45688: must highlight keyword to use "Open Declarations" or "Add Include"
+
2003-11-05 John Camelon
Updated parser clients to use new ParserFactory (stand-alone parser work item).
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OpenDeclarationsAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OpenDeclarationsAction.java
index 23b86f8922..8bf7f8a9d8 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OpenDeclarationsAction.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OpenDeclarationsAction.java
@@ -27,12 +27,14 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.texteditor.IDocumentProvider;
/**
* This action opens a java CEditor on the element represented by text selection of
@@ -105,6 +107,15 @@ public class OpenDeclarationsAction extends Action {
try {
ArrayList elementsFound = new ArrayList();
String sel = selection.getText();
+ if (sel.equals(""))
+ {
+ int selStart = selection.getOffset();
+
+ IDocumentProvider prov = fEditor.getDocumentProvider();
+ IDocument doc = prov.getDocument(fEditor.getEditorInput());
+ sel = getSelection(doc, selStart);
+ }
+
IFile file = fEditor.getInputFile();
if(file == null)
return;
@@ -202,6 +213,39 @@ public class OpenDeclarationsAction extends Action {
}
}
return null;
- }
+ }
+
+
+ public String getSelection(IDocument doc, int fPos){
+ int pos= fPos;
+ char c;
+ int fStartPos =0, fEndPos=0;
+ String selectedWord=null;
+
+ try{
+ while (pos >= 0) {
+ c= doc.getChar(pos);
+ if (!Character.isJavaIdentifierPart(c))
+ break;
+ --pos;
+ }
+ fStartPos= pos + 1;
+
+ pos= fPos;
+ int length= doc.getLength();
+ while (pos < length) {
+ c= doc.getChar(pos);
+ if (!Character.isJavaIdentifierPart(c))
+ break;
+ ++pos;
+ }
+ fEndPos= pos;
+ selectedWord = doc.get(fStartPos, (fEndPos - fStartPos));
+ }
+ catch(BadLocationException e){
+ }
+
+ return selectedWord;
+ }
}

Back to the top