1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-05 00:36:16 +02:00

Bugzilla 198353

This commit is contained in:
Randy Rohrbach 2007-07-31 05:09:31 +00:00
parent c29a7ffa2a
commit ac6017aeb9
7 changed files with 1214 additions and 1 deletions

View file

@ -0,0 +1,3 @@
#Fri Jul 27 14:30:56 EDT 2007
eclipse.preferences.version=1
encoding//src/org/eclipse/dd/dsf/debug/ui/viewmodel/detailpanesupport/messages.properties=8859_1

View file

@ -202,6 +202,12 @@
</viewContribution>
</extension>
<extension
point="org.eclipse.debug.ui.detailPaneFactories">
<detailFactories
class="org.eclipse.dd.dsf.debug.ui.viewmodel.detailpanesupport.DetailPaneFactory"
id="org.eclipse.dd.dsf.debug.ui.viewmodel.detailPaneFactory">
</detailFactories>
</extension>
</plugin>

View file

@ -0,0 +1,76 @@
/*******************************************************************************
* Copyright (c) 2007 Wind River Systems 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:
* Randy Rohrbach (Wind River Systems, Inc.) - initial implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.ui.viewmodel.detailpanesupport;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.debug.ui.IDetailPane;
import org.eclipse.debug.ui.IDetailPaneFactory;
import org.eclipse.jface.viewers.IStructuredSelection;
/**
* This provides a simple Detail Pane Factory for the core debug views for DSF.
*/
@SuppressWarnings("restriction")
public class DetailPaneFactory implements IDetailPaneFactory {
public static final String DETAIL_PANE_ID = Messages.getString("DetailPaneFactory.0"); //$NON-NLS-1$
public static final String DETAIL_PANE_NAME = Messages.getString("DetailPaneFactory.1"); //$NON-NLS-1$
public static final String DETAIL_PANE_DESC = Messages.getString("DetailPaneFactory.2"); //$NON-NLS-1$
/* (non-Javadoc)
* @see org.eclipse.debug.internal.ui.views.variables.IDetailsFactory#createDetailsArea(java.lang.String)
*/
public IDetailPane createDetailPane(String id) {
return new DetailPane();
}
/* (non-Javadoc)
* @see org.eclipse.debug.internal.ui.views.variables.IDetailsFactory#getDetailsTypes(org.eclipse.jface.viewers.IStructuredSelection)
*/
@SuppressWarnings("unchecked")
public Set getDetailPaneTypes(IStructuredSelection selection) {
Set<String> possibleIDs = new HashSet<String>(1);
possibleIDs.add(DETAIL_PANE_ID);
return possibleIDs;
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.IDetailPaneFactory#getDefaultDetailPane(java.util.Set, org.eclipse.jface.viewers.IStructuredSelection)
*/
public String getDefaultDetailPane(IStructuredSelection selection) {
return DETAIL_PANE_ID;
}
/* (non-Javadoc)
* @see org.eclipse.debug.internal.ui.views.variables.IDetailsFactory#getName(java.lang.String)
*/
public String getDetailPaneName(String id) {
if (id.equals(DETAIL_PANE_ID)){
return DETAIL_PANE_NAME;
}
return null;
}
/* (non-Javadoc)
* @see org.eclipse.debug.internal.ui.views.variables.IDetailsFactory#getDescription(java.lang.String)
*/
public String getDetailPaneDescription(String id) {
if (id.equals(DETAIL_PANE_ID)){
return DETAIL_PANE_DESC;
}
return null;
}
}

View file

@ -0,0 +1,32 @@
/*******************************************************************************
* Copyright (c) 2007 Wind River Systems 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:
* Randy Rohrbach (Wind River Systems, Inc.) - initial implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.ui.viewmodel.detailpanesupport;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
public class Messages {
private static final String BUNDLE_NAME = "org.eclipse.dd.dsf.debug.ui.viewmodel.detailpanesupport.messages"; //$NON-NLS-1$
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
.getBundle(BUNDLE_NAME);
private Messages() {
}
public static String getString(String key) {
try {
return RESOURCE_BUNDLE.getString(key);
} catch (MissingResourceException e) {
return '!' + key + '!';
}
}
}

View file

@ -0,0 +1,86 @@
/*******************************************************************************
* Copyright (c) 2006, 2007 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
* Randy Rohrbach (Wind River Systems, Inc.) - extended implementation
*******************************************************************************/
package org.eclipse.dd.dsf.debug.ui.viewmodel.detailpanesupport;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.text.ITextOperationTarget;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.ui.texteditor.IUpdate;
/**
* Common function for actions that operate on a text viewer.
* <p>
* Clients may subclass this class.
* </p>
* @since 3.0
*/
public class TextViewerAction extends Action implements IUpdate {
private int fOperationCode= -1;
private ITextOperationTarget fOperationTarget;
/**
* Constructs a new action in the given text viewer with
* the specified operation code.
*
* @param viewer
* @param operationCode
*/
public TextViewerAction(ITextViewer viewer, int operationCode) {
fOperationCode= operationCode;
fOperationTarget= viewer.getTextOperationTarget();
update();
}
/* (non-Javadoc)
* @see org.eclipse.ui.texteditor.IUpdate#update()
*
* Updates the enabled state of the action.
* Fires a property change if the enabled state changes.
*
* @see org.eclipse.jface.action.Action#firePropertyChange(String, Object, Object)
*/
public void update() {
boolean wasEnabled= isEnabled();
boolean isEnabled= (fOperationTarget != null && fOperationTarget.canDoOperation(fOperationCode));
setEnabled(isEnabled);
if (wasEnabled != isEnabled) {
firePropertyChange(ENABLED, wasEnabled ? Boolean.TRUE : Boolean.FALSE, isEnabled ? Boolean.TRUE : Boolean.FALSE);
}
}
/* (non-Javadoc)
* @see org.eclipse.jface.action.IAction#run()
*/
@Override
public void run() {
if (fOperationCode != -1 && fOperationTarget != null) {
fOperationTarget.doOperation(fOperationCode);
}
}
/**
* Configures this action with a label, tool tip, and description.
*
* @param text action label
* @param toolTipText action tool tip
* @param description action description
*/
public void configureAction(String text, String toolTipText, String description) {
setText(text);
setToolTipText(toolTipText);
setDescription(description);
}
}

View file

@ -0,0 +1,3 @@
DetailPaneFactory.0=DSF Default Detail Pane
DetailPaneFactory.1=DSF Default Viewer
DetailPaneFactory.2=This is the default detail pane representation for DSF assisted views