org.eclipse.debug.ui.IDebugUIConstants Java Examples

The following examples show how to use org.eclipse.debug.ui.IDebugUIConstants. 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: GhidraLaunchDelegate.java    From ghidra with Apache License 2.0 6 votes vote down vote up
/**
 * Handles extra things that should happen when we are launching in debug mode.
 */
private static void handleDebugMode() {
	Display.getDefault().asyncExec(() -> {

		// Switch to debug perspective
		if (PlatformUI.getWorkbench() != null) {
			IPerspectiveDescriptor descriptor =
				PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(
					IDebugUIConstants.ID_DEBUG_PERSPECTIVE);
			EclipseMessageUtils.getWorkbenchPage().setPerspective(descriptor);
		}

		// Start PyDev debugger
		if (PyDevUtils.isSupportedPyDevInstalled()) {
			try {
				PyDevUtils.startPyDevRemoteDebugger();
			}
			catch (OperationNotSupportedException e) {
				EclipseMessageUtils.error(
					"Failed to start the PyDev remote debugger.  PyDev version is not supported.");
			}
		}
	});
}
 
Example #2
Source File: PythonPerspectiveFactory.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @param layout
 */
public void defineActions(IPageLayout layout) {
    layout.addNewWizardShortcut(PythonProjectWizard.WIZARD_ID);
    layout.addNewWizardShortcut(PythonSourceFolderWizard.WIZARD_ID);
    layout.addNewWizardShortcut(PythonPackageWizard.WIZARD_ID);
    layout.addNewWizardShortcut(PythonModuleWizard.WIZARD_ID);
    layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");//$NON-NLS-1$
    layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");//$NON-NLS-1$
    layout.addNewWizardShortcut("org.eclipse.ui.editors.wizards.UntitledTextFileWizard");//$NON-NLS-1$

    layout.addShowViewShortcut("org.python.pydev.navigator.view");
    layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
    layout.addShowViewShortcut("org.python.pydev.debug.pyunit.pyUnitView");
    layout.addShowViewShortcut("org.python.pydev.debug.profile.ProfileView");
    layout.addShowViewShortcut("org.python.pydev.views.PyCodeCoverageView");
    layout.addShowViewShortcut(NewSearchUI.SEARCH_VIEW_ID);
    layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
    layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
    //layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);-- Navigator no longer supported
    layout.addShowViewShortcut("org.eclipse.pde.runtime.LogView");
    layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);

    layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
    layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET);

}
 
Example #3
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 #4
Source File: XdsPerspectiveFactory.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
@Override
    public void createInitialLayout(IPageLayout layout) {
        layout.addNewWizardShortcut("com.excelsior.xds.ui.project.NewProjectFromScratchWizard"); //$NON-NLS-1$
        layout.addNewWizardShortcut("com.excelsior.xds.ui.project.NewProjectFromSourcesWizard"); //$NON-NLS-1$
        
        String editorArea = layout.getEditorArea();
        
        layout.addView(IPageLayout.ID_PROJECT_EXPLORER, IPageLayout.LEFT, 0.20f, editorArea);
        
        // the Tasks view.
        IFolderLayout bottom =
              layout.createFolder("bottom", IPageLayout.BOTTOM, 0.80f, editorArea); //$NON-NLS-1$
        bottom.addView(IPageLayout.ID_PROBLEM_VIEW);
        bottom.addView(IConsoleConstants.ID_CONSOLE_VIEW);
        
        IFolderLayout right = layout.createFolder("right", IPageLayout.RIGHT, 0.80f, editorArea); //$NON-NLS-1$
        right.addView(IPageLayout.ID_OUTLINE);

        layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
        layout.addActionSet("org.eclipse.debug.ui.profileActionSet"); //Bug: not included in IDebugUIConstants  //$NON-NLS-1$ 
        
        // Put the Outline view on the left.
//        layout.addView(IPageLayout.ID_OUTLINE, IPageLayout.RIGHT, 0.01f, editorArea);
    }
 
Example #5
Source File: FixedFatJarExportPage.java    From sarl with Apache License 2.0 6 votes vote down vote up
protected LaunchConfigurationElement[] getLaunchConfigurations() {
	ArrayList<ExistingLaunchConfigurationElement> result= new ArrayList<>();

	try {
		ILaunchManager manager= DebugPlugin.getDefault().getLaunchManager();
		ILaunchConfigurationType type= manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
		ILaunchConfiguration[] launchconfigs= manager.getLaunchConfigurations(type);

		for (int i= 0; i < launchconfigs.length; i++) {
			ILaunchConfiguration launchconfig= launchconfigs[i];
			if (!launchconfig.getAttribute(IDebugUIConstants.ATTR_PRIVATE, false)) {
				String projectName= launchconfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$
				result.add(new ExistingLaunchConfigurationElement(launchconfig, projectName));
			}
		}
	} catch (CoreException e) {
		JavaPlugin.log(e);
	}

	return result.toArray(new LaunchConfigurationElement[result.size()]);
}
 
Example #6
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 #7
Source File: FatJarPackageWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private LaunchConfigurationElement[] getLaunchConfigurations() {
	ArrayList<ExistingLaunchConfigurationElement> result= new ArrayList<ExistingLaunchConfigurationElement>();

	try {
		ILaunchManager manager= DebugPlugin.getDefault().getLaunchManager();
		ILaunchConfigurationType type= manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
		ILaunchConfiguration[] launchconfigs= manager.getLaunchConfigurations(type);

		for (int i= 0; i < launchconfigs.length; i++) {
			ILaunchConfiguration launchconfig= launchconfigs[i];
			if (!launchconfig.getAttribute(IDebugUIConstants.ATTR_PRIVATE, false)) {
				String projectName= launchconfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$
				result.add(new ExistingLaunchConfigurationElement(launchconfig, projectName));
			}
		}
	} catch (CoreException e) {
		JavaPlugin.log(e);
	}

	return result.toArray(new LaunchConfigurationElement[result.size()]);
}
 
Example #8
Source File: SaveAndLaunchPromptDialog.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
@Override
public int open()
{
	String saveDirty = Platform.getPreferencesService().getString(IDebugUIConstants.PLUGIN_ID,
			IInternalDebugUIConstants.PREF_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH, StringUtil.EMPTY,
			new IScopeContext[] { EclipseUtil.instanceScope(), EclipseUtil.defaultScope() });
	if (saveDirty.equals(MessageDialogWithToggle.ALWAYS))
	{
		setResult(dirtyResources);
		return Window.OK;
	}
	return super.open();
}
 
Example #9
Source File: PydevdServerLaunchShortcut.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public ILaunchConfiguration createDefaultLaunchConfiguration(FileOrResource[] resources) {
    ILaunchManager manager = org.eclipse.debug.core.DebugPlugin.getDefault().getLaunchManager();
    ILaunchConfigurationType type = manager.getLaunchConfigurationType(getLaunchConfigurationType());
    if (type == null) {
        reportError("Python launch configuration not found", null);
        return null;
    }

    StringBuffer buffer = new StringBuffer("Debug Server");
    String name = buffer.toString().trim();

    try {

        ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(null, name);

        // Common Tab Arguments
        CommonTab tab = new CommonTab();
        tab.setDefaults(workingCopy);
        tab.dispose();

        // Python Main Tab Arguments
        workingCopy.setAttribute(Constants.ATTR_PROJECT, "PyDevd Debug Server");
        workingCopy.setAttribute(Constants.ATTR_RESOURCE_TYPE, 1);

        workingCopy.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, false);
        workingCopy.setAttribute(IDebugUIConstants.ATTR_PRIVATE, true);

        ILaunchConfiguration ret = workingCopy.doSave();
        return ret;
    } catch (CoreException e) {
        reportError(null, e);
        return null;
    }
}
 
