Search in sources :

Example 56 with ILaunchConfiguration

use of org.eclipse.debug.core.ILaunchConfiguration in project jbosstools-hibernate by jbosstools.

the class CodeGenExternalProcessExecutionTest method setUp.

protected void setUp() throws Exception {
    super.setUp();
    this.project = new LaunchConfigTestProject2();
    final String fileNameConsoleConfig = LaunchConfigTestProject2.LAUNCH_CONSOLE_CONFIG_TEST_FILE;
    ILaunchConfiguration launchConfig = loadLaunchConfigFromFile(fileNameConsoleConfig);
    final EclipseLaunchConsoleConfigurationPreferences cfgprefs = new EclipseLaunchConsoleConfigurationPreferences(launchConfig);
    consoleCfg = new ConsoleConfiguration(cfgprefs);
    KnownConfigurations.getInstance().addConfiguration(consoleCfg, true);
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) ConsoleConfiguration(org.hibernate.console.ConsoleConfiguration) EclipseLaunchConsoleConfigurationPreferences(org.hibernate.eclipse.console.EclipseLaunchConsoleConfigurationPreferences) LaunchConfigTestProject2(org.hibernate.eclipse.console.test.project.LaunchConfigTestProject2)

Example 57 with ILaunchConfiguration

use of org.eclipse.debug.core.ILaunchConfiguration in project jbosstools-hibernate by jbosstools.

the class CodeGenExternalProcessExecutionTest method testExecuteExternalLaunchConfig.

public void testExecuteExternalLaunchConfig() {
    IFolder testFolder = project.getTestFolder();
    int nTest = -1;
    try {
        nTest = testFolder.members().length;
    } catch (CoreException e) {
    }
    assertEquals(0, nTest);
    ILaunchConfiguration launchConfig = null;
    ILaunchConfigurationWorkingCopy launchConfigWC = null;
    // 
    final String fileNameCodeGenExtern = LaunchConfigTestProject2.LAUNCH_CODE_GEN_TEST_FILE_EXTERN;
    launchConfig = loadLaunchConfigFromFile(fileNameCodeGenExtern);
    launchConfigWC = null;
    try {
        launchConfigWC = launchConfig.getWorkingCopy();
    } catch (CoreException e) {
    }
    assertNotNull(launchConfigWC);
    launchConfigWC.setAttribute(IExternalToolConstants.ATTR_LAUNCH_IN_BACKGROUND, false);
    DebugUIPlugin.launchInForeground(launchConfigWC, ILaunchManager.RUN_MODE);
    nTest = -1;
    try {
        nTest = testFolder.members().length;
    } catch (CoreException e) {
    }
    // TODO: uncomment when JBIDE-7441 be fixed
    // assertTrue(nTest > 0);
    // 
    final String fileNameCodeGenIntern = LaunchConfigTestProject2.LAUNCH_CODE_GEN_TEST_FILE_INTERN;
    launchConfig = loadLaunchConfigFromFile(fileNameCodeGenIntern);
    launchConfigWC = null;
    try {
        launchConfigWC = launchConfig.getWorkingCopy();
    } catch (CoreException e) {
    }
    assertNotNull(launchConfigWC);
    launchConfigWC.setAttribute(IExternalToolConstants.ATTR_LAUNCH_IN_BACKGROUND, false);
    DebugUIPlugin.launchInForeground(launchConfigWC, ILaunchManager.RUN_MODE);
    nTest = -1;
    try {
        nTest = testFolder.members().length;
    } catch (CoreException e) {
    }
    assertTrue(nTest > 0);
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) CoreException(org.eclipse.core.runtime.CoreException) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) IFolder(org.eclipse.core.resources.IFolder)

Example 58 with ILaunchConfiguration

use of org.eclipse.debug.core.ILaunchConfiguration in project jbosstools-hibernate by jbosstools.

the class CodeGenExternalProcessExecutionTest method loadLaunchConfigFromFile.

public ILaunchConfiguration loadLaunchConfigFromFile(String fileName) {
    IPath path = new Path(fileName);
    IFile ifile = getProject().getIProject().getFile(path);
    ILaunchConfiguration launchConfig = launchManager.getLaunchConfiguration((IFile) ifile);
    return launchConfig;
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) IFile(org.eclipse.core.resources.IFile) IPath(org.eclipse.core.runtime.IPath)

Example 59 with ILaunchConfiguration

use of org.eclipse.debug.core.ILaunchConfiguration in project jbosstools-hibernate by jbosstools.

the class ConnectionProfileRenameParticipant method createChange.

@Override
public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
    ILaunchConfiguration[] configs = HibernateRefactoringUtil.getAffectedLaunchConfigurations(profile);
    List<Change> changes = new ArrayList<Change>();
    Change change = null;
    for (int i = 0; i < configs.length; i++) {
        change = new ConnectionProfileRenameChange(configs[i], profile, getArguments());
        changes.add(change);
    }
    return HibernateRefactoringUtil.createChangesFromList(changes, getName());
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) ArrayList(java.util.ArrayList) Change(org.eclipse.ltk.core.refactoring.Change)

Example 60 with ILaunchConfiguration

use of org.eclipse.debug.core.ILaunchConfiguration in project jbosstools-hibernate by jbosstools.

the class RenameResourceParticipant method createChange.

/* (non-Javadoc)
	 * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#createChange(org.eclipse.core.runtime.IProgressMonitor)
	 */
public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
    ILaunchConfiguration[] configs = HibernateRefactoringUtil.getAffectedConsoleConfigs(fResource.getFullPath());
    List<Change> changes = new ArrayList<Change>();
    Change change = null;
    for (int i = 0; i < configs.length; i++) {
        ConsoleConfiguration cc = KnownConfigurations.getInstance().find(configs[i].getName());
        if (cc != null) {
            cc.reset();
        }
        change = new LaunchConfigurationResourceNameChange(configs[i], fResource.getFullPath(), fResource.getParent().getFullPath().append(getArguments().getNewName()));
        changes.add(change);
    }
    configs = HibernateRefactoringUtil.getAffectedCodeGenerationConfigs(fResource.getFullPath());
    for (int i = 0; i < configs.length; i++) {
        change = new CodeGenerationResourceNameChange(configs[i], fResource.getFullPath(), fResource.getParent().getFullPath().append(getArguments().getNewName()));
        changes.add(change);
    }
    return HibernateRefactoringUtil.createChangesFromList(changes, getName());
}
Also used : ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) ConsoleConfiguration(org.hibernate.console.ConsoleConfiguration) ArrayList(java.util.ArrayList) Change(org.eclipse.ltk.core.refactoring.Change)

Aggregations

ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfiguration)275 CoreException (org.eclipse.core.runtime.CoreException)100 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)79 Test (org.junit.Test)72 ILaunchConfigurationType (org.eclipse.debug.core.ILaunchConfigurationType)51 ILaunchManager (org.eclipse.debug.core.ILaunchManager)41 ArrayList (java.util.ArrayList)37 ILaunch (org.eclipse.debug.core.ILaunch)37 IPath (org.eclipse.core.runtime.IPath)20 IProject (org.eclipse.core.resources.IProject)19 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)17 IStatus (org.eclipse.core.runtime.IStatus)16 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)16 IEditorPart (org.eclipse.ui.IEditorPart)15 IProcess (org.eclipse.debug.core.model.IProcess)14 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)14 IFile (org.eclipse.core.resources.IFile)13 Status (org.eclipse.core.runtime.Status)13 CachegrindViewPart (org.eclipse.linuxtools.internal.valgrind.cachegrind.CachegrindViewPart)13 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)11