Merge remote-tracking branch 'cdt/master' into sd90
|
@ -13,6 +13,7 @@
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
* Thomas Corbat (IFS)
|
* Thomas Corbat (IFS)
|
||||||
* Nathan Ridge
|
* Nathan Ridge
|
||||||
|
* Marc-Andre Laperle
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.parser.tests.ast2;
|
package org.eclipse.cdt.core.parser.tests.ast2;
|
||||||
|
|
||||||
|
@ -7482,6 +7483,14 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
ba.assertProblem("enum_name", 9);
|
ba.assertProblem("enum_name", 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// struct MyStruct {
|
||||||
|
// enum MyEnum {};
|
||||||
|
// MyStruct(MyEnum value) {}
|
||||||
|
// };
|
||||||
|
public void testEnumRedefinitionInStruct_385144() throws Exception {
|
||||||
|
parseAndCheckBindings(getAboveComment(), ParserLanguage.CPP);
|
||||||
|
}
|
||||||
|
|
||||||
// class CL {
|
// class CL {
|
||||||
// typedef int x;
|
// typedef int x;
|
||||||
// friend void test() {
|
// friend void test() {
|
||||||
|
|
|
@ -104,14 +104,17 @@ public class ChangeConfigurationTests extends PDOMTestBase {
|
||||||
Pattern testFunc2 = Pattern.compile("testFunc2");
|
Pattern testFunc2 = Pattern.compile("testFunc2");
|
||||||
int i = 0, noTrials = 50;
|
int i = 0, noTrials = 50;
|
||||||
do {
|
do {
|
||||||
|
boolean isFirstConfig = i % 2 == 0;
|
||||||
IIndex index = CCorePlugin.getIndexManager().getIndex(cProject);
|
IIndex index = CCorePlugin.getIndexManager().getIndex(cProject);
|
||||||
index.acquireReadLock();
|
index.acquireReadLock();
|
||||||
boolean isFirstConfig = i % 2 == 0;
|
try {
|
||||||
IBinding[] bindings = index.findBindings(isFirstConfig ? testFunc1 : testFunc2, true, IndexFilter.ALL, new NullProgressMonitor());
|
IBinding[] bindings = index.findBindings(isFirstConfig ? testFunc1 : testFunc2, true, IndexFilter.ALL, new NullProgressMonitor());
|
||||||
IBinding[] noBindings = index.findBindings(isFirstConfig ? testFunc2 : testFunc1, true, IndexFilter.ALL, new NullProgressMonitor());
|
IBinding[] noBindings = index.findBindings(isFirstConfig ? testFunc2 : testFunc1, true, IndexFilter.ALL, new NullProgressMonitor());
|
||||||
assertEquals(1, bindings.length);
|
assertEquals(1, bindings.length);
|
||||||
assertEquals(0, noBindings.length);
|
assertEquals(0, noBindings.length);
|
||||||
index.releaseReadLock();
|
} finally {
|
||||||
|
index.releaseReadLock();
|
||||||
|
}
|
||||||
|
|
||||||
String nextConfig = isFirstConfig ? secondConfigName : firstConfigName;
|
String nextConfig = isFirstConfig ? secondConfigName : firstConfigName;
|
||||||
changeProjectConfiguration(project, nextConfig);
|
changeProjectConfiguration(project, nextConfig);
|
||||||
|
|
|
@ -82,13 +82,17 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.ISafeRunnable;
|
import org.eclipse.core.runtime.ISafeRunnable;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.SafeRunner;
|
import org.eclipse.core.runtime.SafeRunner;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.core.runtime.content.IContentType;
|
import org.eclipse.core.runtime.content.IContentType;
|
||||||
import org.eclipse.core.runtime.content.IContentTypeManager;
|
import org.eclipse.core.runtime.content.IContentTypeManager;
|
||||||
import org.eclipse.core.runtime.content.IContentTypeManager.ContentTypeChangeEvent;
|
import org.eclipse.core.runtime.content.IContentTypeManager.ContentTypeChangeEvent;
|
||||||
import org.eclipse.core.runtime.content.IContentTypeManager.IContentTypeChangeListener;
|
import org.eclipse.core.runtime.content.IContentTypeManager.IContentTypeChangeListener;
|
||||||
|
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
||||||
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
|
|
||||||
public class CModelManager implements IResourceChangeListener, IContentTypeChangeListener,
|
public class CModelManager implements IResourceChangeListener, IContentTypeChangeListener,
|
||||||
ICProjectDescriptionListener, ILanguageSettingsChangeListener {
|
ICProjectDescriptionListener, ILanguageSettingsChangeListener {
|
||||||
|
@ -979,28 +983,45 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(ILanguageSettingsChangeEvent event) {
|
public void handleEvent(ILanguageSettingsChangeEvent event) {
|
||||||
try {
|
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(event.getProjectName());
|
||||||
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(event.getProjectName());
|
ICProject cproject = CModelManager.getDefault().getCModel().getCProject(project);
|
||||||
|
final CElementDelta delta = new CElementDelta(cproject);
|
||||||
|
// Just add all possible flags, listeners tend to recalculate themselves anyway
|
||||||
|
int flag = ICElementDelta.F_CHANGED_PATHENTRY_PROJECT
|
||||||
|
| ICElementDelta.F_CHANGED_PATHENTRY_INCLUDE
|
||||||
|
| ICElementDelta.F_CHANGED_PATHENTRY_MACRO
|
||||||
|
| ICElementDelta.F_ADDED_PATHENTRY_LIBRARY
|
||||||
|
| ICElementDelta.F_REMOVED_PATHENTRY_LIBRARY
|
||||||
|
| ICElementDelta.F_PATHENTRY_REORDER;
|
||||||
|
delta.changed(cproject, flag);
|
||||||
|
|
||||||
// Recalculate cached settings unless already inside CProjectDescriptionManager.setProjectDescription()
|
if (CProjectDescriptionManager.getInstance().isCurrentThreadSetProjectDescription()) {
|
||||||
if (!CProjectDescriptionManager.getInstance().isCurrentThreadSetProjectDescription()) {
|
// If inside CProjectDescriptionManager.setProjectDescription() just send notifications
|
||||||
CoreModel.getDefault().updateProjectDescriptions(new IProject[] {project}, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Notify listeners
|
|
||||||
ICProject cproject = CModelManager.getDefault().getCModel().getCProject(project);
|
|
||||||
CElementDelta delta = new CElementDelta(cproject);
|
|
||||||
// just add all possible flags, listeners tend to recalculate themselves anyway
|
|
||||||
int flag = ICElementDelta.F_CHANGED_PATHENTRY_PROJECT
|
|
||||||
| ICElementDelta.F_CHANGED_PATHENTRY_INCLUDE
|
|
||||||
| ICElementDelta.F_CHANGED_PATHENTRY_MACRO
|
|
||||||
| ICElementDelta.F_ADDED_PATHENTRY_LIBRARY
|
|
||||||
| ICElementDelta.F_REMOVED_PATHENTRY_LIBRARY
|
|
||||||
| ICElementDelta.F_PATHENTRY_REORDER;
|
|
||||||
delta.changed(cproject, flag);
|
|
||||||
fire(delta, ElementChangedEvent.POST_CHANGE);
|
fire(delta, ElementChangedEvent.POST_CHANGE);
|
||||||
} catch (CoreException e) {
|
} else {
|
||||||
CCorePlugin.log(e);
|
// If not inside CProjectDescriptionManager.setProjectDescription() recalculate cached settings
|
||||||
|
try {
|
||||||
|
CoreModel.getDefault().updateProjectDescriptions(new IProject[] {project}, null);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
// Fire notifications in a job with workspace rule to ensure running after the updateProjectDescriptions(...)
|
||||||
|
// which is run in separate thread with workspace rule
|
||||||
|
ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
|
Job job = new Job(CoreModelMessages.getFormattedString("CModelManager.LanguageSettingsChangeEventNotifications")) { //$NON-NLS-1$
|
||||||
|
@Override
|
||||||
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
|
try {
|
||||||
|
fire(delta, ElementChangedEvent.POST_CHANGE);
|
||||||
|
} catch (Exception e){
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
return Status.OK_STATUS;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
job.setRule(rule);
|
||||||
|
job.setSystem(true);
|
||||||
|
job.schedule();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,3 +73,6 @@ CElementLabels.anonymous=(anonymous)
|
||||||
CElementLabels.concat_string=\ -\
|
CElementLabels.concat_string=\ -\
|
||||||
CElementLabels.comma_string=,\
|
CElementLabels.comma_string=,\
|
||||||
CElementLabels.declseparator_string=\ :\
|
CElementLabels.declseparator_string=\ :\
|
||||||
|
|
||||||
|
CModelManager.LanguageSettingsChangeEventNotifications=Language settings change notifications
|
||||||
|
|
||||||
|
|
|
@ -55,16 +55,12 @@ public class CPPASTTemplateId extends CPPASTNameBase implements ICPPASTTemplateI
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CPPASTTemplateId copy(CopyStyle style) {
|
public CPPASTTemplateId copy(CopyStyle style) {
|
||||||
CPPASTTemplateId copy = new CPPASTTemplateId(templateName == null ?
|
CPPASTTemplateId copy =
|
||||||
null : templateName.copy(style));
|
new CPPASTTemplateId(templateName == null ? null : templateName.copy(style));
|
||||||
for (IASTNode arg : getTemplateArguments()) {
|
for (IASTNode arg : getTemplateArguments()) {
|
||||||
copy.internalAddTemplateArgument(arg == null ? null : arg.copy(style));
|
copy.internalAddTemplateArgument(arg == null ? null : arg.copy(style));
|
||||||
}
|
}
|
||||||
copy.setOffsetAndLength(this);
|
return copy(copy, style);
|
||||||
if (style == CopyStyle.withLocations) {
|
|
||||||
copy.setCopyLocation(this);
|
|
||||||
}
|
|
||||||
return copy;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2012 IBM Corporation and others.
|
* Copyright (c) 2004, 2013 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -12,6 +12,7 @@
|
||||||
* Sergey Prigogin (Google)
|
* Sergey Prigogin (Google)
|
||||||
* Thomas Corbat (IFS)
|
* Thomas Corbat (IFS)
|
||||||
* Nathan Ridge
|
* Nathan Ridge
|
||||||
|
* Marc-Andre Laperle
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
|
||||||
|
|
||||||
|
@ -405,6 +406,9 @@ public class CPPVisitor extends ASTQueries {
|
||||||
IBinding binding = scope.getBinding(name, false);
|
IBinding binding = scope.getBinding(name, false);
|
||||||
if (binding instanceof CPPEnumeration) {
|
if (binding instanceof CPPEnumeration) {
|
||||||
CPPEnumeration e= (CPPEnumeration) binding;
|
CPPEnumeration e= (CPPEnumeration) binding;
|
||||||
|
if (name.equals(e.getDefinition())) {
|
||||||
|
return e;
|
||||||
|
}
|
||||||
if (e.isScoped() == specifier.isScoped()) {
|
if (e.isScoped() == specifier.isScoped()) {
|
||||||
IType ft2= e.getFixedType();
|
IType ft2= e.getFixedType();
|
||||||
if (fixedType == ft2 || (fixedType != null && fixedType.isSameType(ft2))) {
|
if (fixedType == ft2 || (fixedType != null && fixedType.isSameType(ft2))) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class LanguageSettingsChangeListener implements ILanguageSettingsChangeLi
|
||||||
IProject project = wspRoot.getProject(event.getProjectName());
|
IProject project = wspRoot.getProject(event.getProjectName());
|
||||||
|
|
||||||
if (project != null) {
|
if (project != null) {
|
||||||
ICProjectDescription prjDescription = CCorePlugin.getDefault().getProjectDescription(project);
|
ICProjectDescription prjDescription = CCorePlugin.getDefault().getProjectDescription(project, false);
|
||||||
if (prjDescription != null) {
|
if (prjDescription != null) {
|
||||||
// cfgDescription being indexed
|
// cfgDescription being indexed
|
||||||
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
||||||
|
|
|
@ -898,7 +898,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
case CPP_TEMPLATE_ALIAS:
|
case CPP_TEMPLATE_ALIAS:
|
||||||
return new PDOMCPPAliasTemplate(this, record);
|
return new PDOMCPPAliasTemplate(this, record);
|
||||||
case CPP_ENUMERATION_SPECIALIZATION:
|
case CPP_ENUMERATION_SPECIALIZATION:
|
||||||
return new PDOMCPPEnumeratorSpecialization(this, record);
|
return new PDOMCPPEnumerationSpecialization(this, record);
|
||||||
case CPP_ENUMERATOR_SPECIALIZATION:
|
case CPP_ENUMERATOR_SPECIALIZATION:
|
||||||
return new PDOMCPPEnumeratorSpecialization(this, record);
|
return new PDOMCPPEnumeratorSpecialization(this, record);
|
||||||
}
|
}
|
||||||
|
|
BIN
doc/org.eclipse.cdt.doc.user/images/cdt_inline_rename.png
Executable file
After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 55 KiB |
BIN
doc/org.eclipse.cdt.doc.user/images/cdt_rename_dialog.png
Executable file
After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 14 KiB |
BIN
doc/org.eclipse.cdt.doc.user/images/cdt_t_toggle_selection.png
Normal file → Executable file
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 35 KiB |
BIN
doc/org.eclipse.cdt.doc.user/images/cdt_t_toggle_selection2.png
Executable file
After Width: | Height: | Size: 12 KiB |
BIN
doc/org.eclipse.cdt.doc.user/images/cdt_t_toggle_selection3.png
Executable file
After Width: | Height: | Size: 5.2 KiB |
79
doc/org.eclipse.cdt.doc.user/reference/cdt_u_m_refactor.htm
Normal file → Executable file
|
@ -9,22 +9,73 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div role="main"><h1>Refactor Menu actions</h1>
|
<div role="main">
|
||||||
|
<h1>Refactor Menu actions</h1>
|
||||||
|
|
||||||
<p><img src="../images/cdt_menu_refactor.png" alt="Selecting Refactor Menu" ></p>
|
<p>
|
||||||
|
<img src="../images/cdt_menu_refactor.png"
|
||||||
|
alt="Selecting Refactor Menu">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<table border="1" cellspacing="0">
|
||||||
|
<tr>
|
||||||
|
<th id="name">Name</th>
|
||||||
|
<th id="function">Function</th>
|
||||||
|
<th id="keyboard">Keyboard Shortcut</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td headers="name"><strong>Apply Script...</strong></td>
|
||||||
|
<td headers="function">Applies a previously saved list of refactorings.</td>
|
||||||
|
<td headers="keyboard"> </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td headers="name"><strong>Create Script...</strong></td>
|
||||||
|
<td headers="function">Exports a list of previously done refactorings for later use.</td>
|
||||||
|
<td headers="keyboard"> </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td headers="name"><strong>History...</strong></td>
|
||||||
|
<td headers="function">Displays a history of refactorings.</td>
|
||||||
|
<td headers="keyboard"> </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td headers="name"><strong>Rename...</strong></td>
|
||||||
|
<td headers="function">Renames selected object (variable,
|
||||||
|
method, etc...) and propagates changes to other files in project.</td>
|
||||||
|
<td headers="keyboard">Alt+Shift+R</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td headers="name"><strong>Extract Local Variable...</strong></td>
|
||||||
|
<td headers="function">Extracts selected subexpression into a new local variable.</td>
|
||||||
|
<td headers="keyboard">Alt+Shift+L</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td headers="name"><strong>Extract Constant...</strong></td>
|
||||||
|
<td headers="function">Replaces all instances of selected literal with a named constant.</td>
|
||||||
|
<td headers="keyboard">Alt+C</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td headers="name"><strong>Extract Function...</strong></td>
|
||||||
|
<td headers="function">Replaces selected statements with a call to a new function containing them.</td>
|
||||||
|
<td headers="keyboard">Alt+Shift+M</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td headers="name"><strong>Toggle Function Definition</strong></td>
|
||||||
|
<td headers="function">Moves selected function definition from a header file (in- or outside a class definition) to an implementation file, or back.</td>
|
||||||
|
<td headers="keyboard">Alt+Shift+T</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td headers="name"><strong>Hide Method...</strong></td>
|
||||||
|
<td headers="function">Makes selected method private.</td>
|
||||||
|
<td headers="keyboard"> </td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<p><table border="1" cellspacing="0">
|
</table>
|
||||||
|
<p></p>
|
||||||
|
|
||||||
<tr><th id="name">Name</th><th id="function">Function</th><th id="keyboard">Keyboard Shortcut</th></tr>
|
<p>
|
||||||
<tr>
|
<img src="../images/intl_07.gif" alt="Intel Copyright Statement">
|
||||||
<td headers="name"><strong>Rename...</strong></td>
|
</p>
|
||||||
<td headers="function">Renames selected object (variable, method, etc...) and propagates changes to other files in project.</td>
|
</div>
|
||||||
<td headers="keyboard">Alt+Shift+R</td>
|
</body>
|
||||||
</table><p></p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<img src="../images/intl_07.gif" ALT="Intel Copyright Statement" >
|
|
||||||
</p>
|
|
||||||
</div></body>
|
|
||||||
</html>
|
</html>
|
74
doc/org.eclipse.cdt.doc.user/tasks/cdt_t_rename.htm
Normal file → Executable file
|
@ -1,39 +1,55 @@
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Language" content="en-us">
|
<meta http-equiv="Content-Language" content="en-us">
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<title>Rename Refactoring</title>
|
<title>Rename Refactoring</title>
|
||||||
<link rel="stylesheet" type="text/css" href="../help.css">
|
<link rel="stylesheet" type="text/css" href="../help.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<div role="main">
|
||||||
<div role="main"><h1>Rename Refactoring</h1>
|
<h1>Rename Refactoring</h1>
|
||||||
|
<p>
|
||||||
<p>Use the C/C++ Projects, Outline, or the Editor view <strong>Refactor > Rename</strong> context menu to refactor class & type names, methods, function & member names.</p>
|
Use the <strong>Refactor > Rename</strong> command to rename
|
||||||
|
variables, functions, classes, methods, fields or typedefs.
|
||||||
<p>To refactor an object select the object, right click and select <strong>Refactor > Rename...</strong></p>
|
</p>
|
||||||
<p> <img src="../images/cdt_refactor.png" alt="Editor View showing Refactor option" ></p>
|
<p>
|
||||||
|
In an Editor window, select an item and run <strong>Refactor
|
||||||
The refactoring engine will rename all instances of the object in all referenced files. You can Undo refactoring by right clicking a second time and selecting <strong>Refactor > Undo</strong></p>
|
> Rename...</strong> from the context menu.
|
||||||
<p> <img src="../images/cdt_refactor_undo.png" alt="Editor View showing Refactor Undo option" ></p>
|
</p>
|
||||||
|
<p>
|
||||||
<p><img src="../images/ngconcepts.gif" ALT="Related concepts" width="143" height="21">
|
<img src="../images/cdt_inline_rename.png"
|
||||||
<br>
|
alt="Example of inline renaming.">
|
||||||
<a href="../concepts/cdt_c_open_declarations.htm">Open Declaration</a><br>
|
</p>
|
||||||
<a href="../concepts/cdt_c_projects.htm">CDT Projects</a><br>
|
<p>All uses of the name are highlighted, and updated in real time
|
||||||
<a href="../concepts/cdt_c_search.htm">C/C++ search</a></p>
|
as you type. If you want to view the preview, or change any options,
|
||||||
<p><img src="../images/ngtasks.gif" ALT="Related tasks" width="143" height="21">
|
simply click on the triangle, or press the keyboard shortcut again.
|
||||||
<br>
|
Otherwise, the options are the same as the last time a rename
|
||||||
<a href="cdt_t_search.htm">Searching for C/C++ elements</a></p>
|
refactoring was done.</p>
|
||||||
<p><img src="../images/ngref.gif" ALT="Related reference" width="143" height="21">
|
<p>When you hit Enter, all the item's declarations, definitions
|
||||||
<br>
|
and references will be changed to use the new name. The standard Undo
|
||||||
<a href="../reference/cdt_u_search.htm">C/C++ search page, Search dialog box</a></p>
|
command can be used to revert the changes, if necessary.</p>
|
||||||
|
<p>The options can be set using a dialog box, where you can
|
||||||
<img src="../images/ng00_07.gif" ALT="IBM Copyright Statement" >
|
specify the new name, and set various options affecting how hard to
|
||||||
|
look for uses of the name that should be updated. From there you can
|
||||||
</div></body>
|
also view the Preview of the changes that will be made by the
|
||||||
|
refactoring.</p>
|
||||||
|
<p>
|
||||||
|
<img src="../images/cdt_rename_dialog.png" alt="Rename dialog box">
|
||||||
|
</p>
|
||||||
|
<p>Items to be renamed can also be selected from the Project
|
||||||
|
Explorer window, although inline renaming is not available in this
|
||||||
|
case, so the dialog box comes up immediately.</p>
|
||||||
|
<p>
|
||||||
|
<img src="../images/cdt_refactor.png"
|
||||||
|
alt="Project Explorer context menu Refactor > Rename command">
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<img src="../images/ngref.gif" alt="Related reference" width="143"
|
||||||
|
height="21"> <br> <a
|
||||||
|
href="../reference/cdt_u_m_refactor.htm">Refactor Menu actions</a>
|
||||||
|
</p>
|
||||||
|
<img src="../images/ng00_07.gif" alt="IBM Copyright Statement">
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
59
doc/org.eclipse.cdt.doc.user/tasks/cdt_t_toggle.htm
Normal file → Executable file
|
@ -1,36 +1,43 @@
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Language" content="en-us">
|
<meta http-equiv="Content-Language" content="en-us">
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<title>Toggle Function Definition Refactoring</title>
|
<title>Toggle Function Definition Refactoring</title>
|
||||||
<link rel="stylesheet" type="text/css" href="../help.css">
|
<link rel="stylesheet" type="text/css" href="../help.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<div role="main">
|
||||||
<div role="main"><h1>Toggle Function Definition</h1>
|
<h1>Toggle Function Definition</h1>
|
||||||
|
<p>
|
||||||
<p>Toggle Function Definition moves a function definition inside an C/C++ source editor from one
|
Use the <strong>Refactor > Toggle Function Definition</strong>
|
||||||
position to another and preserves correctness.</p>
|
command to toggle the location where a function is defined.
|
||||||
|
</p>
|
||||||
<p>Toggling is available whenever the cursor is inside a function declaration
|
<p>
|
||||||
or definition. Any selection between the first and the last character of
|
In an Editor window, place the cursor inside a function declaration
|
||||||
the function definition (without comments) is considered valid for toggling.</p>
|
or definition, then run <strong>Refactor > Toggle
|
||||||
<p><img alt="Selection" src="../images/cdt_t_toggle_selection.png" title="Valid selection region"><br/>Valid selection region</p>
|
Function Definition</strong> from the context menu. Any cursor position
|
||||||
|
between the first and the last characters of the function definition
|
||||||
<h2>Toggle free functions</h2>
|
(but not including comments preceding the function) will cause that
|
||||||
<p>The refactoring moves free functions from an implementation file to a header file with the same name and back.
|
function to be selected for the refactoring.
|
||||||
If the header file does not exist the file is created.</p>
|
</p>
|
||||||
|
<p>
|
||||||
<h2>Toggle member functions</h2>
|
<img alt="" src="../images/cdt_t_toggle_selection.png">
|
||||||
<p>The function definition of a member function can by moved from the class declaration in the header file to an inline definition
|
</p>
|
||||||
in the header file to the implementation file and back to the class definition.</p>
|
<p>This refactoring switches a function definition from a header
|
||||||
<p><img alt="Toggle Member Function Definition" src="../images/cdt_t_toggle_member.png"></p>
|
file to a correspondingly-named implementation file. If the necessary
|
||||||
|
file does not exist, it will be created (after a confirmation
|
||||||
<img src="../images/ng00_07.gif" ALT="IBM Copyright Statement" >
|
dialog).</p>
|
||||||
|
<p>
|
||||||
</div></body>
|
<img alt="" src="../images/cdt_t_toggle_selection2.png">
|
||||||
|
</p>
|
||||||
|
<p>For methods, it can also switch the method from being defined
|
||||||
|
within its parent class declaration to being defined using an inline
|
||||||
|
definition in the same header file.</p>
|
||||||
|
<p>
|
||||||
|
<img alt="" src="../images/cdt_t_toggle_selection3.png">
|
||||||
|
</p>
|
||||||
|
<img src="../images/ng00_07.gif" ALT="IBM Copyright Statement">
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Marc Khouzam (Ericsson) - initial API and implementation
|
* Marc Khouzam (Ericsson) - initial API and implementation
|
||||||
|
* Marc Dumais (Ericsson) - Bug 400231
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view;
|
package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view;
|
||||||
|
@ -187,7 +188,10 @@ public class MulticoreVisualizerEventListener {
|
||||||
|
|
||||||
fVisualizer.getModel().markThreadExited(tid);
|
fVisualizer.getModel().markThreadExited(tid);
|
||||||
|
|
||||||
fVisualizer.getMulticoreVisualizerCanvas().requestUpdate();
|
MulticoreVisualizerCanvas canvas = fVisualizer.getMulticoreVisualizerCanvas();
|
||||||
|
if (canvas != null) {
|
||||||
|
canvas.requestUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,9 @@ Require-Bundle: org.eclipse.ui,
|
||||||
org.eclipse.jface.text;bundle-version="3.4.0",
|
org.eclipse.jface.text;bundle-version="3.4.0",
|
||||||
org.eclipse.ui.editors;bundle-version="3.4.0",
|
org.eclipse.ui.editors;bundle-version="3.4.0",
|
||||||
org.eclipse.core.filesystem;bundle-version="1.2.0",
|
org.eclipse.core.filesystem;bundle-version="1.2.0",
|
||||||
org.eclipse.cdt.launch;bundle-version="6.1.0"
|
org.eclipse.cdt.launch;bundle-version="6.1.0",
|
||||||
|
org.eclipse.debug.core,
|
||||||
|
org.eclipse.core.resources
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||||
Export-Package: org.eclipse.cdt.dsf.gdb.internal.ui;x-internal:=true,
|
Export-Package: org.eclipse.cdt.dsf.gdb.internal.ui;x-internal:=true,
|
||||||
|
|
|
@ -13,7 +13,8 @@ Require-Bundle: org.eclipse.core.runtime,
|
||||||
org.eclipse.cdt.debug.core,
|
org.eclipse.cdt.debug.core,
|
||||||
org.eclipse.core.variables,
|
org.eclipse.core.variables,
|
||||||
org.eclipse.cdt.launch;bundle-version="6.1.0",
|
org.eclipse.cdt.launch;bundle-version="6.1.0",
|
||||||
org.eclipse.cdt.gdb;bundle-version="7.0.0"
|
org.eclipse.cdt.gdb;bundle-version="7.0.0",
|
||||||
|
org.eclipse.core.resources
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||||
Export-Package: org.eclipse.cdt.dsf.gdb,
|
Export-Package: org.eclipse.cdt.dsf.gdb,
|
||||||
|
|
|
@ -218,18 +218,25 @@ public class CLIEventProcessor
|
||||||
{
|
{
|
||||||
// We know something change, we just do not know what.
|
// We know something change, we just do not know what.
|
||||||
// So the easiest way is to let the top layer handle it.
|
// So the easiest way is to let the top layer handle it.
|
||||||
MIEvent<?> event = new MIBreakpointChangedEvent(
|
IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(dmc, IBreakpointsTargetDMContext.class);
|
||||||
DMContexts.getAncestorOfType(dmc, IBreakpointsTargetDMContext.class), 0);
|
if (bpTargetDmc != null) {
|
||||||
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
|
MIEvent<?> event = new MIBreakpointChangedEvent(bpTargetDmc, 0);
|
||||||
|
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
|
||||||
|
}
|
||||||
} else if (isSettingSignal(operation)) {
|
} else if (isSettingSignal(operation)) {
|
||||||
// We do no know which signal let the upper layer find it.
|
// We do no know which signal let the upper layer find it.
|
||||||
MIEvent<?> event = new MISignalChangedEvent(
|
ISignalsDMContext signalDmc = DMContexts.getAncestorOfType(dmc, ISignalsDMContext.class);
|
||||||
DMContexts.getAncestorOfType(dmc, ISignalsDMContext.class), ""); //$NON-NLS-1$
|
if (signalDmc != null) {
|
||||||
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
|
MIEvent<?> event = new MISignalChangedEvent(signalDmc, ""); //$NON-NLS-1$
|
||||||
|
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
|
||||||
|
}
|
||||||
} else if (isDetach(operation)) {
|
} else if (isDetach(operation)) {
|
||||||
// if it was a "detach" command change the state.
|
// if it was a "detach" command change the state.
|
||||||
MIEvent<?> event = new MIDetachedEvent(DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class), token);
|
ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
|
||||||
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
|
if (controlDmc != null) {
|
||||||
|
MIEvent<?> event = new MIDetachedEvent(controlDmc, token);
|
||||||
|
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -169,18 +169,25 @@ public class CLIEventProcessor_7_0
|
||||||
{
|
{
|
||||||
// We know something change, we just do not know what.
|
// We know something change, we just do not know what.
|
||||||
// So the easiest way is to let the top layer handle it.
|
// So the easiest way is to let the top layer handle it.
|
||||||
MIEvent<?> event = new MIBreakpointChangedEvent(
|
IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(dmc, IBreakpointsTargetDMContext.class);
|
||||||
DMContexts.getAncestorOfType(dmc, IBreakpointsTargetDMContext.class), 0);
|
if (bpTargetDmc != null) {
|
||||||
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
|
MIEvent<?> event = new MIBreakpointChangedEvent(bpTargetDmc, 0);
|
||||||
|
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
|
||||||
|
}
|
||||||
} else if (isSettingSignal(operation)) {
|
} else if (isSettingSignal(operation)) {
|
||||||
// We do no know which signal let the upper layer find it.
|
// We do no know which signal let the upper layer find it.
|
||||||
MIEvent<?> event = new MISignalChangedEvent(
|
ISignalsDMContext signalDmc = DMContexts.getAncestorOfType(dmc, ISignalsDMContext.class);
|
||||||
DMContexts.getAncestorOfType(dmc, ISignalsDMContext.class), ""); //$NON-NLS-1$
|
if (signalDmc != null) {
|
||||||
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
|
MIEvent<?> event = new MISignalChangedEvent(signalDmc, ""); //$NON-NLS-1$
|
||||||
|
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
|
||||||
|
}
|
||||||
} else if (isDetach(operation)) {
|
} else if (isDetach(operation)) {
|
||||||
// if it was a "detach" command change the state.
|
// if it was a "detach" command change the state.
|
||||||
MIEvent<?> event = new MIDetachedEvent(DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class), token);
|
ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
|
||||||
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
|
if (controlDmc != null) {
|
||||||
|
MIEvent<?> event = new MIDetachedEvent(controlDmc, token);
|
||||||
|
fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,9 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.5.0",
|
||||||
org.eclipse.ui.ide;bundle-version="3.5.0",
|
org.eclipse.ui.ide;bundle-version="3.5.0",
|
||||||
org.eclipse.cdt.ui;bundle-version="5.1.0",
|
org.eclipse.cdt.ui;bundle-version="5.1.0",
|
||||||
org.eclipse.core.expressions;bundle-version="3.4.0",
|
org.eclipse.core.expressions;bundle-version="3.4.0",
|
||||||
org.eclipse.core.filesystem;bundle-version="1.2.0"
|
org.eclipse.core.filesystem;bundle-version="1.2.0",
|
||||||
|
org.eclipse.debug.core,
|
||||||
|
org.eclipse.core.resources
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Export-Package: org.eclipse.cdt.dsf.debug.internal.ui;x-internal:=true,
|
Export-Package: org.eclipse.cdt.dsf.debug.internal.ui;x-internal:=true,
|
||||||
org.eclipse.cdt.dsf.debug.internal.ui.actions;x-internal:=true,
|
org.eclipse.cdt.dsf.debug.internal.ui.actions;x-internal:=true,
|
||||||
|
|
|
@ -9,7 +9,8 @@ Bundle-Localization: plugin
|
||||||
Require-Bundle: org.eclipse.core.runtime,
|
Require-Bundle: org.eclipse.core.runtime,
|
||||||
org.eclipse.debug.core,
|
org.eclipse.debug.core,
|
||||||
org.eclipse.cdt.core,
|
org.eclipse.cdt.core,
|
||||||
org.eclipse.cdt.debug.core
|
org.eclipse.cdt.debug.core,
|
||||||
|
org.eclipse.core.resources
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Export-Package: org.eclipse.cdt.dsf.concurrent,
|
Export-Package: org.eclipse.cdt.dsf.concurrent,
|
||||||
org.eclipse.cdt.dsf.datamodel,
|
org.eclipse.cdt.dsf.datamodel,
|
||||||
|
|