</view>
</extension> -->
<extension
+ point="org.eclipse.ui.editors">
+ <editor
+ name="%phpEditorName"
+ default="true"
+ icon="icons/obj16/phpedit.gif"
+ extensions="php"
+ contributorClass="net.sourceforge.phpeclipse.phpeditor.PHPActionContributor"
+ class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
+ id="net.sourceforge.phpeclipse.PHPUnitEditor">
+ </editor>
+ <editor
+ name="%phpEditorName"
+ default="true"
+ icon="icons/obj16/phpedit.gif"
+ extensions="php3"
+ contributorClass="net.sourceforge.phpeclipse.phpeditor.PHPActionContributor"
+ class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
+ id="net.sourceforge.phpeclipse.PHPUnitEditor">
+ </editor>
+ <editor
+ name="%phpEditorName"
+ default="true"
+ icon="icons/obj16/phpedit.gif"
+ extensions="php4"
+ contributorClass="net.sourceforge.phpeclipse.phpeditor.PHPActionContributor"
+ class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
+ id="net.sourceforge.phpeclipse.PHPUnitEditor">
+ </editor>
+ <editor
+ name="%phpEditorName"
+ default="true"
+ icon="icons/obj16/phpedit.gif"
+ extensions="inc"
+ contributorClass="net.sourceforge.phpeclipse.phpeditor.PHPActionContributor"
+ class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
+ id="net.sourceforge.phpeclipse.PHPUnitEditor">
+ </editor>
+ <editor
+ name="%phpEditorName"
+ default="true"
+ icon="icons/obj16/phpedit.gif"
+ extensions="phtml"
+ contributorClass="net.sourceforge.phpeclipse.phpeditor.PHPActionContributor"
+ class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
+ id="net.sourceforge.phpeclipse.PHPUnitEditor">
+ </editor>
+ <editor
+ name="%phpEditorName"
+ default="true"
+ icon="icons/obj16/htmledit.gif"
+ extensions="htm"
+ contributorClass="net.sourceforge.phpeclipse.phpeditor.PHPActionContributor"
+ class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
+ id="net.sourceforge.phpeclipse.PHPUnitEditor">
+ </editor>
+ <editor
+ name="%phpEditorName"
+ default="true"
+ icon="icons/obj16/htmledit.gif"
+ extensions="html"
+ contributorClass="net.sourceforge.phpeclipse.phpeditor.PHPActionContributor"
+ class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
+ id="net.sourceforge.phpeclipse.PHPUnitEditor">
+ </editor>
+ <editor
+ name="%phpEditorName"
+ default="true"
+ icon="icons/obj16/xmledit.gif"
+ extensions="xml"
+ contributorClass="net.sourceforge.phpeclipse.phpeditor.PHPActionContributor"
+ class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
+ id="net.sourceforge.phpeclipse.PHPUnitEditor">
+ </editor>
+ </extension>
+ <extension
point="org.eclipse.ui.actionSets">
<actionSet
label="PHP/Apache"
label="%SourceMenu.label"
path="edit"
id="net.sourceforge.phpeclipse.ui.source.menu">
- <separator
- name="editGroup">
- </separator>
+ <separator name="editGroup" />
</menu>
<action
definitionId="net.sourceforge.phpeclipse.phpeditor.format"
label="%ShiftLeftAction.label"
retarget="true"
menubarPath="net.sourceforge.phpeclipse.ui.source.menu/editGroup"
- id="net.sourceforge.phpeclipse.ui.actions.ShiftLeft">
+ id="net.sourceforge.phpeclipse.phpeditor.ShiftLeft">
</action>
<action
label="%ShiftRightAction.label"
retarget="true"
menubarPath="net.sourceforge.phpeclipse.ui.source.menu/editGroup"
- id="net.sourceforge.phpeclipse.ui.actions.ShiftRight">
+ id="net.sourceforge.phpeclipse.phpeditor.ShiftRight">
</action>
<action
definitionId="net.sourceforge.phpeclipse.phpeditor.uncomment"
point="org.eclipse.ui.actionSetPartAssociations">
<actionSetPartAssociation
targetID="net.sourceforge.phpeclipse.ui.CodingActionSet">
- <part
- id="net.sourceforge.phpeclipse.PHPUnitEditor">
- </part>
+ <part id="net.sourceforge.phpeclipse.PHPUnitEditor" />
</actionSetPartAssociation>
</extension>
<!-- =========================================================================== -->
</accelerator>
</acceleratorSet>
</extension> -->
- <extension
- point="org.eclipse.ui.editors">
- <editor
- name="%phpEditorName"
- default="true"
- icon="icons/obj16/phpedit.gif"
- extensions="php"
- contributorClass="net.sourceforge.phpeclipse.phpeditor.PHPActionContributor"
- class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
- id="net.sourceforge.phpeclipse.PHPUnitEditor">
- </editor>
- <editor
- name="%phpEditorName"
- default="true"
- icon="icons/obj16/phpedit.gif"
- extensions="php3"
- contributorClass="net.sourceforge.phpeclipse.phpeditor.PHPActionContributor"
- class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
- id="net.sourceforge.phpeclipse.PHPUnitEditor">
- </editor>
- <editor
- name="%phpEditorName"
- default="true"
- icon="icons/obj16/phpedit.gif"
- extensions="php4"
- contributorClass="net.sourceforge.phpeclipse.phpeditor.PHPActionContributor"
- class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
- id="net.sourceforge.phpeclipse.PHPUnitEditor">
- </editor>
- <editor
- name="%phpEditorName"
- default="true"
- icon="icons/obj16/phpedit.gif"
- extensions="inc"
- contributorClass="net.sourceforge.phpeclipse.phpeditor.PHPActionContributor"
- class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
- id="net.sourceforge.phpeclipse.PHPUnitEditor">
- </editor>
- <editor
- name="%phpEditorName"
- default="true"
- icon="icons/obj16/phpedit.gif"
- extensions="phtml"
- contributorClass="net.sourceforge.phpeclipse.phpeditor.PHPActionContributor"
- class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
- id="net.sourceforge.phpeclipse.PHPUnitEditor">
- </editor>
- <editor
- name="%phpEditorName"
- default="true"
- icon="icons/obj16/htmledit.gif"
- extensions="htm"
- contributorClass="net.sourceforge.phpeclipse.phpeditor.PHPActionContributor"
- class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
- id="net.sourceforge.phpeclipse.PHPUnitEditor">
- </editor>
- <editor
- name="%phpEditorName"
- default="true"
- icon="icons/obj16/htmledit.gif"
- extensions="html"
- contributorClass="net.sourceforge.phpeclipse.phpeditor.PHPActionContributor"
- class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
- id="net.sourceforge.phpeclipse.PHPUnitEditor">
- </editor>
- <editor
- name="%phpEditorName"
- default="true"
- icon="icons/obj16/xmledit.gif"
- extensions="xml"
- contributorClass="net.sourceforge.phpeclipse.phpeditor.PHPActionContributor"
- class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
- id="net.sourceforge.phpeclipse.PHPUnitEditor">
- </editor>
- </extension>
+
<extension
point="org.eclipse.ui.popupMenus">
<objectContribution
id="net.sourceforge.phpeclipse.views.phpconsoleview">
</view>
</extension>
+
<!-- =========================================================================== -->
-<!-- Java Editor Key Bindings -->
+<!-- PHPDT/UI command definitions -->
+<!-- =========================================================================== -->
+<!--
+<extension point="org.eclipse.ui.commands">
+ <category
+ name="%category.source.name"
+ description="%category.source.description"
+ id="net.sourceforge.phpeclipse.ui.category.source">
+ </category>
+
+
+ <scope
+ name="%scope.javaEditor.name"
+ parent="org.eclipse.ui.textEditorScope"
+ description="%scope.javaEditor.description"
+ id="net.sourceforge.phpeclipse.ui.textEditorScope">
+ </scope>
+
+
+ <command
+ category="org.eclipse.ui.category.edit"
+ id="org.eclipse.jdt.ui.edit.text.java.correction.assist.proposals"
+ name= "%ActionDefinition.correctionAssistProposals.name"
+ description="%ActionDefinition.correctionAssistProposals.description">
+ </command>
+ <keyBinding
+ string="Ctrl+1"
+ scope="net.sourceforge.phpeclipse.ui.textEditorScope"
+ command="org.eclipse.jdt.ui.edit.text.java.correction.assist.proposals"
+ configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
+ </keyBinding>
+ <keyBinding
+ platform="carbon"
+ string="Command+1"
+ scope="net.sourceforge.phpeclipse.ui.textEditorScope"
+ command="org.eclipse.jdt.ui.edit.text.java.correction.assist.proposals"
+ configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
+ </keyBinding>
+
+
+ <command
+ category="net.sourceforge.phpeclipse.ui.category.source"
+ id="net.sourceforge.phpeclipse.phpeditor.comment"
+ name= "%ActionDefinition.comment.name"
+ description= "%ActionDefinition.comment.description">
+ </command>
+ <keyBinding
+ string="Ctrl+/"
+ scope="net.sourceforge.phpeclipse.ui.textEditorScope"
+ command="net.sourceforge.phpeclipse.phpeditor.comment"
+ configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
+ </keyBinding>
+ <keyBinding
+ platform="carbon"
+ string="Command+/"
+ scope="net.sourceforge.phpeclipse.ui.textEditorScope"
+ command="net.sourceforge.phpeclipse.phpeditor.comment"
+ configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
+ </keyBinding>
+
+ <command
+ category="net.sourceforge.phpeclipse.ui.category.source"
+ id="net.sourceforge.phpeclipse.phpeditor.uncomment"
+ name= "%ActionDefinition.uncomment.name"
+ description= "%ActionDefinition.uncomment.description">
+ </command>
+ <keyBinding
+ string="Ctrl+\"
+ scope="net.sourceforge.phpeclipse.ui.textEditorScope"
+ command="net.sourceforge.phpeclipse.phpeditor.uncomment"
+ configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
+ </keyBinding>
+ <keyBinding
+ platform="carbon"
+ string="Command+\"
+ scope="net.sourceforge.phpeclipse.ui.textEditorScope"
+ command="net.sourceforge.phpeclipse.phpeditor.uncomment"
+ configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
+ </keyBinding>
+
+ <command
+ category="net.sourceforge.phpeclipse.ui.category.source"
+ id="org.eclipse.jdt.ui.edit.text.java.format"
+ name= "%ActionDefinition.format.name"
+ description= "%ActionDefinition.format.description">
+ </command>
+ <keyBinding
+ string="Ctrl+Shift+F"
+ scope="net.sourceforge.phpeclipse.ui.textEditorScope"
+ command="org.eclipse.jdt.ui.edit.text.java.format"
+ configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
+ </keyBinding>
+ <keyBinding
+ platform="carbon"
+ string="Command+Shift+F"
+ scope="net.sourceforge.phpeclipse.ui.textEditorScope"
+ command="org.eclipse.jdt.ui.edit.text.java.format"
+ configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
+ </keyBinding>
+
+</extension>
+-->
+<!-- =========================================================================== -->
+<!-- PHP Editor Key Bindings -->
<!-- =========================================================================== -->
<extension
point="org.eclipse.ui.acceleratorSets">
<accelerator
key="Ctrl+\"
id="net.sourceforge.phpeclipse.phpeditor.uncomment">
- </accelerator>
+ </accelerator>
<accelerator
key="Ctrl+Shift+F"
id="net.sourceforge.phpeclipse.phpeditor.format">
platform="carbon"
key="Command+\"
id="net.sourceforge.phpeclipse.phpeditor.uncomment">
- </accelerator>
+ </accelerator>
</acceleratorSet>
</extension>
import java.util.Iterator;
import java.util.List;
+import net.sourceforge.phpdt.internal.ui.actions.ActionMessages;
import net.sourceforge.phpdt.internal.ui.actions.AddTaskAction;
import net.sourceforge.phpdt.ui.IContextMenuConstants;
import net.sourceforge.phpeclipse.phpeditor.PHPEditor;
-import org.eclipse.debug.internal.ui.actions.ActionMessages;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
import org.eclipse.jface.util.Assert;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
public class GenerateActionGroup extends ActionGroup {
private PHPEditor fEditor;
- private boolean fEditorIsOwner;
+// private boolean fEditorIsOwner;
private IWorkbenchSite fSite;
private String fGroupName= IContextMenuConstants.GROUP_SOURCE;
private List fRegisteredSelectionListeners;
*/
public GenerateActionGroup(PHPEditor editor, String groupName) {
fSite= editor.getSite();
- fEditor= editor;
- fEditorIsOwner= true;
+ fEditor= editor;
fGroupName= groupName;
+
ISelectionProvider provider= fSite.getSelectionProvider();
ISelection selection= provider.getSelection();
* Note: This method is for internal use only. Clients should not call this method.
*/
public void editorStateChanged() {
- Assert.isTrue(fEditorIsOwner);
+ Assert.isTrue(isEditorOwner());
// http://dev.eclipse.org/bugs/show_bug.cgi?id=17709
fConvertToMac.update();
/* (non-Javadoc)
* Method declared in ActionGroup
*/
+// public void fillContextMenu(IMenuManager menu) {
+// super.fillContextMenu(menu);
+// if (fEditorIsOwner) {
+// IMenuManager subMenu= createEditorSubMenu(menu);
+// if (subMenu != null)
+// menu.appendToGroup(fGroupName, subMenu);
+// } else {
+//// appendToGroup(menu, fOrganizeImports);
+//// appendToGroup(menu, fOverrideMethods);
+//// appendToGroup(menu, fAddGetterSetter);
+//// appendToGroup(menu, fAddUnimplementedConstructors);
+//// appendToGroup(menu, fAddJavaDocStub);
+// appendToGroup(menu, fAddBookmark);
+// }
+// }
+ /* (non-Javadoc)
+ * Method declared in ActionGroup
+ */
public void fillContextMenu(IMenuManager menu) {
super.fillContextMenu(menu);
- if (fEditorIsOwner) {
- IMenuManager subMenu= createEditorSubMenu(menu);
- if (subMenu != null)
- menu.appendToGroup(fGroupName, subMenu);
+ IMenuManager subMenu= null;
+ if (isEditorOwner()) {
+ subMenu= createEditorSubMenu(menu);
} else {
-// appendToGroup(menu, fOrganizeImports);
-// appendToGroup(menu, fOverrideMethods);
-// appendToGroup(menu, fAddGetterSetter);
-// appendToGroup(menu, fAddUnimplementedConstructors);
-// appendToGroup(menu, fAddJavaDocStub);
- appendToGroup(menu, fAddBookmark);
+ // subMenu= createViewSubMenu(menu);
}
+ if (subMenu != null)
+ menu.appendToGroup(fGroupName, subMenu);
}
private IMenuManager createEditorSubMenu(IMenuManager mainMenu) {
int added= 0;
added+= addEditorAction(result, "Comment"); //$NON-NLS-1$
added+= addEditorAction(result, "Uncomment"); //$NON-NLS-1$
+ added+= addEditorAction(result, "Format"); //$NON-NLS-1$
// result.add(new Separator());
// added+= addAction(result, fOrganizeImports);
// added+= addAction(result, fAddImport);
- result.add(new Separator());
+// result.add(new Separator());
// added+= addAction(result, fOverrideMethods);
// added+= addAction(result, fAddGetterSetter);
// added+= addAction(result, fAddUnimplementedConstructors);
// added+= addAction(result, fAddJavaDocStub);
- added+= addAction(result, fAddBookmark);
+// added+= addAction(result, fAddBookmark);
// result.add(new Separator());
// added+= addAction(result, fSurroundWithTryCatch);
// added+= addAction(result, fExternalizeStrings);
actionBar.setGlobalActionHandler(PHPdtActionConstants.CONVERT_LINE_DELIMITERS_TO_WINDOWS, fConvertToWindows);
actionBar.setGlobalActionHandler(PHPdtActionConstants.CONVERT_LINE_DELIMITERS_TO_UNIX, fConvertToUNIX);
actionBar.setGlobalActionHandler(PHPdtActionConstants.CONVERT_LINE_DELIMITERS_TO_MAC, fConvertToMac);
- if (!fEditorIsOwner) {
+ if (!isEditorOwner()) {
// editor provides its own implementation of these actions.
actionBar.setGlobalActionHandler(IWorkbenchActionConstants.BOOKMARK, fAddBookmark);
actionBar.setGlobalActionHandler(IWorkbenchActionConstants.ADD_TASK, fAddTaskAction);
* (value <code>"net.sourceforge.phpdt.ui.actions.Uncomment"</code>).
*/
public static final String UNCOMMENT = "net.sourceforge.phpeclipse.phpeditor.Uncomment"; //$NON-NLS-1$
+ /**
+ * Source menu: name of standard Shift Rightl action
+ * (value <code>"net.sourceforge.phpeclipse.phpeditor.ShiftRight"</code>).
+ */
+ public static final String SHIFT_RIGHT = "net.sourceforge.phpeclipse.phpeditor.ShiftRight"; //$NON-NLS-1$
+
+ /**
+ * Source menu: name of standard Shift Left global action
+ * (value <code>"net.sourceforge.phpeclipse.phpeditor.ShiftLeft"</code>).
+ */
+ public static final String SHIFT_LEFT = "net.sourceforge.phpeclipse.phpeditor.ShiftLeft"; //$NON-NLS-1$
/**
* Source menu: name of standard Format global action (value <code>"org.
* phpeclipse.phpdt.ui.actions.Format"</code>).
*/
public static final String FORMAT = "net.sourceforge.phpeclipse.phpeditor.Format"; //$NON-NLS-1$
-
+
/**
* Source menu: name of standard Convert Line Delimiters To Windows global action
* (value <code>"org.phpeclipse.phpdt.ui.actions.ConvertLineDelimitersToWindows"</code>).
*/
- public static String CONVERT_LINE_DELIMITERS_TO_WINDOWS= "net.sourceforge.phpeclipse.ui.actions.ConvertLineDelimitersToWindows"; //$NON-NLS-1$
+ public static String CONVERT_LINE_DELIMITERS_TO_WINDOWS = "net.sourceforge.phpeclipse.ui.actions.ConvertLineDelimitersToWindows"; //$NON-NLS-1$
/**
* Source menu: name of standard Convert Line Delimiters To UNIX global action
* (value <code>"org.phpeclipse.phpdt.ui.actions.ConvertLineDelimitersToUNIX"</code>).
*/
- public static String CONVERT_LINE_DELIMITERS_TO_UNIX= "net.sourceforge.phpeclipse.ui.actions.ConvertLineDelimitersToUNIX"; //$NON-NLS-1$
+ public static String CONVERT_LINE_DELIMITERS_TO_UNIX = "net.sourceforge.phpeclipse.ui.actions.ConvertLineDelimitersToUNIX"; //$NON-NLS-1$
/**
* Source menu: name of standardConvert Line Delimiters ToMac global action
* (value <code>"org.phpeclipse.phpdt.ui.actions.ConvertLineDelimitersToMac"</code>).
*/
- public static String CONVERT_LINE_DELIMITERS_TO_MAC= "net.sourceforge.phpeclipse.ui.actions.ConvertLineDelimitersToMac"; //$NON-NLS-1$
+ public static String CONVERT_LINE_DELIMITERS_TO_MAC = "net.sourceforge.phpeclipse.ui.actions.ConvertLineDelimitersToMac"; //$NON-NLS-1$
/**
* Navigate menu: name of standard Open global action
* (value <code>"org.phpeclipse.phpdt.ui.actions.Open"</code>).
*/
- public static final String OPEN= "net.sourceforge.phpeclipse.ui.actions.Open"; //$NON-NLS-1$
+ public static final String OPEN = "net.sourceforge.phpeclipse.ui.actions.Open"; //$NON-NLS-1$
}
import java.util.List;
import java.util.ResourceBundle;
+import net.sourceforge.phpdt.ui.IContextMenuConstants;
import net.sourceforge.phpdt.ui.actions.GotoMatchingBracketAction;
import net.sourceforge.phpdt.ui.actions.PHPdtActionConstants;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.actions.ActionGroup;
+import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.actions.RetargetAction;
import org.eclipse.ui.texteditor.AbstractTextEditor;
import org.eclipse.ui.texteditor.BasicTextEditorActionContributor;
*/
public class PHPActionContributor extends BasicTextEditorActionContributor {
- // protected RetargetTextEditorAction fContentAssistTip;
+ protected RetargetTextEditorAction fContentAssistTip;
// protected TextEditorAction fTogglePresentation;
protected RetargetAction fRetargetContentAssist;
protected RetargetTextEditorAction fContentAssist;
private RetargetTextEditorAction fGotoMatchingBracket;
private List fRetargetToolbarActions = new ArrayList();
+ private List fPartListeners = new ArrayList();
protected PHPParserAction fParserAction;
protected ShowExternalPreviewAction fShowExternalPreviewAction;
ResourceBundle b = PHPEditorMessages.getResourceBundle();
fRetargetContentAssist = new RetargetAction(PHPdtActionConstants.CONTENT_ASSIST, PHPEditorMessages.getString("ContentAssistProposal.label")); //$NON-NLS-1$
- fRetargetContentAssist.setActionDefinitionId(PHPEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
+ fRetargetContentAssist.setActionDefinitionId(
+ PHPEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
+ markAsPartListener(fRetargetContentAssist);
fContentAssist = new RetargetTextEditorAction(b, "ContentAssistProposal."); //$NON-NLS-1$
- fContentAssist.setActionDefinitionId(PHPEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
+ fContentAssist.setActionDefinitionId(
+ PHPEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
fGotoMatchingBracket = new RetargetTextEditorAction(b, "GotoMatchingBracket."); //$NON-NLS-1$
- fGotoMatchingBracket.setActionDefinitionId(PHPEditorActionDefinitionIds.GOTO_MATCHING_BRACKET);
+ fGotoMatchingBracket.setActionDefinitionId(
+ PHPEditorActionDefinitionIds.GOTO_MATCHING_BRACKET);
// fContentAssist.setImageDescriptor(JavaPluginImages.DESC_CLCL_CODE_ASSIST);
// fContentAssist.setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_CODE_ASSIST);
// fContentAssist = new RetargetTextEditorAction(PHPEditorMessages.getResourceBundle(), "ContentAssistProposal."); //$NON-NLS-1$
- // fContentAssistTip = new RetargetTextEditorAction(PHPEditorMessages.getResourceBundle(), "ContentAssistTip."); //$NON-NLS-1$
+ fContentAssistTip = new RetargetTextEditorAction(PHPEditorMessages.getResourceBundle(), "ContentAssistTip."); //$NON-NLS-1$
// fTogglePresentation = new PresentationAction();
fParserAction = PHPParserAction.getInstance();
if (SWT.getPlatform().equals("win32")) {
+ // ExternalPreview only available as ActiveX on win32 (Eclipse2.1)
fShowExternalPreviewAction = ShowExternalPreviewAction.getInstance();
}
}
+ protected final void markAsPartListener(RetargetAction action) {
+ fPartListeners.add(action);
+ }
+
/*
* @see EditorActionBarContributor#contributeToMenu(IMenuManager)
*/
// }
/*
+ * @see org.eclipse.ui.part.EditorActionBarContributor#contributeToMenu(org.eclipse.jface.action.IMenuManager)
+ */
+ public void contributeToMenu(IMenuManager menu) {
+
+ super.contributeToMenu(menu);
+
+ IMenuManager editMenu =
+ menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
+ if (editMenu != null) {
+ editMenu.add(new Separator(IContextMenuConstants.GROUP_OPEN));
+ editMenu.add(new Separator(IContextMenuConstants.GROUP_GENERATE));
+ editMenu.add(new Separator(IContextMenuConstants.GROUP_ADDITIONS));
+
+// editMenu.appendToGroup(
+// IContextMenuConstants.GROUP_GENERATE,
+// fRetargetContentAssist);
+
+ // MenuManager structureSelection= new MenuManager(JavaEditorMessages.getString("ExpandSelectionMenu.label"), "expandSelection"); //$NON-NLS-1$ //$NON-NLS-2$
+ // structureSelection.add(fStructureSelectEnclosingAction);
+ // structureSelection.add(fStructureSelectNextAction);
+ // structureSelection.add(fStructureSelectPreviousAction);
+ // structureSelection.add(fStructureSelectHistoryAction);
+ // editMenu.appendToGroup(IContextMenuConstants.GROUP_OPEN, structureSelection);
+
+ // editMenu.appendToGroup(IContextMenuConstants.GROUP_GENERATE, fRetargetShowJavaDoc);
+ }
+
+ // IMenuManager navigateMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_NAVIGATE);
+ // if (navigateMenu != null) {
+ // navigateMenu.appendToGroup(IWorkbenchActionConstants.SHOW_EXT, fShowOutline);
+ // }
+
+ IMenuManager gotoMenu = menu.findMenuUsingPath("navigate/goTo"); //$NON-NLS-1$
+ if (gotoMenu != null) {
+ gotoMenu.add(new Separator("additions2")); //$NON-NLS-1$
+ // gotoMenu.appendToGroup("additions2", fGotoPreviousMemberAction); //$NON-NLS-1$
+ // gotoMenu.appendToGroup("additions2", fGotoNextMemberAction); //$NON-NLS-1$
+ gotoMenu.appendToGroup("additions2", fGotoMatchingBracket); //$NON-NLS-1$
+ }
+ }
+ /*
* @see EditorActionBarContributor#contributeToToolBar(IToolBarManager)
*/
public void contributeToToolBar(IToolBarManager tbm) {
}
/*
+ * @see IEditorActionBarContributor#init(IActionBars, IWorkbenchPage)
+ */
+ public void init(IActionBars bars, IWorkbenchPage page) {
+ Iterator e = fPartListeners.iterator();
+ while (e.hasNext())
+ page.addPartListener((RetargetAction) e.next());
+
+ super.init(bars, page);
+ }
+ /*
* @see IEditorActionBarContributor#init(IActionBars)
*/
public void init(IActionBars bars) {
super.init(bars);
IMenuManager menuManager = bars.getMenuManager();
- IMenuManager editMenu = menuManager.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
+ IMenuManager editMenu =
+ menuManager.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
if (editMenu != null) {
editMenu.add(new Separator());
editMenu.add(fContentAssist);
- editMenu.add(fGotoMatchingBracket);
-
+ // editMenu.add(fGotoMatchingBracket);
// editMenu.add(fContentAssistTip);
}
- bars.setGlobalActionHandler(PHPdtActionConstants.CONTENT_ASSIST, fContentAssist);
+ bars.setGlobalActionHandler(
+ PHPdtActionConstants.CONTENT_ASSIST,
+ fContentAssist);
// IToolBarManager toolBarManager = bars.getToolBarManager();
// if (toolBarManager != null) {
// toolBarManager.add(new Separator());
private void doSetActiveEditor(IEditorPart part) {
super.setActiveEditor(part);
+ IActionBars bars = getActionBars();
+ IStatusLineManager manager = bars.getStatusLineManager();
+ manager.setMessage(null);
+ manager.setErrorMessage(null);
+
ITextEditor textEditor = null;
if (part instanceof ITextEditor)
textEditor = (ITextEditor) part;
fContentAssist.setAction(getAction(textEditor, "ContentAssistProposal")); //$NON-NLS-1$
- // fContentAssistTip.setAction(getAction(editor, "ContentAssistTip")); //$NON-NLS-1$
- fGotoMatchingBracket.setAction(getAction(textEditor, GotoMatchingBracketAction.GOTO_MATCHING_BRACKET));
-
- IActionBars bars = getActionBars();
- bars.setGlobalActionHandler(PHPdtActionConstants.COMMENT, getAction(textEditor, "Comment"));
- bars.setGlobalActionHandler(PHPdtActionConstants.UNCOMMENT, getAction(textEditor, "Uncomment"));
- bars.setGlobalActionHandler(PHPdtActionConstants.FORMAT, getAction(textEditor, "Format"));
+ fContentAssistTip.setAction(getAction(textEditor, "ContentAssistTip")); //$NON-NLS-1$
+ fGotoMatchingBracket.setAction(
+ getAction(textEditor, GotoMatchingBracketAction.GOTO_MATCHING_BRACKET));
+
+ bars.setGlobalActionHandler(PHPdtActionConstants.SHIFT_RIGHT, getAction(textEditor, "ShiftRight")); //$NON-NLS-1$
+ bars.setGlobalActionHandler(PHPdtActionConstants.SHIFT_LEFT, getAction(textEditor, "ShiftLeft")); //$NON-NLS-1$
+
+ bars.setGlobalActionHandler(
+ PHPdtActionConstants.COMMENT,
+ getAction(textEditor, "Comment"));
+ bars.setGlobalActionHandler(
+ PHPdtActionConstants.UNCOMMENT,
+ getAction(textEditor, "Uncomment"));
+ bars.setGlobalActionHandler(
+ PHPdtActionConstants.FORMAT,
+ getAction(textEditor, "Format"));
if (part instanceof PHPEditor) {
- PHPEditor cuEditor = (PHPEditor) part;
- ActionGroup group = cuEditor.getActionGroup();
- if (group != null)
- group.fillActionBars(bars);
+ PHPEditor phpEditor = (PHPEditor) part;
+ phpEditor.getActionGroup().fillActionBars(getActionBars());
}
+ // if (part instanceof PHPEditor) {
+ // PHPEditor cuEditor = (PHPEditor) part;
+ // ActionGroup group = cuEditor.getActionGroup();
+ // if (group != null)
+ // group.fillActionBars(bars);
+ // }
// fTogglePresentation.setEditor(editor);
// fTogglePresentation.update();
PHPeclipsePlugin.getDefault().setLastEditorFile(file);
fParserAction.setEditor(textEditor);
fParserAction.update();
- if (SWT.getPlatform().equals("win32") && textEditor instanceof AbstractTextEditor) {
+ if (SWT.getPlatform().equals("win32")
+ && textEditor instanceof AbstractTextEditor) {
fShowExternalPreviewAction.setEditor(textEditor);
fShowExternalPreviewAction.update();
- IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
+ IPreferenceStore store =
+ PHPeclipsePlugin.getDefault().getPreferenceStore();
if (store.getBoolean(PHPeclipsePlugin.SHOW_EXTERNAL_PREVIEW_PREF)) {
IAction a = ShowExternalPreviewAction.getInstance();
if (a != null)
}
}
}
-
+
}
/*
* @see IEditorActionBarContributor#dispose()
*/
public void dispose() {
+ Iterator e = fPartListeners.iterator();
+ while (e.hasNext())
+ getPage().removePartListener((RetargetAction) e.next());
+ fPartListeners.clear();
+
doSetActiveEditor(null);
super.dispose();
}
import net.sourceforge.phpdt.internal.ui.text.HTMLTextPresenter;
import net.sourceforge.phpdt.internal.ui.text.PHPPairMatcher;
import net.sourceforge.phpdt.internal.ui.viewsupport.IViewPartInputProvider;
+import net.sourceforge.phpdt.ui.IContextMenuConstants;
import net.sourceforge.phpdt.ui.PreferenceConstants;
import net.sourceforge.phpdt.ui.actions.GenerateActionGroup;
import net.sourceforge.phpdt.ui.actions.GotoMatchingBracketAction;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.text.BadLocationException;
/**
* PHP specific text editor.
*/
-public class PHPEditor extends StatusTextEditor implements IViewPartInputProvider { // extends TextEditor {
+public class PHPEditor
+ extends StatusTextEditor
+ implements IViewPartInputProvider { // extends TextEditor {
/** Preference key for showing the line number ruler */
- private final static String LINE_NUMBER_RULER = PreferenceConstants.EDITOR_LINE_NUMBER_RULER;
+ private final static String LINE_NUMBER_RULER =
+ PreferenceConstants.EDITOR_LINE_NUMBER_RULER;
/** Preference key for the foreground color of the line numbers */
- private final static String LINE_NUMBER_COLOR = PreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR;
+ private final static String LINE_NUMBER_COLOR =
+ PreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR;
/** Preference key for the link color */
- private final static String LINK_COLOR = PreferenceConstants.EDITOR_LINK_COLOR;
+ private final static String LINK_COLOR =
+ PreferenceConstants.EDITOR_LINK_COLOR;
// protected PHPActionGroup fActionGroups;
/** The outline page */
protected CompositeActionGroup fActionGroups;
/** The standard action groups added to the menu */
- private GenerateActionGroup fGenerateActionGroup;
- private CompositeActionGroup fContextMenuGroup;
+ protected GenerateActionGroup fGenerateActionGroup;
+ protected CompositeActionGroup fContextMenuGroup;
/** The information presenter. */
private InformationPresenter fInformationPresenter;
public PHPEditor() {
super();
JavaTextTools textTools = PHPeclipsePlugin.getDefault().getJavaTextTools();
- setSourceViewerConfiguration(new PHPSourceViewerConfiguration(textTools, this));
+ setSourceViewerConfiguration(
+ new PHPSourceViewerConfiguration(textTools, this));
setRangeIndicator(new DefaultRangeIndicator());
setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore());
String t = types[i];
- int[] stateMasks = configuration.getConfiguredTextHoverStateMasks(getSourceViewer(), t);
+ int[] stateMasks =
+ configuration.getConfiguredTextHoverStateMasks(getSourceViewer(), t);
ISourceViewer sourceViewer = getSourceViewer();
if (sourceViewer instanceof ITextViewerExtension2) {
if (stateMasks != null) {
for (int j = 0; j < stateMasks.length; j++) {
int stateMask = stateMasks[j];
- ITextHover textHover = configuration.getTextHover(sourceViewer, t, stateMask);
- ((ITextViewerExtension2) sourceViewer).setTextHover(textHover, t, stateMask);
+ ITextHover textHover =
+ configuration.getTextHover(sourceViewer, t, stateMask);
+ ((ITextViewerExtension2) sourceViewer).setTextHover(
+ textHover,
+ t,
+ stateMask);
}
} else {
ITextHover textHover = configuration.getTextHover(sourceViewer, t);
- ((ITextViewerExtension2) sourceViewer).setTextHover(textHover, t, ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
+ ((ITextViewerExtension2) sourceViewer).setTextHover(
+ textHover,
+ t,
+ ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
}
} else
- sourceViewer.setTextHover(configuration.getTextHover(sourceViewer, t), t);
+ sourceViewer.setTextHover(
+ configuration.getTextHover(sourceViewer, t),
+ t);
}
}
public void createPartControl(Composite parent) {
super.createPartControl(parent);
- IInformationControlCreator informationControlCreator = new IInformationControlCreator() {
+ IInformationControlCreator informationControlCreator =
+ new IInformationControlCreator() {
public IInformationControl createInformationControl(Shell parent) {
boolean cutDown = false;
int style = cutDown ? SWT.NONE : (SWT.V_SCROLL | SWT.H_SCROLL);
- return new DefaultInformationControl(parent, SWT.RESIZE, style, new HTMLTextPresenter(cutDown));
+ return new DefaultInformationControl(
+ parent,
+ SWT.RESIZE,
+ style,
+ new HTMLTextPresenter(cutDown));
}
};
* @return the document's complete text
*/
public String get() {
- IDocument doc = this.getDocumentProvider().getDocument(this.getEditorInput());
+ IDocument doc =
+ this.getDocumentProvider().getDocument(this.getEditorInput());
return doc.get();
}
super.createActions();
Action action;
- // setAction(
- // "ContentAssistProposal",
- // new TextOperationAction(
- // PHPEditorMessages.getResourceBundle(),
- // "ContentAssistProposal.",
- // this,
- // ISourceViewer.CONTENTASSIST_PROPOSALS));
- action = new ContentAssistAction(PHPEditorMessages.getResourceBundle(), "ContentAssistProposal.", this); //$NON-NLS-1$
- action.setActionDefinitionId(PHPEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
- setAction("ContentAssistProposal", action); //$NON-NLS-1$
setAction(
"ContentAssistTip",
this,
ISourceViewer.CONTENTASSIST_CONTEXT_INFORMATION));
- action = new TextOperationAction(PHPEditorMessages.getResourceBundle(), "Comment.", this, ITextOperationTarget.PREFIX);
+ action = new ContentAssistAction(PHPEditorMessages.getResourceBundle(), "ContentAssistProposal.", this); //$NON-NLS-1$
+ action.setActionDefinitionId(
+ PHPEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
+ setAction("ContentAssistProposal", action); //$NON-NLS-1$
+ markAsStateDependentAction("ContentAssistProposal", true); //$NON-NLS-1$
+ // WorkbenchHelp.setHelp(action, IJavaHelpContextIds.CONTENT_ASSIST_ACTION);
+
+ action = new TextOperationAction(PHPEditorMessages.getResourceBundle(), "Comment.", this, ITextOperationTarget.PREFIX); //$NON-NLS-1$
action.setActionDefinitionId(PHPEditorActionDefinitionIds.COMMENT);
- setAction("Comment", action);
+ setAction("Comment", action); //$NON-NLS-1$
+ markAsStateDependentAction("Comment", true); //$NON-NLS-1$
+ // WorkbenchHelp.setHelp(action, IJavaHelpContextIds.COMMENT_ACTION);
- action = new TextOperationAction(PHPEditorMessages.getResourceBundle(), "Uncomment.", this, ITextOperationTarget.STRIP_PREFIX);
+ action = new TextOperationAction(PHPEditorMessages.getResourceBundle(), "Uncomment.", this, ITextOperationTarget.STRIP_PREFIX); //$NON-NLS-1$
action.setActionDefinitionId(PHPEditorActionDefinitionIds.UNCOMMENT);
- setAction("Uncomment", action);
+ setAction("Uncomment", action); //$NON-NLS-1$
+ markAsStateDependentAction("Uncomment", true); //$NON-NLS-1$
+ // WorkbenchHelp.setHelp(action, IJavaHelpContextIds.UNCOMMENT_ACTION);
action = new TextOperationAction(PHPEditorMessages.getResourceBundle(), "Format.", this, ISourceViewer.FORMAT); //$NON-NLS-1$
action.setActionDefinitionId(PHPEditorActionDefinitionIds.FORMAT);
setAction("Format", action); //$NON-NLS-1$
-
- markAsStateDependentAction("ContentAssistProposal", true); //$NON-NLS-1$
- markAsStateDependentAction("Comment", true); //$NON-NLS-1$
- markAsStateDependentAction("Uncomment", true); //$NON-NLS-1$
markAsStateDependentAction("Format", true); //$NON-NLS-1$
+ markAsSelectionDependentAction("Format", true); //$NON-NLS-1$
+ // WorkbenchHelp.setHelp(action, IJavaHelpContextIds.FORMAT_ACTION);
action = new GotoMatchingBracketAction(this);
- action.setActionDefinitionId(PHPEditorActionDefinitionIds.GOTO_MATCHING_BRACKET);
+ action.setActionDefinitionId(
+ PHPEditorActionDefinitionIds.GOTO_MATCHING_BRACKET);
setAction(GotoMatchingBracketAction.GOTO_MATCHING_BRACKET, action);
- fGenerateActionGroup = new GenerateActionGroup(this, ITextEditorActionConstants.GROUP_EDIT);
+ fGenerateActionGroup =
+ new GenerateActionGroup(this, ITextEditorActionConstants.GROUP_EDIT);
- fActionGroups = new CompositeActionGroup(new ActionGroup[] { fGenerateActionGroup });
+ fActionGroups =
+ new CompositeActionGroup(new ActionGroup[] { fGenerateActionGroup });
// We have to keep the context menu group separate to have better control over positioning
- fContextMenuGroup = new CompositeActionGroup(new ActionGroup[] { fGenerateActionGroup });
+ fContextMenuGroup =
+ new CompositeActionGroup(new ActionGroup[] { fGenerateActionGroup });
// rg,
// new LocalHistoryActionGroup(this, ITextEditorActionConstants.GROUP_EDIT)});
if (a != null)
a.run();
}
-// if (SWT.getPlatform().equals("win32")) {
-// IAction a = ShowExternalPreviewAction.getInstance();
-// if (a != null)
-// a.run();
-// }
+ // if (SWT.getPlatform().equals("win32")) {
+ // IAction a = ShowExternalPreviewAction.getInstance();
+ // if (a != null)
+ // a.run();
+ // }
if (fOutlinePage != null)
fOutlinePage.update();
}
*/
public void editorContextMenuAboutToShow(MenuManager menu) {
super.editorContextMenuAboutToShow(menu);
-
- addAction(menu, ITextEditorActionConstants.GROUP_EDIT, "Format"); //$NON-NLS-1$
-
- ActionContext context = new ActionContext(getSelectionProvider().getSelection());
- fContextMenuGroup.setContext(context);
- fContextMenuGroup.fillContextMenu(menu);
- fContextMenuGroup.setContext(null);
+ menu.appendToGroup(ITextEditorActionConstants.GROUP_UNDO, new Separator(IContextMenuConstants.GROUP_OPEN));
+ menu.insertAfter(IContextMenuConstants.GROUP_OPEN, new GroupMarker(IContextMenuConstants.GROUP_SHOW));
+
+ ActionContext context= new ActionContext(getSelectionProvider().getSelection());
+ fContextMenuGroup.setContext(context);
+ fContextMenuGroup.fillContextMenu(menu);
+ fContextMenuGroup.setContext(null);
+// addAction(menu, ITextEditorActionConstants.GROUP_EDIT, "Format"); //$NON-NLS-1$
+//
+// ActionContext context =
+// new ActionContext(getSelectionProvider().getSelection());
+// fContextMenuGroup.setContext(context);
+// fContextMenuGroup.fillContextMenu(menu);
+// fContextMenuGroup.setContext(null);
}
protected void updateStateDependentActions() {
if (value instanceof Integer) {
sourceViewer.getTextWidget().setTabs(((Integer) value).intValue());
} else if (value instanceof String) {
- sourceViewer.getTextWidget().setTabs(Integer.parseInt((String) value));
+ sourceViewer.getTextWidget().setTabs(
+ Integer.parseInt((String) value));
}
return;
}
if (!store.getBoolean(PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT)) {
if (store.contains(PREFERENCE_COLOR_BACKGROUND)) {
if (store.isDefault(PREFERENCE_COLOR_BACKGROUND))
- rgb = PreferenceConverter.getDefaultColor(store, PREFERENCE_COLOR_BACKGROUND);
+ rgb =
+ PreferenceConverter.getDefaultColor(
+ store,
+ PREFERENCE_COLOR_BACKGROUND);
else
- rgb = PreferenceConverter.getColor(store, PREFERENCE_COLOR_BACKGROUND);
+ rgb =
+ PreferenceConverter.getColor(store, PREFERENCE_COLOR_BACKGROUND);
}
}
rulerColumn.setBackground(manager.getColor(rgb));
return false;
}
- private static boolean isSurroundedByBrackets(IDocument document, int offset) {
+ private static boolean isSurroundedByBrackets(
+ IDocument document,
+ int offset) {
if (offset == 0 || offset == document.getLength())
return false;
try {
- return isBracket(document.getChar(offset - 1)) && isBracket(document.getChar(offset));
+ return isBracket(document.getChar(offset - 1))
+ && isBracket(document.getChar(offset));
} catch (BadLocationException e) {
return false;
return;
int anchor = fBracketMatcher.getAnchor();
- int targetOffset = (PHPPairMatcher.RIGHT == anchor) ? offset : offset + length - 1;
+ int targetOffset =
+ (PHPPairMatcher.RIGHT == anchor) ? offset : offset + length - 1;
boolean visible = false;
if (sourceViewer instanceof ITextViewerExtension3) {
visible = (extension.modelOffset2WidgetOffset(targetOffset) > -1);
} else {
IRegion visibleRegion = sourceViewer.getVisibleRegion();
- visible = (targetOffset >= visibleRegion.getOffset() && targetOffset < visibleRegion.getOffset() + visibleRegion.getLength());
+ visible =
+ (targetOffset >= visibleRegion.getOffset()
+ && targetOffset < visibleRegion.getOffset() + visibleRegion.getLength());
}
if (!visible) {
* @param msg message to be set
*/
protected void setStatusLineErrorMessage(String msg) {
- IEditorStatusLine statusLine = (IEditorStatusLine) getAdapter(IEditorStatusLine.class);
+ IEditorStatusLine statusLine =
+ (IEditorStatusLine) getAdapter(IEditorStatusLine.class);
if (statusLine != null)
statusLine.setMessage(true, msg, null);
}
* @return the line's bidi segmentation
* @throws BadLocationException in case lineOffset is not valid in document
*/
- public static int[] getBidiLineSegments(IDocument document, int lineOffset) throws BadLocationException {
+ public static int[] getBidiLineSegments(IDocument document, int lineOffset)
+ throws BadLocationException {
IRegion line = document.getLineInformationOfOffset(lineOffset);
- ITypedRegion[] linePartitioning = document.computePartitioning(lineOffset, line.getLength());
+ ITypedRegion[] linePartitioning =
+ document.computePartitioning(lineOffset, line.getLength());
List segmentation = new ArrayList();
for (int i = 0; i < linePartitioning.length; i++) {
- if (IPHPPartitionScannerConstants.PHP_STRING.equals(linePartitioning[i].getType()))
+ if (IPHPPartitionScannerConstants
+ .PHP_STRING
+ .equals(linePartitioning[i].getType()))
segmentation.add(linePartitioning[i]);
}
/*
* @see AbstractTextEditor#createSourceViewer(Composite, IVerticalRuler, int)
*/
- protected final ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
+ protected final ISourceViewer createSourceViewer(
+ Composite parent,
+ IVerticalRuler ruler,
+ int styles) {
ISourceViewer viewer = createJavaSourceViewer(parent, ruler, styles);
StyledText text = viewer.getTextWidget();
text.addBidiSegmentListener(new BidiSegmentListener() {
/*
* @see AbstractTextEditor#createSourceViewer(Composite, IVerticalRuler, int)
*/
- protected ISourceViewer createJavaSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
+ protected ISourceViewer createJavaSourceViewer(
+ Composite parent,
+ IVerticalRuler ruler,
+ int styles) {
return super.createSourceViewer(parent, ruler, styles);
}
ContentAssistTip.image=
ContentAssistTip.description=Content Tip
+Format.label=F&ormat
+Format.tooltip=Format the Selected Text
+Format.description=Format the selected text
+
Comment.label=Comment@Ctrl+/
Comment.tooltip=Comment selected lines
import java.util.Map;
import net.sourceforge.phpdt.internal.compiler.parser.Scanner;
+import net.sourceforge.phpdt.internal.ui.actions.CompositeActionGroup;
import net.sourceforge.phpdt.internal.ui.text.ContentAssistPreference;
import net.sourceforge.phpdt.internal.ui.text.PHPPairMatcher;
import net.sourceforge.phpdt.internal.ui.text.link.LinkedPositionManager;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
+import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.text.AbstractHoverInformationControlManager;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.actions.ActionContext;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.ui.texteditor.IDocumentProvider;
AnnotationType.SEARCH_RESULT,
AnnotationType.WARNING,
AnnotationType.ERROR };
-
/**
* Creates a new php unit editor.
*/
return oldExtension.equals(newExtension);
}
+
+ /*
+ * @see AbstractTextEditor#editorContextMenuAboutToShow(IMenuManager)
+ */
+ public void editorContextMenuAboutToShow(IMenuManager menu) {
+ super.editorContextMenuAboutToShow(menu);
+
+ ActionContext context= new ActionContext(getSelectionProvider().getSelection());
+ fContextMenuGroup.setContext(context);
+ fContextMenuGroup.fillContextMenu(menu);
+ fContextMenuGroup.setContext(null);
+ }
}