mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
cleanup CEditor removed unused extension points
This commit is contained in:
parent
31188ddb10
commit
4ea7546869
5 changed files with 60 additions and 268 deletions
|
@ -34,20 +34,6 @@
|
|||
<!-- Extension point: org.eclipse.cdt.ui.textHovers -->
|
||||
<!-- =========================================================================== -->
|
||||
<extension-point id="textHovers" name="%textHoversName"/>
|
||||
<!-- =========================================================================== -->
|
||||
<!-- must implement org.eclipse.cdt.ui.ICEditorContextMenuAction -->
|
||||
<!-- Extension Implementation: -->
|
||||
<!-- Purpose: Provide an action for the CEditor's context menu -->
|
||||
<!-- Extension point: org.eclipse.cdt.ui.editorActions -->
|
||||
<!-- =========================================================================== -->
|
||||
<extension-point id="editorActions" name="%editorActionsName"/>
|
||||
<!-- =========================================================================== -->
|
||||
<!-- must implement org.eclipse.cdt.ui.ICEditorRulerAction -->
|
||||
<!-- Extension Implementation: -->
|
||||
<!-- Purpose: Provide an action for the CEditor's ruler -->
|
||||
<!-- Extension point: org.eclipse.cdt.ui.editorRulerActions -->
|
||||
<!-- =========================================================================== -->
|
||||
<extension-point id="editorRulerActions" name="%editorRulerActionsName"/>
|
||||
|
||||
<!-- Implement our filters for C-View. -->
|
||||
<extension
|
||||
|
@ -281,6 +267,20 @@
|
|||
</filter>
|
||||
</page>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.editorActions">
|
||||
<editorContribution
|
||||
targetID="org.eclipse.cdt.ui.editor.CEditor"
|
||||
id="org.eclipse.ui.texteditor.ruler.actions">
|
||||
<action
|
||||
label="%Dummy.label"
|
||||
helpContextId="org.eclipse.ui.bookmark_action_context"
|
||||
class="org.eclipse.ui.texteditor.BookmarkRulerAction"
|
||||
actionID="RulerDoubleClick"
|
||||
id="org.eclipse.ui.texteditor.BookmarkRulerAction">
|
||||
</action>
|
||||
</editorContribution>
|
||||
</extension>
|
||||
<!--
|
||||
<page
|
||||
objectClass="org.eclipse.core.resources.IFile"
|
||||
|
@ -353,6 +353,42 @@
|
|||
id="compareWithHistory">
|
||||
</action>
|
||||
</objectContribution>
|
||||
<objectContribution
|
||||
objectClass="org.eclipse.core.resources.IMarker"
|
||||
id="org.eclipse.cdt.ui.action.DeleteTaskAction">
|
||||
<filter
|
||||
name="type"
|
||||
value="org.eclipse.cdt.core.problem">
|
||||
</filter>
|
||||
<action
|
||||
label="%DeleteTaskAction.label"
|
||||
icon="icons/full/ovr16/error_co.gif"
|
||||
class="org.eclipse.cdt.internal.ui.util.DeleteTaskAction"
|
||||
menubarPath="additions"
|
||||
enablesFor="+"
|
||||
id="org.eclipse.cdt.ui.action.DeleteTaskAction">
|
||||
</action>
|
||||
</objectContribution>
|
||||
<viewerContribution
|
||||
targetID="#CRulerContext"
|
||||
id="org.eclipse.cdt.ui.editor.CEditorPopupActions">
|
||||
<action
|
||||
label="%AddTask.label"
|
||||
helpContextId="org.eclipse.ui.AddTask_action_context"
|
||||
tooltip="%AddTask.tooltip"
|
||||
class="org.eclipse.ui.texteditor.TaskRulerAction"
|
||||
menubarPath="add"
|
||||
id="org.eclipse.ui.texteditor.TaskRulerAction">
|
||||
</action>
|
||||
<action
|
||||
label="%AddBookmark.label"
|
||||
helpContextId="org.eclipse.ui.bookmark_action_context"
|
||||
tooltip="%AddBookmark.tooltip"
|
||||
class="org.eclipse.ui.texteditor.BookmarkRulerAction"
|
||||
menubarPath="add"
|
||||
id="org.eclipse.ui.texteditor.BookmarkRulerAction">
|
||||
</action>
|
||||
</viewerContribution>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.compare.structureCreators">
|
||||
|
@ -404,25 +440,6 @@
|
|||
id="org.eclipse.cdt.ui.MakeView">
|
||||
</view>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.popupMenus">
|
||||
<objectContribution
|
||||
objectClass="org.eclipse.core.resources.IMarker"
|
||||
id="org.eclipse.cdt.ui.action.DeleteTaskAction">
|
||||
<filter
|
||||
name="type"
|
||||
value="org.eclipse.cdt.core.problem">
|
||||
</filter>
|
||||
<action
|
||||
label="%DeleteTaskAction.label"
|
||||
icon="icons/full/ovr16/error_co.gif"
|
||||
class="org.eclipse.cdt.internal.ui.util.DeleteTaskAction"
|
||||
menubarPath="additions"
|
||||
enablesFor="+"
|
||||
id="org.eclipse.cdt.ui.action.DeleteTaskAction">
|
||||
</action>
|
||||
</objectContribution>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.projectNatureImages">
|
||||
<image
|
||||
|
@ -431,7 +448,6 @@
|
|||
id="org.eclipse.cdt.ui.cProjectNatureImage">
|
||||
</image>
|
||||
</extension>
|
||||
|
||||
<!-- =========================================================================== -->
|
||||
<!-- Debug Model Presentation -->
|
||||
<!-- =========================================================================== -->
|
||||
|
|
|
@ -7,36 +7,34 @@ package org.eclipse.cdt.internal.ui.editor;
|
|||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.ISourceRange;
|
||||
import org.eclipse.cdt.core.model.ISourceReference;
|
||||
import org.eclipse.cdt.internal.ui.CPlugin;
|
||||
import org.eclipse.cdt.internal.ui.IContextMenuConstants;
|
||||
import org.eclipse.cdt.internal.ui.text.CSourceViewerConfiguration;
|
||||
import org.eclipse.cdt.internal.ui.text.CTextTools;
|
||||
import org.eclipse.cdt.internal.ui.text.IColorManager;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.core.runtime.IExtension;
|
||||
import org.eclipse.core.runtime.IExtensionPoint;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IPluginRegistry;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
import org.eclipse.jface.action.IStatusLineManager;
|
||||
import org.eclipse.jface.action.MenuManager;
|
||||
import org.eclipse.jface.action.Separator;
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.jface.dialogs.ErrorDialog;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.preference.PreferenceConverter;
|
||||
import org.eclipse.jface.text.BadLocationException;
|
||||
import org.eclipse.jface.text.DocumentCommand;
|
||||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.jface.text.ITextOperationTarget;
|
||||
|
@ -61,12 +59,9 @@ import org.eclipse.jface.viewers.IStructuredSelection;
|
|||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.ST;
|
||||
import org.eclipse.swt.custom.StyledText;
|
||||
import org.eclipse.swt.custom.VerifyKeyListener;
|
||||
import org.eclipse.swt.events.KeyEvent;
|
||||
import org.eclipse.swt.events.KeyListener;
|
||||
import org.eclipse.swt.events.MouseEvent;
|
||||
import org.eclipse.swt.events.MouseListener;
|
||||
import org.eclipse.swt.events.VerifyEvent;
|
||||
import org.eclipse.swt.events.VerifyListener;
|
||||
|
@ -95,25 +90,12 @@ import org.eclipse.ui.part.EditorActionBarContributor;
|
|||
import org.eclipse.ui.part.FileEditorInput;
|
||||
import org.eclipse.ui.texteditor.AbstractTextEditor;
|
||||
import org.eclipse.ui.texteditor.DefaultRangeIndicator;
|
||||
import org.eclipse.ui.texteditor.IStatusField;
|
||||
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
|
||||
import org.eclipse.ui.texteditor.MarkerAnnotation;
|
||||
import org.eclipse.ui.texteditor.MarkerUtilities;
|
||||
import org.eclipse.ui.texteditor.TextOperationAction;
|
||||
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
|
||||
import org.eclipse.ui.views.tasklist.TaskList;
|
||||
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.ISourceRange;
|
||||
import org.eclipse.cdt.core.model.ISourceReference;
|
||||
import org.eclipse.cdt.internal.ui.CPlugin;
|
||||
import org.eclipse.cdt.internal.ui.IContextMenuConstants;
|
||||
import org.eclipse.cdt.internal.ui.text.CSourceViewerConfiguration;
|
||||
import org.eclipse.cdt.internal.ui.text.CTextTools;
|
||||
import org.eclipse.cdt.internal.ui.text.IColorManager;
|
||||
import org.eclipse.cdt.ui.ICDTConstants;
|
||||
import org.eclipse.cdt.ui.ICEditorContextMenuAction;
|
||||
import org.eclipse.cdt.ui.ICEditorRulerAction;
|
||||
/**
|
||||
* C specific text editor.
|
||||
*/
|
||||
|
@ -123,10 +105,6 @@ public class CEditor extends AbstractTextEditor implements ISelectionChangedList
|
|||
/** The outline page */
|
||||
protected CContentOutlinePage fOutlinePage;
|
||||
|
||||
private ICEditorContextMenuAction[] fEditorActions;
|
||||
// private HashMap fEditorActionPaths = new HashMap( 5 );
|
||||
private ICEditorRulerAction[] fRulerActions;
|
||||
private IAction fRulerSingleclickAction;
|
||||
private SearchForReferencesAction fSearchForReferencesAction;
|
||||
|
||||
/** Status bar fields -- @@@ gone with Eclipse 2.0 */
|
||||
|
@ -218,7 +196,6 @@ public class CEditor extends AbstractTextEditor implements ISelectionChangedList
|
|||
//setOutlinerContextMenuId("#CEditorOutlinerContext"); //$NON-NLS-1$
|
||||
|
||||
fCEditorErrorTickUpdater= new CEditorErrorTickUpdater(this);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -649,11 +626,6 @@ public class CEditor extends AbstractTextEditor implements ISelectionChangedList
|
|||
{
|
||||
super.createActions();
|
||||
|
||||
fEditorActions = getContextMenuActions();
|
||||
|
||||
for ( int i = 0; i < fEditorActions.length; ++i )
|
||||
setAction( fEditorActions[i].getId(), fEditorActions[i] );
|
||||
|
||||
// Default text editing menu items
|
||||
setAction("Comment", new TextOperationAction(CEditorMessages.getResourceBundle(), "Comment.", this, ITextOperationTarget.PREFIX)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
setAction("Uncomment", new TextOperationAction(CEditorMessages.getResourceBundle(), "Uncomment.", this, ITextOperationTarget.STRIP_PREFIX)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
@ -662,39 +634,8 @@ public class CEditor extends AbstractTextEditor implements ISelectionChangedList
|
|||
|
||||
setAction("AddIncludeOnSelection", new AddIncludeOnSelectionAction(this)); //$NON-NLS-1$
|
||||
setAction("OpenOnSelection", new OpenOnSelectionAction(this));
|
||||
//setAction("OrganizeImports", new OrganizeImportsAction(this)); //$NON-NLS-1$
|
||||
|
||||
|
||||
fSearchForReferencesAction= new SearchForReferencesAction(getSelectionProvider());
|
||||
|
||||
fRulerSingleclickAction = new CRulerSingleclickAction( getVerticalRuler(), this, getSourceViewer());
|
||||
|
||||
fRulerActions = getRulerActions();
|
||||
|
||||
for ( int i = 0; i < fRulerActions.length; ++i )
|
||||
{
|
||||
setAction( fRulerActions[i].getId(), fRulerActions[i] );
|
||||
|
||||
/* To make it configurable, we could do
|
||||
if(fRulerActions[i].isDefaultDoubleClick()) {
|
||||
setAction(ITextEditorActionConstants.RULER_DOUBLE_CLICK, fRulerActions[i]);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
* Create the action for the single-click in the ruler
|
||||
*/
|
||||
setAction( fRulerSingleclickAction.getId(), fRulerSingleclickAction );
|
||||
|
||||
/*
|
||||
* Instead, take action 0 as the double-click default
|
||||
*/
|
||||
|
||||
if ( fRulerActions.length > 0 )
|
||||
{
|
||||
setAction( ITextEditorActionConstants.RULER_DOUBLE_CLICK, fRulerActions[0] );
|
||||
}
|
||||
}
|
||||
|
||||
public void editorContextMenuAboutToShow( IMenuManager menu )
|
||||
|
@ -705,17 +646,6 @@ public class CEditor extends AbstractTextEditor implements ISelectionChangedList
|
|||
addGroup(menu, ITextEditorActionConstants.GROUP_EDIT, IContextMenuConstants.GROUP_GENERATE);
|
||||
addGroup(menu, ITextEditorActionConstants.GROUP_EDIT, IContextMenuConstants.GROUP_NEW);
|
||||
|
||||
for ( int i = 0; i < fEditorActions.length; ++i )
|
||||
{
|
||||
if ( fEditorActions[i].isEnabled() )
|
||||
{
|
||||
String menuPath = fEditorActions[i].getMenuPath();
|
||||
addAction( menu,
|
||||
( menuPath != null ) ? menuPath : ITextEditorActionConstants.GROUP_REST,
|
||||
fEditorActions[i].getId() );
|
||||
}
|
||||
}
|
||||
|
||||
// Code formatting menu items -- only show in C perspective
|
||||
addAction(menu, ITextEditorActionConstants.GROUP_EDIT, "Comment"); //$NON-NLS-1$
|
||||
addAction(menu, ITextEditorActionConstants.GROUP_EDIT, "Uncomment"); //$NON-NLS-1$
|
||||
|
@ -733,27 +663,6 @@ public class CEditor extends AbstractTextEditor implements ISelectionChangedList
|
|||
addAction(menu, IContextMenuConstants.GROUP_GENERATE, "OpenOnSelection"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Add our items to the ruler menu. Since most people care about breakpoints
|
||||
* and not about tasks, we add our items before the default task ones.
|
||||
*/
|
||||
protected void rulerContextMenuAboutToShow( IMenuManager menu )
|
||||
{
|
||||
|
||||
for ( int i = 0; i < fRulerActions.length; ++i )
|
||||
{
|
||||
if ( fRulerActions[i].isEnabled() )
|
||||
addAction( menu, fRulerActions[i].getId() );
|
||||
}
|
||||
|
||||
/* Give us a nice separator */
|
||||
menu.add(new Separator(ITextEditorActionConstants.GROUP_REST));
|
||||
|
||||
super.rulerContextMenuAboutToShow( menu );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Internal interface for a cursor listener. I.e. aggregation
|
||||
* of mouse and key listener.
|
||||
|
@ -773,24 +682,6 @@ public class CEditor extends AbstractTextEditor implements ISelectionChangedList
|
|||
public void createPartControl(Composite parent) {
|
||||
super.createPartControl(parent);
|
||||
fPaintManager= new PaintManager(getSourceViewer());
|
||||
Control ruler;
|
||||
ruler = getVerticalRuler().getControl();
|
||||
MouseListener mListener = new MouseListener() {
|
||||
public void mouseDown(MouseEvent e) {
|
||||
if(e.button == 1) {
|
||||
IAction action= getAction(fRulerSingleclickAction.getId());
|
||||
if (action != null) {
|
||||
action.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void mouseUp(MouseEvent e) {}
|
||||
|
||||
public void mouseDoubleClick(MouseEvent e) {}
|
||||
};
|
||||
ruler.addMouseListener(mListener);
|
||||
|
||||
ISelectionChangedListener sListener = new ISelectionChangedListener() {
|
||||
private Runnable fRunnable= new Runnable() {
|
||||
public void run() {
|
||||
|
@ -1537,86 +1428,6 @@ public class CEditor extends AbstractTextEditor implements ISelectionChangedList
|
|||
return affects ? affects : super.affectsTextPresentation(event);
|
||||
}
|
||||
|
||||
private ICEditorContextMenuAction[] getContextMenuActions()
|
||||
{
|
||||
LinkedList menuActions = new LinkedList();
|
||||
IPluginRegistry pluginRegistry = Platform.getPluginRegistry();
|
||||
IExtensionPoint point = pluginRegistry.getExtensionPoint( CPlugin.getDefault().getDescriptor().getUniqueIdentifier(),
|
||||
ICDTConstants.EP_EDITOR_ACTIONS );
|
||||
if ( point != null )
|
||||
{
|
||||
IExtension[] extensions = point.getExtensions();
|
||||
for ( int i = 0; i < extensions.length; i++ )
|
||||
{
|
||||
IExtension currentExtension = extensions[i];
|
||||
IConfigurationElement[] configElements = currentExtension.getConfigurationElements();
|
||||
for ( int j = 0; j < configElements.length; j++ )
|
||||
{
|
||||
IConfigurationElement element = configElements[j];
|
||||
if ( element.getName().equals( ICDTConstants.TAG_ACTION ) )
|
||||
{
|
||||
ICEditorContextMenuAction action = null;
|
||||
try
|
||||
{
|
||||
action = (ICEditorContextMenuAction)element.createExecutableExtension( ICDTConstants.ATT_CLASS );
|
||||
}
|
||||
catch( CoreException e )
|
||||
{
|
||||
CPlugin.getDefault().getLog().log( e.getStatus() );
|
||||
// ErrorDialog.openError( CPlugin.getDefault().getActiveWorkbenchShell(), null, null, e.getStatus() );
|
||||
}
|
||||
if ( action != null )
|
||||
{
|
||||
action.init( this );
|
||||
menuActions.add( action );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return (ICEditorContextMenuAction[])menuActions.toArray( new ICEditorContextMenuAction[0] );
|
||||
}
|
||||
|
||||
private ICEditorRulerAction[] getRulerActions()
|
||||
{
|
||||
LinkedList rulerActions = new LinkedList();
|
||||
IPluginRegistry pluginRegistry = Platform.getPluginRegistry();
|
||||
IExtensionPoint point = pluginRegistry.getExtensionPoint( CPlugin.getDefault().getDescriptor().getUniqueIdentifier(),
|
||||
ICDTConstants.EP_EDITOR_RULER_ACTIONS );
|
||||
if ( point != null )
|
||||
{
|
||||
IExtension[] extensions = point.getExtensions();
|
||||
for ( int i = 0; i < extensions.length; i++ )
|
||||
{
|
||||
IExtension currentExtension = extensions[i];
|
||||
IConfigurationElement[] configElements = currentExtension.getConfigurationElements();
|
||||
for ( int j = 0; j < configElements.length; j++ )
|
||||
{
|
||||
IConfigurationElement element = configElements[j];
|
||||
if ( element.getName().equals( ICDTConstants.TAG_ACTION ) )
|
||||
{
|
||||
ICEditorRulerAction action = null;
|
||||
try
|
||||
{
|
||||
action = (ICEditorRulerAction)element.createExecutableExtension( ICDTConstants.ATT_CLASS );
|
||||
}
|
||||
catch( CoreException e )
|
||||
{
|
||||
CPlugin.getDefault().getLog().log( e.getStatus() );
|
||||
// ErrorDialog.openError( CPlugin.getDefault().getActiveWorkbenchShell(), null, null, e.getStatus() );
|
||||
}
|
||||
if ( action != null )
|
||||
{
|
||||
action.init( getVerticalRuler(), this );
|
||||
rulerActions.add( action );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return (ICEditorRulerAction[])rulerActions.toArray( new ICEditorRulerAction[0] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new line number ruler column that is appropriately initialized.
|
||||
*/
|
||||
|
|
|
@ -9,12 +9,9 @@ public interface ICDTConstants
|
|||
{
|
||||
// CDT Extension Points
|
||||
public static final String EP_TEXT_HOVERS = "textHovers";
|
||||
public static final String EP_EDITOR_ACTIONS = "editorActions";
|
||||
public static final String EP_EDITOR_RULER_ACTIONS = "editorRulerActions";
|
||||
|
||||
// Persistance tags.
|
||||
public static final String TAG_TEXT_HOVER = "textHover";
|
||||
public static final String TAG_ACTION = "action";
|
||||
|
||||
// Atributes
|
||||
public static final String ATT_CLASS = "class";
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
package org.eclipse.cdt.ui;
|
||||
|
||||
/*
|
||||
* (c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.ui.texteditor.ITextEditor;
|
||||
|
||||
public interface ICEditorContextMenuAction extends IAction
|
||||
{
|
||||
void init( ITextEditor textEditor );
|
||||
String getMenuPath();
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
package org.eclipse.cdt.ui;
|
||||
|
||||
/*
|
||||
* (c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.text.source.IVerticalRuler;
|
||||
import org.eclipse.ui.texteditor.ITextEditor;
|
||||
|
||||
public interface ICEditorRulerAction extends IAction
|
||||
{
|
||||
void init( IVerticalRuler ruler, ITextEditor textEditor );
|
||||
}
|
||||
|
Loading…
Add table
Reference in a new issue