Example #10
Source File: PythonFileRunner.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
private static ILaunchConfigurationWorkingCopy getLaunchConfiguration(IFile resource, String programArguments)
        throws CoreException, MisconfigurationException, PythonNatureWithoutProjectException {
    String vmargs = ""; // Not sure if it should be a parameter or not
    IProject project = resource.getProject();
    PythonNature nature = PythonNature.getPythonNature(project);
    ILaunchManager manager = org.eclipse.debug.core.DebugPlugin.getDefault().getLaunchManager();
    String launchConfigurationType = configurationFor(nature.getInterpreterType());
    ILaunchConfigurationType type = manager.getLaunchConfigurationType(launchConfigurationType);
    if (type == null) {
        throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Python launch configuration not found",
                null));
    }

    String location = resource.getRawLocation().toString();
    String name = manager.generateUniqueLaunchConfigurationNameFrom(resource.getName());
    String baseDirectory = new File(location).getParent();
    int resourceType = IResource.FILE;

    ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(null, name);
    // Python Main Tab Arguments        
    workingCopy.setAttribute(Constants.ATTR_PROJECT, project.getName());
    workingCopy.setAttribute(Constants.ATTR_RESOURCE_TYPE, resourceType);
    workingCopy.setAttribute(Constants.ATTR_INTERPRETER, nature.getProjectInterpreter().getExecutableOrJar());
    workingCopy.setAttribute(Constants.ATTR_LOCATION, location);
    workingCopy.setAttribute(Constants.ATTR_WORKING_DIRECTORY, baseDirectory);
    workingCopy.setAttribute(Constants.ATTR_PROGRAM_ARGUMENTS, programArguments);
    workingCopy.setAttribute(Constants.ATTR_VM_ARGUMENTS, vmargs);

    workingCopy.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, true);
    workingCopy.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, true);
    workingCopy.setMappedResources(new IResource[] { resource });
    return workingCopy;
}
 
Example #11
Source File: PydevIProcessFactory.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
private static ILaunchConfiguration createLaunchConfig() {
    ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
    ILaunchConfigurationType launchConfigurationType = manager
            .getLaunchConfigurationType("org.python.pydev.debug.interactiveConsoleConfigurationType");
    ILaunchConfigurationWorkingCopy newInstance;
    try {
        newInstance = launchConfigurationType.newInstance(null,
                manager.generateLaunchConfigurationName("PyDev Interactive Launch"));
    } catch (CoreException e) {
        return null;
    }
    newInstance.setAttribute(IDebugUIConstants.ATTR_PRIVATE, true);
    return newInstance;
}
 
Example #12
Source File: WatchExpressionAction.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
private void showExpressionsView() {
    IWorkbenchPage page = PydevDebugPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
    IViewPart part = page.findView(IDebugUIConstants.ID_EXPRESSION_VIEW);
    if (part == null) {
        try {
            page.showView(IDebugUIConstants.ID_EXPRESSION_VIEW);
        } catch (PartInitException e) {
        }
    } else {
        page.bringToTop(part);
    }

}
 
Example #13
Source File: ExportSarlApplicationPage.java    From sarl with Apache License 2.0 5 votes vote down vote up
private static void getLaunchConfiguration(List<ExistingLaunchConfigurationElement> result, ILaunchConfigurationType type,
		ILaunchManager manager, Set<String> selectedProjects) throws CoreException {
	final ILaunchConfiguration[] launchconfigs = manager.getLaunchConfigurations(type);
	for (int i = 0; i < launchconfigs.length; ++i) {
		final ILaunchConfiguration launchconfig = launchconfigs[i];
		if (!launchconfig.getAttribute(IDebugUIConstants.ATTR_PRIVATE, false)) {
			final String projectName = launchconfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$
			if (selectedProjects.isEmpty() || selectedProjects.contains(projectName)) {
				result.add(new ExistingLaunchConfigurationElement(launchconfig, projectName));
			}
		}
	}
}
 
Example #14
Source File: PythonRunner.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Actually creates the process (and create the encoding config file)
 */
@SuppressWarnings("deprecation")
private static Process createProcess(ILaunch launch, String[] envp, String[] cmdLine, File workingDirectory)
        throws CoreException {
    Map<String, String> arrayAsMapEnv = ProcessUtils.getArrayAsMapEnv(envp);
    arrayAsMapEnv.put("PYTHONUNBUFFERED", "1");
    arrayAsMapEnv.put("PYDEV_COMPLETER_PYTHONPATH", CorePlugin.getBundleInfo().getRelativePath(new Path("pysrc"))
            .toString());

    //Not using DebugPlugin.ATTR_CONSOLE_ENCODING to provide backward compatibility for eclipse 3.2
    String encoding = launch.getAttribute(IDebugUIConstants.ATTR_CONSOLE_ENCODING);
    if (encoding != null && encoding.trim().length() > 0) {
        arrayAsMapEnv.put("PYDEV_CONSOLE_ENCODING", encoding);

        //In Python 3.0, we can use the PYTHONIOENCODING.
        //Note that we always replace it, because this is really the encoding of the allocated console view,
        //so, if we had something different put, the encoding from the Python side would differ from the encoding
        //on the java side (which would make things garbled anyways).
        arrayAsMapEnv.put("PYTHONIOENCODING", encoding);
    }
    envp = ProcessUtils.getMapEnvAsArray(arrayAsMapEnv);
    Process p = DebugPlugin.exec(cmdLine, workingDirectory, envp);
    if (p == null) {
        throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Could not execute python process.",
                null));
    }
    PythonRunnerCallbacks.afterCreatedProcess.call(p);
    return p;
}
 
