mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
@Override annotations
This commit is contained in:
parent
032d94ff51
commit
c099f67da4
23 changed files with 361 additions and 283 deletions
|
@ -188,18 +188,21 @@ public class BaseCElementContentProvider implements ITreeContentProvider {
|
|||
/* (non-Cdoc)
|
||||
* Method declared on IContentProvider.
|
||||
*/
|
||||
@Override
|
||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||
}
|
||||
|
||||
/* (non-Cdoc)
|
||||
* Method declared on IContentProvider.
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
/* (non-Cdoc)
|
||||
* Method declared on IStructuredContentProvider.
|
||||
*/
|
||||
@Override
|
||||
public Object[] getElements(Object parent) {
|
||||
return getChildren(parent);
|
||||
}
|
||||
|
@ -207,6 +210,7 @@ public class BaseCElementContentProvider implements ITreeContentProvider {
|
|||
/* (non-Cdoc)
|
||||
* Method declared on ITreeContentProvider.
|
||||
*/
|
||||
@Override
|
||||
public Object[] getChildren(Object element) {
|
||||
if (!exists(element))
|
||||
return NO_CHILDREN;
|
||||
|
@ -263,6 +267,7 @@ public class BaseCElementContentProvider implements ITreeContentProvider {
|
|||
*
|
||||
* @see ITreeContentProvider
|
||||
*/
|
||||
@Override
|
||||
public boolean hasChildren(Object element) {
|
||||
if (fProvideMembers) {
|
||||
// assume TUs and binary files are never empty
|
||||
|
@ -315,6 +320,7 @@ public class BaseCElementContentProvider implements ITreeContentProvider {
|
|||
/* (non-Cdoc)
|
||||
* Method declared on ITreeContentProvider.
|
||||
*/
|
||||
@Override
|
||||
public Object getParent(Object element) {
|
||||
if (!exists(element)) {
|
||||
return null;
|
||||
|
|
|
@ -25,6 +25,7 @@ public class CActionFilter implements IActionFilter {
|
|||
public CActionFilter() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testAttribute(Object target, String name, String value) {
|
||||
ICElement element = (ICElement) target;
|
||||
IResource resource = element.getResource();
|
||||
|
|
|
@ -47,6 +47,7 @@ public class CElementAdapterFactory implements IAdapterFactory {
|
|||
/**
|
||||
* @see CElementAdapterFactory#getAdapterList
|
||||
*/
|
||||
@Override
|
||||
public Class<?>[] getAdapterList() {
|
||||
return PROPERTIES;
|
||||
}
|
||||
|
@ -54,6 +55,7 @@ public class CElementAdapterFactory implements IAdapterFactory {
|
|||
/**
|
||||
* @see CElementAdapterFactory#getAdapter
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public Object getAdapter(Object element, Class key) {
|
||||
ICElement celem = (ICElement) element;
|
||||
|
|
|
@ -11,13 +11,14 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.jface.viewers.IBasicPropertyConstants;
|
||||
import org.eclipse.ui.views.properties.IPropertyDescriptor;
|
||||
import org.eclipse.ui.views.properties.IPropertySource;
|
||||
import org.eclipse.ui.views.properties.PropertyDescriptor;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
public class CElementPropertySource implements IPropertySource {
|
||||
|
||||
private final static String LABEL= "CElementProperties.name"; //$NON-NLS-1$
|
||||
|
@ -43,6 +44,7 @@ public class CElementPropertySource implements IPropertySource {
|
|||
/**
|
||||
* @see IPropertySource#getPropertyDescriptors
|
||||
*/
|
||||
@Override
|
||||
public IPropertyDescriptor[] getPropertyDescriptors() {
|
||||
return fgPropertyDescriptors;
|
||||
}
|
||||
|
@ -50,6 +52,7 @@ public class CElementPropertySource implements IPropertySource {
|
|||
/**
|
||||
* @see IPropertySource#getPropertyValue
|
||||
*/
|
||||
@Override
|
||||
public Object getPropertyValue(Object name) {
|
||||
if (name.equals(IBasicPropertyConstants.P_TEXT)) {
|
||||
return fCElement.getElementName();
|
||||
|
@ -60,12 +63,14 @@ public class CElementPropertySource implements IPropertySource {
|
|||
/**
|
||||
* @see IPropertySource#setPropertyValue
|
||||
*/
|
||||
@Override
|
||||
public void setPropertyValue(Object name, Object value) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IPropertySource#getEditableValue
|
||||
*/
|
||||
@Override
|
||||
public Object getEditableValue() {
|
||||
return null;
|
||||
}
|
||||
|
@ -73,6 +78,7 @@ public class CElementPropertySource implements IPropertySource {
|
|||
/**
|
||||
* @see IPropertySource#isPropertySet
|
||||
*/
|
||||
@Override
|
||||
public boolean isPropertySet(Object property) {
|
||||
return false;
|
||||
}
|
||||
|
@ -80,6 +86,7 @@ public class CElementPropertySource implements IPropertySource {
|
|||
/**
|
||||
* @see IPropertySource#resetPropertyValue
|
||||
*/
|
||||
@Override
|
||||
public void resetPropertyValue(Object property) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.wizards.CWizardRegistry;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.search.ui.NewSearchUI;
|
||||
import org.eclipse.ui.IFolderLayout;
|
||||
import org.eclipse.ui.IPageLayout;
|
||||
|
@ -21,6 +19,10 @@ import org.eclipse.ui.IPerspectiveFactory;
|
|||
import org.eclipse.ui.console.IConsoleConstants;
|
||||
import org.eclipse.ui.navigator.resources.ProjectExplorer;
|
||||
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.wizards.CWizardRegistry;
|
||||
|
||||
public class CPerspectiveFactory implements IPerspectiveFactory {
|
||||
|
||||
/**
|
||||
|
@ -33,6 +35,7 @@ public class CPerspectiveFactory implements IPerspectiveFactory {
|
|||
/**
|
||||
* @see IPerspectiveFactory#createInitialLayout
|
||||
*/
|
||||
@Override
|
||||
public void createInitialLayout(IPageLayout layout) {
|
||||
String editorArea = layout.getEditorArea();
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ public class CProjectAdapterFactory implements IAdapterFactory {
|
|||
/*
|
||||
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Object getAdapter(Object adaptableObject, Class adapterType) {
|
||||
if (IProject.class.equals(adapterType)) {
|
||||
|
@ -39,6 +40,7 @@ public class CProjectAdapterFactory implements IAdapterFactory {
|
|||
/*
|
||||
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
|
||||
*/
|
||||
@Override
|
||||
public Class<?>[] getAdapterList() {
|
||||
return ADAPTERS;
|
||||
}
|
||||
|
|
|
@ -12,14 +12,16 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui;
|
||||
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.ui.model.IWorkbenchAdapter;
|
||||
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.IParent;
|
||||
import org.eclipse.cdt.internal.ui.viewsupport.CElementImageProvider;
|
||||
import org.eclipse.cdt.ui.CElementLabelProvider;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.ui.model.IWorkbenchAdapter;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.viewsupport.CElementImageProvider;
|
||||
|
||||
/**
|
||||
* An implementation of the IWorkbenchAdapter for CElements.
|
||||
|
@ -38,6 +40,7 @@ public class CWorkbenchAdapter implements IWorkbenchAdapter {
|
|||
/**
|
||||
* @see IWorkbenchAdapter#getChildren
|
||||
*/
|
||||
@Override
|
||||
public Object[] getChildren(Object o) {
|
||||
if (o instanceof IParent) {
|
||||
try {
|
||||
|
@ -55,6 +58,7 @@ public class CWorkbenchAdapter implements IWorkbenchAdapter {
|
|||
/**
|
||||
* @see IWorkbenchAdapter#getImageDescriptor
|
||||
*/
|
||||
@Override
|
||||
public ImageDescriptor getImageDescriptor(Object element) {
|
||||
if (element instanceof ICElement) {
|
||||
return fImageProvider.getCImageDescriptor(
|
||||
|
@ -67,6 +71,7 @@ public class CWorkbenchAdapter implements IWorkbenchAdapter {
|
|||
/**
|
||||
* @see IWorkbenchAdapter#getLabel
|
||||
*/
|
||||
@Override
|
||||
public String getLabel(Object o) {
|
||||
if (o instanceof ICElement) {
|
||||
return fLabelProvider.getText(o);
|
||||
|
@ -77,6 +82,7 @@ public class CWorkbenchAdapter implements IWorkbenchAdapter {
|
|||
/**
|
||||
* @see IWorkbenchAdapter#getParent
|
||||
*/
|
||||
@Override
|
||||
public Object getParent(Object o) {
|
||||
if (o instanceof ICElement) {
|
||||
return ((ICElement) o).getParent();
|
||||
|
|
|
@ -10,13 +10,14 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.IParent;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
||||
import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
|
||||
import org.eclipse.ui.progress.IElementCollector;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.IParent;
|
||||
|
||||
public class DeferredCWorkbenchAdapter extends CWorkbenchAdapter implements IDeferredWorkbenchAdapter {
|
||||
|
||||
private ICElement fCElement;
|
||||
|
@ -33,6 +34,7 @@ public class DeferredCWorkbenchAdapter extends CWorkbenchAdapter implements IDef
|
|||
* org.eclipse.jface.progress.IElementCollector,
|
||||
* org.eclipse.core.runtime.IProgressMonitor)
|
||||
*/
|
||||
@Override
|
||||
public void fetchDeferredChildren(Object object, IElementCollector collector, IProgressMonitor monitor) {
|
||||
Object[] children = getChildren(object);
|
||||
if (monitor.isCanceled()) {
|
||||
|
@ -47,6 +49,7 @@ public class DeferredCWorkbenchAdapter extends CWorkbenchAdapter implements IDef
|
|||
*
|
||||
* @see org.eclipse.ui.progress.IDeferredWorkbenchAdapter#isContainer()
|
||||
*/
|
||||
@Override
|
||||
public boolean isContainer() {
|
||||
return fCElement instanceof IParent;
|
||||
}
|
||||
|
@ -56,6 +59,7 @@ public class DeferredCWorkbenchAdapter extends CWorkbenchAdapter implements IDef
|
|||
*
|
||||
* @see org.eclipse.ui.progress.IDeferredWorkbenchAdapter#getRule(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public ISchedulingRule getRule(final Object object) {
|
||||
return fCElement.getResource();
|
||||
}
|
||||
|
|
|
@ -232,6 +232,7 @@ public class LineBackgroundPainter implements IPainter, LineBackgroundListener {
|
|||
/*
|
||||
* @see org.eclipse.jface.text.IPainter#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
// no deactivate!
|
||||
fIsActive= false;
|
||||
|
@ -256,6 +257,7 @@ public class LineBackgroundPainter implements IPainter, LineBackgroundListener {
|
|||
/*
|
||||
* @see org.eclipse.jface.text.IPainter#paint(int)
|
||||
*/
|
||||
@Override
|
||||
public void paint(int reason) {
|
||||
IDocument document= fTextViewer.getDocument();
|
||||
if (document == null) {
|
||||
|
@ -429,6 +431,7 @@ public class LineBackgroundPainter implements IPainter, LineBackgroundListener {
|
|||
/*
|
||||
* @see org.eclipse.jface.text.IPainter#deactivate(boolean)
|
||||
*/
|
||||
@Override
|
||||
public void deactivate(boolean redraw) {
|
||||
if (fIsActive) {
|
||||
fIsActive= false;
|
||||
|
@ -443,6 +446,7 @@ public class LineBackgroundPainter implements IPainter, LineBackgroundListener {
|
|||
/*
|
||||
* @see org.eclipse.jface.text.IPainter#setPositionManager(org.eclipse.jface.text.IPaintPositionManager)
|
||||
*/
|
||||
@Override
|
||||
public void setPositionManager(IPaintPositionManager manager) {
|
||||
fPositionManager= manager;
|
||||
}
|
||||
|
@ -485,6 +489,7 @@ public class LineBackgroundPainter implements IPainter, LineBackgroundListener {
|
|||
/*
|
||||
* @see org.eclipse.swt.custom.LineBackgroundListener#lineGetBackground(org.eclipse.swt.custom.LineBackgroundEvent)
|
||||
*/
|
||||
@Override
|
||||
public void lineGetBackground(LineBackgroundEvent event) {
|
||||
if (fTextWidget != null) {
|
||||
Position match= findIncludingPosition(getDocumentOffset(event.lineOffset));
|
||||
|
|
|
@ -66,7 +66,8 @@ public class PersistableCElementFactory implements IElementFactory, IPersistable
|
|||
/**
|
||||
* @see IElementFactory
|
||||
*/
|
||||
public IAdaptable createElement(IMemento memento) {
|
||||
@Override
|
||||
public IAdaptable createElement(IMemento memento) {
|
||||
// Get the file name.
|
||||
String fileName = memento.getString(TAG_PATH);
|
||||
if (fileName == null) {
|
||||
|
@ -114,14 +115,16 @@ public class PersistableCElementFactory implements IElementFactory, IPersistable
|
|||
/**
|
||||
* @see IPersistableElement
|
||||
*/
|
||||
public String getFactoryId() {
|
||||
@Override
|
||||
public String getFactoryId() {
|
||||
return FACTORY_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IPersistableElement
|
||||
*/
|
||||
public void saveState(IMemento memento) {
|
||||
@Override
|
||||
public void saveState(IMemento memento) {
|
||||
if (fCElement.getResource() != null) {
|
||||
memento.putString(TAG_PATH, fCElement.getResource().getFullPath().toString());
|
||||
memento.putInteger(TAG_TYPE, fCElement.getResource().getType());
|
||||
|
|
|
@ -33,6 +33,7 @@ public class ResourceAdapterFactory implements IAdapterFactory {
|
|||
/**
|
||||
* @see IAdapterFactory#getAdapterList
|
||||
*/
|
||||
@Override
|
||||
public Class<?>[] getAdapterList() {
|
||||
return PROPERTIES;
|
||||
}
|
||||
|
@ -40,6 +41,7 @@ public class ResourceAdapterFactory implements IAdapterFactory {
|
|||
/**
|
||||
* @see IAdapterFactory#getAdapter
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Object getAdapter(Object element, Class key) {
|
||||
if (ICElement.class.equals(key)) {
|
||||
|
|
|
@ -35,9 +35,11 @@ public abstract class AbstractUpdateIndexAction implements IObjectActionDelegate
|
|||
|
||||
private ISelection fSelection;
|
||||
|
||||
@Override
|
||||
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(IAction action) {
|
||||
if (!(fSelection instanceof IStructuredSelection))
|
||||
return;
|
||||
|
@ -71,6 +73,7 @@ public abstract class AbstractUpdateIndexAction implements IObjectActionDelegate
|
|||
/**
|
||||
* @see IActionDelegate#selectionChanged(IAction, ISelection)
|
||||
*/
|
||||
@Override
|
||||
public void selectionChanged(IAction action, ISelection selection) {
|
||||
fSelection = selection;
|
||||
}
|
||||
|
|
|
@ -11,20 +11,17 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.actions;
|
||||
|
||||
import org.eclipse.swt.custom.StyledText;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.core.commands.IHandler;
|
||||
|
||||
import org.eclipse.jface.text.IRegion;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
import org.eclipse.jface.text.ITextViewerExtension5;
|
||||
import org.eclipse.jface.text.Region;
|
||||
import org.eclipse.jface.text.source.ISourceViewer;
|
||||
|
||||
import org.eclipse.swt.custom.StyledText;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.ui.actions.QuickMenuCreator;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.editor.CEditor;
|
||||
|
@ -99,6 +96,7 @@ public abstract class CDTQuickMenuCreator extends QuickMenuCreator {
|
|||
*/
|
||||
public IHandler createHandler() {
|
||||
return new AbstractHandler() {
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
createMenu();
|
||||
return null;
|
||||
|
|
|
@ -117,6 +117,7 @@ public class CreateParserLogAction implements IObjectActionDelegate {
|
|||
}
|
||||
|
||||
private static final Comparator<String> COMP_INSENSITIVE= new Comparator<String> () {
|
||||
@Override
|
||||
public int compare(String o1, String o2) {
|
||||
return o1.toUpperCase().compareTo(o2.toUpperCase());
|
||||
}
|
||||
|
@ -127,14 +128,17 @@ public class CreateParserLogAction implements IObjectActionDelegate {
|
|||
|
||||
private boolean fWroteUnresolvedTitle;
|
||||
|
||||
@Override
|
||||
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
|
||||
fSite= targetPart.getSite();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectionChanged(IAction action, ISelection selection) {
|
||||
fSelection = selection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(IAction action) {
|
||||
if (!(fSelection instanceof IStructuredSelection))
|
||||
return;
|
||||
|
@ -205,6 +209,7 @@ public class CreateParserLogAction implements IObjectActionDelegate {
|
|||
CUIPlugin.log(e);
|
||||
}
|
||||
ASTProvider.getASTProvider().runOnAST(tu, ASTProvider.WAIT_IF_OPEN, pm, new ASTCache.ASTRunnable() {
|
||||
@Override
|
||||
public IStatus runOnAST(ILanguage lang, IASTTranslationUnit ast) throws CoreException {
|
||||
if (ast != null)
|
||||
return createLog(out, tu, lang, ast);
|
||||
|
|
|
@ -141,6 +141,7 @@ public class DeleteResConfigsHandler extends AbstractHandler {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
openDialog();
|
||||
return null;
|
||||
|
@ -198,6 +199,7 @@ public class DeleteResConfigsHandler extends AbstractHandler {
|
|||
|
||||
return new IStructuredContentProvider() {
|
||||
|
||||
@Override
|
||||
public Object[] getElements(Object inputElement) {
|
||||
if (outData != null) return outData.toArray();
|
||||
|
||||
|
@ -227,7 +229,9 @@ public class DeleteResConfigsHandler extends AbstractHandler {
|
|||
}
|
||||
return outData.toArray();
|
||||
}
|
||||
@Override
|
||||
public void dispose() {}
|
||||
@Override
|
||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -176,6 +176,7 @@ public class ExcludeFromBuildHandler extends AbstractHandler {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
openDialog();
|
||||
return null;
|
||||
|
@ -252,8 +253,11 @@ public class ExcludeFromBuildHandler extends AbstractHandler {
|
|||
|
||||
private IStructuredContentProvider createSelectionDialogContentProvider() {
|
||||
return new IStructuredContentProvider() {
|
||||
@Override
|
||||
public Object[] getElements(Object inputElement) { return cfgNames.toArray(); }
|
||||
@Override
|
||||
public void dispose() {}
|
||||
@Override
|
||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ public class FoldingActionGroup extends ActionGroup {
|
|||
super(bundle, prefix, IAction.AS_PUSH_BUTTON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
setEnabled(FoldingActionGroup.this.isEnabled() && fViewer.isProjectionMode());
|
||||
}
|
||||
|
@ -91,9 +92,11 @@ public class FoldingActionGroup extends ActionGroup {
|
|||
fViewer= (ProjectionViewer) viewer;
|
||||
|
||||
fProjectionListener= new IProjectionListener() {
|
||||
@Override
|
||||
public void projectionEnabled() {
|
||||
update();
|
||||
}
|
||||
@Override
|
||||
public void projectionDisabled() {
|
||||
update();
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ public class GotoNextBookmarkAction extends TextEditorAction {
|
|||
* Private class to handle comparison of markers using their line numbers.
|
||||
*/
|
||||
private class CompareMarker implements Comparator<IMarker> {
|
||||
@Override
|
||||
public int compare(IMarker m1, IMarker m2) {
|
||||
int l1 = MarkerUtilities.getLineNumber(m1);
|
||||
int l2 = MarkerUtilities.getLineNumber(m2);
|
||||
|
|
|
@ -117,6 +117,7 @@ public class IndentAction extends TextEditorAction {
|
|||
}
|
||||
|
||||
Runnable runnable= new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
IRewriteTarget target= (IRewriteTarget)getTextEditor().getAdapter(IRewriteTarget.class);
|
||||
if (target != null)
|
||||
|
|
|
@ -27,9 +27,11 @@ public class RebuildIndexAction implements IObjectActionDelegate {
|
|||
|
||||
private ISelection fSelection;
|
||||
|
||||
@Override
|
||||
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(IAction action) {
|
||||
IStructuredSelection cElements= SelectionConverter.convertSelectionToCElements(fSelection);
|
||||
for (Iterator<?> i = cElements.iterator(); i.hasNext();) {
|
||||
|
@ -43,6 +45,7 @@ public class RebuildIndexAction implements IObjectActionDelegate {
|
|||
/**
|
||||
* @see IActionDelegate#selectionChanged(IAction, ISelection)
|
||||
*/
|
||||
@Override
|
||||
public void selectionChanged(IAction action, ISelection selection) {
|
||||
fSelection= selection;
|
||||
}
|
||||
|
|
|
@ -15,10 +15,11 @@ import org.eclipse.jface.action.Action;
|
|||
import org.eclipse.jface.action.IMenuListener;
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
import org.eclipse.jface.action.MenuManager;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
import org.eclipse.ui.actions.ActionGroup;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.editor.CEditor;
|
||||
|
||||
public class SurroundWithActionGroup extends ActionGroup {
|
||||
|
@ -56,6 +57,7 @@ public class SurroundWithActionGroup extends ActionGroup {
|
|||
menu.appendToGroup(fGroup, subMenu);
|
||||
subMenu.add(new Action() {});
|
||||
subMenu.addMenuListener(new IMenuListener() {
|
||||
@Override
|
||||
public void menuAboutToShow(IMenuManager manager) {
|
||||
manager.removeAll();
|
||||
SurroundWithTemplateMenuAction.fillMenu(manager, fEditor);
|
||||
|
|
|
@ -15,24 +15,12 @@ import java.util.ArrayList;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.swt.events.MenuAdapter;
|
||||
import org.eclipse.swt.events.MenuEvent;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.swt.widgets.MenuItem;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.action.ActionContributionItem;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
import org.eclipse.jface.action.Separator;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||
|
||||
import org.eclipse.jface.text.DocumentEvent;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.jface.text.IEditingSupport;
|
||||
|
@ -44,7 +32,15 @@ import org.eclipse.jface.text.ITextViewer;
|
|||
import org.eclipse.jface.text.ITextViewerExtension;
|
||||
import org.eclipse.jface.text.contentassist.ICompletionProposal;
|
||||
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension2;
|
||||
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||
import org.eclipse.swt.events.MenuAdapter;
|
||||
import org.eclipse.swt.events.MenuEvent;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.swt.widgets.MenuItem;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.IPartListener;
|
||||
import org.eclipse.ui.IPartService;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
|
@ -55,6 +51,7 @@ import org.eclipse.ui.dialogs.PreferencesUtil;
|
|||
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.editor.CEditor;
|
||||
import org.eclipse.cdt.internal.ui.text.contentassist.CContentAssistInvocationContext;
|
||||
import org.eclipse.cdt.internal.ui.text.contentassist.TemplateCompletionProposalComputer;
|
||||
|
@ -103,19 +100,24 @@ public class SurroundWithTemplateMenuAction implements IWorkbenchWindowPulldownD
|
|||
private IPartService fPartService;
|
||||
private IPartListener fPartListener= new IPartListener() {
|
||||
|
||||
@Override
|
||||
public void partActivated(IWorkbenchPart part) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void partBroughtToTop(IWorkbenchPart part) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void partClosed(IWorkbenchPart part) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void partDeactivated(IWorkbenchPart part) {
|
||||
disposeMenuItems();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void partOpened(IWorkbenchPart part) {
|
||||
}
|
||||
};
|
||||
|
@ -136,6 +138,7 @@ public class SurroundWithTemplateMenuAction implements IWorkbenchWindowPulldownD
|
|||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Menu getMenu(Menu parent) {
|
||||
setMenu(new Menu(parent));
|
||||
fillMenu(fMenu);
|
||||
|
@ -146,6 +149,7 @@ public class SurroundWithTemplateMenuAction implements IWorkbenchWindowPulldownD
|
|||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Menu getMenu(Control parent) {
|
||||
setMenu(new Menu(parent));
|
||||
fillMenu(fMenu);
|
||||
|
@ -170,6 +174,7 @@ public class SurroundWithTemplateMenuAction implements IWorkbenchWindowPulldownD
|
|||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (fPartService != null) {
|
||||
fPartService.removePartListener(fPartListener);
|
||||
|
@ -181,6 +186,7 @@ public class SurroundWithTemplateMenuAction implements IWorkbenchWindowPulldownD
|
|||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void init(IWorkbenchWindow window) {
|
||||
if (fPartService != null) {
|
||||
fPartService.removePartListener(fPartListener);
|
||||
|
@ -199,6 +205,7 @@ public class SurroundWithTemplateMenuAction implements IWorkbenchWindowPulldownD
|
|||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void run(IAction action) {
|
||||
IWorkbenchPart activePart= CUIPlugin.getActivePage().getActivePart();
|
||||
if (!(activePart instanceof CEditor))
|
||||
|
@ -217,6 +224,7 @@ public class SurroundWithTemplateMenuAction implements IWorkbenchWindowPulldownD
|
|||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void selectionChanged(IAction action, ISelection selection) {
|
||||
// Default do nothing
|
||||
}
|
||||
|
@ -344,10 +352,12 @@ public class SurroundWithTemplateMenuAction implements IWorkbenchWindowPulldownD
|
|||
IEditingSupportRegistry registry= null;
|
||||
IEditingSupport helper= new IEditingSupport() {
|
||||
|
||||
@Override
|
||||
public boolean isOriginator(DocumentEvent event, IRegion focus) {
|
||||
return focus.getOffset() <= offset && focus.getOffset() + focus.getLength() >= offset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ownsFocusShell() {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -12,8 +12,6 @@ package org.eclipse.cdt.internal.ui.actions;
|
|||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.internal.ui.CUIStatus;
|
||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
@ -23,10 +21,13 @@ import org.eclipse.core.runtime.OperationCanceledException;
|
|||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
|
||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||
import org.eclipse.jface.operation.IThreadListener;
|
||||
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.CUIStatus;
|
||||
|
||||
/**
|
||||
* An <code>IRunnableWithProgress</code> that adapts and <code>IWorkspaceRunnable</code>
|
||||
* so that is can be executed inside <code>IRunnableContext</code>. <code>OperationCanceledException</code>
|
||||
|
@ -71,6 +72,7 @@ public class WorkbenchRunnableAdapter implements IRunnableWithProgress, IThreadL
|
|||
return fRule;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void threadChange(Thread thread) {
|
||||
if (fTransfer)
|
||||
Job.getJobManager().transferRule(fRule, thread);
|
||||
|
@ -79,6 +81,7 @@ public class WorkbenchRunnableAdapter implements IRunnableWithProgress, IThreadL
|
|||
/*
|
||||
* @see IRunnableWithProgress#run(IProgressMonitor)
|
||||
*/
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||
try {
|
||||
CoreModel.run(fWorkspaceRunnable, fRule, monitor);
|
||||
|
|
Loading…
Add table
Reference in a new issue