private static final String HELP_DOCS = "file:///" // $NON-NLS-1$ + JMeterUtils.getJMeterHome() + "/printable_docs/usermanual/"; // $NON-NLS-1$ private static final String HELP_PAGE = HELP_DOCS + "component_reference.html"; // $NON-NLS-1$ public static final String HELP_FUNCTIONS = HELP_DOCS + "functions.html"; // $NON-NLS-1$ private static JDialog helpWindow; private static HtmlPane helpDoc; private static JScrollPane scroller; private static String currentPage; static { commands.add(ActionNames.HELP); helpDoc = new HtmlPane(); scroller = new JScrollPane(helpDoc); helpDoc.setEditable(false); try { helpDoc.setPage(HELP_PAGE); currentPage = HELP_PAGE; } catch (IOException err) { String msg = "Couldn't load help file " + err.toString(); log.error(msg); currentPage = "";// Avoid NPE in resetPage() // $NON-NLS-1$ } } /** * @see org.apache.jmeter.gui.action.Command#doAction(ActionEvent) */ public void doAction(ActionEvent e) { if (helpWindow == null) { helpWindow = new JDialog(new Frame(),// independent frame to // allow it to be overlaid // by the main frame JMeterUtils.getResString("help"),//$NON-NLS-1$ false); helpWindow.getContentPane().setLayout(new GridLayout(1, 1)); ComponentUtil.centerComponentInWindow(helpWindow, 60); } helpWindow.getContentPane().removeAll(); helpWindow.getContentPane().add(scroller); helpWindow.show(); if (e.getSource() instanceof String[]) { String[] source = (String[]) e.getSource(); resetPage(source[0]); helpDoc.scrollToReference(source[1]); } else { resetPage(HELP_PAGE); helpDoc.scrollToReference(GuiPackage.getInstance().getTreeListener().getCurrentNode().getDocAnchor()); } } private void resetPage(String source) { if (!currentPage.equals(source)) { try { helpDoc.setPage(source); currentPage = source; } catch (IOException err) { log.error(err.toString()); JMeterUtils.reportErrorToUser("Problem loading a help page - see log for details"); currentPage = ""; // $NON-NLS-1$ } } } /** * @see org.apache.jmeter.gui.action.Command#getActionNames() */ public Set getActionNames() { return commands;
public static final String HELP_DOCS = "file:///" + JMeterUtils.getJMeterHome() + "/printable_docs/usermanual/"; public static final String HELP_PAGE = HELP_DOCS + "component_reference.html"; public static final String HELP_FUNCTIONS = HELP_DOCS + "functions.html"; private static JDialog helpWindow; private static HtmlPane helpDoc; private static JScrollPane scroller; private static String currentPage; static { commands.add(HELP); helpDoc = new HtmlPane(); scroller = new JScrollPane(helpDoc); helpDoc.setEditable(false); try { helpDoc.setPage(HELP_PAGE); currentPage = HELP_PAGE; } catch (IOException err) { String msg = "Couldn't load help file " + err.toString(); log.error(msg); currentPage = "";// Avoid NPE in resetPage() } } /** * @see org.apache.jmeter.gui.action.Command#doAction(ActionEvent) */ public void doAction(ActionEvent e) { if (helpWindow == null) { helpWindow = new JDialog(new Frame(),// independent frame to // allow it to be overlaid // by the main frame JMeterUtils.getResString("help"),//$NON-NLS-1$ false); helpWindow.getContentPane().setLayout(new GridLayout(1, 1)); ComponentUtil.centerComponentInWindow(helpWindow, 60); } helpWindow.getContentPane().removeAll(); helpWindow.getContentPane().add(scroller); helpWindow.show(); if (e.getSource() instanceof String[]) { String[] source = (String[]) e.getSource(); resetPage(source[0]); helpDoc.scrollToReference(source[1]); } else { resetPage(HELP_PAGE); helpDoc.scrollToReference(ReportGuiPackage.getInstance().getTreeListener().getCurrentNode().getDocAnchor()); } } private void resetPage(String source) { if (!currentPage.equals(source)) { try { helpDoc.setPage(source); currentPage = source; } catch (IOException err) { log.error(err.toString()); JMeterUtils.reportErrorToUser("Problem loading a help page - see log for details"); currentPage = ""; } } } /** * @see org.apache.jmeter.gui.action.Command#getActionNames() */ public Set getActionNames() { return commands;
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/action/Help.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/report/gui/action/ReportHelp.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
private static final String HELP_DOCS = "file:///"  // $NON-NLS-1$
1
public static final String HELP_DOCS = "file:///" 
2
		+ JMeterUtils.getJMeterHome() 
2
+ JMeterUtils.getJMeterHome() 
3
		+ "/printable_docs/usermanual/"; // $NON-NLS-1$
3
+ "/printable_docs/usermanual/";
4
	private
5
 static final String HELP_PAGE = HELP_DOCS + "component_reference.html"; // $NON-NLS-1$
4
	public static final String HELP_PAGE = HELP_DOCS + "component_reference.html";
6
	public static final String HELP_FUNCTIONS = HELP_DOCS + "functions.html"; // $NON-NLS-1$
5
	public static final String HELP_FUNCTIONS = HELP_DOCS + "functions.html";
7
	private static JDialog helpWindow;
6
	private static JDialog helpWindow;
8
	private static HtmlPane helpDoc;
7
	private static HtmlPane helpDoc;
9
	private static JScrollPane scroller;
8
	private static JScrollPane scroller;
10
	private static String currentPage;
9
	private static String currentPage;
11
	static {
10
	static {
12
		commands.add(ActionNames.HELP);
11
		commands.add(HELP);
13
		helpDoc = new HtmlPane();
12
		helpDoc = new HtmlPane();
14
		scroller = new JScrollPane(helpDoc);
13
		scroller = new JScrollPane(helpDoc);
15
		helpDoc.setEditable(false);
14
		helpDoc.setEditable(false);
16
		try {
15
		try {
17
			helpDoc.setPage(HELP_PAGE);
16
			helpDoc.setPage(HELP_PAGE);
18
			currentPage = HELP_PAGE;
17
			currentPage = HELP_PAGE;
19
		} catch (IOException err) {
18
		} catch (IOException err) {
20
			String msg = "Couldn't load help file " + err.toString();
19
			String msg = "Couldn't load help file " + err.toString();
21
			log.error(msg);
20
			log.error(msg);
22
			currentPage = "";// Avoid NPE in resetPage() // $NON-NLS-1$
21
			currentPage = "";// Avoid NPE in resetPage()
23
		}
22
		}
24
	}
23
	}
25
	/**
24
	/**
26
	 * @see org.apache.jmeter.gui.action.Command#doAction(ActionEvent)
25
	 * @see org.apache.jmeter.gui.action.Command#doAction(ActionEvent)
27
	 */
26
	 */
28
	public void doAction(ActionEvent e) {
27
	public void doAction(ActionEvent e) {
29
		if (helpWindow == null) {
28
		if (helpWindow == null) {
30
			helpWindow = new JDialog(new Frame(),// independent frame to
29
			helpWindow = new JDialog(new Frame(),// independent frame to
31
													// allow it to be overlaid
30
													// allow it to be overlaid
32
													// by the main frame
31
													// by the main frame
33
					JMeterUtils.getResString("help"),//$NON-NLS-1$
32
					JMeterUtils.getResString("help"),//$NON-NLS-1$
34
					false);
33
					false);
35
			helpWindow.getContentPane().setLayout(new GridLayout(1, 1));
34
			helpWindow.getContentPane().setLayout(new GridLayout(1, 1));
36
			ComponentUtil.centerComponentInWindow(helpWindow, 60);
35
			ComponentUtil.centerComponentInWindow(helpWindow, 60);
37
		}
36
		}
38
		helpWindow.getContentPane().removeAll();
37
		helpWindow.getContentPane().removeAll();
39
		helpWindow.getContentPane().add(scroller);
38
		helpWindow.getContentPane().add(scroller);
40
		helpWindow.show();
39
		helpWindow.show();
41
		if (e.getSource() instanceof String[]) {
40
		if (e.getSource() instanceof String[]) {
42
			String[] source = (String[]) e.getSource();
41
			String[] source = (String[]) e.getSource();
43
			resetPage(source[0]);
42
			resetPage(source[0]);
44
			helpDoc.scrollToReference(source[1]);
43
			helpDoc.scrollToReference(source[1]);
45
		} else {
44
		} else {
46
			resetPage(HELP_PAGE);
45
			resetPage(HELP_PAGE);
47
			helpDoc.scrollToReference(GuiPackage.getInstance().getTreeListener().getCurrentNode().getDocAnchor());
46
			helpDoc.scrollToReference(ReportGuiPackage.getInstance().getTreeListener().getCurrentNode().getDocAnchor());
48
		}
47
		}
49
	}
48
	}
50
	private void resetPage(String source) {
49
	private void resetPage(String source) {
51
		if (!currentPage.equals(source)) {
50
		if (!currentPage.equals(source)) {
52
			try {
51
			try {
53
				helpDoc.setPage(source);
52
				helpDoc.setPage(source);
54
				currentPage = source;
53
				currentPage = source;
55
			} catch (IOException err) {
54
			} catch (IOException err) {
56
				log.error(err.toString());
55
				log.error(err.toString());
57
				JMeterUtils.reportErrorToUser("Problem loading a help page - see log for details");
56
				JMeterUtils.reportErrorToUser("Problem loading a help page - see log for details");
58
				currentPage = ""; // $NON-NLS-1$
57
				currentPage = "";
59
			}
58
			}
60
		}
59
		}
61
	}
60
	}
62
	/**
61
	/**
63
	 * @see org.apache.jmeter.gui.action.Command#getActionNames()
62
	 * @see org.apache.jmeter.gui.action.Command#getActionNames()
64
	 */
63
	 */
65
	public Set getActionNames() {
64
	public Set getActionNames() {
66
		return commands;
65
		return commands;
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0