import net.sourceforge.phpdt.internal.ui.dialog.StatusInfo;
import net.sourceforge.phpdt.internal.ui.text.template.TemplateVariableProcessor;
import net.sourceforge.phpdt.internal.ui.util.SWTUtil;
+import net.sourceforge.phpdt.ui.text.JavaTextTools;
import net.sourceforge.phpeclipse.IPreferenceConstants;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
import net.sourceforge.phpeclipse.phpeditor.PHPSourceViewerConfiguration;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IDocumentPartitioner;
import org.eclipse.jface.text.ITextListener;
import org.eclipse.jface.text.ITextOperationTarget;
import org.eclipse.jface.text.ITextViewer;
private final IContentAssistProcessor fProcessor;
// SimpleJavaSourceViewerConfiguration(JavaTextTools tools, ITextEditor editor, IContentAssistProcessor processor) {
- SimpleJavaSourceViewerConfiguration(IContentAssistProcessor processor) {
- super();
+ SimpleJavaSourceViewerConfiguration(JavaTextTools tools, IContentAssistProcessor processor) {
+ super(tools, null);
fProcessor= processor;
}
ContentAssistant assistant= new ContentAssistant();
assistant.setContentAssistProcessor(fProcessor, IDocument.DEFAULT_CONTENT_TYPE);
// Register the same processor for strings and single line comments to get code completion at the start of those partitions.
-// assistant.setContentAssistProcessor(fProcessor, JavaPartitionScanner.JAVA_STRING);
+// assistant.setContentAssistProcessor(fProcessor, JavaPartitionScanner.PHP_STRING);
// assistant.setContentAssistProcessor(fProcessor, JavaPartitionScanner.JAVA_SINGLE_LINE_COMMENT);
//
// assistant.setContentAssistProcessor(fProcessor, JavaPartitionScanner.JAVA_DOC);
// assistant.enableAutoInsert(store.getBoolean(ContentAssistPreference.AUTOINSERT));
// assistant.enableAutoActivation(store.getBoolean(ContentAssistPreference.AUTOACTIVATION));
// assistant.setAutoActivationDelay(store.getInt(ContentAssistPreference.AUTOACTIVATION_DELAY));
- assistant.setProposalPopupOrientation(assistant.PROPOSAL_OVERLAY);
- assistant.setContextInformationPopupOrientation(assistant.CONTEXT_INFO_ABOVE);
+ assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
+ assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
// assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));
Display display= sourceViewer.getTextWidget().getDisplay();
private SourceViewer createEditor(Composite parent) {
SourceViewer viewer= new SourceViewer(parent, null, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- // JavaTextTools tools= JavaPlugin.getDefault().getJavaTextTools();
+ JavaTextTools tools= PHPeclipsePlugin.getDefault().getJavaTextTools();
IDocument document= new Document(fTemplate.getPattern());
- // IDocumentPartitioner partitioner= tools.createDocumentPartitioner();
- // document.setDocumentPartitioner(partitioner);
- // partitioner.connect(document);
+ IDocumentPartitioner partitioner= tools.createDocumentPartitioner();
+ document.setDocumentPartitioner(partitioner);
+ partitioner.connect(document);
// viewer.configure(new SimpleJavaSourceViewerConfiguration(tools, null, fProcessor));
- viewer.configure(new SimpleJavaSourceViewerConfiguration(fProcessor));
+ viewer.configure(new SimpleJavaSourceViewerConfiguration(tools, fProcessor));
viewer.setEditable(true);
viewer.setDocument(document);
}
private void initializeActions() {
- TextViewerAction action= new TextViewerAction(fPatternEditor, fPatternEditor.UNDO);
+ TextViewerAction action= new TextViewerAction(fPatternEditor, SourceViewer.UNDO);
action.setText(TemplateMessages.getString("EditTemplateDialog.undo")); //$NON-NLS-1$
fGlobalActions.put(ITextEditorActionConstants.UNDO, action);
- action= new TextViewerAction(fPatternEditor, fPatternEditor.CUT);
+ action= new TextViewerAction(fPatternEditor, SourceViewer.CUT);
action.setText(TemplateMessages.getString("EditTemplateDialog.cut")); //$NON-NLS-1$
fGlobalActions.put(ITextEditorActionConstants.CUT, action);
- action= new TextViewerAction(fPatternEditor, fPatternEditor.COPY);
+ action= new TextViewerAction(fPatternEditor, SourceViewer.COPY);
action.setText(TemplateMessages.getString("EditTemplateDialog.copy")); //$NON-NLS-1$
fGlobalActions.put(ITextEditorActionConstants.COPY, action);
- action= new TextViewerAction(fPatternEditor, fPatternEditor.PASTE);
+ action= new TextViewerAction(fPatternEditor, SourceViewer.PASTE);
action.setText(TemplateMessages.getString("EditTemplateDialog.paste")); //$NON-NLS-1$
fGlobalActions.put(ITextEditorActionConstants.PASTE, action);
- action= new TextViewerAction(fPatternEditor, fPatternEditor.SELECT_ALL);
+ action= new TextViewerAction(fPatternEditor, SourceViewer.SELECT_ALL);
action.setText(TemplateMessages.getString("EditTemplateDialog.select.all")); //$NON-NLS-1$
fGlobalActions.put(ITextEditorActionConstants.SELECT_ALL, action);
- action= new TextViewerAction(fPatternEditor, fPatternEditor.CONTENTASSIST_PROPOSALS);
+ action= new TextViewerAction(fPatternEditor, SourceViewer.CONTENTASSIST_PROPOSALS);
action.setText(TemplateMessages.getString("EditTemplateDialog.content.assist")); //$NON-NLS-1$
fGlobalActions.put("ContentAssistProposal", action); //$NON-NLS-1$