mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 11:55:40 +02:00
autotools: Cleanups in the ui bundle.
* Do not check for null variables that are known to be non-null already. * Stop using SubProgressMonitor in favor of SubMonitor. * Non-javadoc removed. * Commented code removed. * Multi-catch. Change-Id: Ib0aa433fbdfa8581c89161225f83a1f1640dd2dc Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
This commit is contained in:
parent
7cc28b5400
commit
ae53f82634
16 changed files with 138 additions and 226 deletions
|
@ -14,8 +14,8 @@ package org.eclipse.cdt.internal.autotools.ui;
|
|||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
|
||||
import java.text.BreakIterator;
|
||||
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
|
||||
/*
|
||||
|
|
|
@ -28,8 +28,9 @@ public class InvokeAclocalAction extends InvokeAction {
|
|||
public void run(IAction action) {
|
||||
|
||||
IContainer container = getSelectedContainer();
|
||||
if (container == null)
|
||||
if (container == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IPath execDir = getExecDir(container);
|
||||
String cwd = InvokeMessages.getString("CWD") + getCWD(container); //$NON-NLS-1$
|
||||
|
@ -66,21 +67,19 @@ public class InvokeAclocalAction extends InvokeAction {
|
|||
}
|
||||
|
||||
int iOption = 0;
|
||||
if (targetList.length > 0)
|
||||
if (targetList.length > 0) {
|
||||
iOption = 1;
|
||||
}
|
||||
|
||||
String[] argumentList = new String[targetList.length
|
||||
+ optionsList.length + iOption];
|
||||
String[] argumentList = new String[targetList.length + optionsList.length + iOption];
|
||||
|
||||
System.arraycopy(optionsList, 0, argumentList, 0, optionsList.length);
|
||||
|
||||
if (iOption == 1)
|
||||
argumentList[optionsList.length] = "-I"; //$NON-NLS-1$
|
||||
|
||||
System.arraycopy(targetList, 0, argumentList, optionsList.length
|
||||
+ iOption, targetList.length);
|
||||
System.arraycopy(targetList, 0, argumentList, optionsList.length + iOption, targetList.length);
|
||||
|
||||
if (container != null) {
|
||||
String aclocalCommand = null;
|
||||
IProject project = getSelectedContainer().getProject();
|
||||
try {
|
||||
|
@ -90,12 +89,11 @@ public class InvokeAclocalAction extends InvokeAction {
|
|||
}
|
||||
|
||||
// If unset, use default system path
|
||||
if (aclocalCommand == null)
|
||||
if (aclocalCommand == null) {
|
||||
aclocalCommand = DEFAULT_COMMAND;
|
||||
|
||||
executeConsoleCommand(DEFAULT_COMMAND, aclocalCommand,
|
||||
argumentList, execDir);
|
||||
}
|
||||
|
||||
executeConsoleCommand(DEFAULT_COMMAND, aclocalCommand, argumentList, execDir);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -43,7 +43,7 @@ import org.eclipse.core.runtime.IStatus;
|
|||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||
import org.eclipse.core.runtime.SubMonitor;
|
||||
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.jface.dialogs.InputDialog;
|
||||
|
@ -414,8 +414,8 @@ public abstract class InvokeAction extends AbstractTargetAction {
|
|||
} catch (IOException e1) {
|
||||
}
|
||||
|
||||
if (launcher.waitAndRead(stdout, stderr, new SubProgressMonitor(monitor1,
|
||||
IProgressMonitor.UNKNOWN)) != ICommandLauncher.OK) {
|
||||
if (launcher.waitAndRead(stdout, stderr,
|
||||
SubMonitor.convert(monitor1)) != ICommandLauncher.OK) {
|
||||
errMsg = launcher.getErrorMessage();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,9 +20,6 @@ import org.eclipse.jface.action.IAction;
|
|||
|
||||
/**
|
||||
* Class responsible for invoking autoconf.
|
||||
*
|
||||
* @author klee
|
||||
*
|
||||
*/
|
||||
public class InvokeAutoconfAction extends InvokeAction {
|
||||
|
||||
|
@ -35,7 +32,6 @@ public class InvokeAutoconfAction extends InvokeAction {
|
|||
|
||||
IPath execDir = getExecDir(container);
|
||||
|
||||
if (container != null) {
|
||||
IProject project = container.getProject();
|
||||
String autoconfCommand = null;
|
||||
try {
|
||||
|
@ -45,11 +41,10 @@ public class InvokeAutoconfAction extends InvokeAction {
|
|||
}
|
||||
|
||||
// If unset for the project, default to system path
|
||||
if (autoconfCommand == null)
|
||||
if (autoconfCommand == null) {
|
||||
autoconfCommand = DEFAULT_COMMAND;
|
||||
|
||||
executeConsoleCommand(DEFAULT_COMMAND, autoconfCommand, new String[]{}, execDir);
|
||||
}
|
||||
executeConsoleCommand(DEFAULT_COMMAND, autoconfCommand, new String[] {}, execDir);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -29,19 +29,15 @@ public class InvokeAutoheaderAction extends InvokeAction {
|
|||
public void run(IAction action) {
|
||||
|
||||
IContainer container = getSelectedContainer();
|
||||
if (container == null)
|
||||
if (container == null) {
|
||||
return;
|
||||
|
||||
}
|
||||
IPath execDir = getExecDir(container);
|
||||
String cwd = InvokeMessages.getString("CWD") + getCWD(container); //$NON-NLS-1$
|
||||
|
||||
InputDialog optionDialog = new SingleInputDialog(
|
||||
new Shell(),
|
||||
cwd,
|
||||
InvokeMessages
|
||||
.getString("InvokeAutoheaderAction.windowTitle.options"), //$NON-NLS-1$
|
||||
InvokeMessages
|
||||
.getString("InvokeAutoheaderAction.message.options.otherOptions"), //$NON-NLS-1$
|
||||
InputDialog optionDialog = new SingleInputDialog(new Shell(), cwd,
|
||||
InvokeMessages.getString("InvokeAutoheaderAction.windowTitle.options"), //$NON-NLS-1$
|
||||
InvokeMessages.getString("InvokeAutoheaderAction.message.options.otherOptions"), //$NON-NLS-1$
|
||||
DEFAULT_OPTION, null);
|
||||
optionDialog.open();
|
||||
|
||||
|
@ -54,7 +50,6 @@ public class InvokeAutoheaderAction extends InvokeAction {
|
|||
|
||||
System.arraycopy(optionsList, 0, argumentList, 0, optionsList.length);
|
||||
|
||||
if (container != null) {
|
||||
String autoheaderCommand = null;
|
||||
IProject project = getSelectedContainer().getProject();
|
||||
try {
|
||||
|
@ -64,13 +59,12 @@ public class InvokeAutoheaderAction extends InvokeAction {
|
|||
}
|
||||
|
||||
// If unset, use default system path
|
||||
if (autoheaderCommand == null)
|
||||
if (autoheaderCommand == null) {
|
||||
autoheaderCommand = DEFAULT_COMMAND;
|
||||
|
||||
executeConsoleCommand(DEFAULT_COMMAND, autoheaderCommand,
|
||||
argumentList, execDir);
|
||||
}
|
||||
|
||||
executeConsoleCommand(DEFAULT_COMMAND, autoheaderCommand, argumentList, execDir);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,18 +34,17 @@ public class InvokeAutomakeAction extends InvokeAction {
|
|||
public void run(IAction action) {
|
||||
|
||||
IContainer container = getSelectedContainer();
|
||||
if (container == null)
|
||||
if (container == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IPath execDir = getExecDir(container);
|
||||
String cwd = InvokeMessages.getString("CWD") + getCWD(container); //$NON-NLS-1$
|
||||
;
|
||||
TwoInputDialog optionDialog = new TwoInputDialog(new Shell(), cwd,
|
||||
InvokeMessages
|
||||
.getString("InvokeAutomakeAction.windowTitle.options"), //$NON-NLS-1$
|
||||
InvokeMessages
|
||||
.getString("InvokeAutomakeAction.message.options.otherOptions"),InvokeMessages //$NON-NLS-1$
|
||||
.getString("InvokeAutomakeAction.message.options.makeTargets"), DEFAULT_OPTION, null); //$NON-NLS-1$
|
||||
InvokeMessages.getString("InvokeAutomakeAction.windowTitle.options"), //$NON-NLS-1$
|
||||
InvokeMessages.getString("InvokeAutomakeAction.message.options.otherOptions"), InvokeMessages //$NON-NLS-1$
|
||||
.getString("InvokeAutomakeAction.message.options.makeTargets"), //$NON-NLS-1$
|
||||
DEFAULT_OPTION, null);
|
||||
|
||||
optionDialog.open();
|
||||
|
||||
|
@ -74,7 +73,6 @@ InvokeMessages
|
|||
System.arraycopy(targetList, 0, argumentList, optionsList.length,
|
||||
targetList.length);
|
||||
|
||||
if (container != null) {
|
||||
IProject project = container.getProject();
|
||||
String automakeCommand = null;
|
||||
try {
|
||||
|
@ -84,12 +82,11 @@ InvokeMessages
|
|||
}
|
||||
|
||||
// If automake path not set for the project, default to system path
|
||||
if (automakeCommand == null)
|
||||
if (automakeCommand == null) {
|
||||
automakeCommand = DEFAULT_COMMAND;
|
||||
|
||||
executeConsoleCommand(DEFAULT_COMMAND, automakeCommand,
|
||||
argumentList, execDir);
|
||||
}
|
||||
|
||||
executeConsoleCommand(DEFAULT_COMMAND, automakeCommand, argumentList, execDir);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,8 +29,9 @@ public class InvokeAutoreconfAction extends InvokeAction {
|
|||
public void run(IAction action) {
|
||||
|
||||
IContainer container = getSelectedContainer();
|
||||
if (container == null)
|
||||
if (container == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IPath execDir = getExecDir(container);
|
||||
String cwd = InvokeMessages.getString("CWD") + getCWD(container); //$NON-NLS-1$
|
||||
|
@ -54,7 +55,6 @@ public class InvokeAutoreconfAction extends InvokeAction {
|
|||
|
||||
System.arraycopy(optionsList, 0, argumentList, 0, optionsList.length);
|
||||
|
||||
if (container != null) {
|
||||
String autoreconfCommand = null;
|
||||
IProject project = getSelectedContainer().getProject();
|
||||
try {
|
||||
|
@ -64,12 +64,11 @@ public class InvokeAutoreconfAction extends InvokeAction {
|
|||
}
|
||||
|
||||
// If unset, use default system path
|
||||
if (autoreconfCommand == null)
|
||||
if (autoreconfCommand == null) {
|
||||
autoreconfCommand = DEFAULT_COMMAND;
|
||||
|
||||
executeConsoleCommand(DEFAULT_COMMAND, autoreconfCommand,
|
||||
argumentList, execDir);
|
||||
}
|
||||
|
||||
executeConsoleCommand(DEFAULT_COMMAND, autoreconfCommand, argumentList, execDir);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,19 +29,16 @@ public class InvokeLibtoolizeAction extends InvokeAction {
|
|||
public void run(IAction action) {
|
||||
|
||||
IContainer container = getSelectedContainer();
|
||||
if (container == null)
|
||||
if (container == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IPath execDir = getExecDir(container);
|
||||
String cwd = InvokeMessages.getString("CWD") + getCWD(container); //$NON-NLS-1$
|
||||
|
||||
InputDialog optionDialog = new SingleInputDialog(
|
||||
new Shell(),
|
||||
cwd,
|
||||
InvokeMessages
|
||||
.getString("InvokeLibtoolizeAction.windowTitle.options"), //$NON-NLS-1$
|
||||
InvokeMessages
|
||||
.getString("InvokeLibtoolizeAction.message.options.otherOptions"), //$NON-NLS-1$
|
||||
InputDialog optionDialog = new SingleInputDialog(new Shell(), cwd,
|
||||
InvokeMessages.getString("InvokeLibtoolizeAction.windowTitle.options"), //$NON-NLS-1$
|
||||
InvokeMessages.getString("InvokeLibtoolizeAction.message.options.otherOptions"), //$NON-NLS-1$
|
||||
DEFAULT_OPTION, null);
|
||||
optionDialog.open();
|
||||
|
||||
|
@ -54,7 +51,6 @@ public class InvokeLibtoolizeAction extends InvokeAction {
|
|||
|
||||
System.arraycopy(optionsList, 0, argumentList, 0, optionsList.length);
|
||||
|
||||
if (container != null) {
|
||||
String libtoolizeCommand = null;
|
||||
IProject project = getSelectedContainer().getProject();
|
||||
try {
|
||||
|
@ -64,12 +60,11 @@ public class InvokeLibtoolizeAction extends InvokeAction {
|
|||
}
|
||||
|
||||
// If unset, use default system path
|
||||
if (libtoolizeCommand == null)
|
||||
if (libtoolizeCommand == null) {
|
||||
libtoolizeCommand = DEFAULT_COMMAND;
|
||||
|
||||
executeConsoleCommand(DEFAULT_COMMAND, libtoolizeCommand,
|
||||
argumentList, execDir);
|
||||
}
|
||||
|
||||
executeConsoleCommand(DEFAULT_COMMAND, libtoolizeCommand, argumentList, execDir);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
package org.eclipse.cdt.internal.autotools.ui.editors.automake;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
import org.eclipse.ui.IEditorInput;
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
package org.eclipse.cdt.internal.autotools.ui.editors.automake;
|
||||
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
|
||||
import org.eclipse.jface.dialogs.DialogPage;
|
||||
|
||||
public class StatusTool {
|
||||
|
|
|
@ -33,20 +33,16 @@ import org.eclipse.core.runtime.CoreException;
|
|||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||
import org.eclipse.core.runtime.SubMonitor;
|
||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||
import org.eclipse.jface.wizard.IWizardPage;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class AutotoolsNewCCProjectWizardV2 extends NewCCProjectWizard {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* String constants
|
||||
*/
|
||||
protected static final String PREFIX = "WizardAutotoolsNewCCProjectV2"; //$NON-NLS-1$
|
||||
protected static final String OP_ERROR = PREFIX + ".op_error"; //$NON-NLS-1$
|
||||
protected static final String WZ_TITLE = PREFIX + ".title"; //$NON-NLS-1$
|
||||
|
@ -168,13 +164,13 @@ public class AutotoolsNewCCProjectWizardV2 extends NewCCProjectWizard {
|
|||
protected void addNature(IProgressMonitor monitor) throws CoreException {
|
||||
monitor.beginTask("", 4);
|
||||
monitor.subTask(AutotoolsUIPlugin.getResourceString(MSG_ADD_NATURE));
|
||||
ManagedCProjectNature.addManagedNature(newProject, new SubProgressMonitor(monitor, 1));
|
||||
ManagedCProjectNature.addManagedNature(newProject, SubMonitor.convert(monitor, 1));
|
||||
monitor.subTask(AutotoolsUIPlugin.getResourceString(MSG_ADD_BUILDER));
|
||||
ManagedCProjectNature.addManagedBuilder(newProject, new SubProgressMonitor(monitor, 1));
|
||||
ManagedCProjectNature.addManagedBuilder(newProject, SubMonitor.convert(monitor, 1));
|
||||
monitor.subTask(AutotoolsUIPlugin.getResourceString(MSG_ADD_NATURE));
|
||||
AutotoolsNewProjectNature.addAutotoolsNature(newProject, new SubProgressMonitor(monitor, 1));
|
||||
AutotoolsNewProjectNature.addAutotoolsNature(newProject, SubMonitor.convert(monitor, 1));
|
||||
monitor.subTask(AutotoolsUIPlugin.getResourceString(MSG_ADD_BUILDER));
|
||||
AutotoolsNewProjectNature.addAutotoolsBuilder(newProject, new SubProgressMonitor(monitor, 1));
|
||||
AutotoolsNewProjectNature.addAutotoolsBuilder(newProject, SubMonitor.convert(monitor, 1));
|
||||
monitor.done();
|
||||
}
|
||||
|
||||
|
@ -189,11 +185,11 @@ public class AutotoolsNewCCProjectWizardV2 extends NewCCProjectWizard {
|
|||
}
|
||||
|
||||
// super.doRun() just creates the project and does not assign a builder to it.
|
||||
super.doRun(new SubProgressMonitor(monitor, 5));
|
||||
super.doRun(SubMonitor.convert(monitor, 5));
|
||||
|
||||
// Add the managed build nature and builder
|
||||
try {
|
||||
addNature(new SubProgressMonitor(monitor, 2));
|
||||
addNature(SubMonitor.convert(monitor, 2));
|
||||
} catch (CoreException e) {
|
||||
AutotoolsUIPlugin.log(e);
|
||||
}
|
||||
|
@ -265,7 +261,7 @@ public class AutotoolsNewCCProjectWizardV2 extends NewCCProjectWizard {
|
|||
|
||||
// Modify the project settings
|
||||
if (newProject != null) {
|
||||
optionPage.performApply(new SubProgressMonitor(monitor, 2));
|
||||
optionPage.performApply(SubMonitor.convert(monitor, 2));
|
||||
}
|
||||
|
||||
// Save the build options
|
||||
|
@ -284,18 +280,12 @@ public class AutotoolsNewCCProjectWizardV2 extends NewCCProjectWizard {
|
|||
monitor.done();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.ui.wizards.NewCProjectWizard#doRunPrologue(org.eclipse.core.runtime.IProgressMonitor)
|
||||
*/
|
||||
@Override
|
||||
protected void doRunPrologue(IProgressMonitor monitor) {
|
||||
// Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.ui.wizards.NewCProjectWizard#doRunEpilogue(org.eclipse.core.runtime.IProgressMonitor)
|
||||
*/
|
||||
@Override
|
||||
protected void doRunEpilogue(IProgressMonitor monitor) {
|
||||
// Get my initializer to run
|
||||
|
@ -318,28 +308,19 @@ public class AutotoolsNewCCProjectWizardV2 extends NewCCProjectWizard {
|
|||
{
|
||||
try {
|
||||
operations[k].run(monitor);
|
||||
} catch(InvocationTargetException e) {
|
||||
//TODO: what should we do?
|
||||
} catch(InterruptedException e) {
|
||||
} catch (InvocationTargetException | InterruptedException e) {
|
||||
//TODO: what should we do?
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.ui.wizards.NewCProjectWizard#getProjectID()
|
||||
*/
|
||||
@Override
|
||||
public String getProjectID() {
|
||||
// return "org.eclipse.cdt.make.core.make"; //$NON-NLS-1$
|
||||
return ManagedBuilderCorePlugin.MANAGED_MAKE_PROJECT_ID;
|
||||
}
|
||||
|
||||
// public IProjectType getSelectedProjectType() {
|
||||
// return projectConfigurationPage.getSelectedProjectType();
|
||||
// }
|
||||
|
||||
public IConfiguration[] getSelectedConfigurations() {
|
||||
return projectConfigurationPage.getSelectedConfigurations();
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||
import org.eclipse.core.runtime.SubMonitor;
|
||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||
import org.eclipse.jface.wizard.IWizardPage;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
@ -165,13 +165,13 @@ public class AutotoolsNewCProjectWizardV2 extends NewCProjectWizard {
|
|||
protected void addNature(IProgressMonitor monitor) throws CoreException {
|
||||
monitor.beginTask("", 4);
|
||||
monitor.subTask(AutotoolsUIPlugin.getResourceString(MSG_ADD_NATURE));
|
||||
ManagedCProjectNature.addManagedNature(newProject, new SubProgressMonitor(monitor, 1));
|
||||
ManagedCProjectNature.addManagedNature(newProject, SubMonitor.convert(monitor, 1));
|
||||
monitor.subTask(AutotoolsUIPlugin.getResourceString(MSG_ADD_BUILDER));
|
||||
ManagedCProjectNature.addManagedBuilder(newProject, new SubProgressMonitor(monitor, 1));
|
||||
ManagedCProjectNature.addManagedBuilder(newProject, SubMonitor.convert(monitor, 1));
|
||||
monitor.subTask(AutotoolsUIPlugin.getResourceString(MSG_ADD_NATURE));
|
||||
AutotoolsNewProjectNature.addAutotoolsNature(newProject, new SubProgressMonitor(monitor, 1));
|
||||
AutotoolsNewProjectNature.addAutotoolsNature(newProject, SubMonitor.convert(monitor, 1));
|
||||
monitor.subTask(AutotoolsUIPlugin.getResourceString(MSG_ADD_BUILDER));
|
||||
AutotoolsNewProjectNature.addAutotoolsBuilder(newProject, new SubProgressMonitor(monitor, 1));
|
||||
AutotoolsNewProjectNature.addAutotoolsBuilder(newProject, SubMonitor.convert(monitor, 1));
|
||||
monitor.done();
|
||||
}
|
||||
|
||||
|
@ -186,11 +186,11 @@ public class AutotoolsNewCProjectWizardV2 extends NewCProjectWizard {
|
|||
}
|
||||
|
||||
// super.doRun() just creates the project and does not assign a builder to it.
|
||||
super.doRun(new SubProgressMonitor(monitor, 5));
|
||||
super.doRun(SubMonitor.convert(monitor, 5));
|
||||
|
||||
// Add the managed build nature and builder
|
||||
try {
|
||||
addNature(new SubProgressMonitor(monitor, 2));
|
||||
addNature(SubMonitor.convert(monitor, 2));
|
||||
} catch (CoreException e) {
|
||||
AutotoolsUIPlugin.log(e);
|
||||
}
|
||||
|
@ -251,18 +251,9 @@ public class AutotoolsNewCProjectWizardV2 extends NewCProjectWizard {
|
|||
AutotoolsUIPlugin.log(e);
|
||||
}
|
||||
|
||||
// Following is a bit of a hack because changing the project options
|
||||
// causes a change event to be fired which will try to reindex the project.
|
||||
// We are in the middle of setting the project indexer which may end up
|
||||
// being the null indexer. In that case, we don't want the default indexer
|
||||
// (Fast Indexer) to be invoked.
|
||||
//IPDOMManager manager = CCorePlugin.getPDOMManager();
|
||||
//ICProject cproject = CoreModel.getDefault().create(newProject);
|
||||
//manager.setIndexerId(cproject, ConvertToAutotoolsProjectWizard.NULL_INDEXER_ID);
|
||||
|
||||
// Modify the project settings
|
||||
if (newProject != null) {
|
||||
optionPage.performApply(new SubProgressMonitor(monitor, 2));
|
||||
optionPage.performApply(SubMonitor.convert(monitor, 2));
|
||||
}
|
||||
|
||||
// Save the build options
|
||||
|
@ -281,18 +272,12 @@ public class AutotoolsNewCProjectWizardV2 extends NewCProjectWizard {
|
|||
monitor.done();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.ui.wizards.NewCProjectWizard#doRunPrologue(org.eclipse.core.runtime.IProgressMonitor)
|
||||
*/
|
||||
@Override
|
||||
protected void doRunPrologue(IProgressMonitor monitor) {
|
||||
// Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.ui.wizards.NewCProjectWizard#doRunEpilogue(org.eclipse.core.runtime.IProgressMonitor)
|
||||
*/
|
||||
@Override
|
||||
protected void doRunEpilogue(IProgressMonitor monitor) {
|
||||
// Get my initializer to run
|
||||
|
@ -315,28 +300,19 @@ public class AutotoolsNewCProjectWizardV2 extends NewCProjectWizard {
|
|||
{
|
||||
try {
|
||||
operations[k].run(monitor);
|
||||
} catch(InvocationTargetException e) {
|
||||
//TODO: what should we do?
|
||||
} catch(InterruptedException e) {
|
||||
} catch (InvocationTargetException | InterruptedException e) {
|
||||
//TODO: what should we do?
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.ui.wizards.NewCProjectWizard#getProjectID()
|
||||
*/
|
||||
@Override
|
||||
public String getProjectID() {
|
||||
// return "org.eclipse.cdt.make.core.make"; //$NON-NLS-1$
|
||||
return ManagedBuilderCorePlugin.MANAGED_MAKE_PROJECT_ID;
|
||||
}
|
||||
|
||||
// public IProjectType getSelectedProjectType() {
|
||||
// return projectConfigurationPage.getSelectedProjectType();
|
||||
// }
|
||||
|
||||
public IConfiguration[] getSelectedConfigurations() {
|
||||
return projectConfigurationPage.getSelectedConfigurations();
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
|
|||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||
import org.eclipse.core.runtime.SubMonitor;
|
||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
|
@ -121,9 +121,9 @@ public class AutotoolsProjectImportWizard extends NewMakeProjFromExisting {
|
|||
project, monitor);
|
||||
|
||||
// C++ natures
|
||||
if (isCPP)
|
||||
CCProjectNature.addCCNature(project,
|
||||
new SubProgressMonitor(monitor, 1));
|
||||
if (isCPP) {
|
||||
CCProjectNature.addCCNature(project, SubMonitor.convert(monitor, 1));
|
||||
}
|
||||
|
||||
// Set up build information
|
||||
ICProjectDescriptionManager pdMgr = CoreModel.getDefault()
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.eclipse.cdt.ui.wizards.conversion.ConversionWizard;
|
|||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||
import org.eclipse.core.runtime.SubMonitor;
|
||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||
import org.eclipse.jface.wizard.Wizard;
|
||||
|
||||
|
@ -173,7 +173,7 @@ public class ConvertToAutotoolsProjectWizard extends ConversionWizard {
|
|||
protected void doRun(IProgressMonitor monitor) throws CoreException {
|
||||
monitor.beginTask(AutotoolsUIPlugin.getResourceString("WizardAutotoolsProjectConversion.monitor.convertingToMakeProject"), 2); //$NON-NLS-1$
|
||||
try {
|
||||
super.doRun(new SubProgressMonitor(monitor, 5));
|
||||
super.doRun(SubMonitor.convert(monitor, 5));
|
||||
} finally {
|
||||
monitor.done();
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.eclipse.core.resources.IProject;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||
import org.eclipse.core.runtime.SubMonitor;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
|
||||
|
@ -117,7 +117,7 @@ public class ConvertToAutotoolsProjectWizardPage extends ConvertProjectWizardPag
|
|||
IConfiguration defaultCfg = null;
|
||||
Boolean convertingNewAutotoolsProject = false;
|
||||
try {
|
||||
super.convertProject(project, new SubProgressMonitor(monitor, 1), projectID);
|
||||
super.convertProject(project, SubMonitor.convert(monitor, 1), projectID);
|
||||
// Bug 289834 - Converting C Autotools project to C++ loses configurations
|
||||
if (project.hasNature(AutotoolsNewProjectNature.AUTOTOOLS_NATURE_ID)) {
|
||||
convertingNewAutotoolsProject = true; // set this for finally clause
|
||||
|
@ -125,13 +125,12 @@ public class ConvertToAutotoolsProjectWizardPage extends ConvertProjectWizardPag
|
|||
}
|
||||
// Otherwise, we must scrap existing configurations as they will have tool settings we cannot use
|
||||
monitor.subTask(AutotoolsUIPlugin.getResourceString(MSG_ADD_NATURE));
|
||||
ManagedCProjectNature.addManagedNature(project, new SubProgressMonitor(monitor, 1));
|
||||
AutotoolsNewProjectNature.addAutotoolsNature(project, new SubProgressMonitor(monitor, 1));
|
||||
ManagedCProjectNature.addManagedNature(project, SubMonitor.convert(monitor, 1));
|
||||
AutotoolsNewProjectNature.addAutotoolsNature(project, SubMonitor.convert(monitor, 1));
|
||||
// We need to remove any old Autotools nature, if one exists.
|
||||
AutotoolsNewProjectNature.removeOldAutotoolsNature(project, new SubProgressMonitor(monitor, 1));
|
||||
AutotoolsNewProjectNature.removeOldAutotoolsNature(project, SubMonitor.convert(monitor, 1));
|
||||
monitor.subTask(AutotoolsUIPlugin.getResourceString(MSG_ADD_BUILDER));
|
||||
// ManagedCProjectNature.addManagedBuilder(project, new SubProgressMonitor(monitor, 1));
|
||||
AutotoolsNewProjectNature.addAutotoolsBuilder(project, new SubProgressMonitor(monitor,1));
|
||||
AutotoolsNewProjectNature.addAutotoolsBuilder(project, SubMonitor.convert(monitor, 1));
|
||||
// FIXME: Default scanner property: make -w - eventually we want to use Make core's build scanner
|
||||
project.setPersistentProperty(AutotoolsPropertyConstants.SCANNER_USE_MAKE_W, AutotoolsPropertyConstants.TRUE);
|
||||
// Specify false for override in next call as override can cause the method to throw an
|
||||
|
@ -175,31 +174,11 @@ public class ConvertToAutotoolsProjectWizardPage extends ConvertProjectWizardPag
|
|||
AutotoolsUIPlugin.log(e);
|
||||
}
|
||||
|
||||
// Following is a bit of a hack because changing the project options
|
||||
// causes a change event to be fired which will try to reindex the project.
|
||||
// We are in the middle of setting the project indexer which may end up
|
||||
// being the null indexer. In that case, we don't want the default indexer
|
||||
// (Fast Indexer) to be invoked.
|
||||
//IIndexManager manager = CCorePlugin.getIndexManager();
|
||||
//ICProject cproject = CoreModel.getDefault().create(project);
|
||||
//manager.setIndexerId(cproject, ConvertToAutotoolsProjectWizard.NULL_INDEXER_ID);
|
||||
|
||||
// Modify the project settings
|
||||
if (project != null) {
|
||||
applyOptions(project, new SubProgressMonitor(monitor, 2));
|
||||
applyOptions(project, SubMonitor.convert(monitor, 2));
|
||||
}
|
||||
|
||||
// Set the ScannerInfoProvider. We must do this after
|
||||
// applying the options because changing the ScannerInfoProvider
|
||||
// is considered a change to the project and a reindex will
|
||||
// occur. One of the options being applied above is the indexer
|
||||
// selected by the user. Thus, we wait until now.
|
||||
// try {
|
||||
// AutotoolsUIPlugin.setScannerInfoProvider(project);
|
||||
// } catch (CoreException e) {
|
||||
// ManagedBuilderUIPlugin.log(e);
|
||||
// }
|
||||
|
||||
// Save the build options
|
||||
monitor.subTask(AutotoolsUIPlugin.getResourceString(MSG_SAVE));
|
||||
if (info != null) {
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||
import org.eclipse.core.runtime.SubMonitor;
|
||||
import org.eclipse.jface.viewers.CheckboxTableViewer;
|
||||
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
||||
import org.eclipse.swt.SWT;
|
||||
|
@ -177,7 +177,7 @@ public class ReferenceBlock extends AbstractCOptionPage {
|
|||
try {
|
||||
IProjectDescription description = project.getDescription();
|
||||
description.setReferencedProjects(refProjects);
|
||||
project.setDescription(description, new SubProgressMonitor(monitor, 1));
|
||||
project.setDescription(description, SubMonitor.convert(monitor, 1));
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue