[Pydev-cvs] org.python.pydev/src/org/python/pydev/editor PyEditConfiguration.java,1.36,1.37 PyEdit.j
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2005-09-24 15:31:04
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1618/src/org/python/pydev/editor Modified Files: PyEditConfiguration.java PyEdit.java Log Message: Index: PyEditConfiguration.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/PyEditConfiguration.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** PyEditConfiguration.java 23 Sep 2005 01:19:36 -0000 1.36 --- PyEditConfiguration.java 24 Sep 2005 15:30:55 -0000 1.37 *************** *** 29,34 **** import org.eclipse.swt.SWT; import org.eclipse.swt.custom.StyleRange; - import org.eclipse.swt.graphics.Color; - import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; --- 29,32 ---- *************** *** 40,43 **** --- 38,43 ---- import org.python.pydev.editor.hover.PyAnnotationHover; import org.python.pydev.editor.hover.PyTextHover; + import org.python.pydev.editor.simpleassist.SimpleAssistProcessor; + import org.python.pydev.editor.simpleassist.SimpleContentAssistant; import org.python.pydev.plugin.PydevPlugin; import org.python.pydev.plugin.PydevPrefs; *************** *** 248,253 **** //delay and auto activate set on PyContentAssistant constructor. ! Color bgColor = colorCache.getColor(new RGB(230, 255, 230)); ! pyContentAssistant.setProposalSelectorBackground(bgColor); pyContentAssistant.setDocumentPartitioning(PyPartitionScanner.PYTHON_PARTITION_TYPE); --- 248,253 ---- //delay and auto activate set on PyContentAssistant constructor. ! // Color bgColor = colorCache.getColor(new RGB(230, 255, 230)); ! // pyContentAssistant.setProposalSelectorBackground(bgColor); pyContentAssistant.setDocumentPartitioning(PyPartitionScanner.PYTHON_PARTITION_TYPE); *************** *** 276,281 **** //delay and auto activate set on PyContentAssistant constructor. ! Color bgColor = colorCache.getColor(new RGB(230, 255, 230)); ! assistant.setProposalSelectorBackground(bgColor); assistant.setDocumentPartitioning(PyPartitionScanner.PYTHON_PARTITION_TYPE); --- 276,281 ---- //delay and auto activate set on PyContentAssistant constructor. ! // Color bgColor = colorCache.getColor(new RGB(230, 255, 230)); ! // assistant.setProposalSelectorBackground(bgColor); assistant.setDocumentPartitioning(PyPartitionScanner.PYTHON_PARTITION_TYPE); *************** *** 283,286 **** --- 283,316 ---- } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentAssistant(org.eclipse.jface.text.source.ISourceViewer) + */ + public SimpleContentAssistant getSimpleAssistant(ISourceViewer sourceViewer) { + // create a content assistant: + SimpleContentAssistant assistant = new SimpleContentAssistant(); + + // next create a content assistant processor to populate the completions window + IContentAssistProcessor processor = new SimpleAssistProcessor(this.getEdit()); + + // Correction assist works only on default content + assistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE); + assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer)); + + //delay and auto activate set on PyContentAssistant constructor. + + // Color bgColor = colorCache.getColor(new RGB(230, 255, 230)); + // assistant.setProposalSelectorBackground(bgColor); + assistant.setDocumentPartitioning(PyPartitionScanner.PYTHON_PARTITION_TYPE); + + assistant.enableAutoActivation(true); + assistant.setAutoActivationDelay(0); + assistant.enableAutoInsert(false); + + return assistant; + } + // The presenter instance for the information window private static final DefaultInformationControl.IInformationPresenter presenter = new DefaultInformationControl.IInformationPresenter() { Index: PyEdit.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/PyEdit.java,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** PyEdit.java 20 Sep 2005 19:53:00 -0000 1.63 --- PyEdit.java 24 Sep 2005 15:30:55 -0000 1.64 *************** *** 387,392 **** --- 387,396 ---- private static final String CORRECTIONASSIST_PROPOSAL_ID = "org.python.pydev.editors.PyEdit.CorrectionAssist"; + private static final String SIMPLEASSIST_PROPOSAL_ID = "org.python.pydev.editors.PyEdit.SimpleAssist"; + public static final int CORRECTIONASSIST_PROPOSALS = 999777; + public static final int SIMPLEASSIST_PROPOSALS = 999778; + private static class MyResources extends ListResourceBundle { public Object[][] getContents() { *************** *** 415,418 **** --- 419,431 ---- setActionActivationCode(CORRECTIONASSIST_PROPOSAL_ID, '1', -1, SWT.CTRL); + // ------------------------------------------------------------------------------------- + //simple assistant for extending later + action = new TextOperationAction(resources, "SimpleAssist", this, SIMPLEASSIST_PROPOSALS); //$NON-NLS-1$ + + action.setActionDefinitionId(SIMPLEASSIST_PROPOSAL_ID); + setAction(SIMPLEASSIST_PROPOSAL_ID, action); //$NON-NLS-1$ + // markAsStateDependentAction(SIMPLEASSIST_PROPOSAL_ID, true); //$NON-NLS-1$ + // setActionActivationCode(SIMPLEASSIST_PROPOSAL_ID, 'c', -1, SWT.NONE); + // This action will fire a CONTENTASSIST_PROPOSALS operation // when executed |