org.eclipse.debug.ui.DebugUITools Java Examples

The following examples show how to use org.eclipse.debug.ui.DebugUITools. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EnginePreferencesInitializer.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void initializeDefaultPreferences() {
    final IPreferenceStore store = EnginePlugin.getDefault().getPreferenceStore();
    store.setDefault(EnginePreferenceConstants.CURRENT_CONFIG, EnginePreferenceConstants.DEFAULT_CONFIG);
    store.setDefault(EnginePreferenceConstants.REMOTE_DEPLOYMENT_CHOICE, EnginePreferenceConstants.STANDARD_MODE);
    store.setDefault(EnginePreferenceConstants.TOGGLE_STATE_FOR_NO_INITIATOR, MessageDialogWithToggle.NEVER);
    store.setDefault(EnginePreferenceConstants.TOGGLE_STATE_FOR_CONTRACT_AND_NOFORM_AND_INITIATOR,
            MessageDialogWithToggle.NEVER);
    store.setDefault(EnginePreferenceConstants.DROP_BUSINESS_DATA_DB_ON_EXIT_PREF, false);
    store.setDefault(EnginePreferenceConstants.DROP_BUSINESS_DATA_DB_ON_INSTALL, false);
    store.setDefault(DesignerPreferenceConstants.FORCE_INTERNAL_FORM_MAPPING, true);
    store.setDefault(EnginePreferenceConstants.LAZYLOAD_ENGINE, false);
    store.setDefault(EnginePreferenceConstants.TOMCAT_XMX_OPTION, 1024);
    store.setDefault(EnginePreferenceConstants.TOMCAT_EXTRA_PARAMS, getDefaultOr(EnginePreferenceConstants.TOMCAT_EXTRA_PARAMS,"-DnoCacheCustomPage=true"));

    if (PlatformUI.isWorkbenchRunning()) {
        DebugUITools.getPreferenceStore().setValue(
                org.eclipse.debug.internal.ui.IInternalDebugUIConstants.PREF_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH,
                MessageDialogWithToggle.NEVER);
    }
}
 
Example #2
Source File: ProcessServerOutputStream.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Checks if the last thing entered was a new line, and if it was, notifies clients about it.
 */
private void checkFinishedLine() {
    String s = this.toString();
    this.reset();
    char c;
    if (s.length() > 0 && ((c = s.charAt(s.length() - 1)) == '\n' || c == '\r')) {
        IAdaptable context = DebugUITools.getDebugContext();
        if (context != null) {
            s = StringUtils.rightTrim(s);
            Object adapter = context.getAdapter(IDebugTarget.class);
            if (adapter instanceof AbstractDebugTarget) {
                AbstractDebugTarget target = (AbstractDebugTarget) adapter;

                for (IConsoleInputListener listener : participants) {
                    listener.newLineReceived(s, target);
                }
            }
        }
    }
}
 
Example #3
Source File: LaunchShortcut.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Resolves a type that can be launched from the given scope and launches in the
 * specified mode.
 * 
 * @param scope the XDS elements to consider for a type that can be launched
 * @param mode launch mode
 * @param emptyMessage error message when no types are resolved for launching
 */
private void searchAndLaunch(Object[] scope, String mode, String emptyMessage) {
	IProject xdsProject = selectXdsProject(scope, emptyMessage);
	if (xdsProject != null) {
		ILaunchConfigurationType launchConfigType = getConfigurationType(LAUNCH_CONFIG_TYPE_ID);
           List<ILaunchConfiguration> configs = getLaunchConfigurations(xdsProject, launchConfigType).collect(Collectors.toList());
           ILaunchConfiguration config = null;
           if (!configs.isEmpty()) {
           	config = selectConfiguration(configs);
           	if (config == null) {
           		return;
           	}
           }
           if (config == null) {
           	config = createConfiguration(xdsProject);
           }
           if (config != null) {
               DebugUITools.launch(config, mode);
           }
	}
}
 
Example #4
Source File: AbstractLaunchDelegate.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
protected static void openEditConfigurationPrompt(final ILaunchConfiguration configuration, final String message) {
	 Display.getDefault().asyncExec(new Runnable() {
         @Override
         public void run() {
             if (SWT.YES == SWTFactory.ShowMessageBox(
                     null,
                     Messages.AbstractLaunchDelegate_ProblemOccured,
                     String.format(Messages.AbstractLaunchDelegate_ProblemDescriptionAndAskToEdit,
                                   configuration.getName(), message),
                     SWT.YES | SWT.NO | SWT.ICON_QUESTION)) 
             {
                 IStructuredSelection selection = new StructuredSelection(configuration);
                 DebugUITools.openLaunchConfigurationDialogOnGroup(SwtUtils.getDefaultShell(), selection, IDebugUIConstants.ID_RUN_LAUNCH_GROUP);
             }
        }
     });
}
 
Example #5
Source File: DebugScriptAction.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void run( IAction action )
{
	ModuleHandle handle = null;

	if (handle == null )
	{
		FormEditor editor = UIUtil.getActiveReportEditor( false );
		if (editor instanceof MultiPageReportEditor)
		{
			handle = ((MultiPageReportEditor)editor).getModel( );
		}
	}
	if (handle != null)
	{
		String fileName = handle.getFileName( );
		
		ILaunchConfiguration config = ScriptLaunchShortcut.findLaunchConfiguration( fileName, ScriptLaunchShortcut.getConfigurationType( ) );
		if (config != null) {
			DebugUITools.launch(config, "debug");//$NON-NLS-1$
		}	
	}
}
 
Example #6
Source File: ScriptLaunchShortcut.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void launch( IEditorPart editor, String mode )
{
	Object obj = editor.getEditorInput( );
	if ( !( obj instanceof FileEditorInput ) )
	{
		return;
	}

	FileEditorInput input = (FileEditorInput) obj;
	String fileName = input.getPath( ).toOSString( );
	ILaunchConfiguration config = findLaunchConfiguration( fileName,
			getConfigurationType( ) );
	if ( config != null )
	{
		DebugUITools.launch( config, mode );
	}

}
 
Example #7
Source File: HybridProjectLaunchShortcut.java    From thym with Eclipse Public License 1.0 6 votes vote down vote up
private void launch(IProject project) {
	try {
		HybridProject hp = HybridProject.getHybridProject(project);
		if(!validateBuildToolsReady() 
				|| !shouldProceedWithLaunch(hp)
				|| !RequirementsUtility.checkCordovaRequirements() ){
			return;
		}
		ILaunchConfiguration launchConfig = findOrCreateLaunchConfiguration(project);
		ILaunchConfigurationWorkingCopy wc = launchConfig.getWorkingCopy();
		updateLaunchConfiguration(wc);
		launchConfig = wc.doSave();
		DebugUITools.launch(launchConfig, "run");
		
	} catch (CoreException e) {
		if (e.getCause() instanceof IOException) {
			Status status = new Status(IStatus.ERROR, HybridUI.PLUGIN_ID,
					"Unable to complete the build for target plarform",
					e.getCause());
			StatusManager.handle(status);
		}else{
			StatusManager.handle(e);
		}
	}
}
 
Example #8
Source File: SimulationView.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void run() {
	Display.getDefault().asyncExec(new Runnable() {

		@Override
		public void run() {
			IDebugTarget[] debugTargets = debugTarget.getLaunch().getDebugTargets();
			for (IDebugTarget current : debugTargets) {
				ILaunch launch = current.getLaunch();
				SCTDebugTarget target = (SCTDebugTarget) launch.getDebugTarget();
				try {
					target.getLaunch().terminate();
				} catch (CoreException e) {
					e.printStackTrace();
				}
			}
			ILaunchConfiguration launchConfiguration = debugTarget.getLaunch().getLaunchConfiguration();
			DebugUITools.launch(launchConfiguration, debugTarget.getLaunch().getLaunchMode());
		}
	});
}
 
Example #9
Source File: LaunchHandler.java    From corrosion with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Looks up an existing cargo test launch configuration with the arguments
 * specified in {@code command} for the given {@code project}. If no such launch
 * configuration exists, creates a new one. The launch configuration is then
 * run.
 *
 * @param command rls.run command with all information needed to run cargo test
 * @param project the context project for which the launch configuration is
 *                looked up / created
 */
private static void createAndStartCargoTest(RLSRunCommand command, IProject project) {
	CargoArgs args = CargoArgs.fromAllArguments(command.args);
	Map<String, String> envMap = command.env;

	ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
	ILaunchConfigurationType type = manager
			.getLaunchConfigurationType(CargoTestDelegate.CARGO_TEST_LAUNCH_CONFIG_TYPE_ID);
	try {
		// check if launch config already exists
		ILaunchConfiguration[] launchConfigurations = manager.getLaunchConfigurations(type);

		Set<Entry<String, String>> envMapEntries = envMap.entrySet();
		// prefer running existing launch configuration with same parameters
		ILaunchConfiguration launchConfig = Arrays.stream(launchConfigurations)
				.filter((l) -> matchesTestLaunchConfig(l, project, args, envMapEntries)).findAny()
				.orElseGet(() -> createCargoLaunchConfig(manager, type, project, args, envMap));

		if (launchConfig != null) {
			DebugUITools.launch(launchConfig, ILaunchManager.RUN_MODE);
		}
	} catch (CoreException e) {
		CorrosionPlugin.logError(e);
	}
}
 
Example #10
Source File: AbstractRunnerLaunchShortcut.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Launch a file, using the file information, which means using default launch configurations.
 */
protected void launchFile(IFile originalFileToRun, String mode) {
	final String runnerId = getRunnerId();
	final String path = originalFileToRun.getFullPath().toOSString();
	final URI moduleToRun = URI.createPlatformResourceURI(path, true);

	final String implementationId = chooseImplHelper.chooseImplementationIfRequired(runnerId, moduleToRun);
	if (implementationId == ChooseImplementationHelper.CANCEL)
		return;

	RunConfiguration runConfig = runnerFrontEnd.createConfiguration(runnerId,
			implementationId != null ? new N4JSProjectName(implementationId) : null,
			moduleToRun);

	ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
	ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(getLaunchConfigTypeID());
	DebugUITools.launch(runConfigConverter.toLaunchConfiguration(type, runConfig), mode);
	// execution dispatched to proper delegate LaunchConfigurationDelegate
}
 
Example #11
Source File: AbstractSarlLaunchShortcut.java    From sarl with Apache License 2.0 6 votes vote down vote up
/**
 * Returns a configuration from the given collection of configurations that should be launched,
 * or {@code null} to cancel. Default implementation opens a selection dialog that allows
 * the user to choose one of the specified launch configurations.  Returns the chosen configuration,
 * or {@code null} if the user cancels.
 *
 * @param configList list of configurations to choose from.
 * @return configuration to launch or {@code null} to cancel.
 */
@SuppressWarnings("static-method")
protected ILaunchConfiguration chooseConfiguration(List<ILaunchConfiguration> configList) {
	final IDebugModelPresentation labelProvider = DebugUITools.newDebugModelPresentation();
	final ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
	dialog.setElements(configList.toArray());
	dialog.setTitle(Messages.AbstractSarlLaunchShortcut_0);
	dialog.setMessage(Messages.AbstractSarlLaunchShortcut_1);
	dialog.setMultipleSelection(false);
	final int result = dialog.open();
	labelProvider.dispose();
	if (result == Window.OK) {
		return (ILaunchConfiguration) dialog.getFirstResult();
	}
	return null;
}
 
