출처 : http://divestudy.tistory.com/17

Eclipse에서 run configuration을 적용하여 프로그램을 실행할 경우 더럽게 귀찮다.


그래서 단축키를 지정해주고 싶었는데 단축키 따윈 없음.


그러다가 찾은 방법임.


엄청 간단함. 은 아니고 생각보단 간단함.


먼저 Help > install new software 선택 후 주소창에 입력 후 work with 에  아래 주소 입력 후 설치

http://puremvcnotificationviewer.googlecode.com/svn/trunk/PracticallyMacroGoogleUpdateSite



설치 완료 되었으면


1. Window > preference 선택 후 "Practically Macro Options"  섹션을 확장하고 Editor Macro Definitor 선택

(귀찮이면 검색창에 "Editor Macro Definitor" 입력)


2. new 버튼 누르고


3. dlg 생기면 오른쪽 리스트에서 Editor Macro script 누르고 가운데 add-> 버튼 누름 그러면 editor 창이 뜸.


4. 기본으로 써있는 텍스트 지우고

 

//Scripts are beanshell format (see http://www.beanshell.org/)
 
//variable               type
//styledText             the org.eclipse.swt.custom.StyledText instance for the current editor
//console                write output to the macro console via console.write(String), .writeln(String), .write(Exception)
//findTarget             the instance of org.eclipse.jface.text.IFindReplaceTarget
import org.eclipse.swt.custom.StyledText;
import org.eclipse.jface.text.IFindReplaceTarget;
 
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.ui.DebugUITools;
    try
    {
      // Terminate process if it already exists from a previous launch
      org.eclipse.debug.core.ILaunch[] allLaunches=DebugPlugin.getDefault().getLaunchManager().getLaunches();
      for (ILaunch l : allLaunches)
      {             
        if (l.getLaunchConfiguration().getName().equals("configuration 이름 입력"))
        {
          console.write("terminating launch: " );
          console.writeln(l.getLaunchConfiguration().getName());
          l.terminate();
          break;
        }
      }
 
        org.eclipse.debug.core.ILaunchConfiguration[] allConfigurations=DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations();
        for (ILaunchConfiguration config : allConfigurations) {
            if (config.getName().equals("configuration 이름 입력"))
            {
                DebugUITools.launch(config, "debug or run");
                break;
            }
        }
    } catch (CoreException e) {
        e.printStackTrace();
    }
    finally{}


 

"20번과 31번째 줄에서 "configuration 이름 입력" 이부분에 configuration 이름을 입력하면 됨. 

33번째 줄의 "Debug or Run" 에는 상황에 맞게 debug 또는 run을 입력하고 OK 버튼을 누르면 됨


5. 아래 Macro info에 이름을 적어주고 (이름은 나중에 확인해야 하므로 가급적 알아보기 쉬운걸로 하는걸 권장)

id 입력 id는 중복만 안되면 되니깐 아무거나 사용하면됨.


6. 다시 한번 OK 버튼을 눌러서 preference 창을 닫는다. 


7. 다시 Window > preference 선택하여 preference 창을 연다.


8. General 섹션의 keys 를 누른다. type filter text에서 key로 검색해도 됨.


9 가운데 command들 중에서 5번에서 적어준 이름을 찾은 후 선택


10. 왼쪽 아래에 Binding 에 원하는 바로가키 키를 누른다. 


11 ok 버튼을 누른다.


그럼 끝!!!!

+ Recent posts