1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 10:46:02 +02:00

Copy from Type Hierarchy.

This commit is contained in:
Sergey Prigogin 2010-05-16 00:09:56 +00:00
parent 9790fbc6ab
commit 328e9da961
25 changed files with 289 additions and 277 deletions

View file

@ -27,9 +27,9 @@ public abstract class AbstractToggleLinkingAction extends Action {
* Constructs a new action. * Constructs a new action.
*/ */
public AbstractToggleLinkingAction() { public AbstractToggleLinkingAction() {
super(ActionMessages.getString("ToggleLinkingAction.label")); //$NON-NLS-1$ super(ActionMessages.ToggleLinkingAction_label);
setDescription(ActionMessages.getString("ToggleLinkingAction.description")); //$NON-NLS-1$ setDescription(ActionMessages.ToggleLinkingAction_description);
setToolTipText(ActionMessages.getString("ToggleLinkingAction.tooltip")); //$NON-NLS-1$ setToolTipText(ActionMessages.ToggleLinkingAction_tooltip);
CPluginImages.setImageDescriptors(this, CPluginImages.T_LCL, "synced.gif"); //$NON-NLS-1$ CPluginImages.setImageDescriptors(this, CPluginImages.T_LCL, "synced.gif"); //$NON-NLS-1$
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, ICHelpContextIds.LINK_EDITOR_ACTION); PlatformUI.getWorkbench().getHelpSystem().setHelp(this, ICHelpContextIds.LINK_EDITOR_ACTION);
} }

View file

@ -7,85 +7,83 @@
* *
* Contributors: * Contributors:
* Rational Software - initial implementation * Rational Software - initial implementation
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.ui.actions; package org.eclipse.cdt.internal.ui.actions;
import org.eclipse.osgi.util.NLS;
import com.ibm.icu.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/** /**
* Class that gives access to the action messages resource bundle. * Class that gives access to the action messages resource bundle.
*/ */
public class ActionMessages { public class ActionMessages extends NLS {
private static final String BUNDLE_NAME= "org.eclipse.cdt.internal.ui.actions.ActionMessages"; //$NON-NLS-1$ private static final String BUNDLE_NAME= "org.eclipse.cdt.internal.ui.actions.ActionMessages"; //$NON-NLS-1$
private static ResourceBundle fgResourceBundle; public static String SourceMenu_label;
public static String SelectionConverter_codeResolve_failed;
public static String OpenAction_label;
public static String OpenAction_tooltip;
public static String OpenAction_description;
public static String OpenAction_declaration_label;
public static String OpenAction_select_element;
public static String OpenAction_error_title;
public static String OpenAction_error_message;
public static String OpenAction_error_messageArgs;
public static String OpenAction_error_messageProblems;
public static String OpenAction_error_messageBadSelection;
public static String MemberFilterActionGroup_hide_fields_label;
public static String MemberFilterActionGroup_hide_fields_tooltip;
public static String MemberFilterActionGroup_hide_fields_description;
public static String MemberFilterActionGroup_hide_static_label;
public static String MemberFilterActionGroup_hide_static_tooltip;
public static String MemberFilterActionGroup_hide_static_description;
public static String MemberFilterActionGroup_hide_nonpublic_label;
public static String MemberFilterActionGroup_hide_nonpublic_tooltip;
public static String MemberFilterActionGroup_hide_nonpublic_description;
public static String MemberFilterActionGroup_hide_inactive_label;
public static String MemberFilterActionGroup_hide_inactive_tooltip;
public static String MemberFilterActionGroup_hide_inactive_description;
public static String ActionUtil_notOnBuildPath_title;
public static String ActionUtil_notOnBuildPath_message;
public static String SelectAllAction_label;
public static String SelectAllAction_tooltip;
public static String ToggleLinkingAction_label;
public static String ToggleLinkingAction_tooltip;
public static String ToggleLinkingAction_description;
public static String IncludesGroupingAction_label;
public static String IncludesGroupingAction_tooltip;
public static String IncludesGroupingAction_description;
public static String NamespacesGroupingAction_label;
public static String NamespacesGroupingAction_tooltip;
public static String NamespacesGroupingAction_description;
public static String MemberGroupingAction_label;
public static String MemberGroupingAction_tooltip;
public static String MemberGroupingAction_description;
public static String MacroGroupingAction_label;
public static String MacroGroupingAction_tooltip;
public static String MacroGroupingAction_description;
public static String COutlineInformationControl_viewMenu_sort_label;
public static String ChangeBuildConfigMenuAction_title;
public static String ChangeBuildConfigMenuAction_text;
public static String CreateParserLogAction_existingFile;
public static String CreateParserLogAction_readOnlyFile;
public static String DeleteResConfigsAction_0;
public static String DeleteResConfigsAction_1;
public static String ExcludeFromBuildAction_0;
public static String ExcludeFromBuildAction_1;
public static String BuildActiveConfigMenuAction_defaultTooltip;
public static String BuildActiveConfigMenuAction_buildConfigTooltip;
public static String SurroundWithTemplateMenuAction_SubMenuName;
public static String SurroundWithTemplateMenuAction_ConfigureTemplatesActionName;
public static String SurroundWithTemplateMenuAction_NoneApplicable;
public static String CopyTreeAction_problem;
public static String CopyTreeAction_clipboard_busy;
static { static {
try { // Initialize resource bundle.
fgResourceBundle = ResourceBundle.getBundle(BUNDLE_NAME); NLS.initializeMessages(BUNDLE_NAME, ActionMessages.class);
} catch (MissingResourceException x) {
fgResourceBundle = null;
}
} }
private ActionMessages() { private ActionMessages() {
// no instance
}
/**
* Returns the resource bundle managed by the receiver.
*
* @return the resource bundle
* @since 3.0
*/
public static ResourceBundle getResourceBundle() {
return fgResourceBundle;
}
/**
* Returns the resource string associated with the given key in the resource bundle. If there isn't
* any value under the given key, the key is returned.
*
* @param key the resource key
* @return the string
*/
public static String getString(String key) {
try {
return fgResourceBundle.getString(key);
} catch (MissingResourceException e) {
return '!' + key + '!';
} catch (NullPointerException e) {
return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
}
}
/**
* Returns the formatted resource string associated with the given key in the resource bundle.
* <code>MessageFormat</code> is used to format the message. If there isn't any value
* under the given key, the key is returned.
*
* @param key the resource key
* @param arg the message argument
* @return the string
*/
public static String getFormattedString(String key, Object arg) {
return getFormattedString(key, new Object[] { arg });
}
/**
* Returns the formatted resource string associated with the given key in the resource bundle.
* <code>MessageFormat</code> is used to format the message. If there isn't any value
* under the given key, the key is returned.
*
* @param key the resource key
* @param args the message arguments
* @return the string
*/
public static String getFormattedString(String key, Object[] args) {
return MessageFormat.format(getString(key), args);
} }
} }

View file

