plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/ui/actions/JsBreakpointPropertiesRulerAction.java
author Eugene Ostroukhov <eugeneo@symbian.org>
Mon, 23 Aug 2010 09:55:57 -0700
changeset 471 06589bf52fa7
child 484 f5df819c1852
permissions -rw-r--r--
Refactoring and restructuring the repository
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
471
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     1
/*******************************************************************************
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     2
 * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     3
 * All rights reserved.
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     5
 * under the terms of the License "Eclipse Public License v1.0"
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     8
 *
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
     9
 * Initial Contributors:
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    10
 * Symbian Foundation - initial contribution.
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    11
 * Contributors:
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    12
 * Description:
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    13
 * Overview:
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    14
 * Details:
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    15
 * Platforms/Drives/Compatibility:
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    16
 * Assumptions/Requirement/Pre-requisites:
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    17
 * Failures and causes:
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    18
 *******************************************************************************/
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    19
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    20
// Use of this source code is governed by a BSD-style license that can be
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    21
// found in the LICENSE file.
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    22
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    23
package org.symbian.tools.tmw.debug.ui.actions;
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    24
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    25
import org.chromium.debug.core.model.ChromiumLineBreakpoint;
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    26
import org.eclipse.debug.core.model.IBreakpoint;
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    27
import org.eclipse.debug.ui.actions.RulerBreakpointAction;
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    28
import org.eclipse.jface.text.source.IVerticalRulerInfo;
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    29
import org.eclipse.jface.viewers.ISelection;
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    30
import org.eclipse.jface.viewers.ISelectionChangedListener;
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    31
import org.eclipse.jface.viewers.ISelectionProvider;
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    32
import org.eclipse.jface.viewers.StructuredSelection;
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    33
import org.eclipse.ui.dialogs.PropertyDialogAction;
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    34
import org.eclipse.ui.texteditor.ITextEditor;
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    35
import org.eclipse.ui.texteditor.IUpdate;
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    36
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    37
/**
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    38
 * Action to bring up the breakpoint properties dialog.
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    39
 */
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    40
public class JsBreakpointPropertiesRulerAction extends RulerBreakpointAction
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    41
		implements IUpdate {
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    42
	private IBreakpoint breakpoint;
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    43
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    44
	public JsBreakpointPropertiesRulerAction(ITextEditor editor,
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    45
			IVerticalRulerInfo rulerInfo) {
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    46
		super(editor, rulerInfo);
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    47
		setText("Breakpoint Properties...");
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    48
	}
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    49
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    50
	@Override
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    51
	public void run() {
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    52
		if (getBreakpoint() != null) {
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    53
			PropertyDialogAction action = new PropertyDialogAction(getEditor()
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    54
					.getEditorSite(), new ISelectionProvider() {
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    55
				public void addSelectionChangedListener(
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    56
						ISelectionChangedListener listener) {
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    57
				}
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    58
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    59
				public ISelection getSelection() {
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    60
					return new StructuredSelection(getBreakpoint());
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    61
				}
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    62
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    63
				public void removeSelectionChangedListener(
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    64
						ISelectionChangedListener listener) {
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    65
				}
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    66
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    67
				public void setSelection(ISelection selection) {
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    68
				}
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    69
			});
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    70
			action.run();
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    71
		}
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    72
	}
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    73
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    74
	public void update() {
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    75
		breakpoint = null;
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    76
		IBreakpoint activeBreakpoint = getBreakpoint();
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    77
		if (activeBreakpoint != null
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    78
				&& activeBreakpoint instanceof ChromiumLineBreakpoint) {
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    79
			breakpoint = activeBreakpoint;
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    80
		}
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    81
		setEnabled(breakpoint != null);
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    82
	}
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    83
06589bf52fa7 Refactoring and restructuring the repository
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
diff changeset
    84
}