本文整理匯總了Java中org.eclipse.debug.ui.DebugUITools類的典型用法代碼示例。如果您正苦於以下問題:Java DebugUITools類的具體用法?Java DebugUITools怎麽用?Java DebugUITools使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
DebugUITools類屬於org.eclipse.debug.ui包,在下文中一共展示了DebugUITools類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: launchFile
import org.eclipse.debug.ui.DebugUITools; //導入依賴的package包/類
/**
* 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, moduleToRun);
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(getLaunchConfigTypeID());
DebugUITools.launch(runConfigConverter.toLaunchConfiguration(type, runConfig), mode);
// execution dispatched to proper delegate LaunchConfigurationDelegate
}
示例2: launch
import org.eclipse.debug.ui.DebugUITools; //導入依賴的package包/類
protected void launch(IResource type, Object additionalScope, String mode) {
List<ILaunchConfiguration> configs = getCandidates(type, additionalScope, getConfigurationType());
if (configs != null) {
ILaunchConfiguration config = null;
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(type, additionalScope);
}
if (config != null) {
DebugUITools.launch(config, mode);
}
}
}
示例3: chooseAndLaunch
import org.eclipse.debug.ui.DebugUITools; //導入依賴的package包/類
private void chooseAndLaunch(IFile file, ILaunchConfiguration[] configs, String mode) {
ILaunchConfiguration config = null;
if (configs.length == 0) {
config = createConfiguration(file);
} else if (configs.length == 1) {
config = configs[0];
} else {
config = chooseConfiguration(configs);
}
if (config != null) {
Shell shell = getShell();
DebugUITools.openLaunchConfigurationDialogOnGroup(shell, new StructuredSelection(config),
IDebugUIConstants.ID_RUN_LAUNCH_GROUP);
}
}
示例4: launch
import org.eclipse.debug.ui.DebugUITools; //導入依賴的package包/類
/**
* Delegate method to launch the specified <code>ILaunchConfiguration</code>
* in the specified mode
*
* @param mode
* the mode to launch in
* @param configuration
* the <code>ILaunchConfiguration</code> to launch
*/
private void launch(String mode, ILaunchConfiguration configuration) {
if (fShowDialog) {
/*
* // Offer to save dirty editors before opening the dialog as the
* contents // of an Ant editor often affect the contents of the
* dialog. if (!DebugUITools.saveBeforeLaunch()) { return; }
*/
IStatus status = new Status(IStatus.INFO,
JSBuildFileUIPlugin.PLUGIN_ID, STATUS_INIT_RUN_ANT, "",
null);
String groupId;
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
groupId = IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP;
} else {
groupId = org.eclipse.ui.externaltools.internal.model.IExternalToolConstants.ID_EXTERNAL_TOOLS_LAUNCH_GROUP;
}
DebugUITools.openLaunchConfigurationDialog(JSBuildFileUIPlugin
.getActiveWorkbenchWindow().getShell(), configuration,
groupId, status);
} else {
DebugUITools.launch(configuration, mode);
}
}
示例5: chooseConfig
import org.eclipse.debug.ui.DebugUITools; //導入依賴的package包/類
/**
* Prompts the user to choose from the list of given launch configurations
* and returns the config the user choose or <code>null</code> if the user
* pressed Cancel or if the given list is empty.
*
* @param configs
* the list of {@link ILaunchConfiguration}s to choose from
* @return the chosen {@link ILaunchConfiguration} or <code>null</code>
*/
public static 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(JSBuildFileLaunchConfigurationMessages.AntLaunchShortcut_4);
dialog.setMessage(JSBuildFileLaunchConfigurationMessages.AntLaunchShortcut_5);
dialog.setMultipleSelection(false);
int result = dialog.open();
labelProvider.dispose();
if (result == Window.OK) {
return (ILaunchConfiguration) dialog.getFirstResult();
}
return null;
}
示例6: launch
import org.eclipse.debug.ui.DebugUITools; //導入依賴的package包/類
/**
* {@inheritDoc}
*/
public void launch(ISelection selection, String mode) {
if (selection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) selection;
if (ss.size() == 1) {
Object element = ss.getFirstElement();
if (element instanceof IFile || element instanceof IFolder
|| element instanceof IProject) {
IResource res=(IResource)element;
ILaunchConfiguration configuration = getConfiguration(res);
if (configuration != null) {
DebugUITools.launch(configuration, mode);
}
}
}
}
}
示例7: chooseConfiguration
import org.eclipse.debug.ui.DebugUITools; //導入依賴的package包/類
/**
* Returns a configuration from the given collection of configurations that should be launched,
* or <code>null</code> to cancel.
*
* @param configList list of configurations to choose from
* @return configuration to launch or <code>null</code> to cancel
*/
private ILaunchConfiguration chooseConfiguration(List<ILaunchConfiguration> configList) {
if (configList.size() == 1) {
return (ILaunchConfiguration) configList.get(0);
}
IDebugModelPresentation labelProvider = DebugUITools.newDebugModelPresentation();
ElementListSelectionDialog dialog= new ElementListSelectionDialog(Display.getCurrent().getActiveShell(),
labelProvider);
dialog.setElements(configList.toArray());
dialog.setTitle("Select Configuraiton"); //$NON-NLS-1$
dialog.setMessage("&Select an existing configuration:"); //$NON-NLS-1$
dialog.setMultipleSelection(false);
int result = dialog.open();
labelProvider.dispose();
if (result == Window.OK) {
return (ILaunchConfiguration) dialog.getFirstResult();
}
return null;
}
示例8: createPageControls
import org.eclipse.debug.ui.DebugUITools; //導入依賴的package包/類
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 );
}
示例9: chooseConfiguration
import org.eclipse.debug.ui.DebugUITools; //導入依賴的package包/類
/**
* 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();
}
}
示例10: createLaunchConfig
import org.eclipse.debug.ui.DebugUITools; //導入依賴的package包/類
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();
}
示例11: getHoverText
import org.eclipse.debug.ui.DebugUITools; //導入依賴的package包/類
@Override
public String getHoverText(Annotation annotation, ITextViewer textViewer, IRegion hoverRegion) {
if (!BfDebugModelPresentation.INSTRUCTION_POINTER_ANNOTATION_TYPE.equals(annotation.getType())) {
return null;
}
IAdaptable adaptable = DebugUITools.getDebugContext();
if (adaptable instanceof BfStackFrame) {
BfStackFrame stackFrame = (BfStackFrame) adaptable;
try {
int instructionPointer = stackFrame.getCharStart();
String text = "Instruction Pointer: [<b>" + instructionPointer + "</b>]";
int memoryPointer = stackFrame.getMemoryPointer();
IMemoryBlock memoryBlock = stackFrame.getDebugTarget().getMemoryBlock(memoryPointer, 1);
byte value = memoryBlock.getBytes()[0];
text = text + "<br>Memory Value: [<b>0x" + Integer.toHexString(memoryPointer).toUpperCase() + "</b>]=<b>0x" + Integer.toHexString((value & 0xFF)) + "</b>";
return text;
}
catch (DebugException ex) {
DbgActivator.getDefault().logError("Memory Block could not be evaluated", ex);
}
}
return null;
}
示例12: createContributionItems
import org.eclipse.debug.ui.DebugUITools; //導入依賴的package包/類
@Override
public void createContributionItems(IServiceLocator serviceLocator,
IContributionRoot additions) {
CommandContributionItemParameter toggleWatchpointParam = new CommandContributionItemParameter(serviceLocator, null, "org.eclipse.debug.ui.commands.ToggleWatchpoint", CommandContributionItem.STYLE_PUSH);
toggleWatchpointParam.icon = DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_WATCHPOINT);
toggleWatchpointParam.disabledIcon = DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_WATCHPOINT_DISABLED);
toggleWatchpointParam.label = "Add Watchpoint";
CommandContributionItem toggleWatchpoint = new CommandContributionItem(toggleWatchpointParam);
Expression toggleWatchpointVisible = new Expression() {
@Override
public EvaluationResult evaluate(IEvaluationContext context)
throws CoreException {
return EvaluationResult.valueOf((context.getVariable("activeEditor") instanceof BfEditor));
}
};
additions.addContributionItem(toggleWatchpoint, toggleWatchpointVisible);
}
示例13: getInstalledBreakpointImage
import org.eclipse.debug.ui.DebugUITools; //導入依賴的package包/類
private Image getInstalledBreakpointImage(BfBreakpoint breakpoint) {
ImageDescriptor defaultImageDescriptor = DebugUITools.getDefaultImageDescriptor(breakpoint);
if (this.overlayedImages.containsKey(defaultImageDescriptor)) {
return this.overlayedImages.get(defaultImageDescriptor);
}
try {
ImageDescriptor overlay = ImageDescriptor.createFromURL(new URL("platform:/plugin/org.eclipse.ui.ide/icons/full/obj16/header_complete.png"));
Image defaultImage = defaultImageDescriptor.createImage();
this.disposeImages.add(defaultImage);
ImageDescriptor overlayedDescriptor = new DecorationOverlayIcon(defaultImage, overlay, IDecoration.BOTTOM_LEFT);
Image overlayedImage = overlayedDescriptor.createImage();
this.disposeImages.add(overlayedImage);
this.overlayedImages.put(defaultImageDescriptor, overlayedImage);
return overlayedImage;
}
catch (MalformedURLException ex) {
DbgActivator.getDefault().logError("URL malformed", ex);
return null;
}
}
示例14: launch
import org.eclipse.debug.ui.DebugUITools; //導入依賴的package包/類
public final void launch() {
try {
ILaunchConfigurationWorkingCopy workingCopy = createLaunchWorkingCopy();
setUpConfiguration(workingCopy);
final ILaunchConfiguration configuration = workingCopy.doSave();
if(shouldRun())
Utilities.runInDisplayThread(new Runnable() {
public void run() {
// must be called from ui thread
DebugUITools.launch(configuration, ILaunchManager.RUN_MODE);
}
});
} catch (Exception e) {
Utilities.showException(e);
}
}
示例15: run
import org.eclipse.debug.ui.DebugUITools; //導入依賴的package包/類
public void run(IAction action) {
IAdaptable context = DebugUITools.getDebugContext();
if (context == null) { // debugger not active
return;
}
EvaluateContext evaluateContext = (EvaluateContext) context.getAdapter(EvaluateContext.class);
if (evaluateContext == null) {
return;
}
IEditorPart editorPart = activeEditorPart;
String currentSelectedText = retrieveSelection(editorPart);
EvaluateCallbackImpl callback =
new EvaluateCallbackImpl(evaluateContext, editorPart, currentSelectedText);
evaluateContext.getJsEvaluateContext().evaluateAsync(currentSelectedText, null,
callback, null);
}