View | Details | Raw Unified | Return to bug 217333
Collapse All | Expand All

(-)src/org/eclipse/pde/internal/ui/pderesources.properties (+6 lines)
Lines 441-446 Link Here
441
BaseBlock_variablesS=Variable&s...
441
BaseBlock_variablesS=Variable&s...
442
BaseBlock_dirChoose=Choose a directory:
442
BaseBlock_dirChoose=Choose a directory:
443
BaseBlock_relative=Choose a location relative to the workspace:
443
BaseBlock_relative=Choose a location relative to the workspace:
444
BaseBlock_fileTitle=Open file
445
BaseBlock_fileNotFoundMessage=The specified file could not be found.
446
BaseBlock_fileErrorMessage=The specified file could not be opened.
447
BaseBlock_directoryTitle=Open directory
448
BaseBlock_directoryNotFoundMessage=The specified directory could not be found.
449
BaseBlock_directoryErrorMessage=The specified directory could not be opened.
444
ProgramBlock_runProduct=Run a &product:
450
ProgramBlock_runProduct=Run a &product:
445
ProgramBlock_programToRun=Program to Run
451
ProgramBlock_programToRun=Program to Run
446
ProgramBlock_runApplication=Run an &application:
452
ProgramBlock_runApplication=Run an &application:
(-)src/org/eclipse/pde/internal/ui/PDEUIMessages.java (+12 lines)
Lines 2374-2379 Link Here
2374
2374
2375
	public static String BaseBlock_errorMessage;
2375
	public static String BaseBlock_errorMessage;
2376
2376
2377
	public static String BaseBlock_fileTitle;
2378
2379
	public static String BaseBlock_fileNotFoundMessage;
2380
2381
	public static String BaseBlock_fileErrorMessage;
2382
2383
	public static String BaseBlock_directoryTitle;
2384
2385
	public static String BaseBlock_directoryNotFoundMessage;
2386
2387
	public static String BaseBlock_directoryErrorMessage;
2388
2377
	public static String ConfigurationTemplateBlock_name;
2389
	public static String ConfigurationTemplateBlock_name;
2378
2390
2379
	public static String WorkspaceDataBlock_name;
2391
	public static String WorkspaceDataBlock_name;
(-)src/org/eclipse/pde/internal/ui/launcher/ConfigurationTemplateBlock.java (+4 lines)
Lines 112-117 Link Here
112
		return PDEUIMessages.ConfigurationTemplateBlock_name;
112
		return PDEUIMessages.ConfigurationTemplateBlock_name;
113
	}
113
	}
114
114
115
	protected boolean isFile() {
116
		return true;
117
	}
118
115
	protected void handleBrowseWorkspace() {
119
	protected void handleBrowseWorkspace() {
116
		ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(fTab.getControl().getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
120
		ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(fTab.getControl().getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
117
121
(-)src/org/eclipse/pde/internal/ui/launcher/WorkspaceDataBlock.java (+4 lines)
Lines 125-130 Link Here
125
		return PDEUIMessages.WorkspaceDataBlock_name;
125
		return PDEUIMessages.WorkspaceDataBlock_name;
126
	}
126
	}
127
127
128
	protected boolean isFile() {
129
		return false;
130
	}
131
128
	protected void handleBrowseWorkspace() {
132
	protected void handleBrowseWorkspace() {
129
		super.handleBrowseWorkspace();
133
		super.handleBrowseWorkspace();
130
		if (fClearWorkspaceCheck.getSelection())
134
		if (fClearWorkspaceCheck.getSelection())
(-)src/org/eclipse/pde/internal/ui/launcher/BaseBlock.java (-6 / +32 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
2
 * Copyright (c) 2005, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 7-28 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Benjamin Cabe - bug 217333
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.launcher;
12
package org.eclipse.pde.internal.ui.launcher;
12
13
14
import java.io.File;
13
import org.eclipse.core.resources.*;
15
import org.eclipse.core.resources.*;
14
import org.eclipse.core.runtime.*;
16
import org.eclipse.core.runtime.*;
15
import org.eclipse.core.variables.IStringVariableManager;
17
import org.eclipse.core.variables.IStringVariableManager;
16
import org.eclipse.core.variables.VariablesPlugin;
18
import org.eclipse.core.variables.VariablesPlugin;
17
import org.eclipse.debug.ui.StringVariableSelectionDialog;
19
import org.eclipse.debug.ui.StringVariableSelectionDialog;
20
import org.eclipse.jface.dialogs.MessageDialog;
18
import org.eclipse.jface.window.Window;
21
import org.eclipse.jface.window.Window;
19
import org.eclipse.osgi.util.NLS;
22
import org.eclipse.osgi.util.NLS;
23
import org.eclipse.pde.internal.ui.PDEPlugin;
20
import org.eclipse.pde.internal.ui.PDEUIMessages;
24
import org.eclipse.pde.internal.ui.PDEUIMessages;
21
import org.eclipse.pde.internal.ui.util.SWTUtil;
25
import org.eclipse.pde.internal.ui.util.SWTUtil;
22
import org.eclipse.pde.ui.launcher.AbstractLauncherTab;
26
import org.eclipse.pde.ui.launcher.AbstractLauncherTab;
23
import org.eclipse.swt.SWT;
27
import org.eclipse.swt.SWT;
24
import org.eclipse.swt.events.*;
28
import org.eclipse.swt.events.*;
25
import org.eclipse.swt.layout.GridData;
29
import org.eclipse.swt.layout.GridData;
30
import org.eclipse.swt.program.Program;
26
import org.eclipse.swt.widgets.*;
31
import org.eclipse.swt.widgets.*;
27
import org.eclipse.ui.dialogs.ContainerSelectionDialog;
32
import org.eclipse.ui.dialogs.ContainerSelectionDialog;
28
33
Lines 38-44 Link Here
38
43
39
	protected Listener fListener = new Listener();
44
	protected Listener fListener = new Listener();
40
45
41
	protected Label fLocationLabel;
46
	protected Link fLocationLink;
42
47
43
	class Listener extends SelectionAdapter implements ModifyListener {
48
	class Listener extends SelectionAdapter implements ModifyListener {
44
		public void widgetSelected(SelectionEvent e) {
49
		public void widgetSelected(SelectionEvent e) {
Lines 64-75 Link Here
64
	}
69
	}
65
70
66
	protected void createText(Composite parent, String text, int indent) {
71
	protected void createText(Composite parent, String text, int indent) {
67
		fLocationLabel = new Label(parent, SWT.NONE);
72
		fLocationLink = new Link(parent, SWT.NONE);
68
		fLocationLabel.setText(text);
73
		fLocationLink.setText("<a>" + text + "</a>"); //$NON-NLS-1$ //$NON-NLS-2$
69
		if (indent > 0) {
74
		if (indent > 0) {
70
			GridData gd = new GridData();
75
			GridData gd = new GridData();
71
			gd.horizontalIndent = indent;
76
			gd.horizontalIndent = indent;
72
			fLocationLabel.setLayoutData(gd);
77
			fLocationLink.setLayoutData(gd);
73
		}
78
		}
74
79
75
		fLocationText = new Text(parent, SWT.SINGLE | SWT.BORDER);
80
		fLocationText = new Text(parent, SWT.SINGLE | SWT.BORDER);
Lines 77-82 Link Here
77
		gd.widthHint = 400;
82
		gd.widthHint = 400;
78
		fLocationText.setLayoutData(gd);
83
		fLocationText.setLayoutData(gd);
79
		fLocationText.addModifyListener(fListener);
84
		fLocationText.addModifyListener(fListener);
85
86
		fLocationLink.addSelectionListener(new SelectionAdapter() {
87
			public void widgetSelected(SelectionEvent e) {
88
				try {
89
					String path = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(getLocation(), false);
90
					File f = new File(path);
91
					if (f.exists())
92
						Program.launch(f.getCanonicalPath());
93
					else
94
						MessageDialog.openWarning(PDEPlugin.getActiveWorkbenchShell(), isFile() ? PDEUIMessages.BaseBlock_fileTitle : PDEUIMessages.BaseBlock_directoryTitle, isFile() ? PDEUIMessages.BaseBlock_fileNotFoundMessage : PDEUIMessages.BaseBlock_directoryNotFoundMessage); // 
95
				} catch (Exception ex) {
96
					MessageDialog.openWarning(PDEPlugin.getActiveWorkbenchShell(), isFile() ? PDEUIMessages.BaseBlock_fileTitle : PDEUIMessages.BaseBlock_directoryTitle, isFile() ? PDEUIMessages.BaseBlock_fileErrorMessage : PDEUIMessages.BaseBlock_directoryErrorMessage); // 
97
				}
98
			}
99
		});
100
80
	}
101
	}
81
102
82
	protected void createButtons(Composite parent, String[] buttonLabels) {
103
	protected void createButtons(Composite parent, String[] buttonLabels) {
Lines 155-162 Link Here
155
176
156
	protected abstract String getName();
177
	protected abstract String getName();
157
178
179
	/**
180
	 * @return true if the block edits a file, false otherwise (i.e. directory)
181
	 */
182
	protected abstract boolean isFile();
183
158
	protected void enableBrowseSection(boolean enabled) {
184
	protected void enableBrowseSection(boolean enabled) {
159
		fLocationLabel.setEnabled(enabled);
185
		fLocationLink.setEnabled(enabled);
160
		fLocationText.setEnabled(enabled);
186
		fLocationText.setEnabled(enabled);
161
		fFileSystemButton.setEnabled(enabled);
187
		fFileSystemButton.setEnabled(enabled);
162
		fWorkspaceButton.setEnabled(enabled);
188
		fWorkspaceButton.setEnabled(enabled);
(-)src/org/eclipse/pde/internal/ui/launcher/ConfigurationAreaBlock.java (+4 lines)
Lines 114-119 Link Here
114
		return PDEUIMessages.ConfigurationAreaBlock_name;
114
		return PDEUIMessages.ConfigurationAreaBlock_name;
115
	}
115
	}
116
116
117
	protected boolean isFile() {
118
		return false;
119
	}
120
117
	public String validate() {
121
	public String validate() {
118
		if (fUseDefaultLocationButton.getSelection())
122
		if (fUseDefaultLocationButton.getSelection())
119
			return null;
123
			return null;

Return to bug 217333