Example #15
Source File: GdbExtendedViewModelAdapter.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected IVMProvider createViewModelProvider(IPresentationContext context) {
    if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId()) ) {
        return createGdbVariableProvider(context);
    } else if (IDebugUIConstants.ID_EXPRESSION_VIEW.equals(context.getId()) ) {
        return createGdbExpressionProvider(context);
    } else if (IDsfDebugUIConstants.ID_EXPRESSION_HOVER.equals(context.getId()) ) {
        return createGdbExpressionHoverProvider(context);
    }
    return super.createViewModelProvider(context);
}
 
Example #16
Source File: BOSWebServerManager.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected ILaunchConfiguration configureLaunchConfiguration(ILaunchConfigurationWorkingCopy workingCopy)
        throws CoreException {
    final RepositoryAccessor repositoryAccessor = new RepositoryAccessor();
    repositoryAccessor.init();

    workingCopy.setAttribute(
            IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS,
            getTomcatVMArgsBuilder(repositoryAccessor, EnginePlugin.getDefault().getPreferenceStore())
                    .getVMArgs(bundleLocation));
    workingCopy.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_FILE,
            getTomcatLogFile());
    workingCopy.setAttribute(IDebugUIConstants.ATTR_APPEND_TO_FILE, true);
    workingCopy.setAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, "UTF-8");
    return workingCopy.doSave();
}
 
Example #17
Source File: GhidraLaunchUtils.java    From ghidra with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the favorites attribute in the provided working copy to include the launcher in both 
 * the run and debug launch groups.
 * 
 * @param wc The launch configuration working copy to modify.
 * @return The modified working copy.
 * @throws CoreException If there was an Eclipse-related problem with setting the favorites
 *   attribute.
 */
public static ILaunchConfigurationWorkingCopy setFavorites(ILaunchConfigurationWorkingCopy wc)
		throws CoreException {
	List<String> list =
		wc.getAttribute(IDebugUIConstants.ATTR_FAVORITE_GROUPS, new ArrayList<>());
	list.add(IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP);
	list.add(IDebugUIConstants.ID_RUN_LAUNCH_GROUP);
	wc.setAttribute(IDebugUIConstants.ATTR_FAVORITE_GROUPS, list);
	return wc;
}
 
Example #18
Source File: XtendFileHyperlink.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
private ILaunch getLaunch() {
  Object _attribute = this.console.getAttribute(IDebugUIConstants.ATTR_CONSOLE_PROCESS);
  final IProcess process = ((IProcess) _attribute);
  if ((process != null)) {
    return process.getLaunch();
  }
  return null;
}
 
Example #19
Source File: ProcessConsoleColorProvider.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Color getColor(String streamIdentifer) {
	if (IDebugUIConstants.ID_STANDARD_INPUT_STREAM.equals(streamIdentifer)) {
		return resourceRegistry.createColor(ColorStreamType.USER_INPUT.getRgb());
	}
	else if (IDebugUIConstants.ID_STANDARD_ERROR_STREAM.equals(streamIdentifer)) {
		return resourceRegistry.createColor(ColorStreamType.ERROR.getRgb());
	}
	else if (IDebugUIConstants.ID_STANDARD_OUTPUT_STREAM.equals(streamIdentifer)) {
		return resourceRegistry.createColor(ColorStreamType.NORMAL.getRgb());
	}
	return null;
}
 
