Search in sources :

Example 1 with PySearchInOpenDocumentsAction

use of com.python.pydev.refactoring.ui.findreplace.PySearchInOpenDocumentsAction in project Pydev by fabioz.

the class ActionCreatorPyEditListener method onCreateActions.

@Override
public void onCreateActions(ListResourceBundle resources, BaseEditor baseEditor, IProgressMonitor monitor) {
    PyEdit edit = (PyEdit) baseEditor;
    edit.addOfflineActionListener("r", new PyRenameInFileAction(edit), "Rename occurrences in file", false);
    edit.addOfflineActionListener("s", new PySearchInOpenDocumentsAction(edit), "Search in open documents", true);
    edit.addOfflineActionListener("pip", new PyPipEditorAction(edit), "Execute pip actions", true);
    edit.addOfflineActionListener("pipenv", new PyPipenvEditorAction(edit), "Execute pipenv actions", true);
    edit.addOfflineActionListener("conda", new CondaEditorAction(edit), "Execute conda actions", true);
// Experimental code for creating a class derived of a class that's not public! -- depends on javassist.
// try {
// ClassLoader classLoader = IEditorStatusLine.class.getClassLoader();
// ProtectionDomain protectionDomain = IEditorStatusLine.class.getProtectionDomain();
// 
// 
// ClassPool pool = ClassPool.getDefault();
// pool.insertClassPath(new ClassClassPath(this.getClass()));
// final CtClass ctClassNew = pool.makeClass("org.eclipse.ui.texteditor.PydevFindReplaceDialog");
// 
// CtClass ctClassOriginal = pool.get("org.eclipse.ui.texteditor.FindReplaceDialog");
// ctClassNew.setModifiers(Modifier.PUBLIC);
// ctClassNew.setSuperclass(ctClassOriginal);
// 
// CtMethod afterCreateContents = CtNewMethod.make(
// "public void createContents(org.eclipse.swt.widgets.Composite parent){" +
// "super.createContents(parent);" +
// "System.out.println(\"test\");" +
// "}", ctClassNew);
// ctClassNew.addMethod(afterCreateContents);
// final Class class1 = ctClassNew.toClass(classLoader, protectionDomain);
// RunInUiThread.async(new Runnable() {
// 
// public void run() {
// Object newInstance;
// try {
// newInstance = class1.getConstructor(Shell.class).newInstance(PyAction.getShell());
// System.out.println(newInstance);
// } catch (Throwable e) {
// e.printStackTrace();
// }
// }
// });
// } catch (Exception e) {
// e.printStackTrace();//ignored
// }
// Removed because the way the action was done is not really maintainable.
// 
// // -------------------------------------------------------------------------------------
// // Find/Replace
// FindReplaceAction action = new FindReplaceAction(resources, "Editor.FindReplace.", edit);
// action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE);
// action.setId("org.python.pydev.editor.actions.findAndReplace");
// edit.setAction(ITextEditorActionConstants.FIND, action);
}
Also used : PySearchInOpenDocumentsAction(com.python.pydev.refactoring.ui.findreplace.PySearchInOpenDocumentsAction) PyEdit(org.python.pydev.editor.PyEdit)

Aggregations

PySearchInOpenDocumentsAction (com.python.pydev.refactoring.ui.findreplace.PySearchInOpenDocumentsAction)1 PyEdit (org.python.pydev.editor.PyEdit)1