mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-14 20:45:22 +02:00
Add missing Autotools UI fixes done after initial move.
- fix some findBugs warnings - use sh -c to invoke Autotool scripts - switch AutomakeErrorHandler to use IEditorInput
This commit is contained in:
parent
a3a513fffb
commit
22ea1c7683
7 changed files with 57 additions and 33 deletions
|
@ -1,3 +1,31 @@
|
||||||
|
2012-03-30 Jeff Johnston <jjohnstn@redhat.com>
|
||||||
|
|
||||||
|
* src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeEditor.java
|
||||||
|
(AutomakeEditor): Make constructor public so openEditor will work.
|
||||||
|
* src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeErrorHandler.java
|
||||||
|
(AutomakeErrorHandler): Change constructor to accept an IEditorInput rather than
|
||||||
|
an IDocument.
|
||||||
|
* src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakefileReconcilingStrategy.java
|
||||||
|
(AutomakefileReconcilingStrategy): Pass an IEditorInput to create the
|
||||||
|
AutomakeErrorHandler.
|
||||||
|
* src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeDocumentProvider.java
|
||||||
|
(connect): Ditto.
|
||||||
|
|
||||||
|
2012-03-30 Jeff Johnston <jjohnstn@redhat.com>
|
||||||
|
|
||||||
|
* src/org/eclipse/cdt/autotools/ui/editors/AutoconfMacro.java
|
||||||
|
(equals): Fix FindBugs error with missing null case.
|
||||||
|
(hashCode): New method to fix FindBugs error.
|
||||||
|
* src/org/eclipse/cdt/internal/autotools/ui/editors/automake/AutomakeEditor.java
|
||||||
|
(AutomakeEditor): Fix constructor to remove static variable.
|
||||||
|
(static initializer): Fix FindBugs error with static variable usage.
|
||||||
|
|
||||||
|
2012-03-30 Jeff Johnston <jjohnstn@redhat.com>
|
||||||
|
|
||||||
|
Bug #371277
|
||||||
|
* src/org/eclipse/cdt/internal/autotools/ui/actions/InvokeAction.java
|
||||||
|
(..run): Use sh -c to execute the autotool scripts.
|
||||||
|
|
||||||
2012-03-29 Jeff Johnston <jjohnstn@redhat.com>
|
2012-03-29 Jeff Johnston <jjohnstn@redhat.com>
|
||||||
|
|
||||||
Resolves: bug#374026
|
Resolves: bug#374026
|
||||||
|
|
|
@ -42,7 +42,14 @@ public class AutoconfMacro implements Comparable<Object> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(Object x) {
|
public boolean equals(Object x) {
|
||||||
|
if (x == null)
|
||||||
|
return false;
|
||||||
AutoconfMacro y = (AutoconfMacro)x;
|
AutoconfMacro y = (AutoconfMacro)x;
|
||||||
return getName().equals(y.getName());
|
return getName().equals(y.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int hashCode() {
|
||||||
|
return getName().hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.Platform;
|
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||||
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
||||||
|
@ -259,7 +258,7 @@ public abstract class InvokeAction extends AbstractTargetAction {
|
||||||
Process process = cmdL.execute(command, argumentList, envList,
|
Process process = cmdL.execute(command, argumentList, envList,
|
||||||
execDir, new NullProgressMonitor());
|
execDir, new NullProgressMonitor());
|
||||||
|
|
||||||
if (cmdL.waitAndRead(stdout, stderr) == CommandLauncher.OK) {
|
if (cmdL.waitAndRead(stdout, stderr, new NullProgressMonitor()) == CommandLauncher.OK) {
|
||||||
try {
|
try {
|
||||||
status = 0;
|
status = 0;
|
||||||
monitor.done();
|
monitor.done();
|
||||||
|
@ -389,30 +388,18 @@ public abstract class InvokeAction extends AbstractTargetAction {
|
||||||
|
|
||||||
String[] newArgumentList;
|
String[] newArgumentList;
|
||||||
|
|
||||||
// Fix for bug #343905
|
// Fix for bug #343905 and bug #371277
|
||||||
// For Windows and Mac, we cannot run a script directly (in this case, the
|
// For Windows and Mac, we cannot run a script directly (in this case,
|
||||||
// autotools are scripts). We need to run "sh -c command args where command
|
// autotools are scripts). We need to run "sh -c command args where command
|
||||||
// plus args is represented in a single string.
|
// plus args is represented in a single string. The same applies for
|
||||||
if (Platform.getOS().equals(Platform.OS_WIN32)
|
// some Linux shells such as dash. Using sh -c will work on all Linux
|
||||||
|| Platform.getOS().equals(Platform.OS_MACOSX)) {
|
// POSIX-compliant shells.
|
||||||
// Neither Mac or Windows support calling scripts directly.
|
StringBuffer command = new StringBuffer(strippedCommand);
|
||||||
StringBuffer command = new StringBuffer(strippedCommand);
|
for (String arg : argumentList) {
|
||||||
for (String arg : argumentList) {
|
command.append(" " + arg);
|
||||||
command.append(" " + arg);
|
}
|
||||||
}
|
newArgumentList = new String[] { "-c", command.toString() };
|
||||||
newArgumentList = new String[] { "-c", command.toString() };
|
|
||||||
} else {
|
|
||||||
// Otherwise, we don't need the -c argument and can present the command
|
|
||||||
// name and arguments as individual arguments
|
|
||||||
if (argumentList == null)
|
|
||||||
newArgumentList = new String[1];
|
|
||||||
else
|
|
||||||
newArgumentList = new String[argumentList.length + 1];
|
|
||||||
newArgumentList[0] = strippedCommand;
|
|
||||||
if (argumentList != null)
|
|
||||||
System.arraycopy(argumentList, 0, newArgumentList, 1, argumentList.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
OutputStream stdout = consoleOutStream;
|
OutputStream stdout = consoleOutStream;
|
||||||
OutputStream stderr = consoleOutStream;
|
OutputStream stderr = consoleOutStream;
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ import java.util.Iterator;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.jface.text.IDocument;
|
import org.eclipse.jface.text.IDocument;
|
||||||
|
import org.eclipse.ui.IEditorInput;
|
||||||
import org.eclipse.ui.IFileEditorInput;
|
import org.eclipse.ui.IFileEditorInput;
|
||||||
import org.eclipse.ui.IURIEditorInput;
|
import org.eclipse.ui.IURIEditorInput;
|
||||||
import org.eclipse.ui.editors.text.TextFileDocumentProvider;
|
import org.eclipse.ui.editors.text.TextFileDocumentProvider;
|
||||||
|
@ -105,8 +106,7 @@ public class AutomakeDocumentProvider extends TextFileDocumentProvider implement
|
||||||
public void connect(Object element) throws CoreException {
|
public void connect(Object element) throws CoreException {
|
||||||
super.connect(element);
|
super.connect(element);
|
||||||
IMakefile makefile = getWorkingCopy(element);
|
IMakefile makefile = getWorkingCopy(element);
|
||||||
IDocument document = getDocument(element);
|
AutomakeErrorHandler errorHandler = new AutomakeErrorHandler((IEditorInput)element);
|
||||||
AutomakeErrorHandler errorHandler = new AutomakeErrorHandler(document);
|
|
||||||
errorHandler.update(makefile);
|
errorHandler.update(makefile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,12 @@ public class AutomakeEditor extends MakefileEditor {
|
||||||
private static AutomakeEditor fgInstance;
|
private static AutomakeEditor fgInstance;
|
||||||
private IEditorInput input;
|
private IEditorInput input;
|
||||||
|
|
||||||
|
static {
|
||||||
|
fgInstance = new AutomakeEditor();
|
||||||
|
}
|
||||||
|
|
||||||
public AutomakeEditor() {
|
public AutomakeEditor() {
|
||||||
super();
|
super();
|
||||||
fgInstance = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -52,9 +52,8 @@ public class AutomakeErrorHandler {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public AutomakeErrorHandler(IDocument document) {
|
public AutomakeErrorHandler(IEditorInput input) {
|
||||||
this.document = document;
|
this.document = AutomakeEditorFactory.getDefault().getAutomakefileDocumentProvider().getDocument(input);
|
||||||
IEditorInput input = AutomakeEditor.getDefault().getEditorInput();
|
|
||||||
this.fAnnotationModel = (AnnotationModel)AutomakeEditorFactory.getDefault().getAutomakefileDocumentProvider().getAnnotationModel(input);
|
this.fAnnotationModel = (AnnotationModel)AutomakeEditorFactory.getDefault().getAutomakefileDocumentProvider().getAnnotationModel(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class AutomakefileReconcilingStrategy implements IReconcilingStrategy {
|
||||||
input = (IEditorInput) fEditor.getEditorInput();
|
input = (IEditorInput) fEditor.getEditorInput();
|
||||||
fManager= AutomakeEditorFactory.getDefault().getWorkingCopyManager();
|
fManager= AutomakeEditorFactory.getDefault().getWorkingCopyManager();
|
||||||
fDocumentProvider= AutomakeEditorFactory.getDefault().getAutomakefileDocumentProvider();
|
fDocumentProvider= AutomakeEditorFactory.getDefault().getAutomakefileDocumentProvider();
|
||||||
fErrorHandler= new AutomakeErrorHandler(fDocumentProvider.getDocument(input));
|
fErrorHandler= new AutomakeErrorHandler(input);
|
||||||
fMakefileReconcilingParticipant= (IReconcilingParticipant)fEditor;
|
fMakefileReconcilingParticipant= (IReconcilingParticipant)fEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue