Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Rennie2012-07-12 02:03:30 +0000
committerMike Rennie2012-07-12 02:03:30 +0000
commit94b0c8b7da7e2ff4d1cfb63e61b50535f7ed3197 (patch)
tree8b14ed28bb9ee85a7e4c946d5749db5a278ff983 /org.eclipse.debug.ui/ui/org/eclipse
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
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse')
-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
3 files changed, 116 insertions, 15 deletions
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