Example #20
Source File: LaunchPipelineShortcut.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
private void launchNew(LaunchableResource resource, String mode) {
  try {
    ILaunchManager launchManager = getLaunchManager();

    String launchConfigurationName =
        launchManager.generateLaunchConfigurationName(resource.getLaunchName());
    ILaunchConfigurationType configurationType =
        getDataflowLaunchConfigurationType(launchManager);
    ILaunchConfigurationWorkingCopy configuration =
        configurationType.newInstance(null, launchConfigurationName);

    configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME,
        resource.getProjectName());
    IMethod mainMethod = resource.getMainMethod();
    if (mainMethod != null && mainMethod.exists()) {
      configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME,
          mainMethod.getDeclaringType().getFullyQualifiedName());
    }

    String groupIdentifier =
        mode.equals(ILaunchManager.RUN_MODE) ? IDebugUIConstants.ID_RUN_LAUNCH_GROUP
            : IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP;
    int returnStatus =
        DebugUITools.openLaunchConfigurationDialog(DataflowUiPlugin.getActiveWindowShell(),
            configuration, groupIdentifier, null);
    if (returnStatus == Window.OK) {
      configuration.doSave();
    }
  } catch (CoreException e) {
    // TODO: Handle
    DataflowUiPlugin.logError(e, "Error while launching new Launch Configuration for project %s",
        resource.getProjectName());
  }
}
 
Example #21
Source File: DeployCommandHandler.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
private void launchDeployJob(IProject project, Credential credential)
    throws IOException, CoreException {
  sendAnalyticsPing(AnalyticsEvents.APP_ENGINE_DEPLOY);

  IPath workDirectory = createWorkDirectory();
  DeployPreferences deployPreferences = getDeployPreferences(project);

  DeployConsole messageConsole =
      MessageConsoleUtilities.createConsole(getConsoleName(deployPreferences.getProjectId()),
                                            new DeployConsole.Factory());
  IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
  consoleManager.showConsoleView(messageConsole);
  ConsoleColorProvider colorProvider = new ConsoleColorProvider();
  MessageConsoleStream outputStream = messageConsole.newMessageStream();
  MessageConsoleStream errorStream = messageConsole.newMessageStream();
  outputStream.setActivateOnWrite(true);
  errorStream.setActivateOnWrite(true);
  outputStream.setColor(colorProvider.getColor(IDebugUIConstants.ID_STANDARD_OUTPUT_STREAM));
  errorStream.setColor(colorProvider.getColor(IDebugUIConstants.ID_STANDARD_ERROR_STREAM));

  StagingDelegate stagingDelegate = getStagingDelegate(project);

  DeployJob deploy = new DeployJob(deployPreferences, credential, workDirectory,
      outputStream, errorStream, stagingDelegate);
  messageConsole.setJob(deploy);
  deploy.addJobChangeListener(new JobChangeAdapter() {

    @Override
    public void done(IJobChangeEvent event) {
      if (event.getResult().isOK()) {
        sendAnalyticsPing(AnalyticsEvents.APP_ENGINE_DEPLOY_SUCCESS);
      }
      launchCleanupJob();
    }
  });
  deploy.schedule();
}
 
Example #22
Source File: ErrorLineMatcher.java    From corrosion with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void matchFound(PatternMatchEvent event) {
	try {
		int offset = event.getOffset();
		int length = event.getLength();
		IProcess process = (IProcess) console.getAttribute(IDebugUIConstants.ATTR_CONSOLE_PROCESS);
		if (process != null) {
			ILaunch launch = process.getLaunch();
			String projectAttribute = RustLaunchDelegateTools.PROJECT_ATTRIBUTE;
			String launchConfigurationType = launch.getLaunchConfiguration().getType().getIdentifier();
			if (launchConfigurationType.equals(RustLaunchDelegateTools.CORROSION_DEBUG_LAUNCH_CONFIG_TYPE)) {
				// support debug launch configs
				projectAttribute = ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME;
			}
			String projectName = launch.getLaunchConfiguration().getAttribute(projectAttribute, ""); //$NON-NLS-1$
			if (projectName.trim().isEmpty()) {
				return; // can't determine project so prevent error down
			}
			IWorkspaceRoot myWorkspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
			IProject myProject = myWorkspaceRoot.getProject(projectName);
			String errorString = console.getDocument().get(event.getOffset(), event.getLength());
			String[] coordinates = errorString.split(":"); //$NON-NLS-1$
			IHyperlink link = makeHyperlink(myProject.getFile(coordinates[0]), Integer.parseInt(coordinates[1]),
					Integer.parseInt(coordinates[2]));
			console.addHyperlink(link, offset, length);
		}
	} catch (BadLocationException | CoreException e) {
		// ignore
	}
}
 
Example #23
Source File: N4JSStackTraceConsole.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Constructor creating the console with the console font.
 */
public N4JSStackTraceConsole() {
	super(ConsoleMessages.msgN4JSStackTraceConsole(), CONSOLE_TYPE, null, true);
	Font font = JFaceResources.getFont(IDebugUIConstants.PREF_CONSOLE_FONT);
	setFont(font);
	partitioner.connect(getDocument());
}
 
