public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { String projectName = getProjectName(configuration); // get the name for this launch configuration String launchConfigName = ""; // try to base the launch config name on the current project launchConfigName = projectName == null ? "" :projectName; if (launchConfigName == null || launchConfigName.length() == 0) { // if no project name was found, base on a default name launchConfigName = "Jetty Webapp"; } // generate an unique name (e.g. myproject(2)) launchConfigName = getLaunchConfigurationDialog(). generateName(launchConfigName); initDefaultConfiguration(configuration,projectName,launchConfigName); return; }
private void selectWorkspaceField(ILaunchConfigurationDialog dialog) { ILaunchConfigurationTab[] tabs = dialog.getTabs(); if (tabs != null) { for (ILaunchConfigurationTab tab : tabs) { if (tab instanceof MainTab) { MainTab mainTab = (MainTab) tab; dialog.setActiveTab(mainTab); mainTab.applyData(IPDELauncherConstants.LOCATION); } } } }
private String extractNameFromJavaElement(final IJavaElement javaElement) { String name = null; if (javaElement != null) { final String[] nameRef = new String[1]; try { getLaunchConfigurationDialog().run(true, true, new IRunnableWithProgress() { @SuppressWarnings("synthetic-access") @Override public void run(IProgressMonitor pm) throws InvocationTargetException { try { final IJavaProject javaProject = javaElement.getJavaProject(); final IType agentType = javaProject.findType("io.sarl.lang.core.Agent"); //$NON-NLS-1$ final IType[] types = agentType.newTypeHierarchy(pm).getAllSubtypes(agentType); if (types != null && types.length > 0) { nameRef[0] = types[0].getFullyQualifiedName(); } } catch (JavaModelException e) { setErrorMessage(e.getLocalizedMessage()); JDIDebugUIPlugin.log(e); } } }); } catch (Exception e) { setErrorMessage(e.getLocalizedMessage()); JDIDebugUIPlugin.log(e); } name = nameRef[0]; } return Strings.nullToEmpty(name); }
/** * Updates the buttons and message in this page's launch * configuration dialog. */ protected void updateLaunchConfigurationDialog() { if (getLaunchConfigurationDialog() != null) { //order is important here due to the call to //refresh the tab viewer in updateButtons() //which ensures that the messages are up to date getLaunchConfigurationDialog().updateButtons(); getLaunchConfigurationDialog().updateMessage(); } }
@Override public String getText(Object element) { String key = ((Entry<String, Object>) element).getKey(); ILaunchConfigurationTab[] tabs = getLaunchConfigurationDialog().getTabs(); for (ILaunchConfigurationTab tab : tabs) { if (tab instanceof AbstractLaunchConfigurationTab) { String attributeLabel = ((AbstractLaunchConfigurationTab) tab).getAttributeLabel(key); if (attributeLabel != null) { return attributeLabel; } } } return key; } }
/** * @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus, java.lang.Object) */ @Override public Object handleStatus(IStatus status, Object source) { ILaunchConfigurationDialog dialog = (ILaunchConfigurationDialog) source; dialog.setActiveTab(3); return null; }
/** * Returns the description of the given configuration type * in the current mode or <code>null</code> if none. * * @param configType the config type * @return the description of the given configuration type or <code>null</code> */ private String getDescription(ILaunchConfigurationType configType) { String description = null; if(configType != null) { String mode = fDialog.getMode(); description = LaunchConfigurationPresentationManager.getDefault().getDescription(configType, mode); } if (description == null) { description = IInternalDebugCoreConstants.EMPTY_STRING; } return description; }
debugCommandDecoration.setDescriptionText(Messages.DebuggerTab_invalidFile_title); debugCommandDecoration.show(); getLaunchConfigurationDialog().updateButtons(); } else if (!file.canExecute()) { setErrorMessage(Messages.DebuggerTab_nonExecutableFileMessage); debugCommandDecoration.setDescriptionText(Messages.DebuggerTab_nonExecutableFile_title); debugCommandDecoration.show(); getLaunchConfigurationDialog().updateButtons(); } else { setErrorMessage(null);
getLaunchConfigurationDialog().setName(newUniqueToolName);
private void updateTargetsTab() { // the location has changed...set the targets tab to // need to be recomputed ILaunchConfigurationTab[] tabs = getLaunchConfigurationDialog().getTabs(); for (int i = 0; i < tabs.length; i++) { ILaunchConfigurationTab tab = tabs[i]; if (tab instanceof AntTargetsTab) { ((AntTargetsTab) tab).setDirty(true); break; } } }
/** * Returns the listing of modes for the current config * @return the listing of modes for the current config * @since 3.3 */ private Set<String> getCurrentModeSet() { Set<String> set = new HashSet<>(); ILaunchConfigurationWorkingCopy config = getWorkingCopy(); if(config != null) { try { set.addAll(config.getModes()); set.add(getLaunchConfigurationDialog().getMode()); } catch(CoreException ce) {DebugUIPlugin.log(ce);} } return set; }
ILaunchConfigurationTab[] tabs = getLaunchConfigurationDialog().getTabs(); int tabsCount = tabs.length; ILaunchConfigurationTab mainTab = null; getLaunchConfigurationDialog().setActiveTab(mainTab);
/** * Reset the given configuration with the agent name attributes associated * to the given element. * * @param javaElement the element from which information may be retrieved. * @param config the config to set with the agent name. */ protected void initializeAgentName(IJavaElement javaElement, ILaunchConfigurationWorkingCopy config) { String name = extractNameFromJavaElement(javaElement); // Set the attribute this.configurator.setAgent(config, name); // Rename the launch configuration if (name.length() > 0) { final int index = name.lastIndexOf('.'); if (index > 0) { name = name.substring(index + 1); } name = getLaunchConfigurationDialog().generateName(name); config.rename(name); } }
/** * Reinit the tabs of the launch configuration dialog. * * @param launchConfiguration the {@link LaunchConfiguration}. */ private void reinitTabs(ILaunchConfiguration launchConfiguration) { ILaunchConfigurationTab[] tabs = getLaunchConfigurationDialog().getTabs(); for (ILaunchConfigurationTab configTab : tabs) { configTab.initializeFrom(launchConfiguration); } }
try { final boolean[] res = new boolean[1]; getLaunchConfigurationDialog().run(true, true, new IRunnableWithProgress() { @SuppressWarnings("synthetic-access") @Override
if(!canLaunchWithModes()) { SelectLaunchModesDialog sld = new SelectLaunchModesDialog(getShell(), getLaunchConfigurationDialog().getMode(), getWorkingCopy()); if(sld.open() == IDialogConstants.OK_ID) { @SuppressWarnings("unchecked") Set<String> modes = (Set<String>) res[0]; modes.remove(getLaunchConfigurationDialog().getMode()); ILaunchConfigurationWorkingCopy wc = getWorkingCopy(); wc.setModes(modes); getWorkingCopy().getType().getDelegates(getCurrentModeSet()), getWorkingCopy(), getLaunchConfigurationDialog().getMode()); if(sldd.open() == IDialogConstants.OK_ID) { displayInstanceTabs(true);
/** * Find the first instance of a type, compilation unit, class file or project in the * specified element's parental hierarchy, and use this as the default name. */ private void initializeName(IJavaElement javaElement, ILaunchConfigurationWorkingCopy config) { String name = EMPTY_STRING; try { IResource resource = javaElement.getUnderlyingResource(); if (resource != null) { name = resource.getName(); int index = name.lastIndexOf('.'); if (index > 0) { name = name.substring(0, index); } } else { name= javaElement.getElementName(); } name = getLaunchConfigurationDialog().generateName(name); } catch (JavaModelException jme) {JDIDebugUIPlugin.log(jme);} config.rename(name); }
private void updateTargetsTab() { // the properties have changed...set the targets tab to // need to be recomputed ILaunchConfigurationTab[] tabs = getLaunchConfigurationDialog().getTabs(); for (int i = 0; i < tabs.length; i++) { ILaunchConfigurationTab tab = tabs[i]; if (tab instanceof AntTargetsTab) { ((AntTargetsTab) tab).setDirty(true); break; } } }
private IType[] searchAgentNames() { final IType[][] res = new IType[1][]; res[0] = new IType[0]; final String projectName = this.fProjText.getText(); final IStatus status = ResourcesPlugin.getWorkspace().validateName(projectName, IResource.PROJECT); if (status.isOK()) { try { getLaunchConfigurationDialog().run(true, true, new IRunnableWithProgress() { @SuppressWarnings("synthetic-access") @Override public void run(IProgressMonitor pm) throws InvocationTargetException { try { final IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); final IJavaProject javaProject = JavaCore.create(project); final IType agentType = javaProject.findType("io.sarl.lang.core.Agent"); //$NON-NLS-1$ res[0] = agentType.newTypeHierarchy(pm).getAllSubtypes(agentType); } catch (JavaModelException e) { setErrorMessage(e.getLocalizedMessage()); JDIDebugUIPlugin.log(e); } } }); } catch (Exception e) { setErrorMessage(e.getLocalizedMessage()); JDIDebugUIPlugin.log(e); } } return res[0]; }
/** * Sets the default values for the given {@link LaunchConfigurationWorkingCopy} * @param wc * @since 3.6 */ protected void doSetDefaults(ILaunchConfigurationWorkingCopy wc) { try { ILaunchConfigurationTabGroup tabGroup = LaunchConfigurationPresentationManager.getDefault().getTabGroup(wc, getMode()); // this only works because this action is only present when the dialog is open ILaunchConfigurationDialog dialog = LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog(); tabGroup.createTabs(dialog, dialog.getMode()); ILaunchConfigurationTab[] tabs = tabGroup.getTabs(); for (int i = 0; i < tabs.length; i++) { tabs[i].setLaunchConfigurationDialog(dialog); } tabGroup.setDefaults(wc); tabGroup.dispose(); } catch (CoreException e) { DebugUIPlugin.log(e.getStatus()); } }