@ -9,82 +9,86 @@
# IBM Corporation - initial API and implementation # IBM Corporation - initial API and implementation
# Anton Leherbauer (Wind River Systems) # Anton Leherbauer (Wind River Systems)
# Axel Mueller - [289339] Surround with # Axel Mueller - [289339] Surround with
# Sergey Prigogin (Google)
############################################################################### ###############################################################################
SourceMenu_label=Source SourceMenu_label=Source
SelectionConverter.codeResolve_failed=Couldn't convert text selection into a C element SelectionConverter_codeResolve_failed=Couldn't convert text selection into a C element
OpenAction.label=&Open OpenAction_label=&Open
OpenAction.tooltip=Open an editor on the selected element OpenAction_tooltip=Open an editor on the selected element
OpenAction.description=Open an editor on the selected element OpenAction_description=Open an editor on the selected element
OpenAction.declaration.label=&Open Declaration OpenAction_declaration_label=&Open Declaration
OpenAction.select_element=&Select or enter the element to open: OpenAction_select_element=&Select or enter the element to open:
OpenAction.error.title=Open OpenAction_error_title=Open
OpenAction.error.message=Cannot open default editor. OpenAction_error_message=Cannot open default editor.
OpenAction.error.messageArgs=Cannot open default editor on {0}. {1} OpenAction_error_messageArgs=Cannot open default editor on {0}. {1}
OpenAction.error.messageProblems=Problems Opening Editor OpenAction_error_messageProblems=Problems Opening Editor
OpenAction.error.messageBadSelection=Current text selection doesn't resolve to a C element OpenAction_error_messageBadSelection=Current text selection doesn't resolve to a C element
MemberFilterActionGroup.hide_fields.label=Hide Fiel&ds MemberFilterActionGroup_hide_fields_label=Hide Fiel&ds
MemberFilterActionGroup.hide_fields.tooltip=Hide Fields MemberFilterActionGroup_hide_fields_tooltip=Hide Fields
MemberFilterActionGroup.hide_fields.description=Toggles the visibility of fields MemberFilterActionGroup_hide_fields_description=Toggles the visibility of fields
MemberFilterActionGroup.hide_static.label=Hide &Static Members MemberFilterActionGroup_hide_static_label=Hide &Static Members
MemberFilterActionGroup.hide_static.tooltip=Hide Static Members MemberFilterActionGroup_hide_static_tooltip=Hide Static Members
MemberFilterActionGroup.hide_static.description=Toggles the visibility of static members MemberFilterActionGroup_hide_static_description=Toggles the visibility of static members
MemberFilterActionGroup.hide_nonpublic.label=Hide Non-&Public Members MemberFilterActionGroup_hide_nonpublic_label=Hide Non-&Public Members
MemberFilterActionGroup.hide_nonpublic.tooltip=Hide Non-Public Members MemberFilterActionGroup_hide_nonpublic_tooltip=Hide Non-Public Members
MemberFilterActionGroup.hide_nonpublic.description=Toggles the visibility of non-public members MemberFilterActionGroup_hide_nonpublic_description=Toggles the visibility of non-public members
MemberFilterActionGroup.hide_inactive.label=Hide &Inactive Elements MemberFilterActionGroup_hide_inactive_label=Hide &Inactive Elements
MemberFilterActionGroup.hide_inactive.tooltip=Hide Inactive Elements MemberFilterActionGroup_hide_inactive_tooltip=Hide Inactive Elements
MemberFilterActionGroup.hide_inactive.description=Toggles the visibility of inactive elements MemberFilterActionGroup_hide_inactive_description=Toggles the visibility of inactive elements
ActionUtil.notOnBuildPath.title=Operation Cannot be Performed ActionUtil_notOnBuildPath_title=Operation Cannot be Performed
ActionUtil.notOnBuildPath.message=The resource is not on the build path of a Java project. ActionUtil_notOnBuildPath_message=The resource is not on the build path of a Java project.
SelectAllAction.label= Select A&ll SelectAllAction_label= Select A&ll
SelectAllAction.tooltip= Select All SelectAllAction_tooltip= Select All
ToggleLinkingAction.label=Lin&k With Editor ToggleLinkingAction_label=Lin&k With Editor
ToggleLinkingAction.tooltip=Link with Editor ToggleLinkingAction_tooltip=Link with Editor
ToggleLinkingAction.description=Link with active editor ToggleLinkingAction_description=Link with active editor
IncludesGroupingAction.label=Group Includes IncludesGroupingAction_label=Group Includes
IncludesGroupingAction.tooltip=Group includes statements IncludesGroupingAction_tooltip=Group includes statements
IncludesGroupingAction.description=Group includes statements IncludesGroupingAction_description=Group includes statements
NamespacesGroupingAction.label=Group Namespaces NamespacesGroupingAction_label=Group Namespaces
NamespacesGroupingAction.tooltip=Group namespaces NamespacesGroupingAction_tooltip=Group namespaces
NamespacesGroupingAction.description=Group namespaces NamespacesGroupingAction_description=Group namespaces
MemberGroupingAction.label=Group Methods MemberGroupingAction_label=Group Methods
MemberGroupingAction.tooltip=Group method definitions MemberGroupingAction_tooltip=Group method definitions
MemberGroupingAction.description=Group method definitions MemberGroupingAction_description=Group method definitions
MacroGroupingAction.label = Group Macros MacroGroupingAction_label= Group Macros
MacroGroupingAction.tooltip = Group macro definitions MacroGroupingAction_tooltip= Group macro definitions
MacroGroupingAction.description = Group macro definitions MacroGroupingAction_description= Group macro definitions
COutlineInformationControl.viewMenu.sort.label=Sort COutlineInformationControl_viewMenu_sort_label=Sort
ChangeBuildConfigMenuAction.title=Sorry ChangeBuildConfigMenuAction_title=Sorry
ChangeBuildConfigMenuAction.text=No way to manage configurations for selected objects. ChangeBuildConfigMenuAction_text=No way to manage configurations for selected objects.
CreateParserLogAction.existingFile=''{0}'' already exists.\nDo you want to replace it? CreateParserLogAction_existingFile=''{0}'' already exists.\nDo you want to replace it?
CreateParserLogAction.readOnlyFile=''{0}'' cannot be modified\! CreateParserLogAction_readOnlyFile=''{0}'' cannot be modified\!
DeleteResConfigsAction.0=Select resource configurations to restore default settings DeleteResConfigsAction_0=Select resource configurations to restore default settings
DeleteResConfigsAction.1=Reset Resource Configurations DeleteResConfigsAction_1=Reset Resource Configurations
ExcludeFromBuildAction.0=Exclude object(s) from build in the following configurations ExcludeFromBuildAction_0=Exclude object(s) from build in the following configurations
ExcludeFromBuildAction.1=Exclude from build ExcludeFromBuildAction_1=Exclude from build
BuildActiveConfigMenuAction_defaultTooltip=Build the active configurations of selected projects BuildActiveConfigMenuAction_defaultTooltip=Build the active configurations of selected projects
BuildActiveConfigMenuAction_buildConfigTooltip=Build ''{0}'' for project ''{1}'' BuildActiveConfigMenuAction_buildConfigTooltip=Build ''{0}'' for project ''{1}''
SurroundWithTemplateMenuAction.SubMenuName=Surround &With SurroundWithTemplateMenuAction_SubMenuName=Surround &With
SurroundWithTemplateMenuAction.ConfigureTemplatesActionName=&Configure Templates... SurroundWithTemplateMenuAction_ConfigureTemplatesActionName=&Configure Templates...
SurroundWithTemplateMenuAction.NoneApplicable=(no template applicable) SurroundWithTemplateMenuAction_NoneApplicable=(no template applicable)
CopyTreeAction_problem=Problem Copying to Clipboard
CopyTreeAction_clipboard_busy=There was a problem when accessing the system clipboard. Retry?

View file