Example #24
Source File: GhidraLaunchUtils.java    From ghidra with Apache License 2.0 5 votes vote down vote up
/**
 * Adds the given launch configuration to the GUI's favorites list.  This is useful to do if
 * you create a launch configuration and want it to appear in the favorites list before ever
 * launching it.
 * 
 * @param launchConfig The launch configuration to add.
 */
public static void addToFavorites(ILaunchConfiguration launchConfig) {
	LaunchConfigurationManager mgr = DebugUIPlugin.getDefault().getLaunchConfigurationManager();
	LaunchHistory runHistory = mgr.getLaunchHistory(IDebugUIConstants.ID_RUN_LAUNCH_GROUP);
	LaunchHistory debugHistory = mgr.getLaunchHistory(IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP);
	runHistory.addFavorite(launchConfig);
	debugHistory.addFavorite(launchConfig);
}
 
Example #25
Source File: HadoopPerspectiveFactory.java    From hadoop-gpu with Apache License 2.0 4 votes vote down vote up
public void createInitialLayout(IPageLayout layout) {
  layout.addNewWizardShortcut("org.apache.hadoop.eclipse.NewDriverWizard");
  layout.addNewWizardShortcut("org.apache.hadoop.eclipse.NewMapperWizard");
  layout
      .addNewWizardShortcut("org.apache.hadoop.eclipse.NewReducerWizard");

  IFolderLayout left =
      layout.createFolder("org.apache.hadoop.eclipse.perspective.left",
          IPageLayout.LEFT, 0.2f, layout.getEditorArea());
  left.addView("org.eclipse.ui.navigator.ProjectExplorer");

  IFolderLayout bottom =
      layout.createFolder("org.apache.hadoop.eclipse.perspective.bottom",
          IPageLayout.BOTTOM, 0.7f, layout.getEditorArea());
  bottom.addView(IPageLayout.ID_PROBLEM_VIEW);
  bottom.addView(IPageLayout.ID_TASK_LIST);
  bottom.addView(JavaUI.ID_JAVADOC_VIEW);
  bottom.addView("org.apache.hadoop.eclipse.view.servers");
  bottom.addPlaceholder(JavaUI.ID_SOURCE_VIEW);
  bottom.addPlaceholder(IPageLayout.ID_PROGRESS_VIEW);
  bottom.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
  bottom.addPlaceholder(IPageLayout.ID_BOOKMARKS);

  IFolderLayout right =
      layout.createFolder("org.apache.hadoop.eclipse.perspective.right",
          IPageLayout.RIGHT, 0.8f, layout.getEditorArea());
  right.addView(IPageLayout.ID_OUTLINE);
  right.addView("org.eclipse.ui.cheatsheets.views.CheatSheetView");
  // right.addView(layout.ID); .. cheat sheet here

  layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
  layout.addActionSet(JavaUI.ID_ACTION_SET);
  layout.addActionSet(JavaUI.ID_CODING_ACTION_SET);
  layout.addActionSet(JavaUI.ID_ELEMENT_CREATION_ACTION_SET);
  layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET);
  layout.addActionSet(JavaUI.ID_SEARCH_ACTION_SET);

  layout
      .addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewPackageCreationWizard");
  layout
      .addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewClassCreationWizard");
  layout
      .addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewInterfaceCreationWizard");
  layout
      .addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewEnumCreationWizard");
  layout
      .addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewAnnotationCreationWizard");
  layout
      .addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSourceFolderCreationWizard");
  layout
      .addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSnippetFileCreationWizard");
  layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");
  layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");
  layout
      .addNewWizardShortcut("org.eclipse.ui.editors.wizards.UntitledTextFileWizard");

  // CheatSheetViewerFactory.createCheatSheetView().setInput("org.apache.hadoop.eclipse.cheatsheet");
}
 
Example #26
Source File: GoPerspective.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected void addActionSets(IPageLayout layout) {
	super.addActionSets(layout);
	
	layout.addActionSet(IDebugUIConstants.DEBUG_ACTION_SET);
}
 
Example #27
Source File: LangPerspective.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
protected void addActionSets(IPageLayout layout) {
	layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET);
	layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
}
 
