Sign in to follow this  
Followers 0
zieliq

Open Resource Plugin for Programming Editors

4 posts in this topic

Hello,

You surely associate the CTRL+SHIFT+R shortcut from Eclipse or Netbeans environment which opens a popup window for searching files in the project.

Well, I've needed similar feature for use in editor like EditPlus, Notepad++, etc.

So here it is.

It is not so beany like its equivalent but works well and meets the need.

Usage:

======

At least you need to run the open_res.au3 file or the compiled exe version.

After few alerts of missing some files the main window of Open Resource will be displayed.

Go to menu/Edit/Configuration and fill the 'Use this dir structure file' field. I attached dummy example dir_structure.dat file. Click 'Apply & Save' button.

Now you can search files in main window.

With default configuration searching will start when you enter at least 3 characters.

Try to find 'sys' or 'ini' or 'Open'. Script should find matching files.

When you click the file item in files listbox the script will try to open it in editor (the default editor is Windows Notepad)

Some files will not be opened because of relative path given in 'dir structure file' or it does not exists in your system.

Main Window Controls:

=====================

Menu/

Edit/Configuration

Edit/Exit

?/About

What to find - the field to enter the pattern of file name you want to open

Case insensitive searching - you know

Search only files - when checked, only files names matching pattern will be included in search result

Matched files - list of files matching search criteria

Create dir structure file button - to simplify creating file with directory and files tree. This button is strictly related to configuration option 'Create dir structure sequence'. In other words: it executes the command entered in configuration.

Configuration Window Controls:

==============================

Create dir structure sequence - the command which will be executed when you click 'Create dir structure file' in main window

Use this dir structure file - path to file containing directory structure of the project you working on

Editor executable file - path to your favourite editor which open the file you were searching for

Start searching after N chars - searching procedure will be fired when you enter at least N characters

Workflow:

=========

Many editors have configurable Users Tools, User Commands and so on. You can define such command, assign external program and shortcut and even pass some arguments like FilePath, FileName, LineNumber or CurrentSelection.

To integrate "Open Resource" script with your favourite editor you should configure editor to run that command "open_res.exe C:\deploys\my_project\Dev\Application\Models\MySqlDataBaseModel.class.php"

Let's suppose you are currently working on the file: "C:\deploys\my_project\Dev\Application\Models\MySqlDataBaseModel.class.php" and you want to open base class "DataBaseModel.class.php":

1. Execute configured command which will call "open_res.exe C:\deploys\my_project\Dev\Application\Models\MySqlDataBaseModel.class.php"

2. open_res script obtain the context path of project you are working on.

3. Search "DBM" (DataBaseModel)

4. You get matching files proposition:

- Dev/Application/Models/DataBaseModel.class.php

- Dev/Application/Models/MySqlDataBaseModel.class.php

- Dev/Application/Models/MSSqlDataBaseModel.class.php

- Dev/Application/Models/MSqlDataBaseModel.class.php

5. Click the file you want to be opened in editor (the first one)

6. At first script will check if path "Dev/Application/Models/DataBaseModel.class.php" is absolute and file exists. Because the path is relative and the file location is unknown script goes to the next step:

7. Script explodes the context path (based on argumend passed to it) and will try to open requested "DataBaseModel.class.php" file in the loop:

- C:\Dev/Application/Models/DataBaseModel.class.php - not found

- C:\deploys\Dev/Application/Models/DataBaseModel.class.php - not found

- C:\deploys\my_project\Dev/Application/Models/DataBaseModel.class.php - hurray!

8. Script fire found file in your editor

Notice: if you are working on other project ex. "my_project_2" with similar dir structure, the context is different and open_res opens the file from other location ("C:\deploys\my_project_2\Dev/Application/Models/DataBaseModel.class.php")

Directory Structure:

====================

The directory structure file can be created in many ways. You can write your own script, run Windows dir Command: "dir /S/B > directory_structure.dat" or execute dedicated bash script.

open_res has a small simple feature to run such script directly form the open_res interface: go to Configuration and complement the "Create dir structure file sequence" field, ex.:

- C:\open_res\create_dir_structure.exe C:\deploys\my_project\

- C:\putty\PLINK.EXE my_login@host -pw my_password "~/open_res/create_dir_structure.sh ~/projects/my_project_2"

I recommend to build directory structure file with relative paths which helps you to easily change the context and switch between projects.

Enjoy.

P.S.

That's one of my first AutoIt script, so all suggestions are kindly welcome.

--

Best regards,

Wojtek

open_res.au3

create_dir_structure.au3

dir_structure.txt

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

I swear to you that I do not understand it!

The main idea? the code? Maybe I can help or explain in other words?

I attach printscreen...

post-64311-0-38057100-1303147835_thumb.p

Edited by zieliq

Share this post


Link to post
Share on other sites

Updated

-FIXED: reloading dir structure file on create

open_res.au3

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0