@ -33,7 +33,7 @@ public class ActionUtil {
// if ((resource == null) || (! (resource instanceof IFolder)) || (! resource.isLinked())) // if ((resource == null) || (! (resource instanceof IFolder)) || (! resource.isLinked()))
// return false; // return false;
// //
// MessageDialog.openInformation(shell, ActionMessages.getString("ActionUtil.not_possible"), ActionMessages.getString("ActionUtil.no_linked")); //$NON-NLS-1$ //$NON-NLS-2$ // MessageDialog.openInformation(shell, ActionMessages.ActionUtil.not_possible"), ActionMessages.ActionUtil.no_linked")); //$NON-NLS-1$ //$NON-NLS-2$
// return true; // return true;
} }
@ -45,8 +45,8 @@ public class ActionUtil {
// then it is for sure not on the build path // then it is for sure not on the build path
if (input == null) { if (input == null) {
MessageDialog.openInformation(shell, MessageDialog.openInformation(shell,
ActionMessages.getString("ActionUtil.notOnBuildPath.title"), //$NON-NLS-1$ ActionMessages.ActionUtil_notOnBuildPath_title,
ActionMessages.getString("ActionUtil.notOnBuildPath.message")); //$NON-NLS-1$ ActionMessages.ActionUtil_notOnBuildPath_message);
return false; return false;
} }
return isProcessable(shell, input); return isProcessable(shell, input);
@ -59,8 +59,8 @@ public class ActionUtil {
if (isOnBuildPath((ICElement)element)) if (isOnBuildPath((ICElement)element))
return true; return true;
MessageDialog.openInformation(shell, MessageDialog.openInformation(shell,
ActionMessages.getString("ActionUtil.notOnBuildPath.title"), //$NON-NLS-1$ ActionMessages.ActionUtil_notOnBuildPath_title,
ActionMessages.getString("ActionUtil.notOnBuildPath.message")); //$NON-NLS-1$ ActionMessages.ActionUtil_notOnBuildPath_message);
return false; return false;
} }

View file

@ -9,7 +9,7 @@
* Jesper Kamstrup Linnet (eclipse@kamstrup-linnet.dk) - initial API and implementation * Jesper Kamstrup Linnet (eclipse@kamstrup-linnet.dk) - initial API and implementation
* Sergey Prigogin (Google) * Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.ui.callhierarchy; package org.eclipse.cdt.internal.ui.actions;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
@ -25,6 +25,7 @@ import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.TextTransfer; import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer; import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.widgets.TreeItem; import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.Assert;
@ -32,21 +33,23 @@ import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.cdt.internal.ui.util.SelectionUtil; import org.eclipse.cdt.internal.ui.util.SelectionUtil;
import org.eclipse.cdt.internal.ui.viewsupport.ExtendedTreeViewer;
class CopyCallHierarchyAction extends Action { /**
* Copies contents of a TreeViewer to the clipboard.
*/
public class CopyTreeAction extends Action {
private static final char INDENTATION= '\t'; private static final char INDENTATION= '\t';
private CHViewPart fView; private ViewPart fView;
private ExtendedTreeViewer fViewer; private TreeViewer fViewer;
private final Clipboard fClipboard; private final Clipboard fClipboard;
public CopyCallHierarchyAction(CHViewPart view, Clipboard clipboard, ExtendedTreeViewer viewer) { public CopyTreeAction(String label, ViewPart view, Clipboard clipboard, TreeViewer viewer) {
super(CHMessages.CopyCallHierarchyAction_label); super(label);
Assert.isNotNull(clipboard); Assert.isNotNull(clipboard);
// PlatformUI.getWorkbench().getHelpSystem().setHelp(this, ICHelpContextIds.CALL_HIERARCHY_COPY_ACTION);
fView= view; fView= view;
fClipboard= clipboard; fClipboard= clipboard;
fViewer= viewer; fViewer= viewer;
@ -72,8 +75,8 @@ class CopyCallHierarchyAction extends Action {
*/ */
@Override @Override
public void run() { public void run() {
StringBuffer buf= new StringBuffer(); StringBuilder buf= new StringBuilder();
addCalls(fViewer.getTree().getSelection()[0], 0, buf); addChildren(fViewer.getTree().getSelection()[0], 0, buf);
TextTransfer plainTextTransfer= TextTransfer.getInstance(); TextTransfer plainTextTransfer= TextTransfer.getInstance();
try { try {
@ -83,19 +86,21 @@ class CopyCallHierarchyAction extends Action {
} catch (SWTError e) { } catch (SWTError e) {
if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD) if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD)
throw e; throw e;
if (MessageDialog.openQuestion(fView.getViewSite().getShell(), CHMessages.CopyCallHierarchyAction_problem, CHMessages.CopyCallHierarchyAction_clipboard_busy)) if (MessageDialog.openQuestion(fView.getViewSite().getShell(),
ActionMessages.CopyTreeAction_problem, ActionMessages.CopyTreeAction_clipboard_busy)) {
run(); run();
} }
} }
}
/** /**
* Adds the specified {@link TreeItem}'s text to the StringBuffer. * Adds the specified {@link TreeItem}'s text to the StringBuilder.
* *
* @param item the tree item * @param item the tree item
* @param indent the indent size * @param indent the indent size
* @param buf the string buffer * @param buf the string buffer
*/ */
private void addCalls(TreeItem item, int indent, StringBuffer buf) { private void addChildren(TreeItem item, int indent, StringBuilder buf) {
for (int i= 0; i < indent; i++) { for (int i= 0; i < indent; i++) {
buf.append(INDENTATION); buf.append(INDENTATION);
} }
@ -106,7 +111,7 @@ class CopyCallHierarchyAction extends Action {
if (item.getExpanded()) { if (item.getExpanded()) {
TreeItem[] items= item.getItems(); TreeItem[] items= item.getItems();
for (int i= 0; i < items.length; i++) { for (int i= 0; i < items.length; i++) {
addCalls(items[i], indent + 1, buf); addChildren(items[i], indent + 1, buf);
} }
} }
} }

View file

@ -156,12 +156,12 @@ public class CreateParserLogAction implements IObjectActionDelegate {
File file= new File(path); File file= new File(path);
if (file.exists()) { if (file.exists()) {
if (!file.canWrite()) { if (!file.canWrite()) {
final String msg= NLS.bind(ActionMessages.getString("CreateParserLogAction.readOnlyFile"), path); final String msg= NLS.bind(ActionMessages.CreateParserLogAction_readOnlyFile, path);
MessageDialog.openError(fSite.getShell(), title, msg); MessageDialog.openError(fSite.getShell(), title, msg);
path= null; path= null;
} }
else { else {
final String msg = NLS.bind(ActionMessages.getString("CreateParserLogAction.existingFile"), path); final String msg = NLS.bind(ActionMessages.CreateParserLogAction_existingFile, path);
if (!MessageDialog.openQuestion(fSite.getShell(), title, msg)) { if (!MessageDialog.openQuestion(fSite.getShell(), title, msg)) {
path= null; path= null;
} }

View file

@ -30,8 +30,8 @@ public class SelectAllAction extends Action {
*/ */
public SelectAllAction(TableViewer viewer) { public SelectAllAction(TableViewer viewer) {
super("selectAll"); //$NON-NLS-1$ super("selectAll"); //$NON-NLS-1$
setText(ActionMessages.getString("SelectAllAction.label")); //$NON-NLS-1$ setText(ActionMessages.SelectAllAction_label);
setToolTipText(ActionMessages.getString("SelectAllAction.tooltip")); //$NON-NLS-1$ setToolTipText(ActionMessages.SelectAllAction_tooltip);
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, ICHelpContextIds.SELECT_ALL_ACTION); PlatformUI.getWorkbench().getHelpSystem().setHelp(this, ICHelpContextIds.SELECT_ALL_ACTION);
Assert.isNotNull(viewer); Assert.isNotNull(viewer);
fViewer= viewer; fViewer= viewer;

View file

@ -321,7 +321,7 @@ public class SelectionConverter {
try { try {
return codeResolveOrInput(editor); return codeResolveOrInput(editor);
} catch(CModelException e) { } catch(CModelException e) {
ExceptionHandler.handle(e, shell, title, ActionMessages.getString("SelectionConverter.codeResolve_failed")); //$NON-NLS-1$ ExceptionHandler.handle(e, shell, title, ActionMessages.SelectionConverter_codeResolve_failed);
} }
return null; return null;
} }
@ -332,5 +332,4 @@ public class SelectionConverter {
return getInput(editor) != null; return getInput(editor) != null;
} }
} }

View file

@ -49,7 +49,7 @@ public class SurroundWithActionGroup extends ActionGroup {
if (textSelection.getLength() == 0) if (textSelection.getLength() == 0)
return; return;
String menuText= ActionMessages.getString("SurroundWithTemplateMenuAction.SubMenuName"); //$NON-NLS-1$ String menuText= ActionMessages.SurroundWithTemplateMenuAction_SubMenuName;
MenuManager subMenu = new MenuManager(menuText, SurroundWithTemplateMenuAction.SURROUND_WITH_QUICK_MENU_ACTION_ID); MenuManager subMenu = new MenuManager(menuText, SurroundWithTemplateMenuAction.SURROUND_WITH_QUICK_MENU_ACTION_ID);
subMenu.setActionDefinitionId(SurroundWithTemplateMenuAction.SURROUND_WITH_QUICK_MENU_ACTION_ID); subMenu.setActionDefinitionId(SurroundWithTemplateMenuAction.SURROUND_WITH_QUICK_MENU_ACTION_ID);
@ -62,5 +62,4 @@ public class SurroundWithActionGroup extends ActionGroup {
} }
}); });
} }
} }

View file

@ -72,7 +72,7 @@ public class SurroundWithTemplateMenuAction implements IWorkbenchWindowPulldownD
private static class ConfigureTemplatesAction extends Action { private static class ConfigureTemplatesAction extends Action {
public ConfigureTemplatesAction() { public ConfigureTemplatesAction() {
super(ActionMessages.getString("SurroundWithTemplateMenuAction.ConfigureTemplatesActionName")); //$NON-NLS-1$ super(ActionMessages.SurroundWithTemplateMenuAction_ConfigureTemplatesActionName);
} }
/** /**
@ -88,7 +88,7 @@ public class SurroundWithTemplateMenuAction implements IWorkbenchWindowPulldownD
} }
} }
private static Action NONE_APPLICABLE_ACTION= new Action(ActionMessages.getString("SurroundWithTemplateMenuAction.NoneApplicable")) { //$NON-NLS-1$ private static Action NONE_APPLICABLE_ACTION= new Action(ActionMessages.SurroundWithTemplateMenuAction_NoneApplicable) {
@Override @Override
public void run() { public void run() {
//Do nothing //Do nothing
@ -118,7 +118,6 @@ public class SurroundWithTemplateMenuAction implements IWorkbenchWindowPulldownD
public void partOpened(IWorkbenchPart part) { public void partOpened(IWorkbenchPart part) {
} }
}; };
protected void disposeMenuItems() { protected void disposeMenuItems() {
@ -290,7 +289,7 @@ public class SurroundWithTemplateMenuAction implements IWorkbenchWindowPulldownD
CContentAssistInvocationContext context = new CContentAssistInvocationContext( editor.getViewer(), textSelection.getOffset(), editor, true, false ); CContentAssistInvocationContext context = new CContentAssistInvocationContext( editor.getViewer(), textSelection.getOffset(), editor, true, false );
List<ICompletionProposal> proposals= templateComputer.computeCompletionProposals(context, null); List<ICompletionProposal> proposals= templateComputer.computeCompletionProposals(context, null);
if (proposals == null || proposals.size() == 0) if (proposals == null || proposals.isEmpty())
return null; return null;
return getActionsFromProposals(proposals, context.getInvocationOffset(), editor.getViewer()); return getActionsFromProposals(proposals, context.getInvocationOffset(), editor.getViewer());
@ -352,7 +351,6 @@ public class SurroundWithTemplateMenuAction implements IWorkbenchWindowPulldownD
public boolean ownsFocusShell() { public boolean ownsFocusShell() {
return false; return false;
} }
}; };
try { try {

View file

@ -35,6 +35,7 @@ public class CHMessages extends NLS {
public static String CHViewPart_PreviousReference_tooltip; public static String CHViewPart_PreviousReference_tooltip;
public static String CHViewPart_Refresh_label; public static String CHViewPart_Refresh_label;
public static String CHViewPart_Refresh_tooltip; public static String CHViewPart_Refresh_tooltip;
public static String CHViewPart_CopyCallHierarchy_label;
public static String CHViewPart_ShowCallees_label; public static String CHViewPart_ShowCallees_label;
public static String CHViewPart_ShowCallees_tooltip; public static String CHViewPart_ShowCallees_tooltip;
public static String CHViewPart_ShowCallers_label; public static String CHViewPart_ShowCallers_label;
@ -55,9 +56,6 @@ public class CHMessages extends NLS {
public static String OpenElementInCallHierarchyAction_message; public static String OpenElementInCallHierarchyAction_message;
public static String OpenElementInCallHierarchyAction_title; public static String OpenElementInCallHierarchyAction_title;
public static String OpenElementInCallHierarchyAction_upperListLabel; public static String OpenElementInCallHierarchyAction_upperListLabel;
public static String CopyCallHierarchyAction_label;
public static String CopyCallHierarchyAction_problem;
public static String CopyCallHierarchyAction_clipboard_busy;
static { static {
// initialize resource bundle // initialize resource bundle

View file

@ -33,6 +33,7 @@ CHViewPart_Title_callees=Calls from {0} - in {1}
CHViewPart_FocusOn_label=Focus On ''{0}'' CHViewPart_FocusOn_label=Focus On ''{0}''
CHViewPart_Open_label=Open CHViewPart_Open_label=Open
CHViewPart_Open_tooltip=Open CHViewPart_Open_tooltip=Open
CHViewPart_CopyCallHierarchy_label=Copy E&xpanded Hierarchy
CHLabelProvider_matches=matches CHLabelProvider_matches=matches
CHHistoryDropDownAction_ClearHistory_label=Clear History CHHistoryDropDownAction_ClearHistory_label=Clear History
CHHistoryListAction_HistoryDialog_title=Call Hierarchy History CHHistoryListAction_HistoryDialog_title=Call Hierarchy History
@ -49,6 +50,3 @@ OpenElementInCallHierarchyAction_title=Open Element in Call Hierarchy
OpenElementInCallHierarchyAction_upperListLabel=&Matching Elements: OpenElementInCallHierarchyAction_upperListLabel=&Matching Elements:
OpenElementInCallHierarchyAction_message=&Choose an element (? = any character, * = any string): OpenElementInCallHierarchyAction_message=&Choose an element (? = any character, * = any string):
OpenElementInCallHierarchyAction_errorNoDefinition=Could not locate definition of element ''{0}'' OpenElementInCallHierarchyAction_errorNoDefinition=Could not locate definition of element ''{0}''
CopyCallHierarchyAction_label=Copy E&xpanded Hierarchy
CopyCallHierarchyAction_problem=Problem Copying Hierarchy to Clipboard
CopyCallHierarchyAction_clipboard_busy=There was a problem when accessing the system clipboard. Retry?

View file

@ -75,6 +75,7 @@ import org.eclipse.cdt.ui.refactoring.actions.CRefactoringActionGroup;
import org.eclipse.cdt.internal.ui.CPluginImages; import org.eclipse.cdt.internal.ui.CPluginImages;
import org.eclipse.cdt.internal.ui.ICHelpContextIds; import org.eclipse.cdt.internal.ui.ICHelpContextIds;
import org.eclipse.cdt.internal.ui.IContextMenuConstants; import org.eclipse.cdt.internal.ui.IContextMenuConstants;
import org.eclipse.cdt.internal.ui.actions.CopyTreeAction;
import org.eclipse.cdt.internal.ui.editor.ICEditorActionDefinitionIds; import org.eclipse.cdt.internal.ui.editor.ICEditorActionDefinitionIds;
import org.eclipse.cdt.internal.ui.search.actions.SelectionSearchGroup; import org.eclipse.cdt.internal.ui.search.actions.SelectionSearchGroup;
import org.eclipse.cdt.internal.ui.util.CoreUtility; import org.eclipse.cdt.internal.ui.util.CoreUtility;
@ -133,7 +134,7 @@ public class CHViewPart extends ViewPart {
private Action fHistoryAction; private Action fHistoryAction;
private Action fShowReference; private Action fShowReference;
private Action fOpenElement; private Action fOpenElement;
private CopyCallHierarchyAction fCopyAction; private CopyTreeAction fCopyAction;
// action groups // action groups
private OpenViewActionGroup fOpenViewActionGroup; private OpenViewActionGroup fOpenViewActionGroup;
@ -477,8 +478,6 @@ public class CHViewPart extends ViewPart {
fPreviousAction.setToolTipText(CHMessages.CHViewPart_PreviousReference_tooltip); fPreviousAction.setToolTipText(CHMessages.CHViewPart_PreviousReference_tooltip);
CPluginImages.setImageDescriptors(fPreviousAction, CPluginImages.T_LCL, CPluginImages.IMG_SHOW_PREV); CPluginImages.setImageDescriptors(fPreviousAction, CPluginImages.T_LCL, CPluginImages.IMG_SHOW_PREV);
fCopyAction= new CopyCallHierarchyAction(this, fClipboard, fTreeViewer);
fRefreshAction = new Action(CHMessages.CHViewPart_Refresh_label) { fRefreshAction = new Action(CHMessages.CHViewPart_Refresh_label) {
@Override @Override
public void run() { public void run() {
@ -490,6 +489,8 @@ public class CHViewPart extends ViewPart {
fHistoryAction = new CHHistoryDropDownAction(this); fHistoryAction = new CHHistoryDropDownAction(this);
fCopyAction= new CopyCallHierarchyAction(this, fClipboard, fTreeViewer);
// setup action bar // setup action bar
// global action hooks // global action hooks
IActionBars actionBars = getViewSite().getActionBars(); IActionBars actionBars = getViewSite().getActionBars();
@ -808,4 +809,11 @@ public class CHViewPart extends ViewPart {
public TreeViewer getTreeViewer() { public TreeViewer getTreeViewer() {
return fTreeViewer; return fTreeViewer;
} }
private static class CopyCallHierarchyAction extends CopyTreeAction {
public CopyCallHierarchyAction(ViewPart view, Clipboard clipboard, TreeViewer viewer) {
super(CHMessages.CHViewPart_CopyCallHierarchy_label, view, clipboard, viewer);
// PlatformUI.getWorkbench().getHelpSystem().setHelp(this, ICHelpContextIds.CALL_HIERARCHY_COPY_ACTION);
}
}
} }

View file

@ -187,9 +187,9 @@ public abstract class AbstractCModelOutlinePage extends Page implements IContent
AbstractCModelOutlinePage fOutLinePage; AbstractCModelOutlinePage fOutLinePage;
public IncludeGroupingAction(AbstractCModelOutlinePage outlinePage) { public IncludeGroupingAction(AbstractCModelOutlinePage outlinePage) {
super(ActionMessages.getString("IncludesGroupingAction.label")); //$NON-NLS-1$ super(ActionMessages.IncludesGroupingAction_label);
setDescription(ActionMessages.getString("IncludesGroupingAction.description")); //$NON-NLS-1$ setDescription(ActionMessages.IncludesGroupingAction_description);
setToolTipText(ActionMessages.getString("IncludesGroupingAction.tooltip")); //$NON-NLS-1$ setToolTipText(ActionMessages.IncludesGroupingAction_tooltip);
CPluginImages.setImageDescriptors(this, CPluginImages.T_LCL, CPluginImages.IMG_MENU_GROUP_INCLUDE); CPluginImages.setImageDescriptors(this, CPluginImages.T_LCL, CPluginImages.IMG_MENU_GROUP_INCLUDE);
boolean enabled= isIncludesGroupingEnabled(); boolean enabled= isIncludesGroupingEnabled();
@ -219,9 +219,9 @@ public abstract class AbstractCModelOutlinePage extends Page implements IContent
protected static class MacroGroupingAction extends Action { protected static class MacroGroupingAction extends Action {
public MacroGroupingAction(AbstractCModelOutlinePage outlinePage) { public MacroGroupingAction(AbstractCModelOutlinePage outlinePage) {
super(ActionMessages.getString("MacroGroupingAction.label")); //$NON-NLS-1$ super(ActionMessages.MacroGroupingAction_label);
setDescription(ActionMessages.getString("MacroGroupingAction.description")); //$NON-NLS-1$ setDescription(ActionMessages.MacroGroupingAction_description);
setToolTipText(ActionMessages.getString("MacroGroupingAction.tooltip")); //$NON-NLS-1$ setToolTipText(ActionMessages.MacroGroupingAction_tooltip);
CPluginImages.setImageDescriptors(this, CPluginImages.T_LCL, CPluginImages.IMG_ACTION_HIDE_MACROS); CPluginImages.setImageDescriptors(this, CPluginImages.T_LCL, CPluginImages.IMG_ACTION_HIDE_MACROS);
this.setImageDescriptor(CPluginImages.DESC_OBJS_MACRO); this.setImageDescriptor(CPluginImages.DESC_OBJS_MACRO);
this.setDisabledImageDescriptor(CPluginImages.DESC_OBJS_MACRO); this.setDisabledImageDescriptor(CPluginImages.DESC_OBJS_MACRO);

View file

@ -56,7 +56,7 @@ public class CContentOutlinePage extends AbstractCModelOutlinePage {
} }
/** /**
* Provide access to the CEditor corresponding to this CContentOutlinePage. * Provides access to the CEditor corresponding to this CContentOutlinePage.
* @returns the CEditor corresponding to this CContentOutlinePage. * @returns the CEditor corresponding to this CContentOutlinePage.
*/ */
public CEditor getEditor() { public CEditor getEditor() {
@ -165,9 +165,9 @@ public class CContentOutlinePage extends AbstractCModelOutlinePage {
protected static class NamespaceGroupingAction extends Action { protected static class NamespaceGroupingAction extends Action {
public NamespaceGroupingAction(AbstractCModelOutlinePage outlinePage) { public NamespaceGroupingAction(AbstractCModelOutlinePage outlinePage) {
super(ActionMessages.getString("NamespacesGroupingAction.label")); //$NON-NLS-1$ super(ActionMessages.NamespacesGroupingAction_label);
setDescription(ActionMessages.getString("NamespacesGroupingAction.description")); //$NON-NLS-1$ setDescription(ActionMessages.NamespacesGroupingAction_description);
setToolTipText(ActionMessages.getString("NamespacesGroupingAction.tooltip")); //$NON-NLS-1$ setToolTipText(ActionMessages.NamespacesGroupingAction_tooltip);
this.setImageDescriptor(CPluginImages.DESC_OBJS_NAMESPACE); this.setImageDescriptor(CPluginImages.DESC_OBJS_NAMESPACE);
this.setDisabledImageDescriptor(CPluginImages.DESC_OBJS_NAMESPACE); this.setDisabledImageDescriptor(CPluginImages.DESC_OBJS_NAMESPACE);
@ -186,7 +186,6 @@ public class CContentOutlinePage extends AbstractCModelOutlinePage {
public boolean isNamspacesGroupingEnabled () { public boolean isNamspacesGroupingEnabled () {
return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.OUTLINE_GROUP_NAMESPACES); return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.OUTLINE_GROUP_NAMESPACES);
} }
} }
/** /**
@ -197,9 +196,9 @@ public class CContentOutlinePage extends AbstractCModelOutlinePage {
protected static class MemberGroupingAction extends Action { protected static class MemberGroupingAction extends Action {
public MemberGroupingAction(AbstractCModelOutlinePage outlinePage) { public MemberGroupingAction(AbstractCModelOutlinePage outlinePage) {
super(ActionMessages.getString("MemberGroupingAction.label")); //$NON-NLS-1$ super(ActionMessages.MemberGroupingAction_label);
setDescription(ActionMessages.getString("MemberGroupingAction.description")); //$NON-NLS-1$ setDescription(ActionMessages.MemberGroupingAction_description);
setToolTipText(ActionMessages.getString("MemberGroupingAction.tooltip")); //$NON-NLS-1$ setToolTipText(ActionMessages.MemberGroupingAction_tooltip);
CPluginImages.setImageDescriptors(this, CPluginImages.T_LCL, CPluginImages.IMG_ACTION_SHOW_PUBLIC); CPluginImages.setImageDescriptors(this, CPluginImages.T_LCL, CPluginImages.IMG_ACTION_SHOW_PUBLIC);
boolean enabled= isMemberGroupingEnabled(); boolean enabled= isMemberGroupingEnabled();
@ -217,7 +216,6 @@ public class CContentOutlinePage extends AbstractCModelOutlinePage {
public boolean isMemberGroupingEnabled () { public boolean isMemberGroupingEnabled () {
return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.OUTLINE_GROUP_MEMBERS); return PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.OUTLINE_GROUP_MEMBERS);
} }
} }
@Override @Override

View file

@ -49,6 +49,7 @@ public class Messages extends NLS {
public static String THViewPart_MethodPane_title; public static String THViewPart_MethodPane_title;
public static String THViewPart_Open; public static String THViewPart_Open;
public static String THViewPart_Open_tooltip; public static String THViewPart_Open_tooltip;
public static String THViewPart_CopyTypeHierarchy;
public static String THViewPart_Refresh; public static String THViewPart_Refresh;
public static String THViewPart_Refresh_tooltip; public static String THViewPart_Refresh_tooltip;
public static String THViewPart_ShowFileNames; public static String THViewPart_ShowFileNames;

View file

@ -45,6 +45,7 @@ import org.eclipse.swt.accessibility.AccessibleEvent;
import org.eclipse.swt.custom.CLabel; import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.custom.SashForm; import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.custom.ViewForm; import org.eclipse.swt.custom.ViewForm;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.DND; import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DropTarget; import org.eclipse.swt.dnd.DropTarget;
import org.eclipse.swt.dnd.Transfer; import org.eclipse.swt.dnd.Transfer;
@ -71,6 +72,7 @@ import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionFactory; import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.contexts.IContextActivation; import org.eclipse.ui.contexts.IContextActivation;
import org.eclipse.ui.contexts.IContextService; import org.eclipse.ui.contexts.IContextService;
import org.eclipse.ui.navigator.ICommonMenuConstants;
import org.eclipse.ui.part.PageBook; import org.eclipse.ui.part.PageBook;
import org.eclipse.ui.part.ViewPart; import org.eclipse.ui.part.ViewPart;
import org.eclipse.ui.progress.IWorkbenchSiteProgressService; import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
@ -92,6 +94,7 @@ import org.eclipse.cdt.ui.refactoring.actions.CRefactoringActionGroup;
import org.eclipse.cdt.internal.ui.CPluginImages; import org.eclipse.cdt.internal.ui.CPluginImages;
import org.eclipse.cdt.internal.ui.ICHelpContextIds; import org.eclipse.cdt.internal.ui.ICHelpContextIds;
import org.eclipse.cdt.internal.ui.IContextMenuConstants; import org.eclipse.cdt.internal.ui.IContextMenuConstants;
import org.eclipse.cdt.internal.ui.actions.CopyTreeAction;
import org.eclipse.cdt.internal.ui.editor.ICEditorActionDefinitionIds; import org.eclipse.cdt.internal.ui.editor.ICEditorActionDefinitionIds;
import org.eclipse.cdt.internal.ui.search.actions.SelectionSearchGroup; import org.eclipse.cdt.internal.ui.search.actions.SelectionSearchGroup;
import org.eclipse.cdt.internal.ui.viewsupport.AdaptingSelectionProvider; import org.eclipse.cdt.internal.ui.viewsupport.AdaptingSelectionProvider;
@ -138,6 +141,8 @@ public class THViewPart extends ViewPart implements ITHModelPresenter {
private ArrayList<ICElement> fHistoryEntries= new ArrayList<ICElement>(MAX_HISTORY_SIZE); private ArrayList<ICElement> fHistoryEntries= new ArrayList<ICElement>(MAX_HISTORY_SIZE);
private int fIgnoreSelectionChanges= 0; private int fIgnoreSelectionChanges= 0;
private Clipboard fClipboard;
// widgets // widgets
private PageBook fPagebook; private PageBook fPagebook;
private Label fInfoText; private Label fInfoText;
@ -171,6 +176,7 @@ public class THViewPart extends ViewPart implements ITHModelPresenter {
private Action fCancelAction; private Action fCancelAction;
private Action fHistoryAction; private Action fHistoryAction;
private Action fOpenElement; private Action fOpenElement;
private CopyTreeAction fCopyAction;
private Action fHorizontalOrientation; private Action fHorizontalOrientation;
private Action fVerticalOrientation; private Action fVerticalOrientation;
@ -228,6 +234,8 @@ public class THViewPart extends ViewPart implements ITHModelPresenter {
initSelectionProvider(); initSelectionProvider();
fClipboard = new Clipboard(parent.getDisplay());
initDragAndDrop(); initDragAndDrop();
createActions(); createActions();
createContextMenu(); createContextMenu();
@ -411,6 +419,10 @@ public class THViewPart extends ViewPart implements ITHModelPresenter {
fOpenViewActionGroup.fillContextMenu(menu); fOpenViewActionGroup.fillContextMenu(menu);
} }
if (hierarchyView && fCopyAction.canActionBeAdded()) {
menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, fCopyAction);
}
if (SelectionSearchGroup.canActionBeAdded(selection)) { if (SelectionSearchGroup.canActionBeAdded(selection)) {
fSelectionSearchGroup.fillContextMenu(menu); fSelectionSearchGroup.fillContextMenu(menu);
} }
@ -549,16 +561,14 @@ public class THViewPart extends ViewPart implements ITHModelPresenter {
private void initDragAndDrop() { private void initDragAndDrop() {
THDropTargetListener dropListener= new THDropTargetListener(this); THDropTargetListener dropListener= new THDropTargetListener(this);
Transfer[] localSelectionTransfer= new Transfer[] { Transfer[] localSelectionTransfer= new Transfer[] { LocalSelectionTransfer.getTransfer() };
LocalSelectionTransfer.getTransfer()
};
DropTarget dropTarget = new DropTarget(fPagebook, DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK | DND.DROP_DEFAULT); DropTarget dropTarget = new DropTarget(fPagebook, DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK | DND.DROP_DEFAULT);
dropTarget.setTransfer(localSelectionTransfer); dropTarget.setTransfer(localSelectionTransfer);
dropTarget.addDropListener(dropListener); dropTarget.addDropListener(dropListener);
} }
private void createActions() { private void createActions() {
// action gruops // action groups
fOpenViewActionGroup= new OpenViewActionGroup(this); fOpenViewActionGroup= new OpenViewActionGroup(this);
fOpenViewActionGroup.setSuppressTypeHierarchy(true); fOpenViewActionGroup.setSuppressTypeHierarchy(true);
fOpenViewActionGroup.setSuppressProperties(true); fOpenViewActionGroup.setSuppressProperties(true);
@ -716,8 +726,7 @@ public class THViewPart extends ViewPart implements ITHModelPresenter {
public void run() { public void run() {
if (isChecked()) { if (isChecked()) {
fMemberViewer.addFilter(fStaticFilter); fMemberViewer.addFilter(fStaticFilter);
} } else {
else {
fMemberViewer.removeFilter(fStaticFilter); fMemberViewer.removeFilter(fStaticFilter);
} }
} }
@ -730,8 +739,7 @@ public class THViewPart extends ViewPart implements ITHModelPresenter {
public void run() { public void run() {
if (isChecked()) { if (isChecked()) {
fMemberViewer.addFilter(fNonPublicFilter); fMemberViewer.addFilter(fNonPublicFilter);
} } else {
else {
fMemberViewer.removeFilter(fNonPublicFilter); fMemberViewer.removeFilter(fNonPublicFilter);
} }
} }
@ -776,6 +784,8 @@ public class THViewPart extends ViewPart implements ITHModelPresenter {
fHistoryAction = new THHistoryDropDownAction(this); fHistoryAction = new THHistoryDropDownAction(this);
fCopyAction= new CopyTypeHierarchyAction(this, fClipboard, fHierarchyTreeViewer);
// setup action bar // setup action bar
// global action hooks // global action hooks
IActionBars actionBars = getViewSite().getActionBars(); IActionBars actionBars = getViewSite().getActionBars();
@ -879,8 +889,7 @@ public class THViewPart extends ViewPart implements ITHModelPresenter {
IWorkingSet workingSet= fWorkingSetFilterUI.getWorkingSet(); IWorkingSet workingSet= fWorkingSetFilterUI.getWorkingSet();
if (workingSet == null) { if (workingSet == null) {
message= label; message= label;
} } else {
else {
String scope= workingSet.getLabel(); String scope= workingSet.getLabel();
message= MessageFormat.format("{0} - {1}", new Object[] {label, scope}); //$NON-NLS-1$ message= MessageFormat.format("{0} - {1}", new Object[] {label, scope}); //$NON-NLS-1$
} }
@ -940,8 +949,7 @@ public class THViewPart extends ViewPart implements ITHModelPresenter {
fHierarchyTreeViewer.refresh(); fHierarchyTreeViewer.refresh();
fMemberViewer.refresh(); fMemberViewer.refresh();
setSelections(); setSelections();
} } finally {
finally {
fIgnoreSelectionChanges--; fIgnoreSelectionChanges--;
} }
} }
@ -954,8 +962,7 @@ public class THViewPart extends ViewPart implements ITHModelPresenter {
updateViewers(); updateViewers();
updateDescription(); updateDescription();
updateActionEnablement(); updateActionEnablement();
} } finally {
finally {
fIgnoreSelectionChanges--; fIgnoreSelectionChanges--;
} }
} }
@ -973,8 +980,7 @@ public class THViewPart extends ViewPart implements ITHModelPresenter {
if (elem != null) { if (elem != null) {
fMemberViewer.setSelection(new StructuredSelection(elem)); fMemberViewer.setSelection(new StructuredSelection(elem));
} }
} } finally {
finally {
fIgnoreSelectionChanges--; fIgnoreSelectionChanges--;
} }
} }
@ -1106,8 +1112,7 @@ public class THViewPart extends ViewPart implements ITHModelPresenter {
private int getBestOrientation() { private int getBestOrientation() {
Point size= fSplitter.getSize(); Point size= fSplitter.getSize();
if (size.x != 0 && size.y != 0) { if (size.x != 0 && size.y != 0 && 3 * size.x < 2 * size.y) {
if (3*size.x < 2*size.y)
return ORIENTATION_VERTICAL; return ORIENTATION_VERTICAL;
} }
return ORIENTATION_HORIZONTAL; return ORIENTATION_HORIZONTAL;
@ -1124,4 +1129,11 @@ public class THViewPart extends ViewPart implements ITHModelPresenter {
public IWorkbenchSiteProgressService getProgressService() { public IWorkbenchSiteProgressService getProgressService() {
return (IWorkbenchSiteProgressService) getSite().getAdapter(IWorkbenchSiteProgressService.class); return (IWorkbenchSiteProgressService) getSite().getAdapter(IWorkbenchSiteProgressService.class);
} }
private static class CopyTypeHierarchyAction extends CopyTreeAction {
public CopyTypeHierarchyAction(ViewPart view, Clipboard clipboard, TreeViewer viewer) {
super(Messages.THViewPart_CopyTypeHierarchy, view, clipboard, viewer);
// PlatformUI.getWorkbench().getHelpSystem().setHelp(this, ICHelpContextIds.TYPE_HIERARCHY_COPY_ACTION);
}
}
} }

View file

@ -36,6 +36,7 @@ THViewPart_HideFields_tooltip=Hide Fields
THViewPart_HideStatic_tooltip=Hide Static Fields and Methods THViewPart_HideStatic_tooltip=Hide Static Fields and Methods
THViewPart_Open=Open THViewPart_Open=Open
THViewPart_Open_tooltip=Open THViewPart_Open_tooltip=Open
THViewPart_CopyTypeHierarchy=Copy E&xpanded Hierarchy
THViewPart_ShowFileNames=Show File Names THViewPart_ShowFileNames=Show File Names
THViewPart_Cancel_tooltip=Cancel THViewPart_Cancel_tooltip=Cancel
THViewPart_ShowFileNames_tooltip=Show File Names THViewPart_ShowFileNames_tooltip=Show File Names

View file

@ -36,7 +36,6 @@ import org.eclipse.cdt.internal.ui.cview.BuildGroup;
* Implements a toolbar button that builds the active configuration * Implements a toolbar button that builds the active configuration
* of selected projects. Also includes a menu that builds any of the * of selected projects. Also includes a menu that builds any of the
* other configurations. * other configurations.
*
*/ */
public class BuildActiveConfigMenuAction extends ChangeBuildConfigActionBase public class BuildActiveConfigMenuAction extends ChangeBuildConfigActionBase
implements IWorkbenchWindowPulldownDelegate2, ICProjectDescriptionListener { implements IWorkbenchWindowPulldownDelegate2, ICProjectDescriptionListener {
@ -128,16 +127,15 @@ public class BuildActiveConfigMenuAction extends ChangeBuildConfigActionBase
if (prj != null){ if (prj != null){
ICProjectDescription prjd = CoreModel.getDefault().getProjectDescription(prj, false); ICProjectDescription prjd = CoreModel.getDefault().getProjectDescription(prj, false);
if (prjd != null) { if (prjd != null) {
sb.append(ActionMessages.getFormattedString( sb.append(ActionMessages.bind(ActionMessages.BuildActiveConfigMenuAction_buildConfigTooltip,
"BuildActiveConfigMenuAction_buildConfigTooltip", //$NON-NLS-1$ prjd.getActiveConfiguration().getName(), prj.getName())).append(System.getProperty("line.separator")); //$NON-NLS-1$
new Object[] { prjd.getActiveConfiguration().getName(), prj.getName() })).append(System.getProperty("line.separator")); //$NON-NLS-1$
} }
} }
} }
toolTipText = sb.toString().trim(); toolTipText = sb.toString().trim();
} }
if (toolTipText.length() == 0) if (toolTipText.length() == 0)
toolTipText = ActionMessages.getString("BuildActiveConfigMenuAction_defaultTooltip"); //$NON-NLS-1$ toolTipText = ActionMessages.BuildActiveConfigMenuAction_defaultTooltip;
action.setToolTipText(toolTipText); action.setToolTipText(toolTipText);
} }
@ -146,5 +144,4 @@ public class BuildActiveConfigMenuAction extends ChangeBuildConfigActionBase
updateBuildConfigMenuToolTip(actionMenuCache); updateBuildConfigMenuToolTip(actionMenuCache);
} }
} }
} }