Example #12
Source File: AbstractSarlLaunchShortcut.java    From sarl with Apache License 2.0 6 votes vote down vote up
/**
 * Launches the given element type in the specified mode.
 *
 * @param projectName the name of the project.
 * @param fullyQualifiedName the element name.
 * @param mode launch mode
 * @throws CoreException if something is going wrong.
 */
protected void launch(String projectName, String fullyQualifiedName, String mode)
		throws CoreException {
	final List<ILaunchConfiguration> configs = getCandidates(projectName, fullyQualifiedName);
	ILaunchConfiguration config = null;
	final int count = configs.size();
	if (count == 1) {
		config = configs.get(0);
	} else if (count > 1) {
		config = chooseConfiguration(configs);
		if (config == null) {
			return;
		}
	}
	if (config == null) {
		config = createConfiguration(projectName, fullyQualifiedName);
	}
	if (config != null) {
		DebugUITools.launch(config, mode);
	}
}
 
Example #13
Source File: TestResultsView.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Invoked when user performs {@link #actionStop}.
 */
protected void performStop() {
	IProcess process = DebugUITools.getCurrentProcess();
	if (process == null) {
		return;
	}
	final TestSession session = from(registeredSessions).firstMatch(s -> s.root == currentRoot).orNull();
	if (null != session) {
		ILaunch launch = process.getLaunch();
		ILaunchConfiguration runningConfig = launch.getLaunchConfiguration();
		ILaunchConfiguration sessionConfig = getLaunchConfigForSession(session, null);
		if (runningConfig.getName() == sessionConfig.getName()) { // we use "==" since the name is the same instance
			List<ITerminate> targets = collectTargets(process);
			targets.add(process);
			DebugCommandService service = DebugCommandService
					.getService(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
			service.executeCommand(ITerminateHandler.class, targets.toArray(), null);
			session.root.stopRunning();
			refreshActions();
		}
	}
}
 
Example #14
Source File: WebAppProjectCreator.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
protected void createLaunchConfig(IProject project) throws CoreException {
  // If the default SDK is GWT 2.7 or greater, turn on GWT super dev mode by default.
  boolean turnOnGwtSuperDevMode = GwtVersionUtil.isGwtVersionGreaterOrEqualTo27(JavaCore.create(project));

  ILaunchConfigurationWorkingCopy wc = WebAppLaunchUtil.createLaunchConfigWorkingCopy(project.getName(), project,
      WebAppLaunchUtil.determineStartupURL(project, false), false, turnOnGwtSuperDevMode);
  ILaunchGroup[] groups = DebugUITools.getLaunchGroups();

  ArrayList<String> groupsNames = new ArrayList<String>();
  for (ILaunchGroup group : groups) {
    if (IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP.equals(group.getIdentifier())
        || IDebugUIConstants.ID_RUN_LAUNCH_GROUP.equals(group.getIdentifier())) {
      groupsNames.add(group.getIdentifier());
    }
  }

  wc.setAttribute(IDebugUIConstants.ATTR_FAVORITE_GROUPS, groupsNames);
  wc.doSave();
}
 
Example #15
Source File: AbstractLaunchShortcut.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * COPIED/MODIFIED from AntLaunchShortcut
 */
protected ILaunchConfiguration chooseConfig(List<ILaunchConfiguration> configs) {
    if (configs.isEmpty()) {
        return null;
    }
    ILabelProvider labelProvider = DebugUITools.newDebugModelPresentation();
    ElementListSelectionDialog dialog = new ElementListSelectionDialog(Display.getDefault().getActiveShell(),
            labelProvider);
    dialog.setElements(configs.toArray(new ILaunchConfiguration[configs.size()]));
    dialog.setTitle("Pick a Python configuration");
    dialog.setMessage("Choose a python configuration to run");
    dialog.setMultipleSelection(false);
    int result = dialog.open();
    labelProvider.dispose();
    if (result == Window.OK) {
        return (ILaunchConfiguration) dialog.getFirstResult();
    } else {
        return null;
    }
}
 
Example #16
Source File: AbstractLaunchShortcut.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Launch the given targets in the given build file. The targets are
 * launched in the given mode.
 * 
 * @param resources the resources to launch
 * @param mode the mode in which the file should be executed
 */
protected void launch(FileOrResource[] resources, String mode) {
    ILaunchConfiguration conf = null;
    List<ILaunchConfiguration> configurations = findExistingLaunchConfigurations(resources);
    if (configurations.isEmpty()) {
        conf = createDefaultLaunchConfiguration(resources);
    } else {
        if (configurations.size() == 1) {
            conf = configurations.get(0);
        } else {
            conf = chooseConfig(configurations);
            if (conf == null) {
                // User canceled selection
                return;
            }
        }
    }

    if (conf != null) {
        DebugUITools.launch(conf, mode);
        return;
    }
    fileNotFound();
}
 
Example #17
Source File: LaunchConfigurationUtilities.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Returns a configuration from the given collection of configurations that
 * should be launched, or <code>null</code> to cancel. Default implementation
 * opens a selection dialog that allows the user to choose one of the
 * specified launch configurations. Returns the chosen configuration, or
 * <code>null</code> if the user cancels.
 * 
 * @param configList list of configurations to choose from
 * @return configuration to launch or <code>null</code> to cancel
 */
public static ILaunchConfiguration chooseConfiguration(
    List<ILaunchConfiguration> configList, Shell shell) {
  IDebugModelPresentation labelProvider = DebugUITools.newDebugModelPresentation();
  try {
    ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell,
        labelProvider);
    dialog.setElements(configList.toArray());
    dialog.setTitle("Choose a launch configuration:");
    dialog.setMessage("More than one launch configuration is applicable; please choose one:");
    dialog.setMultipleSelection(false);
    int result = dialog.open();
    if (result == Window.OK) {
      return (ILaunchConfiguration) dialog.getFirstResult();
    }
    return null;
  } finally {
    labelProvider.dispose();
  }
}
 
Example #18
Source File: CleanupPreferencePage.java    From eclipse-extras with Eclipse Public License 1.0 6 votes vote down vote up
private void createPageControls( Composite parent ) {
  cleanupButton = new Button( parent, SWT.CHECK );
  cleanupButton.setText( "Remove on-the-fly generated launch configurations when no longer needed" );
  cleanupButton.addListener( SWT.Selection, this::cleanupButtonSelected );
  cleanupTypesLabel = new Label( parent, SWT.NONE );
  cleanupTypesLabel.setText( "Select the launch configuration types to clean up" );
  cleanupTypesViewer = CheckboxTableViewer.newCheckList( parent, SWT.BORDER );
  cleanupTypesViewer.setLabelProvider( DebugUITools.newDebugModelPresentation() );
  cleanupTypesViewer.setContentProvider( ArrayContentProvider.getInstance() );
  cleanupTypesViewer.setComparator( new WorkbenchViewerComparator() );
  cleanupTypesViewer.addFilter( new LaunchConfigTypeFilter() );
  cleanupTypesViewer.setInput( launchManager.getLaunchConfigurationTypes() );
  selectAllButton = new Button( parent, SWT.PUSH );
  selectAllButton.addListener( SWT.Selection, event -> cleanupTypesViewer.setAllChecked( true ) );
  selectAllButton.setText( "&Select All" );
  deselectAllButton = new Button( parent, SWT.PUSH );
  deselectAllButton.setText( "&Deselect All" );
  deselectAllButton.addListener( SWT.Selection, event -> cleanupTypesViewer.setAllChecked( false ) );
  notelabel = new Label( parent, SWT.WRAP );
  String text
    = "Note: Launch configurations are considered as on-the-fly generated if "
    + "they were created outside the Run Configurations dialog without further "
    + "manual changes. For example with Run As > JUnit Test";
  notelabel.setText( text );
}
 
Example #19
Source File: BaseLaunchShortcut.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
protected ILaunchConfiguration chooseConfiguration(Indexable<ILaunchConfiguration> configs) 
		throws OperationCancellation {
	IDebugModelPresentation labelProvider = DebugUITools.newDebugModelPresentation();
	try {
		ElementListSelectionDialog dialog = new ElementListSelectionDialog(getActiveShell(), labelProvider);
		dialog.setTitle(LangUIMessages.LaunchShortcut_selectLaunch_title);
		dialog.setMessage(LangUIMessages.LaunchShortcut_selectLaunch_message);
		
		dialog.setMultipleSelection(false);
		return ControlUtils.setElementsAndOpenDialog(dialog, configs);
	} finally {
		labelProvider.dispose();
	}
}
 
Example #20
Source File: WatchExpressionAction.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
private void createExpression(String variable) {
    IWatchExpression expression = DebugPlugin.getDefault().getExpressionManager().newWatchExpression(variable);

    DebugPlugin.getDefault().getExpressionManager().addExpression(expression);
    IAdaptable object = DebugUITools.getDebugContext();
    IDebugElement context = null;
    if (object instanceof IDebugElement) {
        context = (IDebugElement) object;
    } else if (object instanceof ILaunch) {
        context = ((ILaunch) object).getDebugTarget();
    }
    expression.setExpressionContext(context);
    showExpressionsView();
}
 
Example #21
Source File: PythonConsoleLineTracker.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
private void updateProjectAndWorkingDir() {
    if (updatedProjectAndWorkingDir) {
        return;
    }
    IProcess process = DebugUITools.getCurrentProcess();
    if (process != null) {
        ILaunch launch = process.getLaunch();
        if (launch != null) {
            updatedProjectAndWorkingDir = true;
            ILaunchConfiguration lc = launch.getLaunchConfiguration();
            initLaunchConfiguration(lc);
        }
    }
}
 
Example #22
Source File: EvalExpressionAction.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a watch expression to be evaluated with the current debug context.
 * 
 * @param expr the expression that should be evaluated in the current context
 * @return the created expression.
 */
public static IWatchExpression createWatchExpression(final String expr) {
    final IWatchExpression expression = DebugPlugin.getDefault().getExpressionManager().newWatchExpression(expr);
    IAdaptable object = DebugUITools.getDebugContext();
    IDebugElement context = null;
    if (object instanceof IDebugElement) {
        context = (IDebugElement) object;
    } else if (object instanceof ILaunch) {
        context = ((ILaunch) object).getDebugTarget();
    }

    expression.setExpressionContext(context);
    return expression;
}
 
Example #23
Source File: RetargetSetNextAction.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void init(IWorkbenchWindow window) {
    super.init(window);
    IDebugContextService service = DebugUITools.getDebugContextManager().getContextService(window);
    service.addDebugContextListener(fContextListener);
    ISelection activeContext = service.getActiveContext();
    fContextListener.contextActivated(activeContext);
}
 
Example #24
Source File: BaseLaunchShortcut.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
protected void doLaunchTarget(ILaunchable launchTarget, String mode) throws CoreException, OperationCancellation {
	ILaunchConfiguration config = findExistingLaunchConfiguration(launchTarget);
	if(config == null) {
		config = launchTarget.createNewConfiguration(); 
	}
	DebugUITools.launch(config, mode);
}
 
Example #25
Source File: LaunchConfigComparator.java    From eclipse-extras with Eclipse Public License 1.0 5 votes vote down vote up
private ILaunchConfiguration getLastLaunchConfig( ILaunchConfiguration launchConfig ) {
  ILaunchConfiguration result = null;
  if( launchMode != null ) {
    ILaunchGroup launchGroup = DebugUITools.getLaunchGroup( launchConfig, launchMode.getIdentifier() );
    if( launchGroup != null ) {
      result = DebugUITools.getLastLaunch( launchGroup.getIdentifier() );
    }
  }
  return result;
}
 
Example #26
Source File: LaunchModeComputer.java    From eclipse-extras with Eclipse Public License 1.0 5 votes vote down vote up
public ILaunchGroup computeLaunchGroup() {
  ILaunchGroup result = null;
  ILaunchMode launchMode = computeLaunchMode();
  if( launchMode != null ) {
    result = DebugUITools.getLaunchGroup( launchConfig, launchMode.getIdentifier() );
  }
  return result;
}
 
Example #27
Source File: DebugResourceAction.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public void run( IAction action )
{
	IFile file = getSelectedFile( );
	if ( file == null )
	{
		return;
	}

	String fileName = file.getLocation( ).toOSString( );
	ILaunchConfiguration config = ScriptLaunchShortcut.findLaunchConfiguration( fileName, ScriptLaunchShortcut.getConfigurationType( ) );
	if (config != null) {
		DebugUITools.launch(config, "debug");//$NON-NLS-1$
	}	
	
}
 
Example #28
Source File: LogContent.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Find the TextConsole associated with the launch. This is required by the
 * {@link JavaStackTraceHyperlink} class (which we subclass).
 */
private TextConsole getLaunchConsole() {
  LaunchConfiguration launchConfiguration = null;
  T entity = log.getEntity();

  if (entity instanceof BrowserTab) {
    BrowserTab browserTab = (BrowserTab) entity;
    launchConfiguration = browserTab.getLaunchConfiguration();
  } else if (entity instanceof LaunchConfiguration) {
    launchConfiguration = (LaunchConfiguration) entity;
  }

  if (launchConfiguration != null) {
    IProcess[] processes = launchConfiguration.getLaunch().getProcesses();
    if (processes.length > 0) {
      /*
       * Just get the console for the first process. If there are multiple
       * processes, they will all link back to the same ILaunch (which is what
       * JavaStackTraceHyperlink uses the console for anyway).
       */
      IConsole console = DebugUITools.getConsole(processes[0]);
      if (console instanceof TextConsole) {
        return (TextConsole) console;
      }
    }
  }

  return null;
}
 
Example #29
Source File: ScriptDebugHover.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private ScriptStackFrame getFrame( )
{
	IAdaptable adaptable = DebugUITools.getDebugContext( );
	if ( adaptable != null )
	{
		return (ScriptStackFrame) adaptable.getAdapter( ScriptStackFrame.class );
	}
	return null;
}
 
Example #30
Source File: NewWebAppProjectWizard.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * We initialize these members here so that finishPage can access them without triggering a SWT
 * InvalidThreadAccessException.
 */
@Override
public boolean performFinish() {
  projectName = newProjectWizardPage.getProjectName();
  useGWT = newProjectWizardPage.useGWT();
  gwtSdkContainerPath = newProjectWizardPage.getGWTSdkContainerPath();
  packageName = newProjectWizardPage.getPackage();
  locationURI = newProjectWizardPage.getCreationLocationURI();
  isGenerateEmptyProject = newProjectWizardPage.isGenerateEmptyProject();
  buildAnt = newProjectWizardPage.getBuildAnt();
  buildMaven = newProjectWizardPage.getBuildMaven();

  /**
   * HACK: We need to make sure that the DebugUITools plugin (and the DebugUIPlugin plugin) is loaded via the main
   * thread. before we call super.performFinish(). Otherwise, a race condition in Eclipse 3.5 occurs where
   * LaunchConfigurationManager.loadLaunchGroups() is called from two threads. The first call comes from our query for
   * launch groups in WebAppProjectCreator.createLaunchConfiguration() (which is part of a ModalContext runnable). The
   * second comes about due to the initialization of the DebugUIPlugin plugin (which we cause, by accessing classes in
   * this plugin through the DebugUITools plugin).
   */
  DebugUITools.getLaunchGroups();

  boolean finished = super.performFinish();
  if (finished) {
    // TODO: See JavaProjectWizard to see how to switch to Java perspective
    // and open new element
  }
  return finished;
}