mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fall back on the Nature of the project
to decide of the syntax of the CEditor. * src/org/eclipse/cdt/internal/ui/editor/CEditor.java NPE in the CSourceHover. * src/org/eclipse/cdt/internal/ui/text/c/hover/CSourceHover.java
This commit is contained in:
parent
ed6d4cbdbb
commit
2beb6089ea
3 changed files with 25 additions and 1 deletions
|
@ -1,3 +1,14 @@
|
|||
2004-06-01 Alain Magloire
|
||||
|
||||
Fall back on the Nature of the project
|
||||
to decide of the syntax of the CEditor.
|
||||
|
||||
* src/org/eclipse/cdt/internal/ui/editor/CEditor.java
|
||||
|
||||
NPE in the CSourceHover.
|
||||
|
||||
* src/org/eclipse/cdt/internal/ui/text/c/hover/CSourceHover.java
|
||||
|
||||
2004-05-31 Alain Magloire
|
||||
|
||||
Putting a good chunk of code(Taken from JDT)
|
||||
|
|
|
@ -13,6 +13,7 @@ import java.util.StringTokenizer;
|
|||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.filetype.ICFileType;
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ISourceRange;
|
||||
import org.eclipse.cdt.core.model.ISourceReference;
|
||||
|
@ -31,6 +32,7 @@ import org.eclipse.cdt.ui.actions.RefactoringActionGroup;
|
|||
import org.eclipse.cdt.ui.actions.ShowInCViewAction;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.Preferences;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
|
@ -902,7 +904,15 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
|||
// Figure out if this is a C or C++ source file
|
||||
IWorkingCopyManager mgr = CUIPlugin.getDefault().getWorkingCopyManager();
|
||||
ITranslationUnit unit = mgr.getWorkingCopy(getEditorInput());
|
||||
String fileType = (unit != null && unit.isCXXLanguage()) ? LANGUAGE_CPP : LANGUAGE_C;
|
||||
String fileType = LANGUAGE_CPP;
|
||||
if (unit != null) {
|
||||
// default is C++ unless the project as C Nature Only
|
||||
// we can then be smarter.
|
||||
IProject p = unit.getCProject().getProject();
|
||||
if (!CoreModel.hasCCNature(p)) {
|
||||
fileType = unit.isCXXLanguage() ? LANGUAGE_CPP : LANGUAGE_C;
|
||||
}
|
||||
}
|
||||
|
||||
fAnnotationAccess = createAnnotationAccess();
|
||||
|
||||
|
|
|
@ -51,6 +51,9 @@ public class CSourceHover extends AbstractCEditorTextHover {
|
|||
IEditorInput input= editor.getEditorInput();
|
||||
IWorkingCopyManager manager= CUIPlugin.getDefault().getWorkingCopyManager();
|
||||
IWorkingCopy copy = manager.getWorkingCopy(input);
|
||||
if (copy == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String expression;
|
||||
try {
|
||||
|
|
Loading…
Add table
Reference in a new issue