1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2012-04-04 17:17:01 -07:00
parent ef82e2a7b2
commit b424f35ce4
6 changed files with 73 additions and 112 deletions

View file

@ -22,10 +22,10 @@ import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.replace.Replace
/**
* @author Thomas Corbat
*/
public class ChangeGeneratorTestSuite{
public class ChangeGeneratorTestSuite {
public static Test suite() throws Exception {
TestSuite suite = new TestSuite("ChangeGeneratorTests");
TestSuite suite = new TestSuite("ChangeGeneratorTestSuite");
suite.addTest(ReplaceTestSuite.suite());
suite.addTest(RemoveTestSuite.suite());

View file

@ -20,7 +20,7 @@ import junit.framework.TestSuite;
public class InsertBeforeTestSuite {
public static Test suite() throws Exception {
TestSuite suite = new TestSuite("ChangeGenerator InsertBefore Tests");
TestSuite suite = new TestSuite("InsertBeforeTestSuite");
suite.addTest(FirstParameterTest.suite());
suite.addTest(PointerParameterTest.suite());

View file

@ -20,7 +20,7 @@ import junit.framework.TestSuite;
public class ReplaceTestSuite {
public static Test suite() throws Exception {
TestSuite suite = new TestSuite("ChangeGeneratorReplaceTests");
TestSuite suite = new TestSuite("ReplaceTestSuite");
suite.addTest(NameTest.suite());
suite.addTest(MoveTest.suite());

View file

@ -85,6 +85,7 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
@ -494,6 +495,8 @@ public class PDOMManager implements IWritableIndexManager, IListener {
String newid= IndexerPreferences.get(prj, IndexerPreferences.KEY_INDEXER_ID, IPDOMManager.ID_NO_INDEXER);
Properties props= IndexerPreferences.getProperties(prj);
// Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=359485
synchronized (new ProjectScope(prj).getNode(CCorePlugin.PLUGIN_ID)) {
synchronized (fUpdatePolicies) {
if (fClosingProjects.contains(prj.getName())) {
return;
@ -517,7 +520,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
}
enqueue(new PDOMRebuildTask(indexer));
}
}
}}
if (oldIndexer != null) {
stopIndexer(oldIndexer);
@ -550,6 +553,8 @@ public class PDOMManager implements IWritableIndexManager, IListener {
assert !Thread.holdsLock(fProjectToPDOM);
try {
// Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=359485
synchronized (new ProjectScope(prj).getNode(CCorePlugin.PLUGIN_ID)) {
synchronized (fUpdatePolicies) {
if (fClosingProjects.contains(name)) {
if (fTraceIndexerSetup)
@ -599,12 +604,14 @@ public class PDOMManager implements IWritableIndexManager, IListener {
}
return;
}
}
}}
// rebuild is required, try import first.
TeamPDOMImportOperation operation= new TeamPDOMImportOperation(project);
operation.run(pm);
// Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=359485
synchronized (new ProjectScope(prj).getNode(CCorePlugin.PLUGIN_ID)) {
synchronized (fUpdatePolicies) {
if (fClosingProjects.contains(name)) {
if (fTraceIndexerSetup)
@ -633,7 +640,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
}
enqueue(task);
}
}
}}
} catch (CoreException e) {
// Ignore if project is no longer open
if (prj.isOpen()) {

View file

@ -38,7 +38,6 @@ import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
/**
* A launch configuration tab that displays and edits program arguments,
* and working directory launch configuration attributes.
@ -47,7 +46,6 @@ import org.eclipse.swt.widgets.Text;
* </p>
*/
public class CArgumentsTab extends CLaunchConfigurationTab {
/**
* Tab identifier used for ordering of tabs added using the
* <code>org.eclipse.debug.ui.launchConfigurationTabs</code>
@ -65,20 +63,17 @@ public class CArgumentsTab extends CLaunchConfigurationTab {
// Working directory
protected WorkingDirectoryBlock fWorkingDirectoryBlock = new WorkingDirectoryBlock();
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createControl(Composite parent) {
Font font = parent.getFont();
Composite comp = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(1, true);
comp.setLayout(layout);
comp.setFont(font);
GridData gd = new GridData(GridData.FILL_BOTH);
comp.setLayoutData(gd);
setControl(comp);
Font font = parent.getFont();
Composite comp = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(1, true);
comp.setLayout(layout);
comp.setFont(font);
GridData gd = new GridData(GridData.FILL_BOTH);
comp.setLayoutData(gd);
setControl(comp);
GdbUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(getControl(), ICDTLaunchHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_ARGUMNETS_TAB);
@ -87,52 +82,46 @@ public class CArgumentsTab extends CLaunchConfigurationTab {
fWorkingDirectoryBlock.createControl(comp);
}
protected void createArgumentComponent(Composite comp, int horizontalSpan) {
Font font = comp.getFont();
Group group = new Group(comp, SWT.NONE);
group.setFont(font);
group.setLayout(new GridLayout());
GridData gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = horizontalSpan;
group.setLayoutData(gd);
group.setText(LaunchMessages.getString("CArgumentsTab.C/C++_Program_Arguments")); //$NON-NLS-1$
fPrgmArgumentsText = new Text(group, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
fPrgmArgumentsText.getAccessible().addAccessibleListener(
new AccessibleAdapter() {
@Override
public void getName(AccessibleEvent e) {
e.result = LaunchMessages.getString("CArgumentsTab.C/C++_Program_Arguments"); //$NON-NLS-1$
}
}
);
gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 40;
gd.widthHint = 100;
fPrgmArgumentsText.setLayoutData(gd);
fPrgmArgumentsText.setFont(font);
fPrgmArgumentsText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent evt) {
updateLaunchConfigurationDialog();
}
});
fArgumentVariablesButton= createPushButton(group, LaunchMessages.getString("CArgumentsTab.Variables"), null); //$NON-NLS-1$
gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
fArgumentVariablesButton.setLayoutData(gd);
fArgumentVariablesButton.addSelectionListener(new SelectionAdapter() {
/* (non-Javadoc)
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
*/
@Override
public void widgetSelected(SelectionEvent arg0) {
handleVariablesButtonSelected(fPrgmArgumentsText);
}
});
addControlAccessibleListener(fArgumentVariablesButton, fArgumentVariablesButton.getText()); // need to strip the mnemonic from buttons
}
protected void createArgumentComponent(Composite comp, int horizontalSpan) {
Font font = comp.getFont();
Group group = new Group(comp, SWT.NONE);
group.setFont(font);
group.setLayout(new GridLayout());
GridData gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = horizontalSpan;
group.setLayoutData(gd);
group.setText(LaunchMessages.getString("CArgumentsTab.C/C++_Program_Arguments")); //$NON-NLS-1$
fPrgmArgumentsText = new Text(group, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
fPrgmArgumentsText.getAccessible().addAccessibleListener(
new AccessibleAdapter() {
@Override
public void getName(AccessibleEvent e) {
e.result = LaunchMessages.getString("CArgumentsTab.C/C++_Program_Arguments"); //$NON-NLS-1$
}
});
gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 40;
gd.widthHint = 100;
fPrgmArgumentsText.setLayoutData(gd);
fPrgmArgumentsText.setFont(font);
fPrgmArgumentsText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent evt) {
updateLaunchConfigurationDialog();
}
});
fArgumentVariablesButton= createPushButton(group, LaunchMessages.getString("CArgumentsTab.Variables"), null); //$NON-NLS-1$
gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
fArgumentVariablesButton.setLayoutData(gd);
fArgumentVariablesButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
handleVariablesButtonSelected(fPrgmArgumentsText);
}
});
addControlAccessibleListener(fArgumentVariablesButton, fArgumentVariablesButton.getText()); // need to strip the mnemonic from buttons
}
/**
* A variable entry button has been pressed for the given text
@ -142,7 +131,6 @@ public class CArgumentsTab extends CLaunchConfigurationTab {
protected void handleVariablesButtonSelected(Text textField) {
String variable = getVariable();
if (variable != null) {
// We should use insert() but not append() to be consistent with the Platform behavior (e.g. Common tab)
textField.insert(variable);
}
}
@ -158,7 +146,7 @@ public class CArgumentsTab extends CLaunchConfigurationTab {
}
public void addControlAccessibleListener(Control control, String controlName) {
//strip mnemonic (&)
// Strip mnemonic (&)
String[] strs = controlName.split("&"); //$NON-NLS-1$
StringBuffer stripped = new StringBuffer();
for (int i = 0; i < strs.length; i++) {
@ -169,36 +157,28 @@ public class CArgumentsTab extends CLaunchConfigurationTab {
private class ControlAccessibleListener extends AccessibleAdapter {
private String controlName;
ControlAccessibleListener(String name) {
controlName = name;
}
@Override
public void getName(AccessibleEvent e) {
e.result = controlName;
}
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration)
*/
@Override
public boolean isValid(ILaunchConfiguration config) {
return fWorkingDirectoryBlock.isValid(config);
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
@Override
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, (String) null);
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String) null);
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
*/
@Override
public void initializeFrom(ILaunchConfiguration configuration) {
try {
@ -211,9 +191,6 @@ public class CArgumentsTab extends CLaunchConfigurationTab {
}
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
configuration.setAttribute(
@ -242,26 +219,17 @@ public class CArgumentsTab extends CLaunchConfigurationTab {
return TAB_ID;
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
*/
@Override
public String getName() {
return LaunchMessages.getString("CArgumentsTab.Arguments"); //$NON-NLS-1$
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#setLaunchConfigurationDialog(org.eclipse.debug.ui.ILaunchConfigurationDialog)
*/
@Override
public void setLaunchConfigurationDialog(ILaunchConfigurationDialog dialog) {
super.setLaunchConfigurationDialog(dialog);
fWorkingDirectoryBlock.setLaunchConfigurationDialog(dialog);
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#getErrorMessage()
*/
@Override
public String getErrorMessage() {
String m = super.getErrorMessage();
@ -271,9 +239,6 @@ public class CArgumentsTab extends CLaunchConfigurationTab {
return m;
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#getMessage()
*/
@Override
public String getMessage() {
String m = super.getMessage();
@ -283,17 +248,11 @@ public class CArgumentsTab extends CLaunchConfigurationTab {
return m;
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage()
*/
@Override
public Image getImage() {
return LaunchImages.get(LaunchImages.IMG_VIEW_ARGUMENTS_TAB);
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#updateLaunchConfigurationDialog()
*/
@Override
protected void updateLaunchConfigurationDialog() {
super.updateLaunchConfigurationDialog();

View file

@ -8,7 +8,6 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
* Ken Ryall (Nokia) - bug 178731
* Anton Gorenkov
*******************************************************************************/
package org.eclipse.cdt.launch.ui;
@ -45,7 +44,6 @@ import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IWorkbenchPage;
public abstract class CLaunchConfigurationTab extends AbstractLaunchConfigurationTab {
/**
* Returns the current C element context from which to initialize default
* settings, or <code>null</code> if none. Note, if possible we will
@ -85,9 +83,9 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
}
}
if (obj instanceof IResource) {
ICElement ce = CoreModel.getDefault().create((IResource)obj);
ICElement ce = CoreModel.getDefault().create((IResource) obj);
if (ce == null) {
IProject pro = ((IResource)obj).getProject();
IProject pro = ((IResource) obj).getProject();
ce = CoreModel.getDefault().create(pro);
}
obj = ce;
@ -96,7 +94,7 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
if (platform != null && !platform.equals("*")) { //$NON-NLS-1$
ICDescriptor descriptor;
try {
descriptor = CCorePlugin.getDefault().getCProjectDescription( ((ICElement)obj).getCProject().getProject(),
descriptor = CCorePlugin.getDefault().getCProjectDescription(((ICElement) obj).getCProject().getProject(),
false);
if (descriptor != null) {
String projectPlatform = descriptor.getPlatform();
@ -109,9 +107,9 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
}
if (obj != null) {
if (programName == null || programName.equals("")) { //$NON-NLS-1$
return (ICElement)obj;
return (ICElement) obj;
}
ICElement ce = (ICElement)obj;
ICElement ce = (ICElement) obj;
IProject project;
project = (IProject)ce.getCProject().getResource();
IPath programFile = project.getFile(programName).getLocation();
@ -119,11 +117,10 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
if (ce != null && ce.exists()) {
return ce;
}
return (ICElement)obj;
return (ICElement) obj;
}
}
if (page != null)
{
if (page != null) {
IEditorPart part = page.getActiveEditor();
if (part != null) {
IEditorInput input = part.getEditorInput();
@ -160,7 +157,6 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
}
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, name);
}
protected String getPlatform(ILaunchConfiguration config) {
@ -210,5 +206,4 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
dialog.open();
return dialog.getVariableExpression();
}
}