Example #28
Source File: PyUnitView.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Called when a test is selected in the tree (shows its results in the text output text component).
 * Makes the line tracker aware of the changes so that links are properly created.
 */
/*default*/void onSelectResult(PyUnitTestResult result) {
    tempOnSelectResult.clear();

    boolean addedErrors = false;
    if (result != null) {
        if (result.errorContents != null && result.errorContents.length() > 0) {
            addedErrors = true;
            tempOnSelectResult.append(ERRORS_HEADER);
            tempOnSelectResult.append(result.errorContents);
        }

        if (result.capturedOutput != null && result.capturedOutput.length() > 0) {
            if (tempOnSelectResult.length() > 0) {
                tempOnSelectResult.append("\n");
            }
            tempOnSelectResult.append(CAPTURED_OUTPUT_HEADER);
            tempOnSelectResult.append(result.capturedOutput);
        }
    }
    String string = tempOnSelectResult.toString();
    testOutputText.setFont(JFaceResources.getFont(IDebugUIConstants.PREF_CONSOLE_FONT));

    testOutputText.setText(string + "\n\n\n"); // Add a few lines to the test output so that we can scroll a bit more.
    testOutputText.setStyleRange(new StyleRange());

    if (addedErrors) {
        StyleRange range = new StyleRange();
        //Set the proper color if it's available.
        TextAttribute errorTextAttribute = ColorManager.getDefault().getConsoleErrorTextAttribute();
        if (errorTextAttribute != null) {
            range.foreground = errorTextAttribute.getForeground();
        }
        range.start = ERRORS_HEADER.length();
        range.length = result.errorContents.length();
        testOutputText.setStyleRange(range);
    }

    PythonConsoleLineTracker lineTracker = new PythonConsoleLineTracker();

    ILaunchConfiguration launchConfiguration = null;
    PyUnitTestRun testRun = result.getTestRun();
    if (testRun != null) {
        IPyUnitLaunch pyUnitLaunch = testRun.getPyUnitLaunch();
        if (pyUnitLaunch != null) {
            launchConfiguration = pyUnitLaunch.getLaunchConfiguration();
        }
    }
    lineTracker.init(launchConfiguration, iLinkContainer);
    lineTracker.setOnlyCreateLinksForExistingFiles(this.onlyCreateLinksForExistingFiles);
    lineTracker.splitInLinesAndAppendToLineTracker(string);
}
 
Example #29
Source File: LaunchConfigurationCreator.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @param resource only used if captureOutput is true!
 * @param location only used if captureOutput is false!
 * @param captureOutput determines if the output should be captured or not (if captured a console will be
 * shown to it by default)
 */
private static ILaunchConfigurationWorkingCopy createDefaultLaunchConfiguration(FileOrResource[] resource,
        String launchConfigurationType, String location, IInterpreterManager pythonInterpreterManager,
        String projName, String vmargs, String programArguments, boolean captureOutput) throws CoreException {

    ILaunchManager manager = org.eclipse.debug.core.DebugPlugin.getDefault().getLaunchManager();
    ILaunchConfigurationType type = manager.getLaunchConfigurationType(launchConfigurationType);
    if (type == null) {
        throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Python launch configuration not found",
                null));
    }

    IStringVariableManager varManager = VariablesPlugin.getDefault().getStringVariableManager();

    String name;
    String baseDirectory;
    String moduleFile;
    int resourceType;

    if (captureOutput) {
        StringBuffer buffer = new StringBuffer(projName);
        buffer.append(" ");
        StringBuffer resourceNames = new StringBuffer();
        for (FileOrResource r : resource) {
            if (resourceNames.length() > 0) {
                resourceNames.append(" - ");
            }
            if (r.resource != null) {
                resourceNames.append(r.resource.getName());
            } else {
                resourceNames.append(r.file.getName());
            }
        }
        buffer.append(resourceNames);
        name = buffer.toString().trim();

        if (resource[0].resource != null) {
            // Build the working directory to a path relative to the workspace_loc
            baseDirectory = resource[0].resource.getFullPath().removeLastSegments(1).makeRelative().toString();
            baseDirectory = varManager.generateVariableExpression("workspace_loc", baseDirectory);

            // Build the location to a path relative to the workspace_loc
            moduleFile = makeFileRelativeToWorkspace(resource, varManager);
            resourceType = resource[0].resource.getType();
        } else {
            baseDirectory = FileUtils.getFileAbsolutePath(resource[0].file.getParentFile());

            // Build the location to a path relative to the workspace_loc
            moduleFile = FileUtils.getFileAbsolutePath(resource[0].file);
            resourceType = IResource.FILE;
        }
    } else {
        captureOutput = true;
        name = location;
        baseDirectory = new File(location).getParent();
        moduleFile = location;
        resourceType = IResource.FILE;
    }

    name = manager.generateLaunchConfigurationName(name);

    ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(null, name);
    // Python Main Tab Arguments

    workingCopy.setAttribute(Constants.ATTR_PROJECT, projName);
    workingCopy.setAttribute(Constants.ATTR_RESOURCE_TYPE, resourceType);
    workingCopy.setAttribute(Constants.ATTR_INTERPRETER, Constants.ATTR_INTERPRETER_DEFAULT);

    workingCopy.setAttribute(Constants.ATTR_LOCATION, moduleFile);
    workingCopy.setAttribute(Constants.ATTR_WORKING_DIRECTORY, baseDirectory);
    workingCopy.setAttribute(Constants.ATTR_PROGRAM_ARGUMENTS, programArguments);
    workingCopy.setAttribute(Constants.ATTR_VM_ARGUMENTS, vmargs);

    workingCopy.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, captureOutput);
    workingCopy.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, captureOutput);

    if (resource[0].resource != null) {
        workingCopy.setMappedResources(FileOrResource.createIResourceArray(resource));
    }
    return workingCopy;
}
 
