diff options
author | Randy Rohrbach | 2008-05-07 13:25:48 +0000 |
---|---|---|
committer | Randy Rohrbach | 2008-05-07 13:25:48 +0000 |
commit | ae03beb86a8223c7b6131b1741e05d0b50cbd7dd (patch) | |
tree | 70cd90ed296f2557933ae822bc3462ced9c61d82 /plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal | |
parent | 3d4405ffaf8eadbe32e8ca4d8a2003552e6232a6 (diff) | |
download | org.eclipse.cdt-ae03beb86a8223c7b6131b1741e05d0b50cbd7dd.tar.gz org.eclipse.cdt-ae03beb86a8223c7b6131b1741e05d0b50cbd7dd.tar.xz org.eclipse.cdt-ae03beb86a8223c7b6131b1741e05d0b50cbd7dd.zip |
Bugzilla 215063
Also performed some minor cleanup of warnings. ( no API changes ).
Randy
Diffstat (limited to 'plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal')
26 files changed, 733 insertions, 184 deletions
diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/ModulesVMNode.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/ModulesVMNode.java index 3071973199e..9602ba9a2e4 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/ModulesVMNode.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/ModulesVMNode.java @@ -7,6 +7,7 @@ * * Contributors: * Wind River Systems - initial API and implementation + * Ericsson AB - Modules view for DSF implementation *******************************************************************************/ package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.modules; diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/ModulesVMProvider.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/ModulesVMProvider.java index 30ec06400ea..f16e51f87e7 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/ModulesVMProvider.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/ModulesVMProvider.java @@ -7,6 +7,7 @@ * * Contributors: * Wind River Systems - initial API and implementation + * Ericsson AB - Modules view for DSF implementation *******************************************************************************/ package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.modules; diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/ModuleDetailPane.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/detail/ModuleDetailPane.java index da36a7a58f9..2e62da1f0b2 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/ModuleDetailPane.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/detail/ModuleDetailPane.java @@ -11,12 +11,11 @@ * Wind River Systems - adopted to use with Modules view * Ericsson AB - Modules view for DSF implementation *******************************************************************************/ -package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.modules; +package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.modules.detail; import java.util.concurrent.ExecutionException; -import org.eclipse.cdt.debug.internal.ui.views.modules.ModulesMessages; import org.eclipse.cdt.debug.ui.ICDebugUIConstants; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; @@ -29,20 +28,15 @@ import org.eclipse.dd.dsf.concurrent.Query; import org.eclipse.dd.dsf.datamodel.DMContexts; import org.eclipse.dd.dsf.datamodel.IDMContext; import org.eclipse.dd.dsf.debug.internal.ui.DsfDebugUIPlugin; -import org.eclipse.dd.dsf.debug.internal.ui.viewmodel.numberformat.detail.TextViewerAction; +import org.eclipse.dd.dsf.debug.internal.ui.viewmodel.detailsupport.MessagesForDetailPane; +import org.eclipse.dd.dsf.debug.internal.ui.viewmodel.detailsupport.TextViewerAction; import org.eclipse.dd.dsf.debug.service.IModules; import org.eclipse.dd.dsf.debug.service.IModules.IModuleDMContext; import org.eclipse.dd.dsf.debug.service.IModules.IModuleDMData; +import org.eclipse.dd.dsf.debug.ui.IDsfDebugUIConstants; import org.eclipse.dd.dsf.service.DsfServicesTracker; import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.dsf.ui.viewmodel.datamodel.IDMVMContext; -import org.eclipse.debug.core.model.IDebugElement; -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.internal.ui.IDebugHelpContextIds; -import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; -import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants; -import org.eclipse.debug.internal.ui.views.variables.details.AbstractDetailPane; -import org.eclipse.debug.internal.ui.views.variables.details.DetailMessages; import org.eclipse.debug.ui.IDebugView; import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuManager; @@ -78,7 +72,7 @@ import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds; /** * */ -public class ModuleDetailPane extends AbstractDetailPane implements IAdaptable, IPropertyChangeListener { +public class ModuleDetailPane extends ModulesAbstractDetailPane implements IAdaptable, IPropertyChangeListener { /** * These are the IDs for the actions in the context menu @@ -106,7 +100,7 @@ public class ModuleDetailPane extends AbstractDetailPane implements IAdaptable, if (isInView()){ createViewSpecificComponents(); createActions(); - DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this); + DsfDebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this); JFaceResources.getFontRegistry().addListener(this); } return fSourceViewer.getControl(); @@ -128,11 +122,6 @@ public class ModuleDetailPane extends AbstractDetailPane implements IAdaptable, return; } - Object firstElement = selection.getFirstElement(); - if (firstElement != null && firstElement instanceof IDebugElement) { - String modelID = ((IDebugElement)firstElement).getModelIdentifier(); - } - synchronized (this) { if (fDetailJob != null) { fDetailJob.cancel(); @@ -150,17 +139,18 @@ public class ModuleDetailPane extends AbstractDetailPane implements IAdaptable, if (fDetailJob != null) { fDetailJob.cancel(); } - fDetailDocument.set(""); + fDetailDocument.set(""); //$NON-NLS-1$ fSourceViewer.setEditable(false); } + @Override public void dispose() { super.dispose(); if (fDetailJob != null) fDetailJob.cancel(); if (fSourceViewer != null && fSourceViewer.getControl() != null) fSourceViewer.getControl().dispose(); if (isInView()){ - DebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this); + DsfDebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this); JFaceResources.getFontRegistry().removeListener(this); } @@ -182,6 +172,8 @@ public class ModuleDetailPane extends AbstractDetailPane implements IAdaptable, } return false; } + + @SuppressWarnings("unchecked") public Object getAdapter(Class adapter) { if (ITextViewer.class.equals(adapter)) { return fSourceViewer; @@ -191,8 +183,8 @@ public class ModuleDetailPane extends AbstractDetailPane implements IAdaptable, public void propertyChange(PropertyChangeEvent event) { String propertyName= event.getProperty(); - if (propertyName.equals(IInternalDebugUIConstants.DETAIL_PANE_FONT)) { - fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(IInternalDebugUIConstants.DETAIL_PANE_FONT)); + if (propertyName.equals(IDsfDebugUIConstants.DETAIL_PANE_FONT)) { + fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(IDsfDebugUIConstants.DETAIL_PANE_FONT)); } } @@ -207,10 +199,10 @@ public class ModuleDetailPane extends AbstractDetailPane implements IAdaptable, // Create & configure a SourceViewer fSourceViewer = new SourceViewer(parent, null, SWT.V_SCROLL | SWT.H_SCROLL); fSourceViewer.setDocument(getDetailDocument()); - fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(IInternalDebugUIConstants.DETAIL_PANE_FONT)); - fSourceViewer.getTextWidget().setWordWrap(DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDebugPreferenceConstants.PREF_DETAIL_PANE_WORD_WRAP)); + fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(IDsfDebugUIConstants.DETAIL_PANE_FONT)); + fSourceViewer.getTextWidget().setWordWrap(DsfDebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP)); fSourceViewer.setEditable(false); - PlatformUI.getWorkbench().getHelpSystem().setHelp(fSourceViewer.getTextWidget(), IDebugHelpContextIds.DETAIL_PANE); + PlatformUI.getWorkbench().getHelpSystem().setHelp(fSourceViewer.getTextWidget(), IDsfDebugUIConstants.DETAIL_PANE); Control control = fSourceViewer.getControl(); GridData gd = new GridData(GridData.FILL_BOTH); control.setLayoutData(gd); @@ -254,7 +246,8 @@ public class ModuleDetailPane extends AbstractDetailPane implements IAdaptable, // Add a focus listener to update actions when details area gains focus fSourceViewer.getControl().addFocusListener(new FocusAdapter() { - public void focusGained(FocusEvent e) { + @Override + public void focusGained(FocusEvent e) { getViewSite().setSelectionProvider(fSourceViewer.getSelectionProvider()); @@ -264,7 +257,8 @@ public class ModuleDetailPane extends AbstractDetailPane implements IAdaptable, getViewSite().getActionBars().updateActionBars(); } - public void focusLost(FocusEvent e) { + @Override + public void focusLost(FocusEvent e) { getViewSite().setSelectionProvider(null); @@ -320,15 +314,15 @@ public class ModuleDetailPane extends AbstractDetailPane implements IAdaptable, */ private void createActions() { TextViewerAction textAction= new TextViewerAction(fSourceViewer, ITextOperationTarget.SELECT_ALL); - textAction.configureAction(DetailMessages.DefaultDetailPane_Select__All_5, "", ""); //$NON-NLS-1$ //$NON-NLS-2$ + textAction.configureAction(MessagesForDetailPane.DetailPane_Select_All, "", ""); //$NON-NLS-1$ //$NON-NLS-2$ textAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.SELECT_ALL); - PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDebugHelpContextIds.DETAIL_PANE_SELECT_ALL_ACTION); + PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDsfDebugUIConstants.DETAIL_PANE_SELECT_ALL_ACTION); setAction(DETAIL_SELECT_ALL_ACTION, textAction); textAction= new TextViewerAction(fSourceViewer, ITextOperationTarget.COPY); - textAction.configureAction(DetailMessages.DefaultDetailPane__Copy_8, "", ""); //$NON-NLS-1$ //$NON-NLS-2$ + textAction.configureAction(MessagesForDetailPane.DetailPane_Copy, "", ""); //$NON-NLS-1$ //$NON-NLS-2$ textAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.COPY); - PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDebugHelpContextIds.DETAIL_PANE_COPY_ACTION); + PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDsfDebugUIConstants.DETAIL_PANE_COPY_ACTION); setAction(DETAIL_COPY_ACTION, textAction); setSelectionDependantAction(DETAIL_COPY_ACTION); @@ -361,33 +355,6 @@ public class ModuleDetailPane extends AbstractDetailPane implements IAdaptable, /* * Make sure this is an element we want to deal with. */ -// if ( fElement instanceof DMVMContext) { -// IModules service = null; -// IModuleDMContext dmc = null ; -// -// IModuleDMContext modDmc = DMContexts.getAncestorOfType(((DMVMContext) fElement).getDMC(), IModuleDMContext.class); -// DsfServicesTracker tracker = new DsfServicesTracker(DsfDebugUIPlugin.getBundleContext(), ((DMVMContext) fElement).getDMC().getSessionId()); -// -// if ( modDmc != null ) { -// dmc = modDmc ; -// service = tracker.getService(IModules.class); -// } -// -// /* -// * If the desired Data Model Context is null then we are not going to -// * process this data. -// */ -// if ( dmc == null ) return Status.OK_STATUS; -// -// final DataRequestMonitor<IModuleDMData> modData = -// new DataRequestMonitor<IModuleDMData>(service.getSession().getExecutor(), null) { -// @Override -// protected void handleSuccess() { -// detailComputed(getModuleDetail(getData())); -// } -// }; -// service.getModuleData(modDmc, modData); -// } IModuleDMContext dmc = null; if (fElement instanceof IDMVMContext) { IDMContext vmcdmc = ((IDMVMContext)fElement).getDMContext(); @@ -400,7 +367,7 @@ public class ModuleDetailPane extends AbstractDetailPane implements IAdaptable, /* * Create the query to write the value to the service. Note: no need to - * guard agains RejectedExecutionException, because + * guard against RejectedExecutionException, because * DsfSession.getSession() above would only return an active session. */ GetModuleDetailsQuery query = new GetModuleDetailsQuery(dmc); @@ -456,40 +423,39 @@ public class ModuleDetailPane extends AbstractDetailPane implements IAdaptable, String type = null; // switch( module.getType() ) { // case ICModule.EXECUTABLE: -// type = ModulesMessages.getString( "ModulesView.1" ); //$NON-NLS-1$ +// type = ModulesMessages.getString( "ModulesView.Executable" ); //$NON-NLS-1$ // break; // case ICModule.SHARED_LIBRARY: -// type = ModulesMessages.getString( "ModulesView.2" ); //$NON-NLS-1$ +// type = ModulesMessages.getString( "ModulesView.SharedLibrary" ); //$NON-NLS-1$ // break; // } - type = ModulesMessages.getString( "ModulesView.2" ); //$NON-NLS-1$ + type = ModulesMessages.getString( "ModulesView.SharedLibrary" ); //$NON-NLS-1$ if ( type != null ) { - sb.append( ModulesMessages.getString( "ModulesView.3" ) ); //$NON-NLS-1$ + sb.append( ModulesMessages.getString( "ModulesView.Type" ) ); //$NON-NLS-1$ sb.append( type ); sb.append( '\n' ); } // Symbols flag - sb.append( ModulesMessages.getString( "ModulesView.4" ) ); //$NON-NLS-1$ - sb.append( ( module.isSymbolsLoaded()) ? ModulesMessages.getString( "ModulesView.5" ) : ModulesMessages.getString( "ModulesView.6" ) ); //$NON-NLS-1$ //$NON-NLS-2$ + sb.append( ModulesMessages.getString( "ModulesView.Symbols" ) ); //$NON-NLS-1$ + sb.append( ( module.isSymbolsLoaded()) ? ModulesMessages.getString( "ModulesView.Loaded" ) : ModulesMessages.getString( "ModulesView.NotLoaded" ) ); //$NON-NLS-1$ //$NON-NLS-2$ sb.append( '\n' ); // Symbols file - sb.append( ModulesMessages.getString( "ModulesView.7" ) ); //$NON-NLS-1$ + sb.append( ModulesMessages.getString( "ModulesView.SymbolsFile" ) ); //$NON-NLS-1$ sb.append( module.getFile()); sb.append( '\n' ); + // Base address String baseAddress = module.getBaseAddress(); - sb.append( ModulesMessages.getString( "ModulesView.9" ) ); //$NON-NLS-1$ - sb.append( baseAddress ); -// sb.append( baseAddress.toHexAddressString() ); - sb.append( '\n' ); -// } -// + sb.append( ModulesMessages.getString( "ModulesView.BaseAddress" ) ); //$NON-NLS-1$ + sb.append( baseAddress ); + sb.append( '\n' ); + // Size long size = module.getSize(); if ( size > 0 ) { - sb.append( ModulesMessages.getString( "ModulesView.10" ) ); //$NON-NLS-1$ + sb.append( ModulesMessages.getString( "ModulesView.Size" ) ); //$NON-NLS-1$ sb.append( size ); sb.append( '\n' ); } diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/ModuleDetailPaneFactory.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/detail/ModuleDetailPaneFactory.java index 480561c9f6a..fb455bfa4ae 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/ModuleDetailPaneFactory.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/detail/ModuleDetailPaneFactory.java @@ -8,7 +8,7 @@ * Contributors: * Ericsson AB - Modules view for DSF implementation *******************************************************************************/ -package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.modules; +package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.modules.detail; import java.util.HashSet; import java.util.Set; diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/detail/ModulesAbstractDetailPane.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/detail/ModulesAbstractDetailPane.java new file mode 100644 index 00000000000..2b7494b6da6 --- /dev/null +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/detail/ModulesAbstractDetailPane.java @@ -0,0 +1,172 @@ +/******************************************************************************* + * 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 + * Wind River Systems - adopted to use with Modules view + *******************************************************************************/ +package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.modules.detail; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.eclipse.debug.ui.IDetailPane; +import org.eclipse.jface.action.IAction; +import org.eclipse.ui.IViewSite; +import org.eclipse.ui.IWorkbenchPartSite; +import org.eclipse.ui.texteditor.IUpdate; + +/** + * Abstract class that holds common methods used by implementors of IDetailPane. + */ +public abstract class ModulesAbstractDetailPane implements IDetailPane { + + /** + * The <code>IWorkbenchPartSite</code> that the details area (and the + * variables view) belongs to. + */ + private IWorkbenchPartSite fWorkbenchPartSite; + + /** + * Map of actions. Keys are strings, values + * are <code>IAction</code>. + */ + private Map<String,IAction> fActionMap = new HashMap<String,IAction>(); + + /** + * Collection to track actions that should be updated when selection occurs. + */ + private List<String> fSelectionActions = new ArrayList<String>(); + + /* (non-Javadoc) + * @see org.eclipse.debug.ui.IDetailPane#init(org.eclipse.ui.IWorkbenchPartSite) + */ + public void init(IWorkbenchPartSite workbench) { + fWorkbenchPartSite = workbench; + + } + + /* (non-Javadoc) + * @see org.eclipse.debug.ui.IDetailPane#dispose() + */ + public void dispose() { + fActionMap.clear(); + fSelectionActions.clear(); + } + + /** + * Adds an action to the Map storing actions. Removes it if action is null. + * + * @param actionID The ID of the action, used as the key in the Map + * @param action The action associated with the ID + */ + protected void setAction(String actionID, IAction action) { + if (action == null) { + fActionMap.remove(actionID); + } else { + fActionMap.put(actionID, action); + } + } + + /** + * Adds the given action to the global action handler for the ViewSite. + * A call to <code>updateActionBars()</code> must be called after changes + * to propagate changes through the workbench. + * + * @param actionID The ID of the action + * @param action The action to be set globally + */ + protected void setGlobalAction(String actionID, IAction action){ + getViewSite().getActionBars().setGlobalActionHandler(actionID, action); + } + + /** + * Adds the given action to the list of actions that will be updated when + * <code>updateSelectionDependentActions()</code> is called. If the string + * is null it will not be added to the list. + * + * @param actionID The ID of the action which should be updated + */ + protected void setSelectionDependantAction(String actionID){ + if (actionID != null) fSelectionActions.add(actionID); + } + + /** + * Gets the action out of the map, casts it to an <code>IAction</code> + * + * @param actionID The ID of the action to find + * @return The action associated with the ID or null if none is found. + */ + protected IAction getAction(String actionID) { + return fActionMap.get(actionID); + } + + /** + * Calls the update method of the action with the given action ID. + * The action must exist in the action map and must be an instance of + * </code>IUpdate</code> + * + * @param actionId The ID of the action to update + */ + protected void updateAction(String actionId) { + IAction action= getAction(actionId); + if (action instanceof IUpdate) { + ((IUpdate) action).update(); + } + } + + /** + * Iterates through the list of selection dependent actions and + * updates them. Use <code>setSelectionDependentAction(String actionID)</code> + * to add an action to the list. The action must have been added to the known + * actions map by calling <code>setAction(String actionID, IAction action)</code> + * before it can be updated by this method. + */ + protected void updateSelectionDependentActions() { + Iterator<String> iterator= fSelectionActions.iterator(); + while (iterator.hasNext()) { + updateAction(iterator.next()); + } + } + + /** + * Gets the view site for this view. May be null if this detail pane + * is not part of a view. + * + * @return The site for this view or <code>null</code> + */ + protected IViewSite getViewSite(){ + if (fWorkbenchPartSite == null){ + return null; + } else { + return (IViewSite) fWorkbenchPartSite.getPart().getSite(); + } + } + + /** + * Gets the workbench part site for this view. May be null if this detail pane + * is not part of a view. + * + * @return The workbench part site or <code>null</code> + */ + protected IWorkbenchPartSite getWorkbenchPartSite() { + return fWorkbenchPartSite; + } + + /** + * Returns whether this detail pane is being displayed in a view with a workbench part site. + * + * @return whether this detail pane is being displayed in a view with a workbench part site. + */ + protected boolean isInView(){ + return fWorkbenchPartSite != null; + } + +} diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/detail/ModulesMessages.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/detail/ModulesMessages.java new file mode 100644 index 00000000000..577379877ef --- /dev/null +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/detail/ModulesMessages.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2004, 2005 QNX Software 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: + * QNX Software Systems - Initial API and implementation + * Wind River Systems, Inc. - extended implementation + *******************************************************************************/ +package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.modules.detail; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * Comment for . + */ +public class ModulesMessages { + + private static final String BUNDLE_NAME = "org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.modules.detail.ModulesMessages";//$NON-NLS-1$ + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME ); + + private ModulesMessages() { + } + + public static String getString( String key ) { + try { + return RESOURCE_BUNDLE.getString( key ); + } + catch( MissingResourceException e ) { + return '!' + key + '!'; + } + } +} diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/detail/ModulesMessages.properties b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/detail/ModulesMessages.properties new file mode 100644 index 00000000000..09881cbfcd6 --- /dev/null +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/modules/detail/ModulesMessages.properties @@ -0,0 +1,25 @@ +############################################################################### +# Copyright (c) 2005 QNX Software 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: +# QNX Software Systems - initial API and implementation +# Wind River Systems - adapted to work with platform Modules view (bug 210558) +############################################################################### +ModulesView.Executable=executable +ModulesView.SharedLibrary=shared library +ModulesView.Type=Type: +ModulesView.Symbols=Symbols: +ModulesView.Loaded=loaded +ModulesView.NotLoaded=not loaded +ModulesView.SymbolsFile=Symbols file: +ModulesView.CPU=CPU: +ModulesView.BaseAddress=Base address: +ModulesView.Size=Size: +ModulesView.SymbolsLoaded=\ (symbols loaded) +ModulesView.SymbolsNotLoaded=(symbols not loaded) +ModulesView.SelectAll=Select &All +ModulesView.Copy=&Copy diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/AbstractSetFormatStyle.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/AbstractSetFormatStyle.java index a804c176099..324d5c730e1 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/AbstractSetFormatStyle.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/AbstractSetFormatStyle.java @@ -98,7 +98,6 @@ public class AbstractSetFormatStyle implements IViewActionDelegate, IDebugContex * (non-Javadoc) * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) */ - @SuppressWarnings("restriction") public void run(IAction action) { /* diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/FormattedValuePreferenceStore.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/FormattedValuePreferenceStore.java index 5cddbb80660..bb512c6d6f4 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/FormattedValuePreferenceStore.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/FormattedValuePreferenceStore.java @@ -29,7 +29,6 @@ public class FormattedValuePreferenceStore implements IFormattedValuePreferenceS return fgSingletonReference; } - @SuppressWarnings("restriction") public String getCurrentNumericFormat( IPresentationContext context ) { Object prop = context.getProperty( IDebugVMConstants.CURRENT_FORMAT_STORAGE ); diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatBinary.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatBinary.java index 5e5c2e31c80..713e5c60be0 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatBinary.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatBinary.java @@ -13,7 +13,6 @@ package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat. import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.AbstractSetFormatStyle; import org.eclipse.dd.dsf.debug.service.IFormattedValues; -@SuppressWarnings("restriction") public class SetDefaultFormatBinary extends AbstractSetFormatStyle { @Override diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatDecimal.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatDecimal.java index a7b7bba785b..2e0c5e89b05 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatDecimal.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatDecimal.java @@ -13,7 +13,6 @@ package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat. import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.AbstractSetFormatStyle; import org.eclipse.dd.dsf.debug.service.IFormattedValues; -@SuppressWarnings("restriction") public class SetDefaultFormatDecimal extends AbstractSetFormatStyle { @Override diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatHex.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatHex.java index 919b7938e89..0451678c3eb 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatHex.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatHex.java @@ -13,7 +13,6 @@ package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat. import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.AbstractSetFormatStyle; import org.eclipse.dd.dsf.debug.service.IFormattedValues; -@SuppressWarnings("restriction") public class SetDefaultFormatHex extends AbstractSetFormatStyle { @Override diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatNatural.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatNatural.java index a03f03793e3..8f1e87b6d87 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatNatural.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatNatural.java @@ -13,7 +13,6 @@ package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat. import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.AbstractSetFormatStyle; import org.eclipse.dd.dsf.debug.service.IFormattedValues; -@SuppressWarnings("restriction") public class SetDefaultFormatNatural extends AbstractSetFormatStyle { @Override diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatOctal.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatOctal.java index cf257035286..8ab1a56fa59 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatOctal.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/numberformat/actions/SetDefaultFormatOctal.java @@ -13,7 +13,6 @@ package org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat. import org.eclipse.dd.dsf.debug.internal.provisional.ui.viewmodel.numberformat.AbstractSetFormatStyle; import org.eclipse.dd.dsf.debug.service.IFormattedValues; -@SuppressWarnings("restriction") public class SetDefaultFormatOctal extends AbstractSetFormatStyle { @Override diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/BreakpointHitUpdatePolicy.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/BreakpointHitUpdatePolicy.java index 9002546ff66..9e5edc2bcf8 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/BreakpointHitUpdatePolicy.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/provisional/ui/viewmodel/update/BreakpointHitUpdatePolicy.java @@ -29,7 +29,7 @@ public class BreakpointHitUpdatePolicy extends ManualUpdatePolicy { @Override public String getName() { - return "Breakpoint Hit"; + return "Breakpoint Hit"; //$NON-NLS-1$ } @Override diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/DsfDebugUIPlugin.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/DsfDebugUIPlugin.java index 144b4d90fa8..a823768972c 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/DsfDebugUIPlugin.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/DsfDebugUIPlugin.java @@ -1,7 +1,13 @@ package org.eclipse.dd.dsf.debug.internal.ui; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; import org.eclipse.dd.dsf.debug.internal.ui.disassembly.model.SourceDocumentProvider; +import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; @@ -86,4 +92,62 @@ public class DsfDebugUIPlugin extends AbstractUIPlugin { public static SourceDocumentProvider getSourceDocumentProvider() { return getDefault().fSourceDocumentProvider; } + + /** + * Logs the specified status with this plug-in's log. + * + * @param status status to log + */ + public static void log(IStatus status) { + getDefault().getLog().log(status); + } + + /** + * Utility method with conventions + */ + public static void errorDialog(Shell shell, String title, String message, Throwable t) { + IStatus status; + if (t instanceof CoreException) { + status= ((CoreException)t).getStatus(); + // if the 'message' resource string and the IStatus' message are the same, + // don't show both in the dialog + if (status != null && message.equals(status.getMessage())) { + message= null; + } + } else { + status= new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDebugUIConstants.INTERNAL_ERROR, "Error within Debug UI: ", t); //$NON-NLS-1$ + log(status); + } + ErrorDialog.openError(shell, title, message, status); + } + + /** + * Logs the specified throwable with this plug-in's log. + * + * @param t throwable to log + */ + public static void log(Throwable t) { + log(newErrorStatus("Error logged from Debug UI: ", t)); //$NON-NLS-1$ + } + + /** + * Logs an internal error with the specified message. + * + * @param message the error message to log + */ + public static void logErrorMessage(String message) { + // this message is intentionally not internationalized, as an exception may + // be due to the resource bundle itself + log(newErrorStatus("Internal message logged from Debug UI: " + message, null)); //$NON-NLS-1$ + } + + /** + * Returns a new error status for this plug-in with the given message + * @param message the message to be included in the status + * @param exception the exception to be included in the status or <code>null</code> if none + * @return a new error status + */ + public static IStatus newErrorStatus(String message, Throwable exception) { + return new Status(IStatus.ERROR, DsfDebugUIPlugin.PLUGIN_ID, IDebugUIConstants.INTERNAL_ERROR, message, exception); + } } diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/detailsupport/DetailPaneMaxLengthAction.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/detailsupport/DetailPaneMaxLengthAction.java new file mode 100644 index 00000000000..12d1b52f121 --- /dev/null +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/detailsupport/DetailPaneMaxLengthAction.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2000, 2006 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 + * Wind River Systems, Inc. - extended implementation + *******************************************************************************/ +package org.eclipse.dd.dsf.debug.internal.ui.viewmodel.detailsupport; + +import org.eclipse.dd.dsf.debug.ui.IDsfDebugUIConstants; +import org.eclipse.jface.action.Action; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; + +/** + * Opens a dialog so that the user can enter the maximum length in characters that + * the detail pane should display. + * + * @see DetailPaneMaxLengthDialog + * @since 3.0 + */ +public class DetailPaneMaxLengthAction extends Action { + + private Shell fDialogShell; + + public DetailPaneMaxLengthAction(Shell dialogShell){ + super(MessagesForDetailPane.PaneMaxLengthAction_MaxLength); + fDialogShell = dialogShell; + + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDsfDebugUIConstants.DETAIL_PANE_MAX_LENGTH_ACTION); + + } + + @Override + public void run() { + DetailPaneMaxLengthDialog dialog = new DetailPaneMaxLengthDialog(fDialogShell); + dialog.open(); + } + +} diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/detailsupport/DetailPaneMaxLengthDialog.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/detailsupport/DetailPaneMaxLengthDialog.java new file mode 100644 index 00000000000..cf0c5563cb6 --- /dev/null +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/detailsupport/DetailPaneMaxLengthDialog.java @@ -0,0 +1,181 @@ +/******************************************************************************* + * Copyright (c) 2000, 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 + * Wind River Systems, Inc. - extended implementation + *******************************************************************************/ +package org.eclipse.dd.dsf.debug.internal.ui.viewmodel.detailsupport; + +import org.eclipse.dd.dsf.debug.internal.ui.DsfDebugUIPlugin; +import org.eclipse.dd.dsf.debug.ui.IDsfDebugUIConstants; +import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.dialogs.IInputValidator; +import org.eclipse.jface.dialogs.TrayDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.PlatformUI; + +/** + * Provides a dialog for changing the maximum length allowed in the detail pane + * + * @since 3.0 + */ +public class DetailPaneMaxLengthDialog extends TrayDialog { + + private static final String SETTINGS_ID = DsfDebugUIPlugin.PLUGIN_ID + ".MAX_DETAILS_LENGTH_DIALOG"; //$NON-NLS-1$ + + private Text fTextWidget; + private Text fErrorTextWidget; + private String fErrorMessage; + private String fValue; + private IInputValidator fValidator; + + /** + * Constructs a new dialog on the given shell. + * + * @param parent shell + */ + public DetailPaneMaxLengthDialog(Shell parent) { + super(parent); + setShellStyle(getShellStyle() | SWT.RESIZE); + fValue = Integer.toString(DsfDebugUIPlugin.getDefault().getPreferenceStore().getInt(IDsfDebugUIConstants.PREF_MAX_DETAIL_LENGTH)); + fValidator = new IInputValidator() { + public String isValid(String newText) { + try { + int num = Integer.parseInt(newText); + if (num < 0) { + return MessagesForDetailPane.PaneMaxLengthDialog_IntegerCannotBeNegative; + } + } catch (NumberFormatException e) { + return MessagesForDetailPane.PaneMaxLengthDialog_EnterAnInteger; + } + return null; + } + + }; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.dialogs.SelectionDialog#getDialogBoundsSettings() + */ + @Override + protected IDialogSettings getDialogBoundsSettings() { + IDialogSettings settings = DsfDebugUIPlugin.getDefault().getDialogSettings(); + IDialogSettings section = settings.getSection(SETTINGS_ID); + if (section == null) { + section = settings.addNewSection(SETTINGS_ID); + } + return section; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#createContents(org.eclipse.swt.widgets.Composite) + */ + @Override + protected Control createContents(Composite parent) { + getShell().setText(MessagesForDetailPane.PaneMaxLengthDialog_ConfigureDetails); + Control contents = super.createContents(parent); + PlatformUI.getWorkbench().getHelpSystem().setHelp(getDialogArea(), IDsfDebugUIConstants.DETAIL_PANE_MAX_LENGTH_ACTION); + return contents; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) + */ + @Override + protected Control createDialogArea(Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + Label label = new Label(composite, SWT.WRAP); + label.setText(MessagesForDetailPane.PaneMaxLengthDialog_MaxCharactersToDisplay); + GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); + data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); + label.setLayoutData(data); + label.setFont(parent.getFont()); + fTextWidget = new Text(composite, SWT.SINGLE | SWT.BORDER); + fTextWidget.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); + fTextWidget.setText(fValue); + fTextWidget.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + validateInput(); + fValue = fTextWidget.getText(); + } + }); + fErrorTextWidget = new Text(composite, SWT.READ_ONLY); + fErrorTextWidget.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL + | GridData.HORIZONTAL_ALIGN_FILL)); + fErrorTextWidget.setBackground(fErrorTextWidget.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); + setErrorMessage(fErrorMessage); + applyDialogFont(composite); + return composite; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#okPressed() + */ + @Override + protected void okPressed() { + String text = getValue(); + try { + DsfDebugUIPlugin.getDefault().getPreferenceStore().setValue(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH, Integer.parseInt(text)); + } + catch (NumberFormatException e) { + DsfDebugUIPlugin.log(e); + } + super.okPressed(); + } + + /** + * Returns the string typed into this input dialog. + * + * @return the input string + * @since 3.3 + */ + public String getValue() { + return fValue; + } + + /** + * Validates the current input + * @since 3.3 + */ + private void validateInput() { + String errorMessage = null; + if (fValidator != null) { + errorMessage = fValidator.isValid(fTextWidget.getText()); + } + setErrorMessage(errorMessage); + } + + /** + * Sets the current error message or none if null + * @param errorMessage + * @since 3.3 + */ + public void setErrorMessage(String errorMessage) { + fErrorMessage = errorMessage; + if (fErrorTextWidget != null && !fErrorTextWidget.isDisposed()) { + fErrorTextWidget.setText(errorMessage == null ? "" : errorMessage); //$NON-NLS-1$ + fErrorTextWidget.getParent().update(); + // Access the ok button by id, in case clients have overridden button creation. + // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=113643 + Control button = getButton(IDialogConstants.OK_ID); + if (button != null) { + button.setEnabled(errorMessage == null); + } + } + } +} diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/detailsupport/DetailPaneWordWrapAction.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/detailsupport/DetailPaneWordWrapAction.java new file mode 100644 index 00000000000..7af6538f4fe --- /dev/null +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/detailsupport/DetailPaneWordWrapAction.java @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2006 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 + * Wind River Systems, Inc. - extended implementation + *******************************************************************************/ +package org.eclipse.dd.dsf.debug.internal.ui.viewmodel.detailsupport; + +import org.eclipse.dd.dsf.debug.internal.ui.DsfDebugUIPlugin; +import org.eclipse.dd.dsf.debug.ui.IDsfDebugUIConstants; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.text.ITextViewer; +import org.eclipse.ui.PlatformUI; + +/** + * An check box action that allows the word wrap property to be set, determining if the detail pane + * should wrap text. + */ +public class DetailPaneWordWrapAction extends Action { + + ITextViewer fTextViewer; + + public DetailPaneWordWrapAction(ITextViewer textViewer) { + super(MessagesForDetailPane.PaneWordWrapAction_WrapText,IAction.AS_CHECK_BOX); + + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDsfDebugUIConstants.DETAIL_PANE_WORD_WRAP_ACTION); + + fTextViewer = textViewer; + setEnabled(true); + + boolean prefSetting = DsfDebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP); + fTextViewer.getTextWidget().setWordWrap(prefSetting); + setChecked(prefSetting); + + + } + + /* (non-Javadoc) + * @see org.eclipse.jface.action.IAction#run() + */ + @Override + public void run() { + fTextViewer.getTextWidget().setWordWrap(isChecked()); + DsfDebugUIPlugin.getDefault().getPreferenceStore().setValue(IDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP,isChecked()); + DsfDebugUIPlugin.getDefault().savePluginPreferences(); + } + +} diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/detailsupport/MessagesForDetailPane.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/detailsupport/MessagesForDetailPane.java new file mode 100644 index 00000000000..71e4d052341 --- /dev/null +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/detailsupport/MessagesForDetailPane.java @@ -0,0 +1,40 @@ +/******************************************************************************* + * 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 + * Wind River Systems, Inc. - extended implementation + *******************************************************************************/ + +package org.eclipse.dd.dsf.debug.internal.ui.viewmodel.detailsupport; + +import org.eclipse.osgi.util.NLS; + +public class MessagesForDetailPane extends NLS { + + private static final String BUNDLE_NAME = "org.eclipse.dd.dsf.debug.internal.ui.viewmodel.detailsupport.messages"; //$NON-NLS-1$ + + public static String NumberFormatDetailPane_Name; + public static String NumberFormatDetailPane_Description; + + public static String DetailPane_Copy; + public static String DetailPane_LabelPattern; + public static String DetailPane_Select_All; + public static String PaneWordWrapAction_WrapText; + public static String PaneMaxLengthAction_MaxLength; + public static String PaneMaxLengthDialog_ConfigureDetails; + public static String PaneMaxLengthDialog_MaxCharactersToDisplay; + public static String PaneMaxLengthDialog_IntegerCannotBeNegative; + public static String PaneMaxLengthDialog_EnterAnInteger; + + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, MessagesForDetailPane.class); + } + + private MessagesForDetailPane() {} +} diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/numberformat/detail/TextViewerAction.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/detailsupport/TextViewerAction.java index a4006004ce8..7ec87670ffc 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/numberformat/detail/TextViewerAction.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/detailsupport/TextViewerAction.java @@ -7,9 +7,9 @@ * * Contributors: * IBM Corporation - initial API and implementation - * Randy Rohrbach (Wind River Systems, Inc.) - extended implementation + * Wind River Systems, Inc. - extended implementation *******************************************************************************/ -package org.eclipse.dd.dsf.debug.internal.ui.viewmodel.numberformat.detail; +package org.eclipse.dd.dsf.debug.internal.ui.viewmodel.detailsupport; import org.eclipse.jface.action.Action; import org.eclipse.jface.text.ITextOperationTarget; diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/detailsupport/messages.properties b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/detailsupport/messages.properties new file mode 100644 index 00000000000..1995fe0865d --- /dev/null +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/detailsupport/messages.properties @@ -0,0 +1,25 @@ +############################################################################### +# Copyright (c) 2006, 2008 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 +# Wind River Systems Inc - copied for non-restricted version for DSDP/DD/DSF +############################################################################### + +NumberFormatDetailPane_Name=Number Formats Viewer +NumberFormatDetailPane_Description=Detail viewer showing selected variable in all available formats. + +DetailPane_LabelPattern={0} : {1} +DetailPane_Select_All=Select &All +DetailPane_Copy=&Copy + +PaneWordWrapAction_WrapText=&Wrap Text +PaneMaxLengthAction_MaxLength=&Max Length... +PaneMaxLengthDialog_ConfigureDetails=Configure Details Pane +PaneMaxLengthDialog_MaxCharactersToDisplay=&Maximum characters to display in details pane (0 = unlimited): +PaneMaxLengthDialog_IntegerCannotBeNegative=Integer must be non-negative +PaneMaxLengthDialog_EnterAnInteger=Enter an integer diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/numberformat/detail/MessagesForNumberFormatDetail.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/numberformat/detail/MessagesForNumberFormatDetail.java deleted file mode 100644 index 0d643a5160a..00000000000 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/numberformat/detail/MessagesForNumberFormatDetail.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.eclipse.dd.dsf.debug.internal.ui.viewmodel.numberformat.detail; - -import org.eclipse.osgi.util.NLS; - -class MessagesForNumberFormatDetail extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.dd.dsf.debug.internal.ui.viewmodel.numberformat.detail.messages"; //$NON-NLS-1$ - - public static String NumberFormatDetailPane_name; - public static String NumberFormatDetailPane_description; - - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, MessagesForNumberFormatDetail.class); - } - - private MessagesForNumberFormatDetail() { - } -} diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/numberformat/detail/NumberFormatDetailPane.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/numberformat/detail/NumberFormatDetailPane.java index 950a52fd025..a13509cc7cc 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/numberformat/detail/NumberFormatDetailPane.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/numberformat/detail/NumberFormatDetailPane.java @@ -7,7 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation - * Randy Rohrbach (Wind River Systems, Inc.) - extended implementation + * Wind River Systems, Inc. - extended implementation *******************************************************************************/ package org.eclipse.dd.dsf.debug.internal.ui.viewmodel.numberformat.detail; @@ -19,7 +19,6 @@ import java.util.List; import java.util.Map; import org.eclipse.core.commands.operations.IUndoContext; -import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; @@ -29,6 +28,10 @@ import org.eclipse.dd.dsf.concurrent.CountingRequestMonitor; import org.eclipse.dd.dsf.concurrent.DataRequestMonitor; import org.eclipse.dd.dsf.datamodel.DMContexts; import org.eclipse.dd.dsf.debug.internal.ui.DsfDebugUIPlugin; +import org.eclipse.dd.dsf.debug.internal.ui.viewmodel.detailsupport.DetailPaneMaxLengthAction; +import org.eclipse.dd.dsf.debug.internal.ui.viewmodel.detailsupport.DetailPaneWordWrapAction; +import org.eclipse.dd.dsf.debug.internal.ui.viewmodel.detailsupport.MessagesForDetailPane; +import org.eclipse.dd.dsf.debug.internal.ui.viewmodel.detailsupport.TextViewerAction; import org.eclipse.dd.dsf.debug.service.IExpressions; import org.eclipse.dd.dsf.debug.service.IFormattedValues; import org.eclipse.dd.dsf.debug.service.IRegisters; @@ -40,22 +43,11 @@ import org.eclipse.dd.dsf.debug.service.IRegisters.IBitFieldDMContext; import org.eclipse.dd.dsf.debug.service.IRegisters.IBitFieldDMData; import org.eclipse.dd.dsf.debug.service.IRegisters.IRegisterDMContext; import org.eclipse.dd.dsf.debug.service.IRegisters.IRegisterDMData; +import org.eclipse.dd.dsf.debug.ui.IDsfDebugUIConstants; import org.eclipse.dd.dsf.service.DsfServicesTracker; import org.eclipse.dd.dsf.ui.viewmodel.datamodel.IDMVMContext; -import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.model.IDebugElement; -import org.eclipse.debug.core.model.IExpression; import org.eclipse.debug.core.model.IValue; -import org.eclipse.debug.core.model.IVariable; -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.internal.ui.IDebugHelpContextIds; -import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; -import org.eclipse.debug.internal.ui.LazyModelPresentation; -import org.eclipse.debug.internal.ui.VariablesViewModelPresentation; -import org.eclipse.debug.internal.ui.actions.variables.details.DetailPaneMaxLengthAction; -import org.eclipse.debug.internal.ui.actions.variables.details.DetailPaneWordWrapAction; -import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants; -import org.eclipse.debug.internal.ui.views.variables.details.DetailMessages; import org.eclipse.debug.ui.IDebugModelPresentation; import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.IDebugView; @@ -288,7 +280,6 @@ public class NumberFormatDetailPane implements IDetailPane, IAdaptable, IPropert class DetailJob extends Job implements IValueDetailListener { private IStructuredSelection fElements; - private IDebugModelPresentation fModel; private boolean fFirst = true; private IProgressMonitor fMonitor; private boolean fComputed = false; @@ -297,7 +288,6 @@ public class NumberFormatDetailPane implements IDetailPane, IAdaptable, IPropert super("compute variable details"); //$NON-NLS-1$ setSystem(true); fElements = elements; - fModel = model; } /* @@ -584,33 +574,23 @@ public class NumberFormatDetailPane implements IDetailPane, IAdaptable, IPropert } } else { - IValue val = null; - if (element instanceof IVariable) { - try { - val = ((IVariable)element).getValue(); - } catch (DebugException e) { - detailComputed(null, e.getStatus().getMessage()); - } - } else if (element instanceof IExpression) { - val = ((IExpression)element).getValue(); - } +// IValue val = null; +// if (element instanceof IVariable) { +// try { +// val = ((IVariable)element).getValue(); +// } catch (DebugException e) { +// detailComputed(null, e.getStatus().getMessage()); +// } +// } else if (element instanceof IExpression) { +// val = ((IExpression)element).getValue(); +// } if (element instanceof String) { message = (String) element; } - if (val != null && !monitor.isCanceled()) { - fModel.computeDetail(val, this); - synchronized (this) { - try { - // wait for a max of 30 seconds for result, then cancel - wait(30000); - if (!fComputed) { - fMonitor.setCanceled(true); - } - } catch (InterruptedException e) { - break; - } - } - } + else { + message = element.toString(); + } + fComputed = true; } // If no details were computed for the selected variable, clear the pane // or use the message, if the variable was a java.lang.String @@ -658,7 +638,7 @@ public class NumberFormatDetailPane implements IDetailPane, IAdaptable, IPropert insert = "\n" + result; //$NON-NLS-1$ } try { - int max = DebugUIPlugin.getDefault().getPreferenceStore().getInt(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH); + int max = DsfDebugUIPlugin.getDefault().getPreferenceStore().getInt(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH); if (max > 0 && insert.length() > max) { insert = insert.substring(0, max) + "..."; //$NON-NLS-1$ } @@ -669,7 +649,7 @@ public class NumberFormatDetailPane implements IDetailPane, IAdaptable, IPropert getDetailDocument().replace(length, 0,insert); } } catch (BadLocationException e) { - DebugUIPlugin.log(e); + DsfDebugUIPlugin.log(e); } } return Status.OK_STATUS; @@ -688,7 +668,6 @@ public class NumberFormatDetailPane implements IDetailPane, IAdaptable, IPropert * The model presentation used to produce the string details for a * selected variable. */ - private VariablesViewModelPresentation fModelPresentation; private String fDebugModelIdentifier; /** @@ -713,7 +692,7 @@ public class NumberFormatDetailPane implements IDetailPane, IAdaptable, IPropert */ private IDocument fDetailDocument; private DetailJob fDetailJob = null; - private final String fPositionLabelPattern = DetailMessages.DefaultDetailPane_56; + private final String fPositionLabelPattern = MessagesForDetailPane.DetailPane_LabelPattern; private final PositionLabelValue fLineLabel = new PositionLabelValue(); private final PositionLabelValue fColumnLabel = new PositionLabelValue(); private final Object[] fPositionLabelPatternArguments = new Object[] {fLineLabel, fColumnLabel }; @@ -724,14 +703,12 @@ public class NumberFormatDetailPane implements IDetailPane, IAdaptable, IPropert */ public Control createControl(Composite parent) { - fModelPresentation = new VariablesViewModelPresentation(); - createSourceViewer(parent); if (isInView()){ createViewSpecificComponents(); createActions(); - DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this); + DsfDebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this); JFaceResources.getFontRegistry().addListener(this); } @@ -748,10 +725,10 @@ public class NumberFormatDetailPane implements IDetailPane, IAdaptable, IPropert // Create & configure a SourceViewer fSourceViewer = new SourceViewer(parent, null, SWT.V_SCROLL | SWT.H_SCROLL); fSourceViewer.setDocument(getDetailDocument()); - fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(IInternalDebugUIConstants.DETAIL_PANE_FONT)); - fSourceViewer.getTextWidget().setWordWrap(DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDebugPreferenceConstants.PREF_DETAIL_PANE_WORD_WRAP)); + fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(IDsfDebugUIConstants.DETAIL_PANE_FONT)); + fSourceViewer.getTextWidget().setWordWrap(DsfDebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP)); fSourceViewer.setEditable(false); - PlatformUI.getWorkbench().getHelpSystem().setHelp(fSourceViewer.getTextWidget(), IDebugHelpContextIds.DETAIL_PANE); + PlatformUI.getWorkbench().getHelpSystem().setHelp(fSourceViewer.getTextWidget(), IDsfDebugUIConstants.DETAIL_PANE); Control control = fSourceViewer.getControl(); GridData gd = new GridData(GridData.FILL_BOTH); control.setLayoutData(gd); @@ -820,15 +797,15 @@ public class NumberFormatDetailPane implements IDetailPane, IAdaptable, IPropert private void createActions() { TextViewerAction textAction= new TextViewerAction(fSourceViewer, ITextOperationTarget.SELECT_ALL); - textAction.configureAction(DetailMessages.DefaultDetailPane_Select__All_5, "", ""); //$NON-NLS-1$ //$NON-NLS-2$ + textAction.configureAction(MessagesForDetailPane.DetailPane_Select_All, "", ""); //$NON-NLS-1$ //$NON-NLS-2$ textAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.SELECT_ALL); - PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDebugHelpContextIds.DETAIL_PANE_SELECT_ALL_ACTION); + PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDsfDebugUIConstants.DETAIL_PANE_SELECT_ALL_ACTION); setAction(DETAIL_SELECT_ALL_ACTION, textAction); textAction= new TextViewerAction(fSourceViewer, ITextOperationTarget.COPY); - textAction.configureAction(DetailMessages.DefaultDetailPane__Copy_8, "", ""); //$NON-NLS-1$ //$NON-NLS-2$ + textAction.configureAction(MessagesForDetailPane.DetailPane_Copy, "", ""); //$NON-NLS-1$ //$NON-NLS-2$ textAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.COPY); - PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDebugHelpContextIds.DETAIL_PANE_COPY_ACTION); + PlatformUI.getWorkbench().getHelpSystem().setHelp(textAction, IDsfDebugUIConstants.DETAIL_PANE_COPY_ACTION); setAction(DETAIL_COPY_ACTION, textAction); setSelectionDependantAction(DETAIL_COPY_ACTION); @@ -907,7 +884,7 @@ public class NumberFormatDetailPane implements IDetailPane, IAdaptable, IPropert if (fDetailJob != null) { fDetailJob.cancel(); } - fDetailJob = new DetailJob(selection, fModelPresentation); + fDetailJob = new DetailJob(selection, null); fDetailJob.schedule(); } } @@ -931,7 +908,6 @@ public class NumberFormatDetailPane implements IDetailPane, IAdaptable, IPropert fSelectionActions.clear(); if (fDetailJob != null) fDetailJob.cancel(); - if (fModelPresentation != null) fModelPresentation.dispose(); fDebugModelIdentifier = null; // Setting this to null makes sure the source viewer is reconfigured with the model presentation after disposal if (fSourceViewer != null && fSourceViewer.getControl() != null) fSourceViewer.getControl().dispose(); @@ -941,7 +917,7 @@ public class NumberFormatDetailPane implements IDetailPane, IAdaptable, IPropert getViewSite().getActionBars().getStatusLineManager().remove(fStatusLineItem); - DebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this); + DsfDebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this); JFaceResources.getFontRegistry().removeListener(this); } } @@ -950,7 +926,7 @@ public class NumberFormatDetailPane implements IDetailPane, IAdaptable, IPropert * @see org.eclipse.debug.ui.IDetailPane#getDescription() */ public String getDescription() { - return MessagesForNumberFormatDetail.NumberFormatDetailPane_description; + return MessagesForDetailPane.NumberFormatDetailPane_Description; } /* (non-Javadoc) @@ -964,7 +940,7 @@ public class NumberFormatDetailPane implements IDetailPane, IAdaptable, IPropert * @see org.eclipse.debug.ui.IDetailPane#getName() */ public String getName() { - return MessagesForNumberFormatDetail.NumberFormatDetailPane_name; + return MessagesForDetailPane.NumberFormatDetailPane_Name; } /* (non-Javadoc) @@ -1008,20 +984,9 @@ public class NumberFormatDetailPane implements IDetailPane, IAdaptable, IPropert * currently being displayed */ protected void configureDetailsViewer() { - LazyModelPresentation mp = (LazyModelPresentation)fModelPresentation.getPresentation(getDebugModel()); - SourceViewerConfiguration svc = null; - if (mp != null) { - try { - svc = mp.newDetailsViewerConfiguration(); - } catch (CoreException e) { - DebugUIPlugin.errorDialog(fSourceViewer.getControl().getShell(), DetailMessages.DefaultDetailPane_Error_1, DetailMessages.DefaultDetailPane_2, e); - } - } + SourceViewerConfiguration svc = new SourceViewerConfiguration(); - if (svc == null) { - svc = new SourceViewerConfiguration(); - fSourceViewer.setEditable(false); - } + fSourceViewer.setEditable(false); fSourceViewer.unconfigure(); fSourceViewer.configure(svc); @@ -1189,13 +1154,13 @@ public class NumberFormatDetailPane implements IDetailPane, IAdaptable, IPropert */ public void propertyChange(PropertyChangeEvent event) { String propertyName= event.getProperty(); - if (propertyName.equals(IInternalDebugUIConstants.DETAIL_PANE_FONT)) { - fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(IInternalDebugUIConstants.DETAIL_PANE_FONT)); - } else if (propertyName.equals(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH)) { + if (propertyName.equals(IDsfDebugUIConstants.DETAIL_PANE_FONT)) { + fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(IDsfDebugUIConstants.DETAIL_PANE_FONT)); + } else if (propertyName.equals(IDsfDebugUIConstants.PREF_MAX_DETAIL_LENGTH)) { display(fLastDisplayed); - } else if (propertyName.equals(IDebugPreferenceConstants.PREF_DETAIL_PANE_WORD_WRAP)) { - fSourceViewer.getTextWidget().setWordWrap(DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDebugPreferenceConstants.PREF_DETAIL_PANE_WORD_WRAP)); - getAction(DETAIL_WORD_WRAP_ACTION).setChecked(DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDebugPreferenceConstants.PREF_DETAIL_PANE_WORD_WRAP)); + } else if (propertyName.equals(IDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP)) { + fSourceViewer.getTextWidget().setWordWrap(DsfDebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP)); + getAction(DETAIL_WORD_WRAP_ACTION).setChecked(DsfDebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDsfDebugUIConstants.PREF_DETAIL_PANE_WORD_WRAP)); } } } diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/numberformat/detail/NumberFormatDetailPaneFactory.java b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/numberformat/detail/NumberFormatDetailPaneFactory.java index 9244986f66a..3d762fab017 100644 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/numberformat/detail/NumberFormatDetailPaneFactory.java +++ b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/numberformat/detail/NumberFormatDetailPaneFactory.java @@ -6,13 +6,14 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Randy Rohrbach (Wind River Systems, Inc.) - initial implementation + * Wind River Systems, Inc. - initial implementation *******************************************************************************/ package org.eclipse.dd.dsf.debug.internal.ui.viewmodel.numberformat.detail; import java.util.HashSet; import java.util.Set; +import org.eclipse.dd.dsf.debug.internal.ui.viewmodel.detailsupport.MessagesForDetailPane; import org.eclipse.debug.ui.IDetailPane; import org.eclipse.debug.ui.IDetailPaneFactory; import org.eclipse.jface.viewers.IStructuredSelection; @@ -52,7 +53,7 @@ public class NumberFormatDetailPaneFactory implements IDetailPaneFactory { */ public String getDetailPaneName(String id) { if (id.equals(NumberFormatDetailPane.ID)){ - return MessagesForNumberFormatDetail.NumberFormatDetailPane_name; + return MessagesForDetailPane.NumberFormatDetailPane_Name; } return null; } @@ -62,7 +63,7 @@ public class NumberFormatDetailPaneFactory implements IDetailPaneFactory { */ public String getDetailPaneDescription(String id) { if (id.equals(NumberFormatDetailPane.ID)){ - return MessagesForNumberFormatDetail.NumberFormatDetailPane_description; + return MessagesForDetailPane.NumberFormatDetailPane_Description; } return null; } diff --git a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/numberformat/detail/messages.properties b/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/numberformat/detail/messages.properties deleted file mode 100644 index c7f0c414add..00000000000 --- a/plugins/org.eclipse.dd.dsf.debug.ui/src/org/eclipse/dd/dsf/debug/internal/ui/viewmodel/numberformat/detail/messages.properties +++ /dev/null @@ -1,2 +0,0 @@ -NumberFormatDetailPane_name=Number Formats Viewer -NumberFormatDetailPane_description=Detail viewer showing selected variable in all available formats. |