View file

@ -75,8 +75,8 @@ public class ChangeBuildConfigMenuAction extends ChangeBuildConfigActionBase imp
cm.manage(obs, true); cm.manage(obs, true);
} else { } else {
MessageDialog.openInformation(CUIPlugin.getActiveWorkbenchShell(), MessageDialog.openInformation(CUIPlugin.getActiveWorkbenchShell(),
ActionMessages.getString("ChangeBuildConfigMenuAction.title"), //$NON-NLS-1$ ActionMessages.ChangeBuildConfigMenuAction_title,
ActionMessages.getString("ChangeBuildConfigMenuAction.text")); //$NON-NLS-1$ ActionMessages.ChangeBuildConfigMenuAction_text);
} }
} }

View file

@ -114,8 +114,8 @@ implements IWorkbenchWindowPulldownDelegate2, IObjectActionDelegate {
CUIPlugin.getActiveWorkbenchShell(), CUIPlugin.getActiveWorkbenchShell(),
objects, objects,
createSelectionDialogContentProvider(), createSelectionDialogContentProvider(),
new LabelProvider() {}, ActionMessages.getString("DeleteResConfigsAction.0")); //$NON-NLS-1$ new LabelProvider() {}, ActionMessages.DeleteResConfigsAction_0);
dialog.setTitle(ActionMessages.getString("DeleteResConfigsAction.1")); //$NON-NLS-1$ dialog.setTitle(ActionMessages.DeleteResConfigsAction_1);
if (dialog.open() == Window.OK) { if (dialog.open() == Window.OK) {
Object[] selected = dialog.getResult(); Object[] selected = dialog.getResult();
if (selected != null && selected.length > 0) { if (selected != null && selected.length > 0) {

View file

@ -75,11 +75,12 @@ implements IWorkbenchWindowPulldownDelegate2, IObjectActionDelegate {
} }
IResource res = null; IResource res = null;
// only folders and files may be affected by this action // only folders and files may be affected by this action
if (obs[i] instanceof ICContainer || obs[i] instanceof ITranslationUnit) if (obs[i] instanceof ICContainer || obs[i] instanceof ITranslationUnit) {
res = ((ICElement) obs[i]).getResource(); res = ((ICElement) obs[i]).getResource();
} else if (obs[i] instanceof IResource) {
// project's configuration cannot be deleted // project's configuration cannot be deleted
else if (obs[i] instanceof IResource)
res = (IResource) obs[i]; res = (IResource) obs[i];
}
if (res != null) { if (res != null) {
ICConfigurationDescription[] cfgds = getCfgsRead(res); ICConfigurationDescription[] cfgds = getCfgsRead(res);
if (cfgds == null || cfgds.length == 0) continue; if (cfgds == null || cfgds.length == 0) continue;
@ -97,8 +98,10 @@ implements IWorkbenchWindowPulldownDelegate2, IObjectActionDelegate {
cfgNames.add(cfgds[j].getName()); cfgNames.add(cfgds[j].getName());
} }
} else { } else {
if (cfgNames.size() != cfgds.length) cfgsOK = false; if (cfgNames.size() != cfgds.length) {
else for (int j=0; j<cfgds.length; j++) { cfgsOK = false;
} else {
for (int j=0; j<cfgds.length; j++) {
if (! canExclude(res, cfgds[j]) || if (! canExclude(res, cfgds[j]) ||
! cfgNames.contains(cfgds[j].getName())) { ! cfgNames.contains(cfgds[j].getName())) {
cfgsOK = false; cfgsOK = false;
@ -111,6 +114,7 @@ implements IWorkbenchWindowPulldownDelegate2, IObjectActionDelegate {
} }
} }
} }
}
action.setEnabled(cfgsOK && objects != null ); action.setEnabled(cfgsOK && objects != null );
} }
@ -152,8 +156,8 @@ implements IWorkbenchWindowPulldownDelegate2, IObjectActionDelegate {
cfgNames, cfgNames,
createSelectionDialogContentProvider(), createSelectionDialogContentProvider(),
new LabelProvider() {}, new LabelProvider() {},
ActionMessages.getString("ExcludeFromBuildAction.0")); //$NON-NLS-1$ ActionMessages.ExcludeFromBuildAction_0);
dialog.setTitle(ActionMessages.getString("ExcludeFromBuildAction.1")); //$NON-NLS-1$ dialog.setTitle(ActionMessages.ExcludeFromBuildAction_1);
boolean[] status = new boolean[cfgNames.size()]; boolean[] status = new boolean[cfgNames.size()];
Iterator<IResource> it = objects.iterator(); Iterator<IResource> it = objects.iterator();
@ -218,5 +222,4 @@ implements IWorkbenchWindowPulldownDelegate2, IObjectActionDelegate {
public Menu getMenu(Menu parent) { return null; } public Menu getMenu(Menu parent) { return null; }
public Menu getMenu(Control parent) { return null; } public Menu getMenu(Control parent) { return null; }
public void setActivePart(IAction action, IWorkbenchPart targetPart) {} public void setActivePart(IAction action, IWorkbenchPart targetPart) {}
} }

