mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 06:32:10 +02:00
Bug 306569: Dynamic content support for ICDebuggerPage
This commit is contained in:
parent
c13a2bfe52
commit
304f3b2500
3 changed files with 103 additions and 4 deletions
|
@ -10,27 +10,69 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.ui;
|
package org.eclipse.cdt.debug.ui;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.ListenerList;
|
||||||
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
|
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Common function for debugger pages.
|
* Common function for debugger pages.
|
||||||
* @since 3.1
|
* @since 3.1
|
||||||
*/
|
*/
|
||||||
abstract public class AbstractCDebuggerPage extends AbstractLaunchConfigurationTab implements ICDebuggerPage {
|
abstract public class AbstractCDebuggerPage
|
||||||
|
extends AbstractLaunchConfigurationTab
|
||||||
|
implements ICDebuggerPage, ICDebuggerPageExtension {
|
||||||
|
|
||||||
private String fDebuggerID = null;
|
private String fDebuggerID = null;
|
||||||
|
private ListenerList fContentListeners;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
public AbstractCDebuggerPage() {
|
||||||
|
super();
|
||||||
|
fContentListeners = new ListenerList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.debug.ui.ICDebuggerPage#init(java.lang.String)
|
* @see org.eclipse.cdt.debug.ui.ICDebuggerPage#init(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public void init( String debuggerID ) {
|
public void init( String debuggerID ) {
|
||||||
fDebuggerID = debuggerID;
|
fDebuggerID = debuggerID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#dispose()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
fContentListeners.clear();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.debug.ui.ICDebuggerPage#getDebuggerIdentifier()
|
* @see org.eclipse.cdt.debug.ui.ICDebuggerPage#getDebuggerIdentifier()
|
||||||
*/
|
*/
|
||||||
public String getDebuggerIdentifier() {
|
public String getDebuggerIdentifier() {
|
||||||
return fDebuggerID;
|
return fDebuggerID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.ui.ICDebuggerPageExtension#addContentChangeListener(org.eclipse.cdt.debug.ui.ICDebuggerPageExtension.IContentChangeListener)
|
||||||
|
*/
|
||||||
|
public void addContentChangeListener( IContentChangeListener listener ) {
|
||||||
|
fContentListeners.add( listener );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.ui.ICDebuggerPageExtension#removeContentChangeListener(org.eclipse.cdt.debug.ui.ICDebuggerPageExtension.IContentChangeListener)
|
||||||
|
*/
|
||||||
|
public void removeContentChangeListener( IContentChangeListener listener ) {
|
||||||
|
fContentListeners.remove( listener );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies the registered listeners that the page's content has changed.
|
||||||
|
*
|
||||||
|
* @since 7.0
|
||||||
|
*/
|
||||||
|
protected void contentChanged() {
|
||||||
|
for ( Object l : fContentListeners.getListeners() )
|
||||||
|
((IContentChangeListener)l).contentChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2010 CodeSourcery 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:
|
||||||
|
* CodeSourcery - Initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.debug.ui;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface extension allows the registration of content listeners.
|
||||||
|
* Page implementors can use it to notify parents of changes in
|
||||||
|
* the page content which will force the parent tab to recalculate its size.
|
||||||
|
*
|
||||||
|
* @since 7.0
|
||||||
|
*/
|
||||||
|
public interface ICDebuggerPageExtension extends ICDebuggerPage {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 7.0
|
||||||
|
*/
|
||||||
|
public interface IContentChangeListener {
|
||||||
|
|
||||||
|
void contentChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a listener to this page. This method has no effect
|
||||||
|
* if the same listener is already registered.
|
||||||
|
*/
|
||||||
|
void addContentChangeListener( IContentChangeListener listener );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a listener from this list. Has no effect if
|
||||||
|
* the same listener was not already registered.
|
||||||
|
*/
|
||||||
|
void removeContentChangeListener( IContentChangeListener listener );
|
||||||
|
}
|
|
@ -17,6 +17,8 @@ import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||||
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
|
import org.eclipse.cdt.debug.core.ICDebugConfiguration;
|
||||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
import org.eclipse.cdt.debug.ui.ICDebuggerPage;
|
import org.eclipse.cdt.debug.ui.ICDebuggerPage;
|
||||||
|
import org.eclipse.cdt.debug.ui.ICDebuggerPageExtension;
|
||||||
|
import org.eclipse.cdt.debug.ui.ICDebuggerPageExtension.IContentChangeListener;
|
||||||
import org.eclipse.cdt.launch.ui.CLaunchConfigurationTab;
|
import org.eclipse.cdt.launch.ui.CLaunchConfigurationTab;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
|
@ -48,7 +50,17 @@ public abstract class AbstractCDebuggerTab extends CLaunchConfigurationTab {
|
||||||
private boolean fIsInitializing = false;
|
private boolean fIsInitializing = false;
|
||||||
private boolean fPageUpdated;
|
private boolean fPageUpdated;
|
||||||
|
|
||||||
protected void setDebugConfig(ICDebugConfiguration config) {
|
private IContentChangeListener fContentListener = new IContentChangeListener() {
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.ui.ICDebuggerPageExtension.IContentChangeListener#contentChanged()
|
||||||
|
*/
|
||||||
|
public void contentChanged() {
|
||||||
|
contentsChanged();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
protected void setDebugConfig(ICDebugConfiguration config) {
|
||||||
fCurrentDebugConfig = config;
|
fCurrentDebugConfig = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +73,11 @@ public abstract class AbstractCDebuggerTab extends CLaunchConfigurationTab {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setDynamicTab(ICDebuggerPage tab) {
|
protected void setDynamicTab(ICDebuggerPage tab) {
|
||||||
|
if ( fDynamicTab instanceof ICDebuggerPageExtension )
|
||||||
|
((ICDebuggerPageExtension)fDynamicTab).removeContentChangeListener( fContentListener );
|
||||||
fDynamicTab = tab;
|
fDynamicTab = tab;
|
||||||
|
if ( fDynamicTab instanceof ICDebuggerPageExtension )
|
||||||
|
((ICDebuggerPageExtension)fDynamicTab).addContentChangeListener( fContentListener );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Composite getDynamicTabHolder() {
|
protected Composite getDynamicTabHolder() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue