Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,11 @@ public void addContentsChangedListener(final IRMLaunchConfigurationContentsChang
this.fListeners.add(listener);
}

public RMLaunchValidation canSave(final Control control, final IResourceManager resourceManager, final IPQueue queue) {
public RMLaunchValidation canSave(final Control control) {
return new RMLaunchValidation(true, null);
}

public void createControl(final Composite parent, final IResourceManager resourceManager,
final IPQueue queue) throws CoreException {
public void createControl(final Composite parent, String id) throws CoreException {
this.fControl = new Composite(parent, SWT.NONE);
this.fControl.setFont(parent.getFont());
this.fControl.setLayout(new GridLayout(1, false));
Expand Down Expand Up @@ -103,8 +102,7 @@ public Control getControl() {
return this.fControl;
}

public RMLaunchValidation initializeFrom(final Control control, final IResourceManager resourceManager, final IPQueue queue,
final ILaunchConfiguration configuration) {
public RMLaunchValidation initializeFrom(final ILaunchConfiguration configuration) {
try {
this.fNumPlacesSpinner.setSelection(configuration.getAttribute(ATTR_NUM_PLACES, DEFAULT_NUM_PLACES));
} catch (CoreException except) {
Expand All @@ -113,16 +111,14 @@ public RMLaunchValidation initializeFrom(final Control control, final IResourceM
return new RMLaunchValidation(true, null);
}

public RMLaunchValidation isValid(final ILaunchConfiguration launchConfig, final IResourceManager resourceManager,
final IPQueue queue) {
public RMLaunchValidation isValid(final ILaunchConfiguration launchConfig) {
if (this.fNumPlacesSpinner.getSelection() < 1) {
return new RMLaunchValidation(false, Messages.SRMLCDT_AtLeastOnePlaceMsg);
}
return new RMLaunchValidation(true, null);
}

public RMLaunchValidation performApply(final ILaunchConfigurationWorkingCopy configuration,
final IResourceManager resourceManager, final IPQueue queue) {
public RMLaunchValidation performApply(final ILaunchConfigurationWorkingCopy configuration) {
configuration.setAttribute(ATTR_NUM_PLACES, this.fNumPlacesSpinner.getSelection());
return new RMLaunchValidation(true, null);
}
Expand All @@ -131,8 +127,7 @@ public void removeContentsChangedListener(final IRMLaunchConfigurationContentsCh
this.fListeners.remove(listener);
}

public RMLaunchValidation setDefaults(final ILaunchConfigurationWorkingCopy configuration,
final IResourceManager resourceManager, final IPQueue queue) {
public RMLaunchValidation setDefaults(final ILaunchConfigurationWorkingCopy configuration) {
return new RMLaunchValidation(true, null);
}

Expand Down
Binary file added x10dt.ui.launch.cpp/icons/obj/x10_application.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions x10dt.ui.launch.cpp/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,17 @@
id="x10dt.ui.cpp.launch.X10LaunchConfigurationTabGroup"
type="x10dt.ui.cpp.launch.X10LaunchConfigurationType">
<launchMode
description="%parallelLaunch.run"
description="%run.launch.mode.descr"
mode="run"
perspective="org.eclipse.ptp.ui.PTPRunPerspective">
perspective="x10dt.ui.perspective">
</launchMode>
</launchConfigurationTabGroup>
</extension>
<extension
point="org.eclipse.debug.ui.launchConfigurationTypeImages">
<launchConfigurationTypeImage
configTypeID="x10dt.ui.cpp.launch.X10LaunchConfigurationType"
icon="icons/obj/parallel_run.gif"
icon="icons/obj/x10_application.gif"
id="x10dt.ui.cpp.launch.X10LaunchConfigurationTypeImage">
</launchConfigurationTypeImage>
</extension>
Expand Down Expand Up @@ -163,7 +163,7 @@
point="org.eclipse.debug.ui.launchShortcuts">
<shortcut
class="x10dt.ui.launch.cpp.launching.X10CppLaunchShortcut"
icon="icons/obj/parallel_run.gif"
icon="icons/obj/x10_application.gif"
id="x10dt.ui.launch.cpp.x10.app"
label="%run.as.x10app"
modes="run">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,17 +384,19 @@ private void createClient(final IManagedForm managedForm, final FormToolkit tool

private ICITypeConfigurationPart createCITypeConfigurationPart(final IServiceProvider serviceProvider) {
final String remoteServiceId = serviceProvider.getId();
IResourceManager rm = ModelManager.getInstance().getResourceManagerFromUniqueName(((ResourceManagerServiceProvider)serviceProvider).getUniqueName());
if (OPEN_MPI_SERVICE_PROVIDER_ID.equals(remoteServiceId)) {
return new OpenMPITypeConfigPart((IOpenMPIResourceManagerConfiguration) rm.getControlConfiguration());
} else if (MPICH2_SERVICE_PROVIDER_ID.equals(remoteServiceId)) {
return new MPICH2TypeConfigPart((IToolRMConfiguration) rm.getControlConfiguration());
} else if (PARALLEL_ENVIRONMENT_SERVICE_PROVIDER_ID.equals(remoteServiceId)) {
return new ParallelEnvironmentTypeConfigPart((PEResourceManagerConfiguration) rm.getControlConfiguration());
} else if (LOAD_LEVELER_SERVICE_PROVIDER_ID.equals(remoteServiceId)) {
//return new LoadLevelerTypeConfigPart((IIBMLLResourceManagerConfiguration) rm.getControlConfiguration());
return new LoadLevelerTypeConfigPart();
} else if (SOCKETS_SERVICE_PROVIDER_ID.equals(remoteServiceId)) {
// IResourceManager rm = ModelManager.getInstance().getResourceManagerFromUniqueName(((ResourceManagerServiceProvider)serviceProvider).getUniqueName());
// if (OPEN_MPI_SERVICE_PROVIDER_ID.equals(remoteServiceId)) {
// return new OpenMPITypeConfigPart((IOpenMPIResourceManagerConfiguration) rm.getControlConfiguration());
// } else if (MPICH2_SERVICE_PROVIDER_ID.equals(remoteServiceId)) {
// return new MPICH2TypeConfigPart((IToolRMConfiguration) rm.getControlConfiguration());
// } else if (PARALLEL_ENVIRONMENT_SERVICE_PROVIDER_ID.equals(remoteServiceId)) {
// return new ParallelEnvironmentTypeConfigPart((PEResourceManagerConfiguration) rm.getControlConfiguration());
// } else if (LOAD_LEVELER_SERVICE_PROVIDER_ID.equals(remoteServiceId)) {
// //return new LoadLevelerTypeConfigPart((IIBMLLResourceManagerConfiguration) rm.getControlConfiguration());
// return new LoadLevelerTypeConfigPart();
// } else

if (SOCKETS_SERVICE_PROVIDER_ID.equals(remoteServiceId)) {
return new HostFileAndListTypeConfigPart();
} else if (PAMI_SERVICE_PROVIDER_ID.equals(remoteServiceId)) {
return new PAMITypeConfigPart();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import java.util.Collection;

import org.eclipse.ptp.core.ModelManager;
import org.eclipse.ptp.core.PTPCorePlugin;
import org.eclipse.ptp.core.events.IResourceManagerChangedEvent;
import org.eclipse.ptp.core.events.IResourceManagerAddedEvent;
Expand Down Expand Up @@ -53,14 +54,14 @@ final class ConfNameSectionPart extends AbstractCommonSectionFormPart implements
addCompletePartListener(formPage);
ServiceModelManager.getInstance().addEventListener(this, IServiceModelEvent.SERVICE_CONFIGURATION_ADDED |
IServiceModelEvent.SERVICE_CONFIGURATION_REMOVED);
PTPCorePlugin.getDefault().getModelManager().addListener(this);
ModelManager.getInstance().addListener(this);
}

// --- IFormPart's interface methods implementation

public void dispose() {
ServiceModelManager.getInstance().removeEventListener(this);
PTPCorePlugin.getDefault().getModelManager().removeListener(this);
ModelManager.getInstance().removeListener(this);
removeCompletePartListener(getFormPage());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.eclipse.osgi.util.NLS;
import org.eclipse.ptp.core.IModelManager;
import org.eclipse.ptp.core.IPTPLaunchConfigurationConstants;
import org.eclipse.ptp.core.ModelManager;
import org.eclipse.ptp.core.PTPCorePlugin;
import org.eclipse.ptp.core.elements.IPResourceManager;
import org.eclipse.ptp.core.elements.IPUniverse;
Expand Down Expand Up @@ -95,8 +96,7 @@ public void widgetSelected(final SelectionEvent event) {
final IRMLaunchConfigurationDynamicTab rmDynamicTab = getRMLaunchConfigurationDynamicTab(resourceManager);
if (rmDynamicTab != null) {
updateConfiguration(configuration, rmDynamicTab);
rmDynamicTab.initializeFrom(CommunicationInterfaceTab.this.fComposite, resourceManager, null /* queue */,
getLaunchConfiguration());
rmDynamicTab.initializeFrom(getLaunchConfiguration());
}
}

Expand Down Expand Up @@ -142,7 +142,7 @@ public void performApply(final ILaunchConfigurationWorkingCopy configuration) {
configuration.setAttribute(ATTR_USE_PLATFORM_CONF_DATA, this.fSynchronizationBt.getSelection());
final IRMLaunchConfigurationDynamicTab rmDynamicTab = getRMLaunchConfigurationDynamicTab(this.fResourceManager);
if (rmDynamicTab != null) {
final RMLaunchValidation validation = rmDynamicTab.performApply(configuration, this.fResourceManager, null);
final RMLaunchValidation validation = rmDynamicTab.performApply(configuration);
if (! validation.isSuccess()) {
setErrorMessage(validation.getMessage());
}
Expand All @@ -151,7 +151,7 @@ public void performApply(final ILaunchConfigurationWorkingCopy configuration) {
}

public void setDefaults(final ILaunchConfigurationWorkingCopy configuration) {
final IModelManager modelManager = PTPCorePlugin.getDefault().getModelManager();
final IModelManager modelManager = ModelManager.getInstance();
final IPUniverse universe = modelManager.getUniverse();
IResourceManager resourceManager = null;
if (universe != null) {
Expand All @@ -177,7 +177,7 @@ public void setDefaults(final ILaunchConfigurationWorkingCopy configuration) {
setErrorMessage(NLS.bind(LaunchMessages.CIT_NoLaunchConfigForRM,
new Object[] { resourceManager.getName() }));
} else {
rmDynamicTab.setDefaults(configuration, resourceManager, null);
rmDynamicTab.setDefaults(configuration);
}
}

Expand Down Expand Up @@ -279,7 +279,7 @@ public boolean isValid(final ILaunchConfiguration configuration) {
if (rmDynamicTab.getControl() == null) {
initializeDynamicTab(configuration, rmDynamicTab);
}
final RMLaunchValidation validation = rmDynamicTab.isValid(configuration, this.fResourceManager, null);
final RMLaunchValidation validation = rmDynamicTab.isValid(configuration);
if (! validation.isSuccess()) {
setErrorMessage(validation.getMessage());
return false;
Expand Down Expand Up @@ -355,14 +355,13 @@ private void initializeDynamicTab(final ILaunchConfiguration configuration,
}

this.fComposite.setLayout(new GridLayout(1, false));
rmDynamicTab.createControl(this.fComposite, this.fResourceManager, null /* queue */);
rmDynamicTab.createControl(this.fComposite, this.fResourceManager.getUniqueName());
rmDynamicTab.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

if (configuration instanceof ILaunchConfigurationWorkingCopy) {
updateConfiguration((ILaunchConfigurationWorkingCopy) configuration, rmDynamicTab);
}
rmDynamicTab.initializeFrom(this.fComposite, this.fResourceManager, null /* queue */,
getLaunchConfiguration());
rmDynamicTab.initializeFrom(getLaunchConfiguration());

this.fParent.setMinSize(this.fComposite.computeSize(this.fSynchronizationBt.getBounds().width, SWT.DEFAULT));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.window.Window;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ptp.core.IPTPLaunchConfigurationConstants;
import org.eclipse.ptp.launch.ui.LaunchConfigurationTab;
import org.eclipse.ptp.launch.ui.LaunchImages;
import org.eclipse.ptp.remote.core.exception.RemoteConnectionException;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
Expand Down Expand Up @@ -78,6 +80,7 @@
import x10dt.ui.launch.cpp.platform_conf.ICppCompilationConf;
import x10dt.ui.launch.cpp.platform_conf.IX10PlatformConf;
import x10dt.ui.launch.cpp.platform_conf.X10PlatformConfFactory;
import x10dt.ui.launch.cpp.utils.PTPConfUtils;
import x10dt.ui.launch.cpp.utils.PlatformConfUtils;
import x10dt.ui.utils.LaunchUtils;

Expand Down Expand Up @@ -126,7 +129,7 @@ public void performApply(final ILaunchConfigurationWorkingCopy configuration) {
configuration.setAttribute(org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME,
this.fMainTypeText.getText().trim());
configuration.setAttribute(ATTR_X10_MAIN_CLASS, this.fMainTypeText.getText().trim());

final String content = this.fPgrmArgsText.getText().trim();
configuration.setAttribute(ATTR_ARGUMENTS, (content.length() > 0) ? content : null);

Expand Down Expand Up @@ -162,9 +165,11 @@ public void setDefaults(final ILaunchConfigurationWorkingCopy configuration) {
CppLaunchCore.log(except.getStatus());
}
}

configuration.setAttribute(ATTR_WORKING_DIR, (String) null);
configuration.setAttribute(ATTR_ARGUMENTS, (String) null);
configuration.setAttribute(ATTR_CONSOLE, true);

}

// --- Overridden methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,15 @@
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.imp.preferences.PreferencesService;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ptp.core.IPTPLaunchConfigurationConstants;
import org.eclipse.ptp.core.ModelManager;
import org.eclipse.ptp.core.PTPCorePlugin;
import org.eclipse.ptp.core.attributes.ArrayAttribute;
import org.eclipse.ptp.core.attributes.AttributeManager;
Expand Down Expand Up @@ -124,6 +127,7 @@ public void launch(final ILaunchConfiguration configuration, final String mode,
monitor.beginTask(null, 10);
monitor.subTask(LaunchMessages.CLCD_ExecCreationTaskName);


this.fProject = verifyProject(configuration);

// The following check shouldn't be necessary, since this ILaunchConfigurationDelegate implementation
Expand All @@ -134,8 +138,15 @@ public void launch(final ILaunchConfiguration configuration, final String mode,
new Status(IStatus.ERROR, CppLaunchCore.PLUGIN_ID, Constants.EMPTY_STR));
return;
}


if (!monitor.isCanceled() && shouldProcessToLinkStep(fProject) &&
createExecutable(configuration, fProject, new SubProgressMonitor(monitor, 5)) == 0) {

ILaunchConfigurationWorkingCopy workingCopy = configuration.getWorkingCopy();
workingCopy.setAttribute(IPTPLaunchConfigurationConstants.ATTR_RESOURCE_MANAGER_UNIQUENAME, fResourceManager.getUniqueName());
workingCopy.doSave();

// Then, performs the launch.
if (!monitor.isCanceled()) {
// Hijack launch if it's PAMI with LoadLeveler
Expand All @@ -146,7 +157,8 @@ public void launch(final ILaunchConfiguration configuration, final String mode,
} else {
monitor.subTask(LaunchMessages.CLCD_LaunchCreationTaskName);
updateAttributes(configuration, mode, monitor);
super.launch(configuration, mode, launch, new SubProgressMonitor(monitor, 5));
//super.launch(configuration, mode, launch, new SubProgressMonitor(monitor, 5));
runMyCommand(monitor);
}
}
}
Expand All @@ -155,6 +167,40 @@ public void launch(final ILaunchConfiguration configuration, final String mode,
}
}

private void runMyCommand(final IProgressMonitor monitor) {
try {
final MessageConsole messageConsole = UIUtils.findOrCreateX10Console();
final MessageConsoleStream mcStream = messageConsole.newMessageStream();
messageConsole.clearConsole();
final String cmd = this.fExecPath;
final List<String> command = new ArrayList<String>();
command.add(cmd);
final int returnCode = this.fTargetOpHelper.run(command, this.fWorkspaceDir, new IProcessOuputListener() {

public void read(final String line) {
mcStream.println(line);
}

public void readError(final String line) {
if (this.fCounter == 0) {
mcStream.println(NLS.bind(LaunchMessages.CLCD_CmdUsedMsg, cmd));
this.fCounter = 1;
}
mcStream.println(line);
}

// --- Fields

int fCounter;

}, monitor);
mcStream.flush();
} catch (InterruptedException e){
//TODO
} catch (IOException e){
//TODO
}
}

private void launchPAMIwLL(final ILaunchConfiguration configuration, final IProject project,
final IProgressMonitor monitor) throws CoreException{
Expand Down Expand Up @@ -372,7 +418,8 @@ protected void updateAttributes(final ILaunchConfiguration configuration, final
//attrMgr.addAttributes(getResourceAttributes(configuration, mode));

// Collects attributes from Environment tab
String[] envArr = getEnvironmentToAppend(configuration);
String[] envArr = null; //org.eclipse.ptp.core.util.LaunchUtils.getEnvironmentToAppend(configuration);

if (this.fIsCygwin) {
final StringBuilder sb = new StringBuilder();
sb.append(PATH_ENV).append('=');
Expand Down Expand Up @@ -420,7 +467,7 @@ protected void updateAttributes(final ILaunchConfiguration configuration, final

// Makes sure there is a queue, even if the resources tab doesn't require one to be specified.
if (attrMgr.getAttribute(JobAttributes.getQueueIdAttributeDefinition()) == null) {
final IPQueue queue = getQueueDefault((IPResourceManager) this.fResourceManager.getAdapter(IPResourceManager.class));
final IPQueue queue = org.eclipse.ptp.core.util.LaunchUtils.getQueueDefault((IPResourceManager) this.fResourceManager.getAdapter(IPResourceManager.class));
if (queue == null) {
throw new CoreException(new Status(IStatus.ERROR, CppLaunchCore.PLUGIN_ID, LaunchMessages.CLCD_NoRMQueueError));
}
Expand All @@ -439,7 +486,7 @@ protected void updateAttributes(final ILaunchConfiguration configuration, final
// Collects attributes from Arguments tab
attrMgr.addAttribute(JobAttributes.getWorkingDirectoryAttributeDefinition().create(this.fWorkspaceDir));

final String[] argArr = getProgramArguments(configuration);
final String[] argArr = org.eclipse.ptp.core.util.LaunchUtils.getProgramArguments(configuration);
if (argArr != null) {
attrMgr.addAttribute(JobAttributes.getProgramArgumentsAttributeDefinition().create(argArr));
}
Expand Down Expand Up @@ -596,8 +643,8 @@ private IFileStore getMainCppFileStore(final String x10MainType, final String wo
}

private IResourceManager getResourceManagerControl(final ILaunchConfiguration configuration) throws CoreException {
final IPUniverse universe = PTPCorePlugin.getDefault().getModelManager().getUniverse();
final String rmUniqueName = getResourceManagerUniqueName(configuration);
final IPUniverse universe = ModelManager.getInstance().getUniverse();
final String rmUniqueName = org.eclipse.ptp.core.util.LaunchUtils.getResourceManagerUniqueName(configuration);
for (final IPResourceManager pResourceManager : universe.getResourceManagers()) {
IResourceManager resourceManager = (IResourceManager) pResourceManager.getAdapter(IResourceManager.class);
if (resourceManager.getUniqueName().equals(rmUniqueName)) {
Expand Down
Loading