mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
- fix for bug #66108 (C++ browser cannot show members of class)
- all types now visible in the types view (ie not just classes & structs) - runnables now use IProgressService.busyCursorWhile (prevents progress dialog from being displayed during short operations)
This commit is contained in:
parent
b16d7061a2
commit
a2e471d3f5
7 changed files with 49 additions and 47 deletions
6
core/org.eclipse.cdt.ui/browser/ChangeLog-browser
Normal file
6
core/org.eclipse.cdt.ui/browser/ChangeLog-browser
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
2004-06-21 Chris Wiebe
|
||||||
|
|
||||||
|
- fix for bug #66108 (C++ browser cannot show members of class)
|
||||||
|
- all types now visible in the types view (ie not just classes & structs)
|
||||||
|
- runnables now use IProgressService.busyCursorWhile (prevents progress
|
||||||
|
dialog from being displayed during short operations)
|
|
@ -57,8 +57,6 @@ import org.eclipse.jface.action.IStatusLineManager;
|
||||||
import org.eclipse.jface.action.IToolBarManager;
|
import org.eclipse.jface.action.IToolBarManager;
|
||||||
import org.eclipse.jface.action.MenuManager;
|
import org.eclipse.jface.action.MenuManager;
|
||||||
import org.eclipse.jface.dialogs.MessageDialog;
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
|
||||||
import org.eclipse.jface.operation.IRunnableContext;
|
|
||||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||||
import org.eclipse.jface.text.ITextSelection;
|
import org.eclipse.jface.text.ITextSelection;
|
||||||
import org.eclipse.jface.util.Assert;
|
import org.eclipse.jface.util.Assert;
|
||||||
|
@ -102,6 +100,7 @@ import org.eclipse.ui.PlatformUI;
|
||||||
import org.eclipse.ui.part.IShowInSource;
|
import org.eclipse.ui.part.IShowInSource;
|
||||||
import org.eclipse.ui.part.ShowInContext;
|
import org.eclipse.ui.part.ShowInContext;
|
||||||
import org.eclipse.ui.part.ViewPart;
|
import org.eclipse.ui.part.ViewPart;
|
||||||
|
import org.eclipse.ui.progress.IProgressService;
|
||||||
import org.eclipse.ui.texteditor.ITextEditor;
|
import org.eclipse.ui.texteditor.ITextEditor;
|
||||||
|
|
||||||
public abstract class CBrowsingPart extends ViewPart implements IMenuListener, ISelectionListener, IViewPartInputProvider {
|
public abstract class CBrowsingPart extends ViewPart implements IMenuListener, ISelectionListener, IViewPartInputProvider {
|
||||||
|
@ -759,7 +758,7 @@ public abstract class CBrowsingPart extends ViewPart implements IMenuListener, I
|
||||||
for (int j = 0; j < enclosedTypes.length; ++j) {
|
for (int j = 0; j < enclosedTypes.length; ++j) {
|
||||||
ITypeInfo enclosedType = enclosedTypes[j];
|
ITypeInfo enclosedType = enclosedTypes[j];
|
||||||
if (enclosedType.getResolvedReference() != null) {
|
if (enclosedType.getResolvedReference() != null) {
|
||||||
ICElement typeElem = enclosedType.getResolvedReference().getCElement();
|
ICElement typeElem = enclosedType.getCElement();
|
||||||
if (typeElem != null && (typeElem.equals(cElem) || (typeElem instanceof IParent && hasChild(typeElem, cElem)))) {
|
if (typeElem != null && (typeElem.equals(cElem) || (typeElem instanceof IParent && hasChild(typeElem, cElem)))) {
|
||||||
return namespaces[i];
|
return namespaces[i];
|
||||||
}
|
}
|
||||||
|
@ -820,10 +819,11 @@ public abstract class CBrowsingPart extends ViewPart implements IMenuListener, I
|
||||||
for (int j = 0; j < enclosedTypes.length; ++j) {
|
for (int j = 0; j < enclosedTypes.length; ++j) {
|
||||||
ITypeInfo enclosedType = enclosedTypes[j];
|
ITypeInfo enclosedType = enclosedTypes[j];
|
||||||
if (enclosedType.getResolvedReference() != null) {
|
if (enclosedType.getResolvedReference() != null) {
|
||||||
ICElement typeElem = enclosedType.getResolvedReference().getCElement();
|
ICElement typeElem = enclosedType.getCElement();
|
||||||
if (typeElem != null && typeElem.equals(cElem)) {
|
if (typeElem != null && (typeElem.equals(cElem) || (typeElem instanceof IParent && hasChild(typeElem, cElem)))) {
|
||||||
return enclosedType;
|
return enclosedType;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1221,9 +1221,9 @@ public abstract class CBrowsingPart extends ViewPart implements IMenuListener, I
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
IRunnableContext runnableContext = new ProgressMonitorDialog(getShell());
|
IProgressService service = PlatformUI.getWorkbench().getProgressService();
|
||||||
try {
|
try {
|
||||||
runnableContext.run(true, true, runnable);
|
service.busyCursorWhile(runnable);
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
String title = OpenTypeMessages.getString("OpenTypeAction.exception.title"); //$NON-NLS-1$
|
String title = OpenTypeMessages.getString("OpenTypeAction.exception.title"); //$NON-NLS-1$
|
||||||
String message = OpenTypeMessages.getString("OpenTypeAction.exception.message"); //$NON-NLS-1$
|
String message = OpenTypeMessages.getString("OpenTypeAction.exception.message"); //$NON-NLS-1$
|
||||||
|
@ -1250,13 +1250,13 @@ public abstract class CBrowsingPart extends ViewPart implements IMenuListener, I
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean openInEditor(ITypeReference location) {
|
private boolean openInEditor(ITypeReference location) {
|
||||||
ICElement cElement = location.getCElement();
|
ITranslationUnit unit = location.getTranslationUnit();
|
||||||
IEditorPart editorPart = null;
|
IEditorPart editorPart = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (cElement != null)
|
if (unit != null)
|
||||||
editorPart = EditorUtility.openInEditor(cElement);
|
editorPart = EditorUtility.openInEditor(unit);
|
||||||
if (editorPart == null) {
|
if (editorPart == null) {
|
||||||
// open as external file
|
// open as external file
|
||||||
IPath path = location.getLocation();
|
IPath path = location.getLocation();
|
||||||
|
@ -1265,8 +1265,13 @@ public abstract class CBrowsingPart extends ViewPart implements IMenuListener, I
|
||||||
editorPart = EditorUtility.openInEditor(storage);
|
editorPart = EditorUtility.openInEditor(storage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (editorPart == null)
|
|
||||||
return false;
|
// highlight the type in the editor
|
||||||
|
if (editorPart != null && editorPart instanceof ITextEditor) {
|
||||||
|
ITextEditor editor = (ITextEditor) editorPart;
|
||||||
|
editor.selectAndReveal(location.getOffset(), location.getLength());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
} catch (CModelException ex) {
|
} catch (CModelException ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
return false;
|
return false;
|
||||||
|
@ -1275,16 +1280,6 @@ public abstract class CBrowsingPart extends ViewPart implements IMenuListener, I
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// highlight the type in the editor
|
|
||||||
if (cElement != null && editorPart instanceof CEditor) {
|
|
||||||
CEditor editor = (CEditor) editorPart;
|
|
||||||
editor.setSelection(cElement);
|
|
||||||
return true;
|
|
||||||
} else if (editorPart instanceof ITextEditor) {
|
|
||||||
ITextEditor editor = (ITextEditor) editorPart;
|
|
||||||
editor.selectAndReveal(location.getOffset(), location.getLength());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ public class MembersView extends CBrowsingPart implements IPropertyChangeListene
|
||||||
protected boolean isValidInput(Object element) {
|
protected boolean isValidInput(Object element) {
|
||||||
if (element instanceof ITypeInfo) {
|
if (element instanceof ITypeInfo) {
|
||||||
ITypeInfo type= (ITypeInfo)element;
|
ITypeInfo type= (ITypeInfo)element;
|
||||||
if (type.getCElementType() == ICElement.C_NAMESPACE && exists(type))
|
if (type.getCElementType() != ICElement.C_NAMESPACE && exists(type))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -24,12 +24,12 @@ import org.eclipse.cdt.internal.ui.util.ExceptionHandler;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.jface.dialogs.MessageDialog;
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
|
||||||
import org.eclipse.jface.operation.IRunnableContext;
|
|
||||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||||
import org.eclipse.jface.util.Assert;
|
import org.eclipse.jface.util.Assert;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
import org.eclipse.ui.progress.IProgressService;
|
||||||
|
|
||||||
class MembersViewContentProvider extends CBrowsingContentProvider {
|
class MembersViewContentProvider extends CBrowsingContentProvider {
|
||||||
|
|
||||||
|
@ -166,9 +166,9 @@ class MembersViewContentProvider extends CBrowsingContentProvider {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
IRunnableContext runnableContext = new ProgressMonitorDialog(getShell());
|
IProgressService service = PlatformUI.getWorkbench().getProgressService();
|
||||||
try {
|
try {
|
||||||
runnableContext.run(true, true, runnable);
|
service.busyCursorWhile(runnable);
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
String title = OpenTypeMessages.getString("OpenTypeAction.exception.title"); //$NON-NLS-1$
|
String title = OpenTypeMessages.getString("OpenTypeAction.exception.title"); //$NON-NLS-1$
|
||||||
String message = OpenTypeMessages.getString("OpenTypeAction.exception.message"); //$NON-NLS-1$
|
String message = OpenTypeMessages.getString("OpenTypeAction.exception.message"); //$NON-NLS-1$
|
||||||
|
@ -184,7 +184,7 @@ class MembersViewContentProvider extends CBrowsingContentProvider {
|
||||||
|
|
||||||
ICElement elem = null;
|
ICElement elem = null;
|
||||||
if (location != null)
|
if (location != null)
|
||||||
elem = location.getCElement();
|
elem = info.getCElement();
|
||||||
|
|
||||||
if (elem == null) {
|
if (elem == null) {
|
||||||
// could not resolve location
|
// could not resolve location
|
||||||
|
|
|
@ -24,12 +24,12 @@ import org.eclipse.cdt.internal.ui.browser.opentype.OpenTypeMessages;
|
||||||
import org.eclipse.cdt.internal.ui.util.ExceptionHandler;
|
import org.eclipse.cdt.internal.ui.util.ExceptionHandler;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
|
||||||
import org.eclipse.jface.operation.IRunnableContext;
|
|
||||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||||
import org.eclipse.jface.util.Assert;
|
import org.eclipse.jface.util.Assert;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
import org.eclipse.ui.progress.IProgressService;
|
||||||
|
|
||||||
class NamespacesViewContentProvider extends CBrowsingContentProvider {
|
class NamespacesViewContentProvider extends CBrowsingContentProvider {
|
||||||
|
|
||||||
|
@ -165,9 +165,9 @@ class NamespacesViewContentProvider extends CBrowsingContentProvider {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
IRunnableContext runnableContext = new ProgressMonitorDialog(getShell());
|
IProgressService service = PlatformUI.getWorkbench().getProgressService();
|
||||||
try {
|
try {
|
||||||
runnableContext.run(true, true, runnable);
|
service.busyCursorWhile(runnable);
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
String title = OpenTypeMessages.getString("OpenTypeAction.exception.title"); //$NON-NLS-1$
|
String title = OpenTypeMessages.getString("OpenTypeAction.exception.title"); //$NON-NLS-1$
|
||||||
String message = OpenTypeMessages.getString("OpenTypeAction.exception.message"); //$NON-NLS-1$
|
String message = OpenTypeMessages.getString("OpenTypeAction.exception.message"); //$NON-NLS-1$
|
||||||
|
|
|
@ -77,9 +77,10 @@ class TypesViewContentProvider extends CBrowsingContentProvider {
|
||||||
|
|
||||||
if (element instanceof ITypeInfo) {
|
if (element instanceof ITypeInfo) {
|
||||||
ITypeInfo info = (ITypeInfo)element;
|
ITypeInfo info = (ITypeInfo)element;
|
||||||
final int kinds[] = { ICElement.C_CLASS, ICElement.C_STRUCT };
|
final int kinds[] = { ICElement.C_CLASS, ICElement.C_STRUCT,
|
||||||
// ICElement.C_UNION, ICElement.C_ENUMERATION,
|
ICElement.C_UNION, ICElement.C_ENUMERATION,
|
||||||
// ICElement.C_TYPEDEF};
|
ICElement.C_TYPEDEF};
|
||||||
|
//TODO this should be a prefs option
|
||||||
return info.getEnclosedTypes(kinds);
|
return info.getEnclosedTypes(kinds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ import org.eclipse.cdt.core.browser.ITypeReference;
|
||||||
import org.eclipse.cdt.core.browser.ITypeSearchScope;
|
import org.eclipse.cdt.core.browser.ITypeSearchScope;
|
||||||
import org.eclipse.cdt.core.browser.TypeSearchScope;
|
import org.eclipse.cdt.core.browser.TypeSearchScope;
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
import org.eclipse.cdt.core.model.CModelException;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.core.resources.FileStorage;
|
import org.eclipse.cdt.core.resources.FileStorage;
|
||||||
import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
||||||
import org.eclipse.cdt.internal.ui.util.ExceptionHandler;
|
import org.eclipse.cdt.internal.ui.util.ExceptionHandler;
|
||||||
|
@ -28,8 +28,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.jface.action.IAction;
|
import org.eclipse.jface.action.IAction;
|
||||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||||
import org.eclipse.jface.dialogs.MessageDialog;
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
|
||||||
import org.eclipse.jface.operation.IRunnableContext;
|
|
||||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
@ -37,6 +35,8 @@ import org.eclipse.ui.IEditorPart;
|
||||||
import org.eclipse.ui.IWorkbenchWindow;
|
import org.eclipse.ui.IWorkbenchWindow;
|
||||||
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
|
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
|
||||||
import org.eclipse.ui.PartInitException;
|
import org.eclipse.ui.PartInitException;
|
||||||
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
import org.eclipse.ui.progress.IProgressService;
|
||||||
import org.eclipse.ui.texteditor.ITextEditor;
|
import org.eclipse.ui.texteditor.ITextEditor;
|
||||||
|
|
||||||
public class OpenTypeAction implements IWorkbenchWindowActionDelegate {
|
public class OpenTypeAction implements IWorkbenchWindowActionDelegate {
|
||||||
|
@ -62,9 +62,9 @@ public class OpenTypeAction implements IWorkbenchWindowActionDelegate {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
IRunnableContext runnableContext = new ProgressMonitorDialog(getShell());
|
IProgressService service = PlatformUI.getWorkbench().getProgressService();
|
||||||
try {
|
try {
|
||||||
runnableContext.run(true, true, runnable);
|
service.busyCursorWhile(runnable);
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
String title = OpenTypeMessages.getString("OpenTypeAction.exception.title"); //$NON-NLS-1$
|
String title = OpenTypeMessages.getString("OpenTypeAction.exception.title"); //$NON-NLS-1$
|
||||||
String message = OpenTypeMessages.getString("OpenTypeAction.exception.message"); //$NON-NLS-1$
|
String message = OpenTypeMessages.getString("OpenTypeAction.exception.message"); //$NON-NLS-1$
|
||||||
|
@ -106,9 +106,9 @@ public class OpenTypeAction implements IWorkbenchWindowActionDelegate {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
IRunnableContext runnableContext = new ProgressMonitorDialog(getShell());
|
IProgressService service = PlatformUI.getWorkbench().getProgressService();
|
||||||
try {
|
try {
|
||||||
runnableContext.run(true, true, runnable);
|
service.busyCursorWhile(runnable);
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
String title = OpenTypeMessages.getString("OpenTypeAction.exception.title"); //$NON-NLS-1$
|
String title = OpenTypeMessages.getString("OpenTypeAction.exception.title"); //$NON-NLS-1$
|
||||||
String message = OpenTypeMessages.getString("OpenTypeAction.exception.message"); //$NON-NLS-1$
|
String message = OpenTypeMessages.getString("OpenTypeAction.exception.message"); //$NON-NLS-1$
|
||||||
|
@ -146,12 +146,12 @@ public class OpenTypeAction implements IWorkbenchWindowActionDelegate {
|
||||||
* @return true if succesfully displayed.
|
* @return true if succesfully displayed.
|
||||||
*/
|
*/
|
||||||
private boolean openTypeInEditor(ITypeReference location) {
|
private boolean openTypeInEditor(ITypeReference location) {
|
||||||
ICElement cElement = location.getCElement();
|
ITranslationUnit unit = location.getTranslationUnit();
|
||||||
IEditorPart editorPart = null;
|
IEditorPart editorPart = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (cElement != null)
|
if (unit != null)
|
||||||
editorPart = EditorUtility.openInEditor(cElement);
|
editorPart = EditorUtility.openInEditor(unit);
|
||||||
if (editorPart == null) {
|
if (editorPart == null) {
|
||||||
// open as external file
|
// open as external file
|
||||||
IPath path = location.getLocation();
|
IPath path = location.getLocation();
|
||||||
|
|
Loading…
Add table
Reference in a new issue