Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Rennie2012-07-12 02:03:30 +0000
committerMike Rennie2012-07-12 02:03:30 +0000
commit94b0c8b7da7e2ff4d1cfb63e61b50535f7ed3197 (patch)
tree8b14ed28bb9ee85a7e4c946d5749db5a278ff983
parent7f838d36513ed33979239489e0dac691b5272d7c (diff)
downloadeclipse.platform.debug-94b0c8b7da7e2ff4d1cfb63e61b50535f7ed3197.tar.gz
eclipse.platform.debug-94b0c8b7da7e2ff4d1cfb63e61b50535f7ed3197.tar.xz
eclipse.platform.debug-94b0c8b7da7e2ff4d1cfb63e61b50535f7ed3197.zip
Bug 285720 - [debug view] Add working directory + environment to processv20120712-020330
properties
-rw-r--r--org.eclipse.debug.core/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java29
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ProcessPropertyPage.java115
5 files changed, 143 insertions, 19 deletions
diff --git a/org.eclipse.debug.core/META-INF/MANIFEST.MF b/org.eclipse.debug.core/META-INF/MANIFEST.MF
index 684e25097..17145c625 100644
--- a/org.eclipse.debug.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.debug.core; singleton:=true
-Bundle-Version: 3.7.100.qualifier
+Bundle-Version: 3.8.0.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.debug.core.DebugPlugin
Bundle-Vendor: %providerName
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
index 3ba41eb5c..463920b9f 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
@@ -284,7 +284,7 @@ public class DebugPlugin extends Plugin {
*
* @since 3.7
*/
- public static final String PREF_DELETE_CONFIGS_ON_PROJECT_DELETE = DebugPlugin.getUniqueIdentifier() + ".PREF_DELETE_CONFIGS_ON_PROJECT_DELETE"; //$NON-NLS-1$
+ public static final String PREF_DELETE_CONFIGS_ON_PROJECT_DELETE = PI_DEBUG_CORE + ".PREF_DELETE_CONFIGS_ON_PROJECT_DELETE"; //$NON-NLS-1$
/**
* Deleted breakpoint marker attribute (value
@@ -294,7 +294,30 @@ public class DebugPlugin extends Plugin {
* @see org.eclipse.core.resources.IMarker#getAttribute(String, boolean)
* @since 3.7
*/
- public static final String ATTR_BREAKPOINT_IS_DELETED= DebugPlugin.getUniqueIdentifier() + ".breakpointIsDeleted"; //$NON-NLS-1$
+ public static final String ATTR_BREAKPOINT_IS_DELETED= PI_DEBUG_CORE + ".breakpointIsDeleted"; //$NON-NLS-1$
+
+ /**
+ * Attribute key for the environment used when an {@link IProcess} was run
+ * @see IProcess
+ * @since 3.8
+ */
+ public static final String ATTR_ENVIRONMENT = PI_DEBUG_CORE + ".ATTR_ENVIRONMENT"; //$NON-NLS-1$
+
+ /**
+ * Attribute key for the path of the working directory for an {@link IProcess}
+ *
+ * @see IProcess
+ * @since 3.8
+ */
+ public static final String ATTR_WORKING_DIRECTORY = PI_DEBUG_CORE + ".ATTR_WORKING_DIRECTORY"; //$NON-NLS-1$
+
+ /**
+ * Attribute key for path of the executable that launched an {@link IProcess}
+ *
+ * @see IProcess
+ * @since 3.8
+ */
+ public static final String ATTR_PATH = PI_DEBUG_CORE + ".ATTR_PATH"; //$NON-NLS-1$
/**
* The singleton debug plug-in instance.
@@ -370,7 +393,7 @@ public class DebugPlugin extends Plugin {
* @since 3.1
*/
private EventDispatchJob fEventDispatchJob = new EventDispatchJob();
-
+
/**
* Event dispatch job. Processes event queue of debug events and runnables.
*
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java
index 7c0681c04..9acd358a8 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation 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
@@ -187,6 +187,14 @@ public class DebugPreferencesMessages extends NLS {
public static String ProcessPropertyPage_5;
+ public static String ProcessPropertyPage_6;
+
+ public static String ProcessPropertyPage_7;
+
+ public static String ProcessPropertyPage_8;
+
+ public static String ProcessPropertyPage_9;
+
public static String DebugPreferencePage_28;
public static String DebugPreferencePage_5;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties
index b77d3941e..dd60914f2 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2011 IBM Corporation and others.
+# Copyright (c) 2000, 2012 IBM Corporation 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
@@ -92,6 +92,10 @@ ProcessPropertyPage_2=Process properties
ProcessPropertyPage_3=No path information available
ProcessPropertyPage_4=No time information available
ProcessPropertyPage_5=No command line information provided
+ProcessPropertyPage_6=&Working Directory:
+ProcessPropertyPage_7=En&vironment:
+ProcessPropertyPage_8=No environment information provided
+ProcessPropertyPage_9=No working directory information provided
SimpleVariablePreferencePage_3=Variable
SimpleVariablePreferencePage_4=Value
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ProcessPropertyPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ProcessPropertyPage.java
index 11b627ef4..e4fa956f1 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ProcessPropertyPage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ProcessPropertyPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation 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
@@ -11,9 +11,12 @@
package org.eclipse.debug.internal.ui.preferences;
+import java.text.ParseException;
+import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
@@ -28,6 +31,8 @@ import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PropertyPage;
+import com.ibm.icu.text.DateFormat;
+
public class ProcessPropertyPage extends PropertyPage {
private static Font fHeadingFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT);
@@ -64,14 +69,22 @@ public class ProcessPropertyPage extends PropertyPage {
text.setText(getPathText(proc));
text.setBackground(parent.getBackground());
SWTFactory.createVerticalSpacer(parent, 2);
+
+ //create working directory section
+ SWTFactory.createLabel(parent, DebugPreferencesMessages.ProcessPropertyPage_6, fHeadingFont, 1);
+ text = SWTFactory.createText(parent, SWT.WRAP | SWT.READ_ONLY, 1);
+ ((GridData)text.getLayoutData()).horizontalIndent = 10;
+ text.setText(getWorkingDirectory(proc));
+ text.setBackground(parent.getBackground());
+ SWTFactory.createVerticalSpacer(parent, 2);
- //create commandline section
+ //create command line section
SWTFactory.createLabel(parent, DebugPreferencesMessages.ProcessPropertyPage_Command_Line__1, fHeadingFont, 1);
text = SWTFactory.createText(parent,
SWT.WRAP | SWT.READ_ONLY | SWT.BORDER | SWT.V_SCROLL,
1,
- convertWidthInCharsToPixels(10),
- convertHeightInCharsToPixels(15),
+ convertWidthInCharsToPixels(13),
+ convertHeightInCharsToPixels(10),
GridData.FILL_BOTH);
text.setBackground(parent.getBackground());
((GridData)text.getLayoutData()).horizontalIndent = 10;
@@ -80,6 +93,18 @@ public class ProcessPropertyPage extends PropertyPage {
text.setText(commandLineText);
}
+ //create environment section
+ SWTFactory.createLabel(parent, DebugPreferencesMessages.ProcessPropertyPage_7, fHeadingFont, 1);
+ text = SWTFactory.createText(parent,
+ SWT.WRAP | SWT.READ_ONLY | SWT.BORDER | SWT.V_SCROLL,
+ 1,
+ convertWidthInCharsToPixels(13),
+ convertHeightInCharsToPixels(8),
+ GridData.FILL_BOTH);
+ text.setBackground(parent.getBackground());
+ ((GridData)text.getLayoutData()).horizontalIndent = 10;
+ text.setText(getEnvironment(proc));
+
setTitle(DebugPreferencesMessages.ProcessPropertyPage_2);
return parent;
}
@@ -107,33 +132,58 @@ public class ProcessPropertyPage extends PropertyPage {
* @param proc the process to extract the path text from
* @return the path text or a message indicating no path text available
*
+ * @see DebugPlugin#ATTR_PATH
* @since 3.2
*/
private String getPathText(IProcess proc) {
String text = DebugPreferencesMessages.ProcessPropertyPage_3;
if(proc != null) {
- String tmp = proc.getLabel();
+ String tmp = proc.getAttribute(DebugPlugin.ATTR_PATH);
+ if(tmp != null) {
+ return tmp;
+ }
+ tmp = proc.getLabel();
int idx = tmp.lastIndexOf("("); //$NON-NLS-1$
if(idx < 0) {
idx = tmp.length();
}
- text = tmp.substring(0, idx);
+ text = tmp.substring(0, idx);
}
return text;
}
/**
- * gets the pattern of text from the process label specified by regex
- * @param proc the process to compile the regex against
+ * gets the pattern of text from the process label specified by RegEx
+ * @param proc the process to compile the RegEx against
* @param deftext the default text to return if the process is null
- * @param regex the regex to match in the process label
- * @return the regex matched text or the default supplied text if the process is null
+ * @param regex the RegEx to match in the process label
+ * @return the RegEx matched text or the default supplied text if the process is null
*
+ * @see DebugPlugin#ATTR_RUN_AT_TIME
* @since 3.2
*/
private String getTimeText(IProcess proc) {
String text = DebugPreferencesMessages.ProcessPropertyPage_4;
if(proc != null) {
+ String tmp = proc.getAttribute(DebugPlugin.ATTR_LAUNCH_TIMESTAMP);
+ if(tmp != null) {
+ //check to see if the date/time is just the raw long (as a string)
+ try {
+ long l = Long.parseLong(tmp);
+ return DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM).format(new Date(l));
+ }
+ catch(NumberFormatException nfe) {
+ //not a number try to format the string so it always looks the same
+ try {
+ Date fdate = DateFormat.getInstance().parse(tmp);
+ return DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM).format(fdate);
+ }
+ catch(ParseException pe) {
+ //couldn't do it, return the raw string
+ }
+ }
+ return tmp;
+ }
Pattern pattern = Pattern.compile("\\(.*\\)"); //$NON-NLS-1$
Matcher matcher = pattern.matcher(proc.getLabel());
if(matcher.find()) {
@@ -144,10 +194,11 @@ public class ProcessPropertyPage extends PropertyPage {
}
/**
- * Initializes the text to be displayed in the commandline text widget
+ * Initializes the text to be displayed in the command line text widget
* @param proc the process to compile the label fragment from
- * @return the commandline text or the empty string
+ * @return the command line text or the empty string
*
+ * @see IProcess#ATTR_CMDLINE
* @since 3.2
*/
private String getCommandLineText(IProcess proc) {
@@ -158,6 +209,45 @@ public class ProcessPropertyPage extends PropertyPage {
return cmdline;
}
+ /**
+ * Initializes the text to be displayed in the environment text widget
+ * @param proc
+ * @return the environment path or a default string never <code>null</code>
+ *
+ * @see DebugPlugin#ATTR_ENVIRONMENT
+ * @since 3.8
+ */
+ String getEnvironment(IProcess proc) {
+ String env = DebugPreferencesMessages.ProcessPropertyPage_8;
+ if(proc != null) {
+ String tmp = proc.getAttribute(DebugPlugin.ATTR_ENVIRONMENT);
+ if(tmp != null) {
+ return tmp;
+ }
+ }
+ return env;
+ }
+
+ /**
+ * Initializes the text to be displayed in the working directory text widget
+ *
+ * @param proc
+ * @return the text to display or a default {@link String} never <code>null</code>
+ *
+ * @see DebugPlugin#ATTR_WORKING_DIRECTORY
+ * @since 3.8
+ */
+ String getWorkingDirectory(IProcess proc) {
+ String wd = DebugPreferencesMessages.ProcessPropertyPage_9;
+ if(proc != null) {
+ String tmp = proc.getAttribute(DebugPlugin.ATTR_WORKING_DIRECTORY);
+ if(tmp != null) {
+ return tmp;
+ }
+ }
+ return wd;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
@@ -165,5 +255,4 @@ public class ProcessPropertyPage extends PropertyPage {
super.createControl(parent);
PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDebugHelpContextIds.PROCESS_PROPERTY_PAGE);
}
-
}

Back to the top