Example #30
Source File: HadoopPerspectiveFactory.java    From RDFS with Apache License 2.0 4 votes vote down vote up
public void createInitialLayout(IPageLayout layout) {
  layout.addNewWizardShortcut("org.apache.hadoop.eclipse.NewDriverWizard");
  layout.addNewWizardShortcut("org.apache.hadoop.eclipse.NewMapperWizard");
  layout
      .addNewWizardShortcut("org.apache.hadoop.eclipse.NewReducerWizard");

  IFolderLayout left =
      layout.createFolder("org.apache.hadoop.eclipse.perspective.left",
          IPageLayout.LEFT, 0.2f, layout.getEditorArea());
  left.addView("org.eclipse.ui.navigator.ProjectExplorer");

  IFolderLayout bottom =
      layout.createFolder("org.apache.hadoop.eclipse.perspective.bottom",
          IPageLayout.BOTTOM, 0.7f, layout.getEditorArea());
  bottom.addView(IPageLayout.ID_PROBLEM_VIEW);
  bottom.addView(IPageLayout.ID_TASK_LIST);
  bottom.addView(JavaUI.ID_JAVADOC_VIEW);
  bottom.addView("org.apache.hadoop.eclipse.view.servers");
  bottom.addPlaceholder(JavaUI.ID_SOURCE_VIEW);
  bottom.addPlaceholder(IPageLayout.ID_PROGRESS_VIEW);
  bottom.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
  bottom.addPlaceholder(IPageLayout.ID_BOOKMARKS);

  IFolderLayout right =
      layout.createFolder("org.apache.hadoop.eclipse.perspective.right",
          IPageLayout.RIGHT, 0.8f, layout.getEditorArea());
  right.addView(IPageLayout.ID_OUTLINE);
  right.addView("org.eclipse.ui.cheatsheets.views.CheatSheetView");
  // right.addView(layout.ID); .. cheat sheet here

  layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
  layout.addActionSet(JavaUI.ID_ACTION_SET);
  layout.addActionSet(JavaUI.ID_CODING_ACTION_SET);
  layout.addActionSet(JavaUI.ID_ELEMENT_CREATION_ACTION_SET);
  layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET);
  layout.addActionSet(JavaUI.ID_SEARCH_ACTION_SET);

  layout
      .addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewPackageCreationWizard");
  layout
      .addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewClassCreationWizard");
  layout
      .addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewInterfaceCreationWizard");
  layout
      .addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewEnumCreationWizard");
  layout
      .addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewAnnotationCreationWizard");
  layout
      .addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSourceFolderCreationWizard");
  layout
      .addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSnippetFileCreationWizard");
  layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");
  layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");
  layout
      .addNewWizardShortcut("org.eclipse.ui.editors.wizards.UntitledTextFileWizard");

  // CheatSheetViewerFactory.createCheatSheetView().setInput("org.apache.hadoop.eclipse.cheatsheet");
}