Package com.python.pydev.refactoring.refactorer.search

Examples of com.python.pydev.refactoring.refactorer.search.AbstractPythonSearchQuery


            description.setText(Messages.format(SearchMessages.ReplaceConfigurationPage_description_many_in_one,
                    arguments));
        }
        description.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1));

        AbstractPythonSearchQuery query = fReplaceRefactoring.getQuery();

        Label label1 = new Label(result, SWT.NONE);
        label1.setText(SearchMessages.ReplaceConfigurationPage_replace_label);

        Text clabel = new Text(result, SWT.BORDER | SWT.READ_ONLY);
        clabel.setText(query.getSearchString());
        GridData gd = new GridData(GridData.FILL_HORIZONTAL);
        gd.widthHint = convertWidthInCharsToPixels(50);
        clabel.setLayoutData(gd);

        Label label2 = new Label(result, SWT.NONE);
        label2.setText(SearchMessages.ReplaceConfigurationPage_with_label);

        fTextField = new Combo(result, SWT.DROP_DOWN);
        gd = new GridData(GridData.FILL_HORIZONTAL);
        gd.widthHint = convertWidthInCharsToPixels(50);
        fTextField.setLayoutData(gd);
        fTextField.setFocus();
        fTextField.addModifyListener(new ModifyListener() {
            public void modifyText(ModifyEvent e) {
                updateOKStatus();
            }
        });

        IDialogSettings settings = PydevPlugin.getDefault().getDialogSettings().getSection(SETTINGS_GROUP);
        if (settings != null) {
            String[] previousReplaceWith = settings.getArray(SETTINGS_REPLACE_WITH);
            if (previousReplaceWith != null) {
                fTextField.setItems(previousReplaceWith);
                fTextField.select(0);
            }
        }

        ComboContentAdapter contentAdapter = new ComboContentAdapter();
        IContentProposalProvider replaceProposer = null;

        //the code below is so that this works in Eclipse 3.3.
        try {
            //new FindReplaceDocumentAdapterContentProposalProvider(false);
            Class<?> class1 = getClass().getClassLoader().loadClass(
                    "org.eclipse.jface.text.FindReplaceDocumentAdapterContentProposalProvider");
            Constructor<?> constructor = class1.getConstructor(Boolean.class);
            replaceProposer = (IContentProposalProvider) constructor.newInstance(false);
        } catch (Throwable e) {
            //just ignore it if we don't succeed
        }

        try {
            fTextFieldContentAssist = new ContentAssistCommandAdapter(fTextField, contentAdapter, replaceProposer,
                    ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, new char[] { '$', '\\' }, true);
        } catch (Throwable e) {
            // Not available in eclipse 3.2
            fTextFieldContentAssist = new ContentAssistCommandAdapter(fTextField, contentAdapter, replaceProposer,
                    ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, new char[] { '$', '\\' });
        }

        new Label(result, SWT.NONE);
        fReplaceWithRegex = new Button(result, SWT.CHECK);
        fReplaceWithRegex.setText(SearchMessages.ReplaceConfigurationPage_isRegex_label);
        fReplaceWithRegex.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                setContentAssistsEnablement(fReplaceWithRegex.getSelection());
            }
        });
        if (query.isRegexSearch()) {
            fReplaceWithRegex.setSelection(true);
        } else {
            fReplaceWithRegex.setSelection(false);
            fReplaceWithRegex.setEnabled(false);
        }
View Full Code Here


    protected void fillContextMenu(IMenuManager mgr) {
        super.fillContextMenu(mgr);
        addSortActions(mgr);
        fActionGroup.setContext(new ActionContext(getSite().getSelectionProvider().getSelection()));
        fActionGroup.fillContextMenu(mgr);
        AbstractPythonSearchQuery query = (AbstractPythonSearchQuery) getInput().getQuery();
        if (query.getSearchString().length() > 0) {
            IStructuredSelection selection = (IStructuredSelection) getViewer().getSelection();
            if (!selection.isEmpty()) {
                ReplaceAction replaceSelection = new ReplaceAction(getSite().getShell(),
                        (PythonFileSearchResult) getInput(), selection.toArray(), true);
                replaceSelection.setText(SearchMessages.ReplaceAction_label_selected);
View Full Code Here

        if (fReplaceString == null) {
            return RefactoringStatus.createFatalErrorStatus(SearchMessages.ReplaceRefactoring_error_no_replace_string);
        }

        Pattern pattern = null;
        AbstractPythonSearchQuery query = getQuery();
        if (query.isRegexSearch()) {
            pattern = createSearchPattern(query);
        }

        RefactoringStatus resultingStatus = new RefactoringStatus();
View Full Code Here

TOP

Related Classes of com.python.pydev.refactoring.refactorer.search.AbstractPythonSearchQuery

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.