/******************************************************************************* * Copyright (c) 2011, 2013 Wind River Systems, Inc. and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Wind River Systems - initial API and implementation *******************************************************************************/ package org.eclipse.tcf.te.tcf.launch.ui.remote.app; import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.Path; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Text; import org.eclipse.tcf.te.launch.core.persistence.DefaultPersistenceDelegate; import org.eclipse.tcf.te.launch.ui.model.LaunchNode; import org.eclipse.tcf.te.launch.ui.properties.BaseTitledSection; import org.eclipse.tcf.te.tcf.launch.ui.nls.Messages; import org.eclipse.tcf.te.tcf.processes.core.interfaces.steps.IProcessesStepAttributes; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; /** * The property section to display the properties of a launch configuration. */ public class RemoteAppPropertiesSection extends BaseTitledSection { private String processImageValue = ""; //$NON-NLS-1$ private String processArgsValue = ""; //$NON-NLS-1$ private Text processImage; private Text processArgs; /* * (non-Javadoc) * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage) */ @Override public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) { super.createControls(parent, aTabbedPropertySheetPage); processImage = createTextField(null, Messages.LaunchConfigurationMainTabSection_processImage_label); processArgs = createTextField(processImage, Messages.LaunchConfigurationMainTabSection_processArguments_label); } /* * (non-Javadoc) * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#setInput(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) */ @Override public void setInput(IWorkbenchPart part, ISelection selection) { super.setInput(part, selection); Assert.isTrue(selection instanceof IStructuredSelection); Object input = ((IStructuredSelection) selection).getFirstElement(); Assert.isTrue(input instanceof LaunchNode); ILaunchConfiguration node = ((LaunchNode)input).getLaunchConfiguration(); processImageValue = DefaultPersistenceDelegate.getAttribute(node, IProcessesStepAttributes.ATTR_PROCESS_IMAGE, ""); //$NON-NLS-1$ processArgsValue = DefaultPersistenceDelegate.getAttribute(node, IProcessesStepAttributes.ATTR_PROCESS_ARGUMENTS, ""); //$NON-NLS-1$ } /* * (non-Javadoc) * @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection#refresh() */ @Override public void refresh() { if (processImage != null) processImage.setText(new Path(processImageValue).toPortableString()); if (processArgs != null) processArgs.setText(processArgsValue); } /* (non-Javadoc) * @see org.eclipse.tcf.te.ui.views.tabbed.BaseTitledSection#getText() */ @Override protected String getText() { return Messages.LaunchConfigurationMainTabSection_title; } }