View file

@ -382,7 +382,7 @@ public class GenerateActionGroup extends ActionGroup implements ISelectionChange
@Override @Override
public void fillContextMenu(IMenuManager menu) { public void fillContextMenu(IMenuManager menu) {
super.fillContextMenu(menu); super.fillContextMenu(menu);
MenuManager subMenu= new MenuManager(ActionMessages.getString("SourceMenu_label"), MENU_ID); //$NON-NLS-1$ MenuManager subMenu= new MenuManager(ActionMessages.SourceMenu_label, MENU_ID);
subMenu.setActionDefinitionId(QUICK_MENU_ID); subMenu.setActionDefinitionId(QUICK_MENU_ID);
int added= 0; int added= 0;
if (isEditorOwner()) { if (isEditorOwner()) {

View file

@ -125,34 +125,34 @@ public class MemberFilterActionGroup extends ActionGroup {
fFilter.addFilter(FILTER_INACTIVE); fFilter.addFilter(FILTER_INACTIVE);
// fields // fields
String title= ActionMessages.getString("MemberFilterActionGroup.hide_fields.label"); //$NON-NLS-1$ String title= ActionMessages.MemberFilterActionGroup_hide_fields_label;
String helpContext= ICHelpContextIds.FILTER_FIELDS_ACTION; String helpContext= ICHelpContextIds.FILTER_FIELDS_ACTION;
MemberFilterAction hideFields= new MemberFilterAction(this, title, FILTER_FIELDS, helpContext, doHideFields); MemberFilterAction hideFields= new MemberFilterAction(this, title, FILTER_FIELDS, helpContext, doHideFields);
hideFields.setDescription(ActionMessages.getString("MemberFilterActionGroup.hide_fields.description")); //$NON-NLS-1$ hideFields.setDescription(ActionMessages.MemberFilterActionGroup_hide_fields_description);
hideFields.setToolTipText(ActionMessages.getString("MemberFilterActionGroup.hide_fields.tooltip")); //$NON-NLS-1$ hideFields.setToolTipText(ActionMessages.MemberFilterActionGroup_hide_fields_tooltip);
CPluginImages.setImageDescriptors(hideFields, CPluginImages.T_LCL, CPluginImages.IMG_ACTION_HIDE_FIELDS); CPluginImages.setImageDescriptors(hideFields, CPluginImages.T_LCL, CPluginImages.IMG_ACTION_HIDE_FIELDS);
// static // static
title= ActionMessages.getString("MemberFilterActionGroup.hide_static.label"); //$NON-NLS-1$ title= ActionMessages.MemberFilterActionGroup_hide_static_label;
helpContext= ICHelpContextIds.FILTER_STATIC_ACTION; helpContext= ICHelpContextIds.FILTER_STATIC_ACTION;
MemberFilterAction hideStatic= new MemberFilterAction(this, title, FILTER_STATIC, helpContext, doHideStatic); MemberFilterAction hideStatic= new MemberFilterAction(this, title, FILTER_STATIC, helpContext, doHideStatic);
hideStatic.setDescription(ActionMessages.getString("MemberFilterActionGroup.hide_static.description")); //$NON-NLS-1$ hideStatic.setDescription(ActionMessages.MemberFilterActionGroup_hide_static_description);
hideStatic.setToolTipText(ActionMessages.getString("MemberFilterActionGroup.hide_static.tooltip")); //$NON-NLS-1$ hideStatic.setToolTipText(ActionMessages.MemberFilterActionGroup_hide_static_tooltip);
CPluginImages.setImageDescriptors(hideStatic, CPluginImages.T_LCL, CPluginImages.IMG_ACTION_HIDE_STATIC); CPluginImages.setImageDescriptors(hideStatic, CPluginImages.T_LCL, CPluginImages.IMG_ACTION_HIDE_STATIC);
// non-public // non-public
title= ActionMessages.getString("MemberFilterActionGroup.hide_nonpublic.label"); //$NON-NLS-1$ title= ActionMessages.MemberFilterActionGroup_hide_nonpublic_label;
helpContext= ICHelpContextIds.FILTER_PUBLIC_ACTION; helpContext= ICHelpContextIds.FILTER_PUBLIC_ACTION;
MemberFilterAction hideNonPublic= new MemberFilterAction(this, title, FILTER_NONPUBLIC, helpContext, doHidePublic); MemberFilterAction hideNonPublic= new MemberFilterAction(this, title, FILTER_NONPUBLIC, helpContext, doHidePublic);
hideNonPublic.setDescription(ActionMessages.getString("MemberFilterActionGroup.hide_nonpublic.description")); //$NON-NLS-1$ hideNonPublic.setDescription(ActionMessages.MemberFilterActionGroup_hide_nonpublic_description);
hideNonPublic.setToolTipText(ActionMessages.getString("MemberFilterActionGroup.hide_nonpublic.tooltip")); //$NON-NLS-1$ hideNonPublic.setToolTipText(ActionMessages.MemberFilterActionGroup_hide_nonpublic_tooltip);
CPluginImages.setImageDescriptors(hideNonPublic, CPluginImages.T_LCL, CPluginImages.IMG_ACTION_SHOW_PUBLIC); CPluginImages.setImageDescriptors(hideNonPublic, CPluginImages.T_LCL, CPluginImages.IMG_ACTION_SHOW_PUBLIC);
// inactive // inactive
title= ActionMessages.getString("MemberFilterActionGroup.hide_inactive.label"); //$NON-NLS-1$ title= ActionMessages.MemberFilterActionGroup_hide_inactive_label;
MemberFilterAction hideInactive= new MemberFilterAction(this, title, FILTER_INACTIVE, null, doHideInactive); MemberFilterAction hideInactive= new MemberFilterAction(this, title, FILTER_INACTIVE, null, doHideInactive);
hideInactive.setDescription(ActionMessages.getString("MemberFilterActionGroup.hide_inactive.description")); //$NON-NLS-1$ hideInactive.setDescription(ActionMessages.MemberFilterActionGroup_hide_inactive_description);
hideInactive.setToolTipText(ActionMessages.getString("MemberFilterActionGroup.hide_inactive.tooltip")); //$NON-NLS-1$ hideInactive.setToolTipText(ActionMessages.MemberFilterActionGroup_hide_inactive_tooltip);
CPluginImages.setImageDescriptors(hideInactive, CPluginImages.T_LCL, CPluginImages.IMG_ACTION_HIDE_INACTIVE); CPluginImages.setImageDescriptors(hideInactive, CPluginImages.T_LCL, CPluginImages.IMG_ACTION_HIDE_INACTIVE);
// order corresponds to order in toolbar // order corresponds to order in toolbar
@ -192,11 +192,11 @@ public class MemberFilterActionGroup extends ActionGroup {
if (filterEnabled) { if (filterEnabled) {
fFilter.addFilter(filterProperty); fFilter.addFilter(filterProperty);
} }
title= ActionMessages.getString("MemberFilterActionGroup.hide_fields.label"); //$NON-NLS-1$ title= ActionMessages.MemberFilterActionGroup_hide_fields_label;
helpContext= ICHelpContextIds.FILTER_FIELDS_ACTION; helpContext= ICHelpContextIds.FILTER_FIELDS_ACTION;
MemberFilterAction hideFields= new MemberFilterAction(this, title, filterProperty, helpContext, filterEnabled); MemberFilterAction hideFields= new MemberFilterAction(this, title, filterProperty, helpContext, filterEnabled);
hideFields.setDescription(ActionMessages.getString("MemberFilterActionGroup.hide_fields.description")); //$NON-NLS-1$ hideFields.setDescription(ActionMessages.MemberFilterActionGroup_hide_fields_description);
hideFields.setToolTipText(ActionMessages.getString("MemberFilterActionGroup.hide_fields.tooltip")); //$NON-NLS-1$ hideFields.setToolTipText(ActionMessages.MemberFilterActionGroup_hide_fields_tooltip);
CPluginImages.setImageDescriptors(hideFields, CPluginImages.T_LCL, "fields_co.gif"); //$NON-NLS-1$ CPluginImages.setImageDescriptors(hideFields, CPluginImages.T_LCL, "fields_co.gif"); //$NON-NLS-1$
actions.add(hideFields); actions.add(hideFields);
} }
@ -208,11 +208,11 @@ public class MemberFilterActionGroup extends ActionGroup {
if (filterEnabled) { if (filterEnabled) {
fFilter.addFilter(filterProperty); fFilter.addFilter(filterProperty);
} }
title= ActionMessages.getString("MemberFilterActionGroup.hide_static.label"); //$NON-NLS-1$ title= ActionMessages.MemberFilterActionGroup_hide_static_label;
helpContext= ICHelpContextIds.FILTER_STATIC_ACTION; helpContext= ICHelpContextIds.FILTER_STATIC_ACTION;
MemberFilterAction hideStatic= new MemberFilterAction(this, title, FILTER_STATIC, helpContext, filterEnabled); MemberFilterAction hideStatic= new MemberFilterAction(this, title, FILTER_STATIC, helpContext, filterEnabled);
hideStatic.setDescription(ActionMessages.getString("MemberFilterActionGroup.hide_static.description")); //$NON-NLS-1$ hideStatic.setDescription(ActionMessages.MemberFilterActionGroup_hide_static_description);
hideStatic.setToolTipText(ActionMessages.getString("MemberFilterActionGroup.hide_static.tooltip")); //$NON-NLS-1$ hideStatic.setToolTipText(ActionMessages.MemberFilterActionGroup_hide_static_tooltip);
CPluginImages.setImageDescriptors(hideStatic, CPluginImages.T_LCL, "static_co.gif"); //$NON-NLS-1$ CPluginImages.setImageDescriptors(hideStatic, CPluginImages.T_LCL, "static_co.gif"); //$NON-NLS-1$
actions.add(hideStatic); actions.add(hideStatic);
} }
@ -224,11 +224,11 @@ public class MemberFilterActionGroup extends ActionGroup {
if (filterEnabled) { if (filterEnabled) {
fFilter.addFilter(filterProperty); fFilter.addFilter(filterProperty);
} }
title= ActionMessages.getString("MemberFilterActionGroup.hide_nonpublic.label"); //$NON-NLS-1$ title= ActionMessages.MemberFilterActionGroup_hide_nonpublic_label;
helpContext= ICHelpContextIds.FILTER_PUBLIC_ACTION; helpContext= ICHelpContextIds.FILTER_PUBLIC_ACTION;
MemberFilterAction hideNonPublic= new MemberFilterAction(this, title, filterProperty, helpContext, filterEnabled); MemberFilterAction hideNonPublic= new MemberFilterAction(this, title, filterProperty, helpContext, filterEnabled);
hideNonPublic.setDescription(ActionMessages.getString("MemberFilterActionGroup.hide_nonpublic.description")); //$NON-NLS-1$ hideNonPublic.setDescription(ActionMessages.MemberFilterActionGroup_hide_nonpublic_description);
hideNonPublic.setToolTipText(ActionMessages.getString("MemberFilterActionGroup.hide_nonpublic.tooltip")); //$NON-NLS-1$ hideNonPublic.setToolTipText(ActionMessages.MemberFilterActionGroup_hide_nonpublic_tooltip);
CPluginImages.setImageDescriptors(hideNonPublic, CPluginImages.T_LCL, "public_co.gif"); //$NON-NLS-1$ CPluginImages.setImageDescriptors(hideNonPublic, CPluginImages.T_LCL, "public_co.gif"); //$NON-NLS-1$
actions.add(hideNonPublic); actions.add(hideNonPublic);
} }
@ -240,10 +240,10 @@ public class MemberFilterActionGroup extends ActionGroup {
if (filterEnabled) { if (filterEnabled) {
fFilter.addFilter(filterProperty); fFilter.addFilter(filterProperty);
} }
title= ActionMessages.getString("MemberFilterActionGroup.hide_inactive.label"); //$NON-NLS-1$ title= ActionMessages.MemberFilterActionGroup_hide_inactive_label;
MemberFilterAction hideInactive= new MemberFilterAction(this, title, filterProperty, null, filterEnabled); MemberFilterAction hideInactive= new MemberFilterAction(this, title, filterProperty, null, filterEnabled);
hideInactive.setDescription(ActionMessages.getString("MemberFilterActionGroup.hide_inactive.description")); //$NON-NLS-1$ hideInactive.setDescription(ActionMessages.MemberFilterActionGroup_hide_inactive_description);
hideInactive.setToolTipText(ActionMessages.getString("MemberFilterActionGroup.hide_inactive.tooltip")); //$NON-NLS-1$ hideInactive.setToolTipText(ActionMessages.MemberFilterActionGroup_hide_inactive_tooltip);
CPluginImages.setImageDescriptors(hideInactive, CPluginImages.T_LCL, "filterInactive.gif"); //$NON-NLS-1$ CPluginImages.setImageDescriptors(hideInactive, CPluginImages.T_LCL, "filterInactive.gif"); //$NON-NLS-1$
actions.add(hideInactive); actions.add(hideInactive);
} }

View file

@ -56,7 +56,6 @@ import org.eclipse.cdt.internal.ui.util.ExceptionHandler;
* @since 2.0 * @since 2.0
*/ */
public class OpenAction extends SelectionDispatchAction { public class OpenAction extends SelectionDispatchAction {
private CEditor fEditor; private CEditor fEditor;
/** /**
@ -68,9 +67,9 @@ public class OpenAction extends SelectionDispatchAction {
*/ */
public OpenAction(IWorkbenchSite site) { public OpenAction(IWorkbenchSite site) {
super(site); super(site);
setText(ActionMessages.getString("OpenAction.label")); //$NON-NLS-1$ setText(ActionMessages.OpenAction_label);
setToolTipText(ActionMessages.getString("OpenAction.tooltip")); //$NON-NLS-1$ setToolTipText(ActionMessages.OpenAction_tooltip);
setDescription(ActionMessages.getString("OpenAction.description")); //$NON-NLS-1$ setDescription(ActionMessages.OpenAction_description);
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, ICHelpContextIds.OPEN_ACTION); PlatformUI.getWorkbench().getHelpSystem().setHelp(this, ICHelpContextIds.OPEN_ACTION);
} }
@ -82,7 +81,7 @@ public class OpenAction extends SelectionDispatchAction {
public OpenAction(CEditor editor) { public OpenAction(CEditor editor) {
this(editor.getEditorSite()); this(editor.getEditorSite());
fEditor= editor; fEditor= editor;
setText(ActionMessages.getString("OpenAction.declaration.label")); //$NON-NLS-1$ setText(ActionMessages.OpenAction_declaration_label);
setEnabled(SelectionConverter.canOperateOn(fEditor)); setEnabled(SelectionConverter.canOperateOn(fEditor));
} }
@ -126,11 +125,11 @@ public class OpenAction extends SelectionDispatchAction {
return; return;
try { try {
ICElement element= SelectionConverter.codeResolve(fEditor, getShell(), getDialogTitle(), ICElement element= SelectionConverter.codeResolve(fEditor, getShell(), getDialogTitle(),
ActionMessages.getString("OpenAction.select_element")); //$NON-NLS-1$ ActionMessages.OpenAction_select_element);
if (element == null) { if (element == null) {
IEditorStatusLine statusLine= (IEditorStatusLine) fEditor.getAdapter(IEditorStatusLine.class); IEditorStatusLine statusLine= (IEditorStatusLine) fEditor.getAdapter(IEditorStatusLine.class);
if (statusLine != null) if (statusLine != null)
statusLine.setMessage(true, ActionMessages.getString("OpenAction.error.messageBadSelection"), null); //$NON-NLS-1$ statusLine.setMessage(true, ActionMessages.OpenAction_error_messageBadSelection, null);
getShell().getDisplay().beep(); getShell().getDisplay().beep();
return; return;
} }
@ -167,15 +166,10 @@ public class OpenAction extends SelectionDispatchAction {
OpenActionUtil.open(element, activateOnOpen); OpenActionUtil.open(element, activateOnOpen);
} catch (CModelException e) { } catch (CModelException e) {
CUIPlugin.log(new Status(IStatus.ERROR, CUIPlugin.getPluginId(), CUIPlugin.log(new Status(IStatus.ERROR, CUIPlugin.getPluginId(),
ICStatusConstants.INTERNAL_ERROR, ActionMessages.getString("OpenAction.error.message"), e)); //$NON-NLS-1$ ICStatusConstants.INTERNAL_ERROR, ActionMessages.OpenAction_error_message, e));
ErrorDialog.openError(getShell(), getDialogTitle(),
ErrorDialog.openError(getShell(), ActionMessages.OpenAction_error_messageProblems, e.getStatus());
getDialogTitle(),
ActionMessages.getString("OpenAction.error.messageProblems"), //$NON-NLS-1$
e.getStatus());
} catch (PartInitException x) { } catch (PartInitException x) {
String name= null; String name= null;
if (element instanceof ICElement) { if (element instanceof ICElement) {
@ -188,9 +182,8 @@ public class OpenAction extends SelectionDispatchAction {
if (name != null) { if (name != null) {
MessageDialog.openError(getShell(), MessageDialog.openError(getShell(),
ActionMessages.getString("OpenAction.error.messageProblems"), //$NON-NLS-1$ ActionMessages.OpenAction_error_messageProblems,
ActionMessages.getFormattedString("OpenAction.error.messageArgs", //$NON-NLS-1$ ActionMessages.bind(ActionMessages.OpenAction_error_messageArgs, name, x.getMessage()));
new String[] { name, x.getMessage() } ));
} }
} }
} }
@ -204,10 +197,10 @@ public class OpenAction extends SelectionDispatchAction {
} }
private String getDialogTitle() { private String getDialogTitle() {
return ActionMessages.getString("OpenAction.error.title"); //$NON-NLS-1$ return ActionMessages.OpenAction_error_title;
} }
private void showError(CoreException e) { private void showError(CoreException e) {
ExceptionHandler.handle(e, getShell(), getDialogTitle(), ActionMessages.getString("OpenAction.error.message")); //$NON-NLS-1$ ExceptionHandler.handle(e, getShell(), getDialogTitle(), ActionMessages.OpenAction_error_message);
} }
} }