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;
// protected PHPActionGroup fActionGroups;
/** The outline page */
- private PHPContentOutlinePage fOutlinePage;
+ private AbstractContentOutlinePage fOutlinePage;
// protected PHPSyntaxParserThread fValidationThread = null;
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;
* Update the hovering behavior depending on the preferences.
*/
private void updateHoverBehavior() {
- SourceViewerConfiguration configuration= getSourceViewerConfiguration();
- String[] types= configuration.getConfiguredContentTypes(getSourceViewer());
+ SourceViewerConfiguration configuration = getSourceViewerConfiguration();
+ String[] types = configuration.getConfiguredContentTypes(getSourceViewer());
- for (int i= 0; i < types.length; i++) {
-
- String t= types[i];
-
- int[] stateMasks= configuration.getConfiguredTextHoverStateMasks(getSourceViewer(), t);
+ for (int i = 0; i < types.length; i++) {
- ISourceViewer sourceViewer= getSourceViewer();
+ String t = types[i];
+
+ 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);
+ 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);
}
} else {
- ITextHover textHover= configuration.getTextHover(sourceViewer, t);
- ((ITextViewerExtension2)sourceViewer).setTextHover(textHover, t, ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
+ ITextHover textHover = configuration.getTextHover(sourceViewer, t);
+ ((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);
}
}
-
+
/*
* @see net.sourceforge.phpdt.internal.ui.viewsupport.IViewPartInputProvider#getViewPartInput()
*/
return fActionGroups;
}
- public PHPContentOutlinePage getfOutlinePage() {
+ public AbstractContentOutlinePage getfOutlinePage() {
return fOutlinePage;
}
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(
* disposal actions required by the php editor.
*/
public void dispose() {
- // PHPEditorEnvironment.disconnect(this);
+ // PHPEditorEnvironment.disconnect(this);
if (fOutlinePage != null)
fOutlinePage.setInput(null);
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() {
*/
protected void initializeEditor() {
IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
- // PHPEditorEnvironment.connect(this);
+ // PHPEditorEnvironment.connect(this);
// store.addPropertyChangeListener(new IPropertyChangeListener() {
// public void propertyChange(PropertyChangeEvent event) {
int styles) {
return super.createSourceViewer(parent, ruler, styles);
}
-
+
/*
* @see AbstractTextEditor#affectsTextPresentation(PropertyChangeEvent)
*/
protected boolean affectsTextPresentation(PropertyChangeEvent event) {
- JavaTextTools textTools= PHPeclipsePlugin.getDefault().getJavaTextTools();
+ JavaTextTools textTools = PHPeclipsePlugin.getDefault().getJavaTextTools();
return textTools.affectsBehavior(event);
}
}