blob: 8000f727b4a927c059dba0cd24500489e92d901c [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2000, 2005 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.debug.ui.actions;
import org.eclipse.jdt.debug.core.IJavaBreakpoint;
import org.eclipse.jface.text.source.IVerticalRulerInfo;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.dialogs.PropertyDialogAction;
import org.eclipse.ui.texteditor.ITextEditor;
/**
* Presents the standard properties dialog to configure
* the attibutes of a Java Breakpoint from the ruler popup menu of a
* text editor.
*/
public class JavaBreakpointPropertiesRulerAction extends AbstractBreakpointRulerAction {
/**
* Creates the action to enable/disable breakpoints
*/
public JavaBreakpointPropertiesRulerAction(ITextEditor editor, IVerticalRulerInfo info) {
setInfo(info);
setTextEditor(editor);
setText(ActionMessages.JavaBreakpointPropertiesRulerAction_Breakpoint__Properties_1);
}
/**
* @see Action#run()
*/
public void run() {
if (getBreakpoint() != null) {
PropertyDialogAction action=
new PropertyDialogAction(getTextEditor().getEditorSite().getShell(), new ISelectionProvider() {
public void addSelectionChangedListener(ISelectionChangedListener listener) {
}
public ISelection getSelection() {
return new StructuredSelection(getBreakpoint());
}
public void removeSelectionChangedListener(ISelectionChangedListener listener) {
}
public void setSelection(ISelection selection) {
}
});
action.run();
}
}
/**
* @see IUpdate#update()
*/
public void update() {
setBreakpoint(determineBreakpoint());
if (getBreakpoint() == null || !(getBreakpoint() instanceof IJavaBreakpoint)) {
setBreakpoint(null);
setEnabled(false);
return;
}
setEnabled(true);
}
}