import net.sourceforge.phpdt.core.IMember;
import net.sourceforge.phpdt.core.ISourceRange;
import net.sourceforge.phpdt.core.ISourceReference;
-import net.sourceforge.phpdt.core.JavaModelException;
import net.sourceforge.phpdt.core.JavaCore;
+import net.sourceforge.phpdt.core.JavaModelException;
import net.sourceforge.phpdt.internal.ui.actions.CompositeActionGroup;
import net.sourceforge.phpdt.internal.ui.text.HTMLTextPresenter;
+import net.sourceforge.phpdt.internal.ui.text.IPHPPartitions;
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.JavaUI;
import net.sourceforge.phpdt.ui.PreferenceConstants;
-import net.sourceforge.phpdt.ui.actions.GenerateActionGroup;
import net.sourceforge.phpdt.ui.actions.GotoMatchingBracketAction;
import net.sourceforge.phpdt.ui.text.JavaTextTools;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-import net.sourceforge.phpeclipse.phpeditor.php.IPHPPartitionScannerConstants;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextHover;
import org.eclipse.jface.text.ITextInputListener;
-import org.eclipse.jface.text.ITextOperationTarget;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.ITextViewerExtension2;
import org.eclipse.ui.editors.text.DefaultEncodingSupport;
import org.eclipse.ui.editors.text.IEncodingSupport;
import org.eclipse.ui.part.IShowInTargetList;
-import org.eclipse.ui.texteditor.ContentAssistAction;
import org.eclipse.ui.texteditor.DefaultRangeIndicator;
import org.eclipse.ui.texteditor.ExtendedTextEditor;
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.IEditorStatusLine;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
-import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
import org.eclipse.ui.texteditor.MarkerAnnotation;
import org.eclipse.ui.texteditor.ResourceAction;
import org.eclipse.ui.texteditor.TextEditorAction;
protected JavaOutlinePage fOutlinePage;
/** Outliner context menu Id */
protected String fOutlinerContextMenuId;
+ /**
+ * The editor selection changed listener.
+ *
+ * @since 3.0
+ */
+// private EditorSelectionChangedListener fEditorSelectionChangedListener;
/** Indicates whether this editor should react on outline page selection changes */
private int fIgnoreOutlinePageSelection;
private MouseClickListener fMouseListener;
protected CompositeActionGroup fActionGroups;
- /** The standard action groups added to the menu */
- protected GenerateActionGroup fGenerateActionGroup;
protected CompositeActionGroup fContextMenuGroup;
/** The information presenter. */
*/
public PHPEditor() {
super();
- JavaTextTools textTools = PHPeclipsePlugin.getDefault().getJavaTextTools();
- setSourceViewerConfiguration(new PHPSourceViewerConfiguration(textTools, this));
- setRangeIndicator(new DefaultRangeIndicator());
- setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore());
-
- // don't activate this scope without synchronizing plugin.xml !!!
- // setKeyBindingScopes(new String[] { "net.sourceforge.phpdt.ui.phpEditorScope" }); //$NON-NLS-1$
-
- if (PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE))
- fUpdater= new OutlinePageSelectionUpdater();
+ JavaTextTools textTools= PHPeclipsePlugin.getDefault().getJavaTextTools();
+ setSourceViewerConfiguration(new PHPSourceViewerConfiguration(textTools, this)); //, IJavaPartitions.JAVA_PARTITIONING));
+ setRangeIndicator(new DefaultRangeIndicator());
+ IPreferenceStore store= PHPeclipsePlugin.getDefault().getPreferenceStore();
+ setPreferenceStore(store);
+ setKeyBindingScopes(new String[] { "net.sourceforge.phpdt.ui.phpEditorScope" }); //$NON-NLS-1$
+// fMarkOccurrenceAnnotations= store.getBoolean(PreferenceConstants.EDITOR_MARK_OCCURRENCES);
+// fStickyOccurrenceAnnotations= store.getBoolean(PreferenceConstants.EDITOR_STICKY_OCCURRENCES);
+
+ // TODO changed in 3.x ?
+ if (PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE))
+ fUpdater= new OutlinePageSelectionUpdater();
}
- //
- // /**
- // * @see IMember#getCompilationUnit()
- // */
- // public ICompilationUnit getCompilationUnit() {
- // return this;
- // }
- // /**
- // * @see org.phpeclipse.phpdt.internal.compiler.env.ICompilationUnit#getContents()
- // */
- // public char[] getContents() {
- // IDocument doc = this.getDocumentProvider().getDocument(this.getEditorInput());
- //
- // return doc.get().toCharArray();
- // }
+
/*
* @see org.eclipse.ui.texteditor.AbstractTextEditor#updatePropertyDependentActions()
*/
*/
protected void createActions() {
super.createActions();
+
+ ResourceAction resAction= new TextOperationAction(PHPEditorMessages.getResourceBundle(), "ShowJavaDoc.", this, ISourceViewer.INFORMATION, true); //$NON-NLS-1$
+ resAction= new InformationDispatchAction(PHPEditorMessages.getResourceBundle(), "ShowJavaDoc.", (TextOperationAction) resAction); //$NON-NLS-1$
+ resAction.setActionDefinitionId(PHPEditorActionDefinitionIds.SHOW_JAVADOC);
+ setAction("ShowJavaDoc", resAction); //$NON-NLS-1$
+// WorkbenchHelp.setHelp(resAction, IJavaHelpContextIds.SHOW_JAVADOC_ACTION);
+
+ Action action= new GotoMatchingBracketAction(this);
+ action.setActionDefinitionId(PHPEditorActionDefinitionIds.GOTO_MATCHING_BRACKET);
+ setAction(GotoMatchingBracketAction.GOTO_MATCHING_BRACKET, action);
+
+// action= new TextOperationAction(PHPEditorMessages.getResourceBundle(),"ShowOutline.", this, JavaSourceViewer.SHOW_OUTLINE, true); //$NON-NLS-1$
+// action.setActionDefinitionId(PHPEditorActionDefinitionIds.SHOW_OUTLINE);
+// setAction(PHPEditorActionDefinitionIds.SHOW_OUTLINE, action);
+//// WorkbenchHelp.setHelp(action, IJavaHelpContextIds.SHOW_OUTLINE_ACTION);
+//
+// action= new TextOperationAction(PHPEditorMessages.getResourceBundle(),"OpenStructure.", this, JavaSourceViewer.OPEN_STRUCTURE, true); //$NON-NLS-1$
+// action.setActionDefinitionId(PHPEditorActionDefinitionIds.SHOW_OUTLINE.OPEN_STRUCTURE);
+// setAction(PHPEditorActionDefinitionIds.SHOW_OUTLINE.OPEN_STRUCTURE, action);
+//// WorkbenchHelp.setHelp(action, IJavaHelpContextIds.OPEN_STRUCTURE_ACTION);
+//
+// action= new TextOperationAction(PHPEditorMessages.getResourceBundle(),"OpenHierarchy.", this, JavaSourceViewer.SHOW_HIERARCHY, true); //$NON-NLS-1$
+// action.setActionDefinitionId(PHPEditorActionDefinitionIds.SHOW_OUTLINE.OPEN_HIERARCHY);
+// setAction(PHPEditorActionDefinitionIds.SHOW_OUTLINE.OPEN_HIERARCHY, action);
+//// WorkbenchHelp.setHelp(action, IJavaHelpContextIds.OPEN_HIERARCHY_ACTION);
+
+ fEncodingSupport= new DefaultEncodingSupport();
+ fEncodingSupport.initialize(this);
+
+// fSelectionHistory= new SelectionHistory(this);
+//
+// action= new StructureSelectEnclosingAction(this, fSelectionHistory);
+// action.setActionDefinitionId(PHPEditorActionDefinitionIds.SELECT_ENCLOSING);
+// setAction(StructureSelectionAction.ENCLOSING, action);
+//
+// action= new StructureSelectNextAction(this, fSelectionHistory);
+// action.setActionDefinitionId(PHPEditorActionDefinitionIds.SELECT_NEXT);
+// setAction(StructureSelectionAction.NEXT, action);
+//
+// action= new StructureSelectPreviousAction(this, fSelectionHistory);
+// action.setActionDefinitionId(PHPEditorActionDefinitionIds.SELECT_PREVIOUS);
+// setAction(StructureSelectionAction.PREVIOUS, action);
+//
+// StructureSelectHistoryAction historyAction= new StructureSelectHistoryAction(this, fSelectionHistory);
+// historyAction.setActionDefinitionId(PHPEditorActionDefinitionIds.SELECT_LAST);
+// setAction(StructureSelectionAction.HISTORY, historyAction);
+// fSelectionHistory.setHistoryAction(historyAction);
+//
+// action= GoToNextPreviousMemberAction.newGoToNextMemberAction(this);
+// action.setActionDefinitionId(PHPEditorActionDefinitionIds.GOTO_NEXT_MEMBER);
+// setAction(GoToNextPreviousMemberAction.NEXT_MEMBER, action);
+//
+// action= GoToNextPreviousMemberAction.newGoToPreviousMemberAction(this);
+// action.setActionDefinitionId(PHPEditorActionDefinitionIds.GOTO_PREVIOUS_MEMBER);
+// setAction(GoToNextPreviousMemberAction.PREVIOUS_MEMBER, action);
+//
+// action= new QuickFormatAction();
+// action.setActionDefinitionId(PHPEditorActionDefinitionIds.QUICK_FORMAT);
+// setAction(IJavaEditorActionDefinitionIds.QUICK_FORMAT, action);
+//
+// action= new RemoveOccurrenceAnnotations(this);
+// action.setActionDefinitionId(PHPEditorActionDefinitionIds.REMOVE_OCCURRENCE_ANNOTATIONS);
+// setAction("RemoveOccurrenceAnnotations", action); //$NON-NLS-1$
- ResourceAction resAction = new TextOperationAction(PHPEditorMessages.getResourceBundle(), "ShowJavaDoc.", this, ISourceViewer.INFORMATION, true); //$NON-NLS-1$
- resAction = new InformationDispatchAction(PHPEditorMessages.getResourceBundle(), "ShowJavaDoc.", (TextOperationAction) resAction); //$NON-NLS-1$
- resAction.setActionDefinitionId(PHPEditorActionDefinitionIds.SHOW_JAVADOC);
- setAction("ShowJavaDoc", resAction); //$NON-NLS-1$
- // WorkbenchHelp.setHelp(resAction, IJavaHelpContextIds.SHOW_JAVADOC_ACTION);
-
- Action action;
-
- setAction(
- "ContentAssistTip",
- new TextOperationAction(PHPEditorMessages.getResourceBundle(), "ContentAssistTip.", this, ISourceViewer.CONTENTASSIST_CONTEXT_INFORMATION));
-
- action = new ContentAssistAction(PHPEditorMessages.getResourceBundle(), "ContentAssistProposal.", this); //$NON-NLS-1$
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
- setAction("ContentAssistProposal", action); //$NON-NLS-1$
- markAsStateDependentAction("ContentAssistProposal", true); //$NON-NLS-1$
- // WorkbenchHelp.setHelp(action, IJavaHelpContextIds.CONTENT_ASSIST_ACTION);
-
- fEncodingSupport = new DefaultEncodingSupport();
- fEncodingSupport.initialize(this);
-
- action = new TextOperationAction(PHPEditorMessages.getResourceBundle(), "Comment.", this, ITextOperationTarget.PREFIX); //$NON-NLS-1$
- action.setActionDefinitionId(PHPEditorActionDefinitionIds.COMMENT);
- 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); //$NON-NLS-1$
- action.setActionDefinitionId(PHPEditorActionDefinitionIds.UNCOMMENT);
- 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("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);
- setAction(GotoMatchingBracketAction.GOTO_MATCHING_BRACKET, action);
-
- fGenerateActionGroup = new GenerateActionGroup(this, ITextEditorActionConstants.GROUP_EDIT);
-
- 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 });
- // rg,
- // new LocalHistoryActionGroup(this, ITextEditorActionConstants.GROUP_EDIT)});
-
+ // add annotation actions
+ action= new JavaSelectMarkerRulerAction2(PHPEditorMessages.getResourceBundle(), "Editor.RulerAnnotationSelection.", this); //$NON-NLS-1$
+ setAction("AnnotationAction", action); //$NON-NLS-1$
+
// add annotation actions
action= new JavaSelectMarkerRulerAction2(PHPEditorMessages.getResourceBundle(), "Editor.RulerAnnotationSelection.", this); //$NON-NLS-1$
setAction("AnnotationAction", action); //$NON-NLS-1$
fOutlinePage.addSelectionChangedListener(fSelectionChangedListener);
}
}
- protected void updateStateDependentActions() {
- super.updateStateDependentActions();
- fGenerateActionGroup.editorStateChanged();
- }
protected void setSelection(ISourceReference reference, boolean moveCursor) {
return;
}
+// if (PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE.equals(property)) {
+// if ((event.getNewValue() instanceof Boolean) && ((Boolean)event.getNewValue()).booleanValue())
+// fEditorSelectionChangedListener.selectionChanged();
+// return;
+// }
+
+ if (PreferenceConstants.EDITOR_DISABLE_OVERWRITE_MODE.equals(property)) {
+ if (event.getNewValue() instanceof Boolean) {
+ Boolean disable= (Boolean) event.getNewValue();
+ configureInsertMode(OVERWRITE, !disable.booleanValue());
+ }
+ }
+
+// if (PreferenceConstants.EDITOR_MARK_OCCURRENCES.equals(property)) {
+// if (event.getNewValue() instanceof Boolean) {
+// boolean markOccurrenceAnnotations= ((Boolean)event.getNewValue()).booleanValue();
+// if (markOccurrenceAnnotations != fMarkOccurrenceAnnotations) {
+// fMarkOccurrenceAnnotations= markOccurrenceAnnotations;
+// if (!fMarkOccurrenceAnnotations)
+// uninstallOccurrencesFinder();
+// else
+// installOccurrencesFinder();
+// }
+// }
+// }
+// if (PreferenceConstants.EDITOR_STICKY_OCCURRENCES.equals(property)) {
+// if (event.getNewValue() instanceof Boolean) {
+// boolean stickyOccurrenceAnnotations= ((Boolean)event.getNewValue()).booleanValue();
+// if (stickyOccurrenceAnnotations != fStickyOccurrenceAnnotations) {
+// fStickyOccurrenceAnnotations= stickyOccurrenceAnnotations;
+//// if (!fMarkOccurrenceAnnotations)
+//// uninstallOccurrencesFinder();
+//// else
+//// installOccurrencesFinder();
+// }
+// }
+// }
+
} finally {
super.handlePreferenceStoreChanged(event);
}
/** Preference key for print margin ruler column */
protected final static String PRINT_MARGIN_COLUMN = PreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN;
/** Preference key for error indication */
- protected final static String ERROR_INDICATION = PreferenceConstants.EDITOR_PROBLEM_INDICATION;
+// protected final static String ERROR_INDICATION = PreferenceConstants.EDITOR_PROBLEM_INDICATION;
/** Preference key for error color */
- protected final static String ERROR_INDICATION_COLOR = PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR;
+// protected final static String ERROR_INDICATION_COLOR = PreferenceConstants.EDITOR_PROBLEM_INDICATION_COLOR;
/** Preference key for warning indication */
- protected final static String WARNING_INDICATION = PreferenceConstants.EDITOR_WARNING_INDICATION;
+// protected final static String WARNING_INDICATION = PreferenceConstants.EDITOR_WARNING_INDICATION;
/** Preference key for warning color */
- protected final static String WARNING_INDICATION_COLOR = PreferenceConstants.EDITOR_WARNING_INDICATION_COLOR;
+// protected final static String WARNING_INDICATION_COLOR = PreferenceConstants.EDITOR_WARNING_INDICATION_COLOR;
/** Preference key for task indication */
protected final static String TASK_INDICATION = PreferenceConstants.EDITOR_TASK_INDICATION;
/** Preference key for task color */
List segmentation = new ArrayList();
for (int i = 0; i < linePartitioning.length; i++) {
- if (IPHPPartitionScannerConstants.PHP_STRING.equals(linePartitioning[i].getType()))
+ if (IPHPPartitions.PHP_STRING.equals(linePartitioning[i].getType()))
segmentation.add(linePartitioning[i]);
}