mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Convert new Runnable to lambda.
Take 2. Change-Id: I060b0e41d8c6058db0c2ba88af8454b5517105b8 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
This commit is contained in:
parent
1e42e5f0e1
commit
a3938937f2
115 changed files with 2719 additions and 4025 deletions
|
@ -36,18 +36,15 @@ public class MakeStartup extends Job {
|
|||
protected IStatus run(IProgressMonitor monitor) {
|
||||
final IProject[] oldProject = UpdateMakeProjectAction.getOldProjects();
|
||||
if (oldProject.length > 0) {
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Shell shell = MakeUIPlugin.getDefault().getShell();
|
||||
boolean shouldUpdate = MessageDialog.openQuestion(shell,
|
||||
MakeUIPlugin.getResourceString("MakeUIPlugin.update_project"), //$NON-NLS-1$
|
||||
MakeUIPlugin.getResourceString("MakeUIPlugin.update_project_message")); //$NON-NLS-1$
|
||||
Display.getDefault().asyncExec(() -> {
|
||||
Shell shell = MakeUIPlugin.getDefault().getShell();
|
||||
boolean shouldUpdate = MessageDialog.openQuestion(shell,
|
||||
MakeUIPlugin.getResourceString("MakeUIPlugin.update_project"), //$NON-NLS-1$
|
||||
MakeUIPlugin.getResourceString("MakeUIPlugin.update_project_message")); //$NON-NLS-1$
|
||||
|
||||
if (shouldUpdate) {
|
||||
ProgressMonitorDialog pd = new ProgressMonitorDialog(shell);
|
||||
UpdateMakeProjectAction.run(false, pd, oldProject);
|
||||
}
|
||||
if (shouldUpdate) {
|
||||
ProgressMonitorDialog pd = new ProgressMonitorDialog(shell);
|
||||
UpdateMakeProjectAction.run(false, pd, oldProject);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -186,12 +186,7 @@ public class MakeUIPlugin extends AbstractUIPlugin {
|
|||
if (display == null)
|
||||
display = Display.getDefault();
|
||||
final IStatus fstatus = status;
|
||||
display.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ErrorDialog.openError(null, title, null, fstatus);
|
||||
}
|
||||
});
|
||||
display.asyncExec(() -> ErrorDialog.openError(null, title, null, fstatus));
|
||||
}
|
||||
|
||||
public static void logException(Throwable e) {
|
||||
|
|
|
@ -34,13 +34,10 @@ import org.eclipse.cdt.make.internal.ui.MakeUIImages;
|
|||
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
|
||||
import org.eclipse.cdt.make.ui.IWorkingCopyManager;
|
||||
import org.eclipse.cdt.ui.CDTSharedImages;
|
||||
import org.eclipse.jface.action.IMenuListener;
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
import org.eclipse.jface.action.IToolBarManager;
|
||||
import org.eclipse.jface.action.MenuManager;
|
||||
import org.eclipse.jface.action.Separator;
|
||||
import org.eclipse.jface.viewers.DoubleClickEvent;
|
||||
import org.eclipse.jface.viewers.IDoubleClickListener;
|
||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
import org.eclipse.jface.viewers.LabelProvider;
|
||||
import org.eclipse.jface.viewers.TreeViewer;
|
||||
|
@ -224,22 +221,14 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
|
|||
|
||||
MenuManager manager = new MenuManager("#MakefileOutlinerContext"); //$NON-NLS-1$
|
||||
manager.setRemoveAllWhenShown(true);
|
||||
manager.addMenuListener(new IMenuListener() {
|
||||
@Override
|
||||
public void menuAboutToShow(IMenuManager m) {
|
||||
contextMenuAboutToShow(m);
|
||||
}
|
||||
});
|
||||
manager.addMenuListener(m -> contextMenuAboutToShow(m));
|
||||
Control tree = viewer.getControl();
|
||||
Menu menu = manager.createContextMenu(tree);
|
||||
tree.setMenu(menu);
|
||||
|
||||
viewer.addDoubleClickListener(new IDoubleClickListener() {
|
||||
@Override
|
||||
public void doubleClick(DoubleClickEvent event) {
|
||||
if (fOpenIncludeAction != null) {
|
||||
fOpenIncludeAction.run();
|
||||
}
|
||||
viewer.addDoubleClickListener(event -> {
|
||||
if (fOpenIncludeAction != null) {
|
||||
fOpenIncludeAction.run();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -283,15 +272,12 @@ public class MakefileContentOutlinePage extends ContentOutlinePage {
|
|||
if (viewer != null) {
|
||||
final Control control = viewer.getControl();
|
||||
if (control != null && !control.isDisposed()) {
|
||||
control.getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!control.isDisposed()) {
|
||||
control.setRedraw(false);
|
||||
viewer.setInput(fInput);
|
||||
viewer.expandAll();
|
||||
control.setRedraw(true);
|
||||
}
|
||||
control.getDisplay().asyncExec(() -> {
|
||||
if (!control.isDisposed()) {
|
||||
control.setRedraw(false);
|
||||
viewer.setInput(fInput);
|
||||
viewer.expandAll();
|
||||
control.setRedraw(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -100,12 +100,7 @@ public final class MakefileToggleCommentAction extends TextEditorAction {
|
|||
if (shell != null && !shell.isDisposed())
|
||||
display = shell.getDisplay();
|
||||
|
||||
BusyIndicator.showWhile(display, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fOperationTarget.doOperation(operationCode);
|
||||
}
|
||||
});
|
||||
BusyIndicator.showWhile(display, () -> fOperationTarget.doOperation(operationCode));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -236,13 +236,10 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
|
|||
* Refresh the whole view.
|
||||
*/
|
||||
private void refreshView() {
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (viewer == null || viewer.getControl() == null || viewer.getControl().isDisposed())
|
||||
return;
|
||||
viewer.refresh();
|
||||
}
|
||||
Display.getDefault().asyncExec(() -> {
|
||||
if (viewer == null || viewer.getControl() == null || viewer.getControl().isDisposed())
|
||||
return;
|
||||
viewer.refresh();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -250,50 +247,47 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
|
|||
* Refresh the project tree or the project subtree (in case of drill-down adapter) in the view.
|
||||
*/
|
||||
private void refreshProjectTree(final IProject project) {
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (viewer == null || viewer.getControl() == null || viewer.getControl().isDisposed())
|
||||
return;
|
||||
Display.getDefault().asyncExec(() -> {
|
||||
if (viewer == null || viewer.getControl() == null || viewer.getControl().isDisposed())
|
||||
return;
|
||||
|
||||
// Get first item of the viewer
|
||||
Object firstItem = null;
|
||||
if (viewer instanceof TreeViewer) {
|
||||
if (((TreeViewer) viewer).getTree().getItemCount() <= 0) {
|
||||
// No items yet, no refresh needed
|
||||
return;
|
||||
} else {
|
||||
firstItem = ((TreeViewer) viewer).getTree().getItem(0).getData();
|
||||
}
|
||||
} else if (viewer instanceof TableViewer) {
|
||||
if (((TableViewer) viewer).getTable().getItemCount() <= 0) {
|
||||
// No items yet, refresh
|
||||
viewer.refresh();
|
||||
return;
|
||||
} else {
|
||||
firstItem = ((TableViewer) viewer).getTable().getItem(0).getData();
|
||||
}
|
||||
// Get first item of the viewer
|
||||
Object firstItem = null;
|
||||
if (viewer instanceof TreeViewer) {
|
||||
if (((TreeViewer) viewer).getTree().getItemCount() <= 0) {
|
||||
// No items yet, no refresh needed
|
||||
return;
|
||||
} else {
|
||||
firstItem = ((TreeViewer) viewer).getTree().getItem(0).getData();
|
||||
}
|
||||
} else if (viewer instanceof TableViewer) {
|
||||
if (((TableViewer) viewer).getTable().getItemCount() <= 0) {
|
||||
// No items yet, refresh
|
||||
viewer.refresh();
|
||||
return;
|
||||
} else {
|
||||
firstItem = ((TableViewer) viewer).getTable().getItem(0).getData();
|
||||
}
|
||||
}
|
||||
|
||||
IContainer parentContainer = null;
|
||||
|
||||
boolean isDrilledDown = !(firstItem instanceof IProject);
|
||||
if (!isDrilledDown) {
|
||||
// view shows projects
|
||||
viewer.refresh(project);
|
||||
} else {
|
||||
// drill-down adapter in the game
|
||||
if (firstItem instanceof IResource) {
|
||||
parentContainer = ((IResource) firstItem).getParent();
|
||||
} else if (firstItem instanceof TargetSourceContainer) {
|
||||
parentContainer = ((TargetSourceContainer) firstItem).getContainer().getParent();
|
||||
} else if (firstItem instanceof IMakeTarget) {
|
||||
parentContainer = ((IMakeTarget) firstItem).getContainer();
|
||||
}
|
||||
|
||||
IContainer parentContainer = null;
|
||||
|
||||
boolean isDrilledDown = !(firstItem instanceof IProject);
|
||||
if (!isDrilledDown) {
|
||||
// view shows projects
|
||||
viewer.refresh(project);
|
||||
} else {
|
||||
// drill-down adapter in the game
|
||||
if (firstItem instanceof IResource) {
|
||||
parentContainer = ((IResource) firstItem).getParent();
|
||||
} else if (firstItem instanceof TargetSourceContainer) {
|
||||
parentContainer = ((TargetSourceContainer) firstItem).getContainer().getParent();
|
||||
} else if (firstItem instanceof IMakeTarget) {
|
||||
parentContainer = ((IMakeTarget) firstItem).getContainer();
|
||||
}
|
||||
|
||||
if (parentContainer != null && project.equals(parentContainer.getProject())) {
|
||||
viewer.refresh();
|
||||
}
|
||||
if (parentContainer != null && project.equals(parentContainer.getProject())) {
|
||||
viewer.refresh();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -428,7 +422,7 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
|
|||
|
||||
/**
|
||||
* Check if the resource is in the list of source entries.
|
||||
|
||||
|
||||
* @param rc - resource to check.
|
||||
* @return {@code true} if the resource is a source folder, {@code false} otherwise.
|
||||
*
|
||||
|
|
|
@ -27,8 +27,6 @@ import org.eclipse.core.runtime.jobs.IJobChangeEvent;
|
|||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
|
@ -115,12 +113,7 @@ public class GCCPerFileSCDProfilePage extends AbstractDiscoveryPage {
|
|||
|
||||
// text field
|
||||
bopOpenFileText = ControlFactory.createTextField(profileGroup, SWT.SINGLE | SWT.BORDER);
|
||||
bopOpenFileText.addModifyListener(new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
handleModifyOpenFileText();
|
||||
}
|
||||
});
|
||||
bopOpenFileText.addModifyListener(e -> handleModifyOpenFileText());
|
||||
bopLoadButton.setEnabled(loadButtonInitialEnabled && handleModifyOpenFileText());
|
||||
|
||||
// browse button
|
||||
|
@ -231,19 +224,14 @@ public class GCCPerFileSCDProfilePage extends AbstractDiscoveryPage {
|
|||
//lock.acquire();
|
||||
synchronized (lock) {
|
||||
if (!instance.shell.isDisposed()) {
|
||||
instance.shell.getDisplay().asyncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (!instance.shell.isDisposed()) {
|
||||
loadButtonInitialEnabled = instance.bopEnabledButton.getSelection()
|
||||
&& handleModifyOpenFileText();
|
||||
instance.bopLoadButton.setEnabled(loadButtonInitialEnabled);
|
||||
} else {
|
||||
loadButtonInitialEnabled = true;
|
||||
}
|
||||
instance.shell.getDisplay().asyncExec(() -> {
|
||||
if (!instance.shell.isDisposed()) {
|
||||
loadButtonInitialEnabled = instance.bopEnabledButton.getSelection()
|
||||
&& handleModifyOpenFileText();
|
||||
instance.bopLoadButton.setEnabled(loadButtonInitialEnabled);
|
||||
} else {
|
||||
loadButtonInitialEnabled = true;
|
||||
}
|
||||
|
||||
});
|
||||
} else {
|
||||
loadButtonInitialEnabled = true;
|
||||
|
|
|
@ -27,8 +27,6 @@ import org.eclipse.core.runtime.jobs.IJobChangeEvent;
|
|||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
|
@ -122,12 +120,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
|
|||
|
||||
// text field
|
||||
bopOpenFileText = ControlFactory.createTextField(profileGroup, SWT.SINGLE | SWT.BORDER);
|
||||
bopOpenFileText.addModifyListener(new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
handleModifyOpenFileText();
|
||||
}
|
||||
});
|
||||
bopOpenFileText.addModifyListener(e -> handleModifyOpenFileText());
|
||||
bopLoadButton.setEnabled(loadButtonInitialEnabled && handleModifyOpenFileText());
|
||||
|
||||
// browse button
|
||||
|
@ -181,12 +174,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
|
|||
|
||||
// text field
|
||||
sipRunCommandText = ControlFactory.createTextField(profileGroup, SWT.SINGLE | SWT.BORDER);
|
||||
sipRunCommandText.addModifyListener(new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
handleModifyRunCommandText();
|
||||
}
|
||||
});
|
||||
sipRunCommandText.addModifyListener(e -> handleModifyRunCommandText());
|
||||
|
||||
// si browse button
|
||||
Button siBrowseButton = ControlFactory.createPushButton(profileGroup, SI_BROWSE);
|
||||
|
@ -221,12 +209,7 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
|
|||
// text field
|
||||
sipRunArgsText = ControlFactory.createTextField(profileGroup, SWT.SINGLE | SWT.BORDER);
|
||||
((GridData) sipRunArgsText.getLayoutData()).horizontalSpan = 3;
|
||||
sipRunArgsText.addModifyListener(new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
handleModifyRunArgsText();
|
||||
}
|
||||
});
|
||||
sipRunArgsText.addModifyListener(e -> handleModifyRunArgsText());
|
||||
|
||||
// si provider console enabled checkbox
|
||||
String sipConsoleEnabledLabel = MakeUIPlugin
|
||||
|
@ -353,19 +336,14 @@ public class GCCPerProjectSCDProfilePage extends AbstractDiscoveryPage {
|
|||
public void done(IJobChangeEvent event) {
|
||||
synchronized (lock) {
|
||||
if (!instance.shell.isDisposed()) {
|
||||
instance.shell.getDisplay().asyncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (!instance.shell.isDisposed()) {
|
||||
loadButtonInitialEnabled = instance.bopEnabledButton.getSelection()
|
||||
&& handleModifyOpenFileText();
|
||||
instance.bopLoadButton.setEnabled(loadButtonInitialEnabled);
|
||||
} else {
|
||||
loadButtonInitialEnabled = true;
|
||||
}
|
||||
instance.shell.getDisplay().asyncExec(() -> {
|
||||
if (!instance.shell.isDisposed()) {
|
||||
loadButtonInitialEnabled = instance.bopEnabledButton.getSelection()
|
||||
&& handleModifyOpenFileText();
|
||||
instance.bopLoadButton.setEnabled(loadButtonInitialEnabled);
|
||||
} else {
|
||||
loadButtonInitialEnabled = true;
|
||||
}
|
||||
|
||||
});
|
||||
} else {
|
||||
loadButtonInitialEnabled = true;
|
||||
|
|
|
@ -266,24 +266,9 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
|
||||
private static Map<IProject, IManagedBuildInfo> fInfoMap = new HashMap<>();
|
||||
|
||||
private static ISorter fToolChainSorter = new ISorter() {
|
||||
@Override
|
||||
public void sort() {
|
||||
resortToolChains();
|
||||
}
|
||||
};
|
||||
private static ISorter fToolSorter = new ISorter() {
|
||||
@Override
|
||||
public void sort() {
|
||||
resortTools();
|
||||
}
|
||||
};
|
||||
private static ISorter fBuilderSorter = new ISorter() {
|
||||
@Override
|
||||
public void sort() {
|
||||
resortBuilders();
|
||||
}
|
||||
};
|
||||
private static ISorter fToolChainSorter = () -> resortToolChains();
|
||||
private static ISorter fToolSorter = () -> resortTools();
|
||||
private static ISorter fBuilderSorter = () -> resortBuilders();
|
||||
|
||||
private static interface ISorter {
|
||||
void sort();
|
||||
|
@ -291,14 +276,11 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
|
||||
static {
|
||||
getEnvironmentVariableProvider()
|
||||
.subscribe(fEnvironmentBuildPathsChangeListener = new IEnvironmentBuildPathsChangeListener() {
|
||||
@Override
|
||||
public void buildPathsChanged(IConfiguration configuration, int buildPathType) {
|
||||
// if(buildPathType == IEnvVarBuildPath.BUILDPATH_INCLUDE){
|
||||
// initializePathEntries(configuration,null);
|
||||
// notifyListeners(configuration,null);
|
||||
// }
|
||||
}
|
||||
.subscribe(fEnvironmentBuildPathsChangeListener = (configuration, buildPathType) -> {
|
||||
// if(buildPathType == IEnvVarBuildPath.BUILDPATH_INCLUDE){
|
||||
// initializePathEntries(configuration,null);
|
||||
// notifyListeners(configuration,null);
|
||||
// }
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -876,7 +858,7 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
return;
|
||||
}
|
||||
} catch (BuildException e) {return;}
|
||||
|
||||
|
||||
// Figure out if there is a listener for this change
|
||||
IResource resource = config.getOwner();
|
||||
List listeners = (List) getBuildModelListeners().get(resource);
|
||||
|
@ -1310,14 +1292,10 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
final Shell shell = window.getShell();
|
||||
if (shell != null) {
|
||||
final String exceptionMsg = err.getMessage();
|
||||
shell.getDisplay().syncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MessageDialog.openError(shell,
|
||||
shell.getDisplay()
|
||||
.syncExec(() -> MessageDialog.openError(shell,
|
||||
ManagedMakeMessages.getResourceString("ManagedBuildManager.error.write_failed_title"), //$NON-NLS-1$
|
||||
ManagedMakeMessages.getFormattedString(MANIFEST_ERROR_WRITE_FAILED, exceptionMsg));
|
||||
}
|
||||
});
|
||||
ManagedMakeMessages.getFormattedString(MANIFEST_ERROR_WRITE_FAILED, exceptionMsg)));
|
||||
}
|
||||
}
|
||||
// If we return an honest status when the operation fails, there are instances when the UI behavior
|
||||
|
@ -1385,10 +1363,10 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
try {
|
||||
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||
Document doc = builder.newDocument();
|
||||
|
||||
|
||||
// Get the build information for the project
|
||||
ManagedBuildInfo buildInfo = (ManagedBuildInfo) getBuildInfo(project);
|
||||
|
||||
|
||||
// Save the build info
|
||||
if (buildInfo != null &&
|
||||
!buildInfo.isReadOnly() &&
|
||||
|
@ -1403,7 +1381,7 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
Element rootElement = doc.createElement(ROOT_NODE_NAME);
|
||||
doc.appendChild(rootElement);
|
||||
buildInfo.serialize(doc, rootElement);
|
||||
|
||||
|
||||
// Transform the document to something we can save in a file
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
Transformer transformer = TransformerFactory.newInstance().newTransformer();
|
||||
|
@ -1413,11 +1391,11 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
DOMSource source = new DOMSource(doc);
|
||||
StreamResult result = new StreamResult(stream);
|
||||
transformer.transform(source, result);
|
||||
|
||||
|
||||
// Save the document
|
||||
IFile projectFile = project.getFile(SETTINGS_FILE_NAME);
|
||||
String utfString = stream.toString("UTF-8"); //$NON-NLS-1$
|
||||
|
||||
|
||||
if (projectFile.exists()) {
|
||||
if (projectFile.isReadOnly()) {
|
||||
// If we are not running headless, and there is a UI Window around, grab it
|
||||
|
@ -1451,7 +1429,7 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
} else {
|
||||
projectFile.create(new ByteArrayInputStream(utfString.getBytes("UTF-8")), IResource.FORCE, new NullProgressMonitor()); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
// Close the streams
|
||||
stream.close();
|
||||
}
|
||||
|
@ -1472,7 +1450,7 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
// Save to IFile failed
|
||||
err = e;
|
||||
}
|
||||
|
||||
|
||||
if (err != null) {
|
||||
// Put out an error message indicating that the attempted write to the .cdtbuild project file failed
|
||||
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
|
||||
|
@ -1480,7 +1458,7 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
IWorkbenchWindow windows[] = PlatformUI.getWorkbench().getWorkbenchWindows();
|
||||
window = windows[0];
|
||||
}
|
||||
|
||||
|
||||
final Shell shell = window.getShell();
|
||||
if (shell != null) {
|
||||
final String exceptionMsg = err.getMessage();
|
||||
|
@ -1558,9 +1536,9 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
for (int i=0; i < configs.length; i++) {
|
||||
ManagedBuildManager.performValueHandlerEvent(configs[i], IManagedOptionValueHandler.EVENT_CLOSE);
|
||||
}
|
||||
|
||||
|
||||
info.setValid(false);
|
||||
|
||||
|
||||
try {
|
||||
resource.setSessionProperty(buildInfoProperty, null);
|
||||
} catch (CoreException e) {
|
||||
|
@ -1841,7 +1819,7 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
return Status.OK_STATUS;
|
||||
/*
|
||||
ManagedBuildInfo buildInfo = null;
|
||||
|
||||
|
||||
// Get the build info associated with this project for this session
|
||||
try {
|
||||
buildInfo = findBuildInfo(resource.getProject(), true);
|
||||
|
@ -2127,15 +2105,11 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
final Shell shell = window.getShell();
|
||||
final String errMsg = ManagedMakeMessages.getFormattedString(MANIFEST_VERSION_ERROR,
|
||||
extension.getUniqueIdentifier());
|
||||
shell.getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MessageDialog.openError(shell,
|
||||
shell.getDisplay()
|
||||
.asyncExec(() -> MessageDialog.openError(shell,
|
||||
ManagedMakeMessages.getResourceString(
|
||||
"ManagedBuildManager.error.manifest_load_failed_title"), //$NON-NLS-1$
|
||||
errMsg);
|
||||
}
|
||||
});
|
||||
errMsg));
|
||||
} else {
|
||||
// Get the "configuraton elements" defined in the plugin.xml file.
|
||||
// Note that these "configuration elements" are not related to the
|
||||
|
@ -2755,7 +2729,7 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
} catch (Exception e) {
|
||||
// TODO: Issue error reagarding not being able to load the project file (.cdtbuild)
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
// Check if the project needs its container initialized
|
||||
initBuildInfoContainer(buildInfo);
|
||||
|
@ -2837,7 +2811,7 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
*/
|
||||
/* synchronized private static ManagedBuildInfo findBuildInfoSynchronized(IProject project, boolean forceLoad) {
|
||||
ManagedBuildInfo buildInfo = null;
|
||||
|
||||
|
||||
// Check if there is any build info associated with this project for this session
|
||||
try {
|
||||
buildInfo = (ManagedBuildInfo)project.getSessionProperty(buildInfoProperty);
|
||||
|
@ -2848,7 +2822,7 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
} catch (CoreException e) {
|
||||
// return null;
|
||||
}
|
||||
|
||||
|
||||
if(buildInfo == null && forceLoad){
|
||||
// Make sure the extension information is loaded first
|
||||
try {
|
||||
|
@ -2857,11 +2831,11 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Check weather getBuildInfo is called from converter
|
||||
buildInfo = UpdateManagedProjectManager.getConvertedManagedBuildInfo(project);
|
||||
|
||||
|
||||
// Nothing in session store, so see if we can load it from cdtbuild
|
||||
if (buildInfo == null) {
|
||||
try {
|
||||
|
@ -2878,7 +2852,7 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
IWorkbenchWindow windows[] = PlatformUI.getWorkbench().getWorkbenchWindows();
|
||||
window = windows[0];
|
||||
}
|
||||
|
||||
|
||||
final Shell shell = window.getShell();
|
||||
final String exceptionMsg = e.getMessage();
|
||||
//using syncExec could cause a dead-lock
|
||||
|
@ -2892,7 +2866,7 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
}
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
if (buildInfo != null && !buildInfo.isContainerInited()) {
|
||||
// NOTE: If this is called inside the above rule, then an IllegalArgumentException can
|
||||
// occur when the CDT project file is saved - it uses the Workspace Root as the scheduling rule.
|
||||
|
@ -2906,7 +2880,7 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return buildInfo;
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -23,8 +23,6 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.ICDescriptor;
|
||||
import org.eclipse.cdt.core.ICDescriptorOperation;
|
||||
import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.IPathEntry;
|
||||
|
@ -58,7 +56,6 @@ import org.eclipse.core.resources.IContainer;
|
|||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IProjectDescription;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IResourceVisitor;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
|
@ -269,17 +266,14 @@ public class ProjectConverter implements ICProjectConverter {
|
|||
|
||||
final Shell shell = window.getShell();
|
||||
final boolean[] answer = new boolean[1];
|
||||
shell.getDisplay().syncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Object ob = PROPS.getProperty(rc, id);
|
||||
if (multiple || ob == null) {
|
||||
PROPS.setProperty(rc, id, Boolean.TRUE);
|
||||
answer[0] = MessageDialog.openQuestion(shell, title, message);
|
||||
PROPS.setProperty(rc, id, answer[0] ? Boolean.TRUE : Boolean.FALSE);
|
||||
} else {
|
||||
answer[0] = ((Boolean) ob).booleanValue();
|
||||
}
|
||||
shell.getDisplay().syncExec(() -> {
|
||||
Object ob = PROPS.getProperty(rc, id);
|
||||
if (multiple || ob == null) {
|
||||
PROPS.setProperty(rc, id, Boolean.TRUE);
|
||||
answer[0] = MessageDialog.openQuestion(shell, title, message);
|
||||
PROPS.setProperty(rc, id, answer[0] ? Boolean.TRUE : Boolean.FALSE);
|
||||
} else {
|
||||
answer[0] = ((Boolean) ob).booleanValue();
|
||||
}
|
||||
});
|
||||
return answer[0];
|
||||
|
@ -294,13 +288,10 @@ public class ProjectConverter implements ICProjectConverter {
|
|||
}
|
||||
|
||||
final Shell shell = window.getShell();
|
||||
shell.getDisplay().syncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (multiple || PROPS.getProperty(rc, id) == null) {
|
||||
PROPS.setProperty(rc, id, Boolean.TRUE);
|
||||
MessageDialog.openInformation(shell, title, message);
|
||||
}
|
||||
shell.getDisplay().syncExec(() -> {
|
||||
if (multiple || PROPS.getProperty(rc, id) == null) {
|
||||
PROPS.setProperty(rc, id, Boolean.TRUE);
|
||||
MessageDialog.openInformation(shell, title, message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -311,42 +302,31 @@ public class ProjectConverter implements ICProjectConverter {
|
|||
monitor = new NullProgressMonitor();
|
||||
|
||||
CCorePlugin.getDefault().getCDescriptorManager().runDescriptorOperation(project, des,
|
||||
new ICDescriptorOperation() {
|
||||
(descriptor, monitor1) -> {
|
||||
final IMakeTargetManager mngr = MakeCorePlugin.getDefault().getTargetManager();
|
||||
|
||||
@Override
|
||||
public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException {
|
||||
final IMakeTargetManager mngr = MakeCorePlugin.getDefault().getTargetManager();
|
||||
project.accept(resource -> {
|
||||
if (resource.getType() == IResource.FILE)
|
||||
return false;
|
||||
|
||||
project.accept(new IResourceVisitor() {
|
||||
try {
|
||||
IContainer cr = (IContainer) resource;
|
||||
IMakeTarget targets[] = mngr.getTargets(cr);
|
||||
for (int i = 0; i < targets.length; i++) {
|
||||
IMakeTarget t = targets[i];
|
||||
if (!OLD_MAKE_TARGET_BUIDER_ID.equals(t.getTargetBuilderID()))
|
||||
continue;
|
||||
|
||||
@Override
|
||||
public boolean visit(IResource resource) throws CoreException {
|
||||
if (resource.getType() == IResource.FILE)
|
||||
return false;
|
||||
|
||||
try {
|
||||
IContainer cr = (IContainer) resource;
|
||||
IMakeTarget targets[] = mngr.getTargets(cr);
|
||||
for (int i = 0; i < targets.length; i++) {
|
||||
IMakeTarget t = targets[i];
|
||||
if (!OLD_MAKE_TARGET_BUIDER_ID.equals(t.getTargetBuilderID()))
|
||||
continue;
|
||||
|
||||
IMakeTarget newT = mngr.createTarget(project, t.getName(),
|
||||
NEW_MAKE_TARGET_BUIDER_ID);
|
||||
copySettings(t, newT);
|
||||
mngr.removeTarget(t);
|
||||
mngr.addTarget(cr, newT);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
ManagedBuilderCorePlugin.log(e);
|
||||
}
|
||||
return true;
|
||||
IMakeTarget newT = mngr.createTarget(project, t.getName(), NEW_MAKE_TARGET_BUIDER_ID);
|
||||
copySettings(t, newT);
|
||||
mngr.removeTarget(t);
|
||||
mngr.addTarget(cr, newT);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
} catch (CoreException e) {
|
||||
ManagedBuilderCorePlugin.log(e);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}, monitor);
|
||||
}
|
||||
|
||||
|
@ -541,32 +521,27 @@ public class ProjectConverter implements ICProjectConverter {
|
|||
}
|
||||
|
||||
final IWorkspace wsp = ResourcesPlugin.getWorkspace();
|
||||
wsp.run(new IWorkspaceRunnable() {
|
||||
wsp.run((IWorkspaceRunnable) monitor1 -> {
|
||||
project.setDescription(eDes, monitor1);
|
||||
CCorePlugin.getDefault().setProjectDescription(project, newDes);
|
||||
Job job = new Job(DataProviderMessages.getString("ProjectConverter.7")) { //$NON-NLS-1$
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
project.setDescription(eDes, monitor);
|
||||
CCorePlugin.getDefault().setProjectDescription(project, newDes);
|
||||
Job job = new Job(DataProviderMessages.getString("ProjectConverter.7")) { //$NON-NLS-1$
|
||||
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
try {
|
||||
ICProjectDescription des = CCorePlugin.getDefault().getProjectDescription(project);
|
||||
convertMakeTargetInfo(project, des, monitor);
|
||||
CCorePlugin.getDefault().setProjectDescription(project, des);
|
||||
} catch (CoreException e) {
|
||||
return e.getStatus();
|
||||
}
|
||||
return Status.OK_STATUS;
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
try {
|
||||
ICProjectDescription des = CCorePlugin.getDefault().getProjectDescription(project);
|
||||
convertMakeTargetInfo(project, des, monitor);
|
||||
CCorePlugin.getDefault().setProjectDescription(project, des);
|
||||
} catch (CoreException e) {
|
||||
return e.getStatus();
|
||||
}
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
job.setRule(wsp.getRoot());
|
||||
job.schedule();
|
||||
}
|
||||
};
|
||||
|
||||
job.setRule(wsp.getRoot());
|
||||
job.schedule();
|
||||
}, wsp.getRoot(), IWorkspace.AVOID_UPDATE, monitor);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -48,7 +48,6 @@ import org.eclipse.swt.layout.GridData;
|
|||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
@ -98,13 +97,10 @@ public class ElementSelectionDialog extends TypeSelectionDialog {
|
|||
if (elements != null && !monitor.isCanceled()) {
|
||||
final Shell shell = getShell();
|
||||
if (shell != null && !shell.isDisposed()) {
|
||||
Runnable update = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!shell.isDisposed() && !monitor.isCanceled()) {
|
||||
setListElements(elements);
|
||||
updateOkState();
|
||||
}
|
||||
Runnable update = () -> {
|
||||
if (!shell.isDisposed() && !monitor.isCanceled()) {
|
||||
setListElements(elements);
|
||||
updateOkState();
|
||||
}
|
||||
};
|
||||
shell.getDisplay().asyncExec(update);
|
||||
|
@ -132,12 +128,9 @@ public class ElementSelectionDialog extends TypeSelectionDialog {
|
|||
fDone = true;
|
||||
final Shell shell = getShell();
|
||||
if (shell != null && !shell.isDisposed()) {
|
||||
Runnable update = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!shell.isDisposed() && fDone) {
|
||||
fMonitor.done();
|
||||
}
|
||||
Runnable update = () -> {
|
||||
if (!shell.isDisposed() && fDone) {
|
||||
fMonitor.done();
|
||||
}
|
||||
};
|
||||
shell.getDisplay().asyncExec(update);
|
||||
|
@ -149,13 +142,10 @@ public class ElementSelectionDialog extends TypeSelectionDialog {
|
|||
fDone = false;
|
||||
final Shell shell = getShell();
|
||||
if (shell != null && !shell.isDisposed()) {
|
||||
Runnable update = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!shell.isDisposed() && !fDone) {
|
||||
fMonitor.beginTask(OpenTypeMessages.ElementSelectionDialog_UpdateElementsJob_inProgress,
|
||||
IProgressMonitor.UNKNOWN);
|
||||
}
|
||||
Runnable update = () -> {
|
||||
if (!shell.isDisposed() && !fDone) {
|
||||
fMonitor.beginTask(OpenTypeMessages.ElementSelectionDialog_UpdateElementsJob_inProgress,
|
||||
IProgressMonitor.UNKNOWN);
|
||||
}
|
||||
};
|
||||
shell.getDisplay().asyncExec(update);
|
||||
|
@ -345,12 +335,7 @@ public class ElementSelectionDialog extends TypeSelectionDialog {
|
|||
@Override
|
||||
protected Text createFilterText(Composite parent) {
|
||||
final Text result = super.createFilterText(parent);
|
||||
Listener listener = new Listener() {
|
||||
@Override
|
||||
public void handleEvent(Event e) {
|
||||
scheduleUpdate(result.getText());
|
||||
}
|
||||
};
|
||||
Listener listener = e -> scheduleUpdate(result.getText());
|
||||
result.addListener(SWT.Modify, listener);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -111,47 +111,44 @@ public class IndentAction extends TextEditorAction {
|
|||
return;
|
||||
}
|
||||
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
IRewriteTarget target = getTextEditor().getAdapter(IRewriteTarget.class);
|
||||
if (target != null)
|
||||
target.beginCompoundChange();
|
||||
Runnable runnable = () -> {
|
||||
IRewriteTarget target = getTextEditor().getAdapter(IRewriteTarget.class);
|
||||
if (target != null)
|
||||
target.beginCompoundChange();
|
||||
|
||||
try {
|
||||
CHeuristicScanner scanner = new CHeuristicScanner(document);
|
||||
CIndenter indenter = new CIndenter(document, scanner, getCProject());
|
||||
final boolean multiLine = nLines > 1;
|
||||
boolean hasChanged = false;
|
||||
for (int i = 0; i < nLines; i++) {
|
||||
hasChanged |= indentLine(document, firstLine + i, offset, indenter, scanner, multiLine);
|
||||
}
|
||||
|
||||
// update caret position: move to new position when indenting just one line
|
||||
// keep selection when indenting multiple
|
||||
int newOffset, newLength;
|
||||
if (!fIsTabAction && multiLine) {
|
||||
newOffset = offset;
|
||||
newLength = end.getOffset() - offset;
|
||||
} else {
|
||||
newOffset = fCaretOffset;
|
||||
newLength = 0;
|
||||
}
|
||||
|
||||
// always reset the selection if anything was replaced
|
||||
// but not when we had a single line non-tab invocation
|
||||
if (newOffset != -1 && (hasChanged || newOffset != offset || newLength != length))
|
||||
selectAndReveal(newOffset, newLength);
|
||||
|
||||
} catch (BadLocationException e) {
|
||||
// will only happen on concurrent modification
|
||||
CUIPlugin.log(new Status(IStatus.ERROR, CUIPlugin.getPluginId(), IStatus.OK,
|
||||
"ConcurrentModification in IndentAction", e)); //$NON-NLS-1$
|
||||
} finally {
|
||||
document.removePosition(end);
|
||||
if (target != null)
|
||||
target.endCompoundChange();
|
||||
try {
|
||||
CHeuristicScanner scanner = new CHeuristicScanner(document);
|
||||
CIndenter indenter = new CIndenter(document, scanner, getCProject());
|
||||
final boolean multiLine = nLines > 1;
|
||||
boolean hasChanged = false;
|
||||
for (int i = 0; i < nLines; i++) {
|
||||
hasChanged |= indentLine(document, firstLine + i, offset, indenter, scanner, multiLine);
|
||||
}
|
||||
|
||||
// update caret position: move to new position when indenting just one line
|
||||
// keep selection when indenting multiple
|
||||
int newOffset, newLength;
|
||||
if (!fIsTabAction && multiLine) {
|
||||
newOffset = offset;
|
||||
newLength = end.getOffset() - offset;
|
||||
} else {
|
||||
newOffset = fCaretOffset;
|
||||
newLength = 0;
|
||||
}
|
||||
|
||||
// always reset the selection if anything was replaced
|
||||
// but not when we had a single line non-tab invocation
|
||||
if (newOffset != -1 && (hasChanged || newOffset != offset || newLength != length))
|
||||
selectAndReveal(newOffset, newLength);
|
||||
|
||||
} catch (BadLocationException e) {
|
||||
// will only happen on concurrent modification
|
||||
CUIPlugin.log(new Status(IStatus.ERROR, CUIPlugin.getPluginId(), IStatus.OK,
|
||||
"ConcurrentModification in IndentAction", e)); //$NON-NLS-1$
|
||||
} finally {
|
||||
document.removePosition(end);
|
||||
if (target != null)
|
||||
target.endCompoundChange();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -276,44 +276,35 @@ public class BuildConsoleManager implements IBuildConsoleManager, IResourceChang
|
|||
fName = name;
|
||||
fContextMenuId = contextId;
|
||||
|
||||
runUI(new Runnable() {
|
||||
runUI(() -> {
|
||||
// add console to the Console view
|
||||
fConsole = createBuildConsole(fName, fContextMenuId, iconUrl);
|
||||
ConsolePlugin.getDefault().getConsoleManager()
|
||||
.addConsoles(new org.eclipse.ui.console.IConsole[] { fConsole });
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Runnable#run()
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
// add console to the Console view
|
||||
fConsole = createBuildConsole(fName, fContextMenuId, iconUrl);
|
||||
ConsolePlugin.getDefault().getConsoleManager()
|
||||
.addConsoles(new org.eclipse.ui.console.IConsole[] { fConsole });
|
||||
|
||||
infoStream.setConsole(fConsole);
|
||||
infoColor = createColor(CUIPlugin.getStandardDisplay(),
|
||||
BuildConsolePreferencePage.PREF_BUILDCONSOLE_INFO_COLOR);
|
||||
infoStream.setColor(infoColor);
|
||||
outputStream.setConsole(fConsole);
|
||||
outputColor = createColor(CUIPlugin.getStandardDisplay(),
|
||||
BuildConsolePreferencePage.PREF_BUILDCONSOLE_OUTPUT_COLOR);
|
||||
outputStream.setColor(outputColor);
|
||||
errorStream.setConsole(fConsole);
|
||||
errorColor = createColor(CUIPlugin.getStandardDisplay(),
|
||||
BuildConsolePreferencePage.PREF_BUILDCONSOLE_ERROR_COLOR);
|
||||
errorStream.setColor(errorColor);
|
||||
backgroundColor = createBackgroundColor(CUIPlugin.getStandardDisplay(),
|
||||
BuildConsolePreferencePage.PREF_BUILDCONSOLE_BACKGROUND_COLOR);
|
||||
fConsole.setBackground(backgroundColor);
|
||||
problemHighlightedColor = createColor(CUIPlugin.getStandardDisplay(),
|
||||
BuildConsolePreferencePage.PREF_BUILDCONSOLE_PROBLEM_HIGHLIGHTED_COLOR);
|
||||
problemErrorBackgroundColor = createBackgroundColor(CUIPlugin.getStandardDisplay(),
|
||||
BuildConsolePreferencePage.PREF_BUILDCONSOLE_PROBLEM_BACKGROUND_COLOR);
|
||||
problemWarningBackgroundColor = createBackgroundColor(CUIPlugin.getStandardDisplay(),
|
||||
BuildConsolePreferencePage.PREF_BUILDCONSOLE_PROBLEM_WARNING_BACKGROUND_COLOR);
|
||||
problemInfoBackgroundColor = createBackgroundColor(CUIPlugin.getStandardDisplay(),
|
||||
BuildConsolePreferencePage.PREF_BUILDCONSOLE_PROBLEM_INFO_BACKGROUND_COLOR);
|
||||
}
|
||||
infoStream.setConsole(fConsole);
|
||||
infoColor = createColor(CUIPlugin.getStandardDisplay(),
|
||||
BuildConsolePreferencePage.PREF_BUILDCONSOLE_INFO_COLOR);
|
||||
infoStream.setColor(infoColor);
|
||||
outputStream.setConsole(fConsole);
|
||||
outputColor = createColor(CUIPlugin.getStandardDisplay(),
|
||||
BuildConsolePreferencePage.PREF_BUILDCONSOLE_OUTPUT_COLOR);
|
||||
outputStream.setColor(outputColor);
|
||||
errorStream.setConsole(fConsole);
|
||||
errorColor = createColor(CUIPlugin.getStandardDisplay(),
|
||||
BuildConsolePreferencePage.PREF_BUILDCONSOLE_ERROR_COLOR);
|
||||
errorStream.setColor(errorColor);
|
||||
backgroundColor = createBackgroundColor(CUIPlugin.getStandardDisplay(),
|
||||
BuildConsolePreferencePage.PREF_BUILDCONSOLE_BACKGROUND_COLOR);
|
||||
fConsole.setBackground(backgroundColor);
|
||||
problemHighlightedColor = createColor(CUIPlugin.getStandardDisplay(),
|
||||
BuildConsolePreferencePage.PREF_BUILDCONSOLE_PROBLEM_HIGHLIGHTED_COLOR);
|
||||
problemErrorBackgroundColor = createBackgroundColor(CUIPlugin.getStandardDisplay(),
|
||||
BuildConsolePreferencePage.PREF_BUILDCONSOLE_PROBLEM_BACKGROUND_COLOR);
|
||||
problemWarningBackgroundColor = createBackgroundColor(CUIPlugin.getStandardDisplay(),
|
||||
BuildConsolePreferencePage.PREF_BUILDCONSOLE_PROBLEM_WARNING_BACKGROUND_COLOR);
|
||||
problemInfoBackgroundColor = createBackgroundColor(CUIPlugin.getStandardDisplay(),
|
||||
BuildConsolePreferencePage.PREF_BUILDCONSOLE_PROBLEM_INFO_BACKGROUND_COLOR);
|
||||
});
|
||||
CUIPlugin.getWorkspace().addResourceChangeListener(this);
|
||||
CUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
|
||||
|
@ -382,12 +373,7 @@ public class BuildConsoleManager implements IBuildConsoleManager, IResourceChang
|
|||
if (v == null)
|
||||
return;
|
||||
Display display = Display.getDefault();
|
||||
display.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
v.getTextWidget().redraw();
|
||||
}
|
||||
});
|
||||
display.asyncExec(() -> v.getTextWidget().redraw());
|
||||
}
|
||||
|
||||
public IBuildConsoleStreamDecorator getStreamDecorator(int type) throws CoreException {
|
||||
|
|
|
@ -40,7 +40,6 @@ import org.eclipse.core.runtime.CoreException;
|
|||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.jface.action.GroupMarker;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.action.IMenuListener;
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
import org.eclipse.jface.action.IToolBarManager;
|
||||
import org.eclipse.jface.action.MenuManager;
|
||||
|
@ -59,7 +58,6 @@ import org.eclipse.jface.viewers.ISelection;
|
|||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.swt.custom.StyledText;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
|
@ -109,13 +107,7 @@ public class BuildConsolePage extends Page
|
|||
private IProject fProject;
|
||||
|
||||
// text selection listener
|
||||
private ISelectionChangedListener fTextListener = new ISelectionChangedListener() {
|
||||
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
updateSelectionDependentActions();
|
||||
}
|
||||
};
|
||||
private ISelectionChangedListener fTextListener = event -> updateSelectionDependentActions();
|
||||
|
||||
// actions
|
||||
private ClearOutputAction fClearOutputAction;
|
||||
|
@ -181,25 +173,15 @@ public class BuildConsolePage extends Page
|
|||
Control control = getControl();
|
||||
if (control != null && !control.isDisposed()) {
|
||||
Display display = control.getDisplay();
|
||||
display.asyncExec(new Runnable() {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Runnable#run()
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
display.asyncExec(() -> {
|
||||
if (isAvailable()) {
|
||||
if (event.getType() == IBuildConsoleEvent.CONSOLE_CLOSE && getProject() != event.getProject()) {
|
||||
return;
|
||||
}
|
||||
setProject(event.getProject());
|
||||
if (isAvailable()) {
|
||||
if (event.getType() == IBuildConsoleEvent.CONSOLE_CLOSE
|
||||
&& getProject() != event.getProject()) {
|
||||
return;
|
||||
}
|
||||
setProject(event.getProject());
|
||||
if (isAvailable()) {
|
||||
setDocument();
|
||||
getConsole().setTitle(getProject());
|
||||
}
|
||||
setDocument();
|
||||
getConsole().setTitle(getProject());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -217,13 +199,7 @@ public class BuildConsolePage extends Page
|
|||
|
||||
MenuManager manager = new MenuManager("#MessageConsole", "#MessageConsole"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
manager.setRemoveAllWhenShown(true);
|
||||
manager.addMenuListener(new IMenuListener() {
|
||||
|
||||
@Override
|
||||
public void menuAboutToShow(IMenuManager m) {
|
||||
contextMenuAboutToShow(m);
|
||||
}
|
||||
});
|
||||
manager.addMenuListener(m -> contextMenuAboutToShow(m));
|
||||
fMenu = manager.createContextMenu(getControl());
|
||||
getControl().setMenu(fMenu);
|
||||
IPageSite site = getSite();
|
||||
|
@ -272,13 +248,7 @@ public class BuildConsolePage extends Page
|
|||
IBuildConsoleStreamDecorator stream = (IBuildConsoleStreamDecorator) source;
|
||||
if (stream.getConsole().equals(getConsole()) && getControl() != null) {
|
||||
Display display = getControl().getDisplay();
|
||||
display.asyncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
getViewer().getTextWidget().redraw();
|
||||
}
|
||||
});
|
||||
display.asyncExec(() -> getViewer().getTextWidget().redraw());
|
||||
}
|
||||
} else if (property.equals(BuildConsolePreferencePage.PREF_BUILDCONSOLE_FONT)) {
|
||||
setFont(JFaceResources.getFont(BuildConsolePreferencePage.PREF_BUILDCONSOLE_FONT));
|
||||
|
|
|
@ -482,12 +482,7 @@ public class BuildConsolePartitioner
|
|||
|
||||
Display display = CUIPlugin.getStandardDisplay();
|
||||
if (display != null) {
|
||||
display.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fManager.startConsoleActivity(project);
|
||||
}
|
||||
});
|
||||
display.asyncExec(() -> fManager.startConsoleActivity(project));
|
||||
}
|
||||
|
||||
if (BuildConsolePreferencePage.isClearBuildConsole()) {
|
||||
|
|
|
@ -137,21 +137,11 @@ public class CHContentProvider extends AsyncTreeContentProvider {
|
|||
}
|
||||
|
||||
if (!IndexUI.isIndexed(index, input)) {
|
||||
getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fView.reportNotIndexed(input);
|
||||
}
|
||||
});
|
||||
getDisplay().asyncExec(() -> fView.reportNotIndexed(input));
|
||||
} else {
|
||||
element = IndexUI.attemptConvertionToHandle(index, input);
|
||||
final ICElement finalElement = element;
|
||||
getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fView.reportInputReplacement(input, finalElement);
|
||||
}
|
||||
});
|
||||
getDisplay().asyncExec(() -> fView.reportInputReplacement(input, finalElement));
|
||||
}
|
||||
ITranslationUnit tu = CModelUtil.getTranslationUnit(element);
|
||||
if (!fComputeReferencedBy && element instanceof IMethod) {
|
||||
|
|
|
@ -87,12 +87,7 @@ public class CallHierarchyUI {
|
|||
protected IStatus run(IProgressMonitor monitor) {
|
||||
final ICElement[] elems = findDefinitions(input);
|
||||
if (elems != null && elems.length > 0) {
|
||||
display.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
internalOpen(window, elems);
|
||||
}
|
||||
});
|
||||
display.asyncExec(() -> internalOpen(window, elems));
|
||||
}
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
|
@ -164,12 +159,7 @@ public class CallHierarchyUI {
|
|||
StatusLineHandler.clearStatusLine(editor.getSite());
|
||||
final ICElement[] elems = findDefinitions(project, editorInput, sel);
|
||||
if (elems.length > 0) {
|
||||
display.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
internalOpen(editor.getSite().getWorkbenchWindow(), elems);
|
||||
}
|
||||
});
|
||||
display.asyncExec(() -> internalOpen(editor.getSite().getWorkbenchWindow(), elems));
|
||||
} else {
|
||||
StatusLineHandler.showStatusLineMessage(editor.getSite(),
|
||||
CHMessages.CallHierarchyUI_openFailureMessage);
|
||||
|
|
|
@ -57,7 +57,6 @@ import org.eclipse.core.resources.IFile;
|
|||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.jface.action.IMenuListener;
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
import org.eclipse.jface.action.MenuManager;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
|
@ -66,11 +65,8 @@ import org.eclipse.jface.util.LocalSelectionTransfer;
|
|||
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||
import org.eclipse.jface.viewers.DoubleClickEvent;
|
||||
import org.eclipse.jface.viewers.IContentProvider;
|
||||
import org.eclipse.jface.viewers.IDoubleClickListener;
|
||||
import org.eclipse.jface.viewers.ILabelProvider;
|
||||
import org.eclipse.jface.viewers.IOpenListener;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.OpenEvent;
|
||||
|
@ -86,7 +82,6 @@ import org.eclipse.swt.events.KeyAdapter;
|
|||
import org.eclipse.swt.events.KeyEvent;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.swt.widgets.ScrollBar;
|
||||
|
@ -178,27 +173,22 @@ public class CView extends ViewPart
|
|||
}
|
||||
};
|
||||
|
||||
private IPropertyChangeListener workingSetListener = new IPropertyChangeListener() {
|
||||
private IPropertyChangeListener workingSetListener = ev -> {
|
||||
String property = ev.getProperty();
|
||||
Object newValue = ev.getNewValue();
|
||||
Object oldValue = ev.getOldValue();
|
||||
IWorkingSet filterWorkingSet = workingSetFilter.getWorkingSet();
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent ev) {
|
||||
String property = ev.getProperty();
|
||||
Object newValue = ev.getNewValue();
|
||||
Object oldValue = ev.getOldValue();
|
||||
IWorkingSet filterWorkingSet = workingSetFilter.getWorkingSet();
|
||||
|
||||
if (property == null) {
|
||||
return;
|
||||
}
|
||||
if (IWorkingSetManager.CHANGE_WORKING_SET_REMOVE.equals(property) && oldValue == filterWorkingSet) {
|
||||
setWorkingSet(null);
|
||||
} else if (IWorkingSetManager.CHANGE_WORKING_SET_NAME_CHANGE.equals(property)
|
||||
&& newValue == filterWorkingSet) {
|
||||
updateTitle();
|
||||
} else if (IWorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE.equals(property)
|
||||
&& newValue == filterWorkingSet) {
|
||||
getViewer().refresh();
|
||||
}
|
||||
if (property == null) {
|
||||
return;
|
||||
}
|
||||
if (IWorkingSetManager.CHANGE_WORKING_SET_REMOVE.equals(property) && oldValue == filterWorkingSet) {
|
||||
setWorkingSet(null);
|
||||
} else if (IWorkingSetManager.CHANGE_WORKING_SET_NAME_CHANGE.equals(property) && newValue == filterWorkingSet) {
|
||||
updateTitle();
|
||||
} else if (IWorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE.equals(property)
|
||||
&& newValue == filterWorkingSet) {
|
||||
getViewer().refresh();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -286,16 +276,12 @@ public class CView extends ViewPart
|
|||
updateActionBars(selection);
|
||||
dragDetected = false;
|
||||
if (isLinkingEnabled()) {
|
||||
getSite().getShell().getDisplay().asyncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (dragDetected == false) {
|
||||
// only synchronize with editor when the selection is
|
||||
// not the result
|
||||
// of a drag. Fixes bug 22274.
|
||||
linkToEditor(selection);
|
||||
}
|
||||
getSite().getShell().getDisplay().asyncExec(() -> {
|
||||
if (dragDetected == false) {
|
||||
// only synchronize with editor when the selection is
|
||||
// not the result
|
||||
// of a drag. Fixes bug 22274.
|
||||
linkToEditor(selection);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -375,13 +361,7 @@ public class CView extends ViewPart
|
|||
initDrag();
|
||||
initDrop();
|
||||
|
||||
dragDetectListener = new Listener() {
|
||||
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
dragDetected = true;
|
||||
}
|
||||
};
|
||||
dragDetectListener = event -> dragDetected = true;
|
||||
viewer.getControl().addListener(SWT.DragDetect, dragDetectListener);
|
||||
|
||||
}
|
||||
|
@ -440,13 +420,7 @@ public class CView extends ViewPart
|
|||
protected void initContextMenu() {
|
||||
MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
|
||||
menuMgr.setRemoveAllWhenShown(true);
|
||||
menuMgr.addMenuListener(new IMenuListener() {
|
||||
|
||||
@Override
|
||||
public void menuAboutToShow(IMenuManager manager) {
|
||||
CView.this.fillContextMenu(manager);
|
||||
}
|
||||
});
|
||||
menuMgr.addMenuListener(manager -> CView.this.fillContextMenu(manager));
|
||||
TreeViewer viewer = getViewer();
|
||||
Menu menu = menuMgr.createContextMenu(viewer.getTree());
|
||||
viewer.getTree().setMenu(menu);
|
||||
|
@ -481,28 +455,11 @@ public class CView extends ViewPart
|
|||
* Add listeners to the viewer.
|
||||
*/
|
||||
protected void initListeners(TreeViewer viewer) {
|
||||
viewer.addDoubleClickListener(new IDoubleClickListener() {
|
||||
viewer.addDoubleClickListener(event -> handleDoubleClick(event));
|
||||
|
||||
@Override
|
||||
public void doubleClick(DoubleClickEvent event) {
|
||||
handleDoubleClick(event);
|
||||
}
|
||||
});
|
||||
viewer.addSelectionChangedListener(event -> handleSelectionChanged(event));
|
||||
|
||||
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
handleSelectionChanged(event);
|
||||
}
|
||||
});
|
||||
|
||||
viewer.addOpenListener(new IOpenListener() {
|
||||
@Override
|
||||
public void open(OpenEvent event) {
|
||||
handleOpen(event);
|
||||
}
|
||||
});
|
||||
viewer.addOpenListener(event -> handleOpen(event));
|
||||
|
||||
viewer.getControl().addKeyListener(new KeyAdapter() {
|
||||
|
||||
|
@ -1077,12 +1034,7 @@ public class CView extends ViewPart
|
|||
* Returns the <code>IShowInSource</code> for this view.
|
||||
*/
|
||||
protected IShowInSource getShowInSource() {
|
||||
return new IShowInSource() {
|
||||
@Override
|
||||
public ShowInContext getShowInContext() {
|
||||
return new ShowInContext(getViewer().getInput(), getViewer().getSelection());
|
||||
}
|
||||
};
|
||||
return () -> new ShowInContext(getViewer().getInput(), getViewer().getSelection());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -174,13 +174,10 @@ public class PasteAction extends SelectionListenerAction {
|
|||
return false;
|
||||
|
||||
final IResource[][] clipboardData = new IResource[1][];
|
||||
shell.getDisplay().syncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// clipboard must have resources or files
|
||||
ResourceTransfer resTransfer = ResourceTransfer.getInstance();
|
||||
clipboardData[0] = (IResource[]) clipboard.getContents(resTransfer);
|
||||
}
|
||||
shell.getDisplay().syncExec(() -> {
|
||||
// clipboard must have resources or files
|
||||
ResourceTransfer resTransfer = ResourceTransfer.getInstance();
|
||||
clipboardData[0] = (IResource[]) clipboard.getContents(resTransfer);
|
||||
});
|
||||
IResource[] resourceData = clipboardData[0];
|
||||
if (resourceData != null && resourceData.length > 0 && resourceData[0].getType() == IResource.PROJECT) {
|
||||
|
|
|
@ -220,12 +220,7 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus
|
|||
*/
|
||||
@Override
|
||||
public int open() {
|
||||
BusyIndicator.showWhile(null, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
access$superOpen();
|
||||
}
|
||||
});
|
||||
BusyIndicator.showWhile(null, () -> access$superOpen());
|
||||
return getReturnCode();
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,6 @@ import org.eclipse.swt.events.MouseAdapter;
|
|||
import org.eclipse.swt.events.MouseEvent;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.TraverseEvent;
|
||||
import org.eclipse.swt.events.TraverseListener;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
@ -143,12 +141,7 @@ public class TableTextCellEditor extends CellEditor {
|
|||
|
||||
private ModifyListener getModifyListener() {
|
||||
if (fModifyListener == null) {
|
||||
fModifyListener = new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
editOccured(e);
|
||||
}
|
||||
};
|
||||
fModifyListener = e -> editOccured(e);
|
||||
}
|
||||
return fModifyListener;
|
||||
}
|
||||
|
@ -227,12 +220,9 @@ public class TableTextCellEditor extends CellEditor {
|
|||
checkSelectable();
|
||||
}
|
||||
});
|
||||
text.addTraverseListener(new TraverseListener() {
|
||||
@Override
|
||||
public void keyTraversed(TraverseEvent e) {
|
||||
if (e.detail == SWT.TRAVERSE_ESCAPE || e.detail == SWT.TRAVERSE_RETURN) {
|
||||
e.doit = false;
|
||||
}
|
||||
text.addTraverseListener(e -> {
|
||||
if (e.detail == SWT.TRAVERSE_ESCAPE || e.detail == SWT.TRAVERSE_RETURN) {
|
||||
e.doit = false;
|
||||
}
|
||||
});
|
||||
// We really want a selection listener but it is not supported so we
|
||||
|
@ -249,13 +239,8 @@ public class TableTextCellEditor extends CellEditor {
|
|||
text.addFocusListener(new FocusAdapter() {
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
e.display.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// without the asyncExec, focus has not had a chance to go to the content assist proposals
|
||||
TableTextCellEditor.this.focusLost();
|
||||
}
|
||||
});
|
||||
// without the asyncExec, focus has not had a chance to go to the content assist proposals
|
||||
e.display.asyncExec(() -> TableTextCellEditor.this.focusLost());
|
||||
}
|
||||
});
|
||||
text.setFont(parent.getFont());
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.eclipse.core.resources.IProject;
|
|||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.jface.dialogs.IDialogSettings;
|
||||
|
@ -191,15 +190,11 @@ public class IncludesSymbolsPropertyPage extends PropertyPage
|
|||
getSettings().put(INDEX, fIncludesSymbolsBlock.getPageIndex());
|
||||
|
||||
Shell shell = getControl().getShell();
|
||||
IRunnableWithProgress runnable = new IRunnableWithProgress() {
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||
try {
|
||||
fIncludesSymbolsBlock.configureCProject(monitor);
|
||||
} catch (CoreException e) {
|
||||
throw new InvocationTargetException(e);
|
||||
}
|
||||
IRunnableWithProgress runnable = monitor -> {
|
||||
try {
|
||||
fIncludesSymbolsBlock.configureCProject(monitor);
|
||||
} catch (CoreException e) {
|
||||
throw new InvocationTargetException(e);
|
||||
}
|
||||
};
|
||||
IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(runnable);
|
||||
|
@ -237,17 +232,13 @@ public class IncludesSymbolsPropertyPage extends PropertyPage
|
|||
if (event.hasContentChanged()) {
|
||||
Control control = getControl();
|
||||
if (control != null && !control.isDisposed()) {
|
||||
control.getDisplay().asyncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Control control = getControl();
|
||||
if (control != null && !control.isDisposed()) {
|
||||
try {
|
||||
fIncludesSymbolsBlock.init(getCElement(), fIncludesSymbolsBlock.getRawCPath());
|
||||
} catch (CModelException e) {
|
||||
CUIPlugin.log(e);
|
||||
}
|
||||
control.getDisplay().asyncExec(() -> {
|
||||
Control control1 = getControl();
|
||||
if (control1 != null && !control1.isDisposed()) {
|
||||
try {
|
||||
fIncludesSymbolsBlock.init(getCElement(), fIncludesSymbolsBlock.getRawCPath());
|
||||
} catch (CModelException e) {
|
||||
CUIPlugin.log(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.eclipse.core.resources.IContainer;
|
|||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.jface.viewers.CheckStateChangedEvent;
|
||||
import org.eclipse.jface.viewers.CheckboxTreeViewer;
|
||||
import org.eclipse.jface.viewers.ICheckStateListener;
|
||||
import org.eclipse.jface.viewers.ILabelProvider;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
|
@ -160,23 +159,19 @@ public class MultipleFolderSelectionDialog extends SelectionStatusDialog impleme
|
|||
@Override
|
||||
public void create() {
|
||||
|
||||
BusyIndicator.showWhile(null, new Runnable() {
|
||||
BusyIndicator.showWhile(null, () -> {
|
||||
access$superCreate();
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
access$superCreate();
|
||||
fViewer.setCheckedElements(getInitialElementSelections().toArray());
|
||||
|
||||
fViewer.setCheckedElements(getInitialElementSelections().toArray());
|
||||
|
||||
fViewer.expandToLevel(2);
|
||||
if (fExisting != null) {
|
||||
for (Iterator<Object> iter = fExisting.iterator(); iter.hasNext();) {
|
||||
fViewer.reveal(iter.next());
|
||||
}
|
||||
fViewer.expandToLevel(2);
|
||||
if (fExisting != null) {
|
||||
for (Iterator<Object> iter = fExisting.iterator(); iter.hasNext();) {
|
||||
fViewer.reveal(iter.next());
|
||||
}
|
||||
|
||||
updateOKStatus();
|
||||
}
|
||||
|
||||
updateOKStatus();
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -193,13 +188,7 @@ public class MultipleFolderSelectionDialog extends SelectionStatusDialog impleme
|
|||
|
||||
fViewer.setContentProvider(fContentProvider);
|
||||
fViewer.setLabelProvider(fLabelProvider);
|
||||
fViewer.addCheckStateListener(new ICheckStateListener() {
|
||||
|
||||
@Override
|
||||
public void checkStateChanged(CheckStateChangedEvent event) {
|
||||
updateOKStatus();
|
||||
}
|
||||
});
|
||||
fViewer.addCheckStateListener(event -> updateOKStatus());
|
||||
|
||||
fViewer.setComparator(new ResourceComparator(ResourceComparator.NAME));
|
||||
if (fFilters != null) {
|
||||
|
@ -262,13 +251,7 @@ public class MultipleFolderSelectionDialog extends SelectionStatusDialog impleme
|
|||
if (fFocusElement != null) {
|
||||
treeViewer.setSelection(new StructuredSelection(fFocusElement), true);
|
||||
}
|
||||
treeViewer.addCheckStateListener(new ICheckStateListener() {
|
||||
|
||||
@Override
|
||||
public void checkStateChanged(CheckStateChangedEvent event) {
|
||||
forceExistingChecked(event);
|
||||
}
|
||||
});
|
||||
treeViewer.addCheckStateListener(event -> forceExistingChecked(event));
|
||||
|
||||
applyDialogFont(composite);
|
||||
return composite;
|
||||
|
|
|
@ -422,15 +422,11 @@ public class SourceAttachmentBlock {
|
|||
* Creates a runnable that sets the source attachment by modifying the project's classpath or updating a container.
|
||||
*/
|
||||
public IRunnableWithProgress getRunnable(final Shell shell) {
|
||||
return new IRunnableWithProgress() {
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws InvocationTargetException {
|
||||
try {
|
||||
attachSource(shell, monitor);
|
||||
} catch (CoreException e) {
|
||||
throw new InvocationTargetException(e);
|
||||
}
|
||||
return monitor -> {
|
||||
try {
|
||||
attachSource(shell, monitor);
|
||||
} catch (CoreException e) {
|
||||
throw new InvocationTargetException(e);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -475,14 +471,10 @@ public class SourceAttachmentBlock {
|
|||
|
||||
private boolean putJarOnClasspathDialog(Shell shell) {
|
||||
final boolean[] result = new boolean[1];
|
||||
shell.getDisplay().syncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
String title = CPathEntryMessages.SourceAttachmentBlock_putoncpdialog_title;
|
||||
String message = CPathEntryMessages.SourceAttachmentBlock_putoncpdialog_message;
|
||||
result[0] = MessageDialog.openQuestion(CUIPlugin.getActiveWorkbenchShell(), title, message);
|
||||
}
|
||||
shell.getDisplay().syncExec(() -> {
|
||||
String title = CPathEntryMessages.SourceAttachmentBlock_putoncpdialog_title;
|
||||
String message = CPathEntryMessages.SourceAttachmentBlock_putoncpdialog_message;
|
||||
result[0] = MessageDialog.openQuestion(CUIPlugin.getActiveWorkbenchShell(), title, message);
|
||||
});
|
||||
return result[0];
|
||||
}
|
||||
|
|
|
@ -92,14 +92,11 @@ public class FileTransferDropAdapter extends CDTViewerDropAdapter implements Tra
|
|||
// Run the import operation asynchronously.
|
||||
// Otherwise the drag source (e.g., Windows Explorer) will be blocked
|
||||
// while the operation executes. Fixes bug 35796.
|
||||
Display.getCurrent().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getShell().forceActive();
|
||||
new CopyFilesAndFoldersOperation(getShell()).copyFiles((String[]) data, target);
|
||||
// Import always performs a copy.
|
||||
event.detail = DND.DROP_COPY;
|
||||
}
|
||||
Display.getCurrent().asyncExec(() -> {
|
||||
getShell().forceActive();
|
||||
new CopyFilesAndFoldersOperation(getShell()).copyFiles((String[]) data, target);
|
||||
// Import always performs a copy.
|
||||
event.detail = DND.DROP_COPY;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -70,16 +70,13 @@ public class AddIncludeAction extends TextEditorAction {
|
|||
@Override
|
||||
public <T> T selectElement(final Collection<T> elements) {
|
||||
final Object[] result = new Object[1];
|
||||
runInUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, new LabelProvider());
|
||||
dialog.setElements(elements.toArray());
|
||||
dialog.setTitle(CEditorMessages.AddInclude_label);
|
||||
dialog.setMessage(CEditorMessages.AddInclude_description);
|
||||
if (dialog.open() == Window.OK)
|
||||
result[0] = dialog.getFirstResult();
|
||||
}
|
||||
runInUIThread(() -> {
|
||||
ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, new LabelProvider());
|
||||
dialog.setElements(elements.toArray());
|
||||
dialog.setTitle(CEditorMessages.AddInclude_label);
|
||||
dialog.setMessage(CEditorMessages.AddInclude_description);
|
||||
if (dialog.open() == Window.OK)
|
||||
result[0] = dialog.getFirstResult();
|
||||
});
|
||||
return (T) result[0];
|
||||
}
|
||||
|
|
|
@ -85,20 +85,17 @@ public class CContentOutlinerProvider extends BaseCElementContentProvider {
|
|||
*/
|
||||
public void contentUpdated() {
|
||||
if (treeViewer != null && !treeViewer.getControl().isDisposed()) {
|
||||
treeViewer.getControl().getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!treeViewer.getControl().isDisposed()) {
|
||||
if (fInitialDeltaPending) {
|
||||
fInitialDeltaPending = false;
|
||||
treeViewer.setInput(root);
|
||||
} else {
|
||||
// setting the selection here causes a secondary editor to scroll
|
||||
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=191358
|
||||
// final ISelection sel = treeViewer.getSelection();
|
||||
// treeViewer.setSelection(updateSelection(sel));
|
||||
treeViewer.refresh();
|
||||
}
|
||||
treeViewer.getControl().getDisplay().asyncExec(() -> {
|
||||
if (!treeViewer.getControl().isDisposed()) {
|
||||
if (fInitialDeltaPending) {
|
||||
fInitialDeltaPending = false;
|
||||
treeViewer.setInput(root);
|
||||
} else {
|
||||
// setting the selection here causes a secondary editor to scroll
|
||||
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=191358
|
||||
// final ISelection sel = treeViewer.getSelection();
|
||||
// treeViewer.setSelection(updateSelection(sel));
|
||||
treeViewer.refresh();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -49,7 +49,6 @@ import org.eclipse.cdt.core.model.ISourceReference;
|
|||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnitHolder;
|
||||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||
import org.eclipse.cdt.internal.core.model.ASTCache.ASTRunnable;
|
||||
import org.eclipse.cdt.internal.corext.util.CodeFormatterUtil;
|
||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
||||
|
@ -137,8 +136,6 @@ import org.eclipse.jface.text.IDocument;
|
|||
import org.eclipse.jface.text.IDocumentExtension;
|
||||
import org.eclipse.jface.text.IDocumentExtension4;
|
||||
import org.eclipse.jface.text.IDocumentListener;
|
||||
import org.eclipse.jface.text.IInformationControl;
|
||||
import org.eclipse.jface.text.IInformationControlCreator;
|
||||
import org.eclipse.jface.text.IPositionUpdater;
|
||||
import org.eclipse.jface.text.IRegion;
|
||||
import org.eclipse.jface.text.ISelectionValidator;
|
||||
|
@ -199,17 +196,13 @@ import org.eclipse.swt.custom.BusyIndicator;
|
|||
import org.eclipse.swt.custom.ST;
|
||||
import org.eclipse.swt.custom.StyledText;
|
||||
import org.eclipse.swt.custom.VerifyKeyListener;
|
||||
import org.eclipse.swt.events.HelpEvent;
|
||||
import org.eclipse.swt.events.HelpListener;
|
||||
import org.eclipse.swt.events.VerifyEvent;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.IActionBars;
|
||||
import org.eclipse.ui.IEditorActionBarContributor;
|
||||
import org.eclipse.ui.IEditorInput;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.IFileEditorInput;
|
||||
import org.eclipse.ui.IPageLayout;
|
||||
import org.eclipse.ui.IPartService;
|
||||
|
@ -840,26 +833,23 @@ public class CEditor extends TextEditor
|
|||
final IDocument document = sourceViewer.getDocument();
|
||||
if (document instanceof IDocumentExtension) {
|
||||
IDocumentExtension extension = (IDocumentExtension) document;
|
||||
extension.registerPostNotificationReplace(null, new IDocumentExtension.IReplace() {
|
||||
@Override
|
||||
public void perform(IDocument d, IDocumentListener owner) {
|
||||
if ((level.fFirstPosition.isDeleted || level.fFirstPosition.length == 0)
|
||||
&& !level.fSecondPosition.isDeleted
|
||||
&& level.fSecondPosition.offset == level.fFirstPosition.offset) {
|
||||
try {
|
||||
document.replace(level.fSecondPosition.offset, level.fSecondPosition.length, null);
|
||||
} catch (BadLocationException e) {
|
||||
CUIPlugin.log(e);
|
||||
}
|
||||
extension.registerPostNotificationReplace(null, (d, owner) -> {
|
||||
if ((level.fFirstPosition.isDeleted || level.fFirstPosition.length == 0)
|
||||
&& !level.fSecondPosition.isDeleted
|
||||
&& level.fSecondPosition.offset == level.fFirstPosition.offset) {
|
||||
try {
|
||||
document.replace(level.fSecondPosition.offset, level.fSecondPosition.length, null);
|
||||
} catch (BadLocationException e1) {
|
||||
CUIPlugin.log(e1);
|
||||
}
|
||||
}
|
||||
|
||||
if (fBracketLevelStack.size() == 0) {
|
||||
document.removePositionUpdater(fUpdater);
|
||||
try {
|
||||
document.removePositionCategory(CATEGORY);
|
||||
} catch (BadPositionCategoryException e) {
|
||||
CUIPlugin.log(e);
|
||||
}
|
||||
if (fBracketLevelStack.size() == 0) {
|
||||
document.removePositionUpdater(fUpdater);
|
||||
try {
|
||||
document.removePositionCategory(CATEGORY);
|
||||
} catch (BadPositionCategoryException e2) {
|
||||
CUIPlugin.log(e2);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1590,12 +1580,7 @@ public class CEditor extends TextEditor
|
|||
ce = null;
|
||||
}
|
||||
final ISelection selection = ce != null ? new StructuredSelection(ce) : null;
|
||||
return (T) new IShowInSource() {
|
||||
@Override
|
||||
public ShowInContext getShowInContext() {
|
||||
return new ShowInContext(getEditorInput(), selection);
|
||||
}
|
||||
};
|
||||
return (T) (IShowInSource) () -> new ShowInContext(getEditorInput(), selection);
|
||||
} else if (adapterClass.isAssignableFrom(ProjectionAnnotationModel.class)) {
|
||||
if (fProjectionSupport != null) {
|
||||
T adapter = fProjectionSupport.getAdapter(getSourceViewer(), adapterClass);
|
||||
|
@ -1764,13 +1749,10 @@ public class CEditor extends TextEditor
|
|||
if (isEnableScalablilityMode()) {
|
||||
if (PreferenceConstants.SCALABILITY_RECONCILER.equals(property)
|
||||
|| PreferenceConstants.SCALABILITY_SYNTAX_COLOR.equals(property)) {
|
||||
BusyIndicator.showWhile(getSite().getShell().getDisplay(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setOutlinePageInput(fOutlinePage, getEditorInput());
|
||||
asv.unconfigure();
|
||||
asv.configure(getSourceViewerConfiguration());
|
||||
}
|
||||
BusyIndicator.showWhile(getSite().getShell().getDisplay(), () -> {
|
||||
setOutlinePageInput(fOutlinePage, getEditorInput());
|
||||
asv.unconfigure();
|
||||
asv.configure(getSourceViewerConfiguration());
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
@ -2525,19 +2507,16 @@ public class CEditor extends TextEditor
|
|||
|
||||
// bug 291008 - register custom help listener
|
||||
final IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
|
||||
parent.addHelpListener(new HelpListener() {
|
||||
@Override
|
||||
public void helpRequested(HelpEvent e) {
|
||||
IContextProvider provider = CEditor.this.getAdapter(IContextProvider.class);
|
||||
if (provider != null) {
|
||||
IContext context = provider.getContext(CEditor.this);
|
||||
if (context != null) {
|
||||
helpSystem.displayHelp(context);
|
||||
return;
|
||||
}
|
||||
parent.addHelpListener(e -> {
|
||||
IContextProvider provider = CEditor.this.getAdapter(IContextProvider.class);
|
||||
if (provider != null) {
|
||||
IContext context = provider.getContext(CEditor.this);
|
||||
if (context != null) {
|
||||
helpSystem.displayHelp(context);
|
||||
return;
|
||||
}
|
||||
helpSystem.displayHelp(ICHelpContextIds.CEDITOR_VIEW);
|
||||
}
|
||||
helpSystem.displayHelp(ICHelpContextIds.CEDITOR_VIEW);
|
||||
});
|
||||
|
||||
fEditorSelectionChangedListener = new EditorSelectionChangedListener();
|
||||
|
@ -2832,12 +2811,8 @@ public class CEditor extends TextEditor
|
|||
fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error"); //$NON-NLS-1$
|
||||
fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning"); //$NON-NLS-1$
|
||||
fProjectionSupport.addSummarizableAnnotationType("org.eclipse.search.results"); //$NON-NLS-1$
|
||||
fProjectionSupport.setHoverControlCreator(new IInformationControlCreator() {
|
||||
@Override
|
||||
public IInformationControl createInformationControl(Shell shell) {
|
||||
return new SourceViewerInformationControl(shell, false, getOrientation(), null);
|
||||
}
|
||||
});
|
||||
fProjectionSupport.setHoverControlCreator(
|
||||
shell -> new SourceViewerInformationControl(shell, false, getOrientation(), null));
|
||||
fProjectionSupport.install();
|
||||
|
||||
fProjectionModelUpdater = CUIPlugin.getDefault().getFoldingStructureProviderRegistry()
|
||||
|
@ -3467,24 +3442,16 @@ public class CEditor extends TextEditor
|
|||
protected void installOccurrencesFinder(boolean forceUpdate) {
|
||||
fMarkOccurrenceAnnotations = true;
|
||||
|
||||
fPostSelectionListenerWithAST = new ISelectionListenerWithAST() {
|
||||
@Override
|
||||
public void selectionChanged(IEditorPart part, ITextSelection selection, IASTTranslationUnit astRoot) {
|
||||
updateOccurrenceAnnotations(selection, astRoot);
|
||||
}
|
||||
};
|
||||
fPostSelectionListenerWithAST = (part, selection, astRoot) -> updateOccurrenceAnnotations(selection, astRoot);
|
||||
SelectionListenerWithASTManager.getDefault().addListener(this, fPostSelectionListenerWithAST);
|
||||
if (forceUpdate && getSelectionProvider() != null) {
|
||||
ICElement inputCElement = getInputCElement();
|
||||
if (inputCElement instanceof ITranslationUnit) {
|
||||
fForcedMarkOccurrencesSelection = getSelectionProvider().getSelection();
|
||||
ASTProvider.getASTProvider().runOnAST(inputCElement, ASTProvider.WAIT_NO, getProgressMonitor(),
|
||||
new ASTRunnable() {
|
||||
@Override
|
||||
public IStatus runOnAST(ILanguage lang, IASTTranslationUnit ast) throws CoreException {
|
||||
updateOccurrenceAnnotations((ITextSelection) fForcedMarkOccurrencesSelection, ast);
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
(lang, ast) -> {
|
||||
updateOccurrenceAnnotations((ITextSelection) fForcedMarkOccurrencesSelection, ast);
|
||||
return Status.OK_STATUS;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -3675,13 +3642,10 @@ public class CEditor extends TextEditor
|
|||
ICElement inputCElement = getInputCElement();
|
||||
if (provideAST && inputCElement instanceof ITranslationUnit) {
|
||||
ASTProvider.getASTProvider().runOnAST(inputCElement, ASTProvider.WAIT_ACTIVE_ONLY, getProgressMonitor(),
|
||||
new ASTRunnable() {
|
||||
@Override
|
||||
public IStatus runOnAST(ILanguage lang, IASTTranslationUnit ast) throws CoreException {
|
||||
if (ast != null)
|
||||
fOverrideIndicatorManager.reconciled(ast, true, getProgressMonitor());
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
(lang, ast) -> {
|
||||
if (ast != null)
|
||||
fOverrideIndicatorManager.reconciled(ast, true, getProgressMonitor());
|
||||
return Status.OK_STATUS;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,12 +108,7 @@ public class CEditorErrorTickUpdater implements IProblemChangedListener {
|
|||
private void postImageChange(final Image newImage) {
|
||||
Shell shell = fCEditor.getEditorSite().getShell();
|
||||
if (shell != null && !shell.isDisposed()) {
|
||||
shell.getDisplay().syncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fCEditor.updatedTitleImage(newImage);
|
||||
}
|
||||
});
|
||||
shell.getDisplay().syncExec(() -> fCEditor.updatedTitleImage(newImage));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -249,14 +249,11 @@ public class DefaultBinaryFileEditor extends AbstractTextEditor implements IReso
|
|||
}
|
||||
|
||||
protected void refresh() {
|
||||
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
doSetInput(getEditorInput());
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.log(e);
|
||||
}
|
||||
PlatformUI.getWorkbench().getDisplay().asyncExec(() -> {
|
||||
try {
|
||||
doSetInput(getEditorInput());
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.log(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -44,12 +44,8 @@ class EclipsePreferencesAdapter implements IPreferenceStore {
|
|||
@Override
|
||||
public void preferenceChange(final IEclipsePreferences.PreferenceChangeEvent event) {
|
||||
if (Display.getCurrent() == null) {
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
firePropertyChangeEvent(event.getKey(), event.getOldValue(), event.getNewValue());
|
||||
}
|
||||
});
|
||||
Display.getDefault().asyncExec(
|
||||
() -> firePropertyChangeEvent(event.getKey(), event.getOldValue(), event.getNewValue()));
|
||||
} else {
|
||||
firePropertyChangeEvent(event.getKey(), event.getOldValue(), event.getNewValue());
|
||||
}
|
||||
|
|
|
@ -30,9 +30,7 @@ import org.eclipse.cdt.core.dom.ast.IASTPreprocessorIfndefStatement;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ILanguage;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.internal.core.model.ASTCache;
|
||||
import org.eclipse.cdt.internal.ui.LineBackgroundPainter;
|
||||
import org.eclipse.cdt.internal.ui.text.ICReconcilingListener;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
@ -108,12 +106,9 @@ public class InactiveCodeHighlighting implements ICReconcilingListener, ITextInp
|
|||
if (fTranslationUnit != null) {
|
||||
final ASTProvider astProvider = CUIPlugin.getDefault().getASTProvider();
|
||||
result = astProvider.runOnAST(fTranslationUnit, ASTProvider.WAIT_IF_OPEN, monitor,
|
||||
new ASTCache.ASTRunnable() {
|
||||
@Override
|
||||
public IStatus runOnAST(ILanguage lang, IASTTranslationUnit ast) {
|
||||
reconciled(ast, true, monitor);
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
(lang, ast) -> {
|
||||
reconciled(ast, true, monitor);
|
||||
return Status.OK_STATUS;
|
||||
});
|
||||
}
|
||||
if (monitor.isCanceled()) {
|
||||
|
@ -200,13 +195,10 @@ public class InactiveCodeHighlighting implements ICReconcilingListener, ITextInp
|
|||
return;
|
||||
}
|
||||
final List<Position> newInactiveCodePositions = collectInactiveCodePositions(ast);
|
||||
Runnable updater = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (fEditor != null && fLineBackgroundPainter != null && !fLineBackgroundPainter.isDisposed()) {
|
||||
fLineBackgroundPainter.replaceHighlightPositions(fInactiveCodePositions, newInactiveCodePositions);
|
||||
fInactiveCodePositions = newInactiveCodePositions;
|
||||
}
|
||||
Runnable updater = () -> {
|
||||
if (fEditor != null && fLineBackgroundPainter != null && !fLineBackgroundPainter.isDisposed()) {
|
||||
fLineBackgroundPainter.replaceHighlightPositions(fInactiveCodePositions, newInactiveCodePositions);
|
||||
fInactiveCodePositions = newInactiveCodePositions;
|
||||
}
|
||||
};
|
||||
if (fEditor != null) {
|
||||
|
|
|
@ -59,17 +59,14 @@ public class InteractiveHeaderChooser implements IHeaderChooser {
|
|||
// Ask the user.
|
||||
final IPath[] elemArray = headers.toArray(new IPath[headers.size()]);
|
||||
final IPath[] selectedElement = new IPath[1];
|
||||
runInUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!shell.isDisposed()) {
|
||||
ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, new LabelProvider());
|
||||
dialog.setElements(elemArray);
|
||||
dialog.setTitle(title);
|
||||
dialog.setMessage(NLS.bind(CEditorMessages.OrganizeIncludes_choose_header, bindingName));
|
||||
if (dialog.open() == Window.OK) {
|
||||
selectedElement[0] = (IPath) dialog.getFirstResult();
|
||||
}
|
||||
runInUIThread(() -> {
|
||||
if (!shell.isDisposed()) {
|
||||
ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, new LabelProvider());
|
||||
dialog.setElements(elemArray);
|
||||
dialog.setTitle(title);
|
||||
dialog.setMessage(NLS.bind(CEditorMessages.OrganizeIncludes_choose_header, bindingName));
|
||||
if (dialog.open() == Window.OK) {
|
||||
selectedElement[0] = (IPath) dialog.getFirstResult();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -343,12 +343,7 @@ public class SemanticHighlightingPresenter implements ITextPresentationListener,
|
|||
if (isCanceled())
|
||||
return null;
|
||||
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updatePresentation(textPresentation, added, removed);
|
||||
}
|
||||
};
|
||||
Runnable runnable = () -> updatePresentation(textPresentation, added, removed);
|
||||
return runnable;
|
||||
}
|
||||
|
||||
|
|
|
@ -102,12 +102,7 @@ public final class ToggleCommentAction extends TextEditorAction {
|
|||
if (shell != null && !shell.isDisposed())
|
||||
display = shell.getDisplay();
|
||||
|
||||
BusyIndicator.showWhile(display, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fOperationTarget.doOperation(operationCode);
|
||||
}
|
||||
});
|
||||
BusyIndicator.showWhile(display, () -> fOperationTarget.doOperation(operationCode));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,12 +41,7 @@ public class IBSetInputJob extends Job {
|
|||
protected IStatus run(IProgressMonitor monitor) {
|
||||
if (CCorePlugin.getIndexManager().joinIndexer(IIndexManager.FOREVER, monitor)) {
|
||||
try {
|
||||
fDisplay.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fViewPart.setInput(fInput);
|
||||
}
|
||||
});
|
||||
fDisplay.asyncExec(() -> fViewPart.setInput(fInput));
|
||||
} catch (SWTException e) {
|
||||
// display may be disposed
|
||||
}
|
||||
|
|
|
@ -55,21 +55,17 @@ import org.eclipse.core.runtime.Status;
|
|||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.action.IMenuListener;
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
import org.eclipse.jface.action.IToolBarManager;
|
||||
import org.eclipse.jface.action.MenuManager;
|
||||
import org.eclipse.jface.action.Separator;
|
||||
import org.eclipse.jface.bindings.BindingManagerEvent;
|
||||
import org.eclipse.jface.bindings.IBindingManagerListener;
|
||||
import org.eclipse.jface.dialogs.IDialogSettings;
|
||||
import org.eclipse.jface.text.IRegion;
|
||||
import org.eclipse.jface.text.Region;
|
||||
import org.eclipse.jface.util.LocalSelectionTransfer;
|
||||
import org.eclipse.jface.viewers.IOpenListener;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.OpenEvent;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.jface.viewers.TreeViewer;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
|
@ -240,23 +236,17 @@ public class IBViewPart extends ViewPart implements IShowInSource, IShowInTarget
|
|||
final ITranslationUnit alt = CoreModelUtil
|
||||
.findTranslationUnitForLocation(input.getLocation(), input.getCProject());
|
||||
if (alt != null && IndexUI.isIndexed(index, alt)) {
|
||||
display.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (fTreeViewer.getInput() == input) {
|
||||
setInput(alt);
|
||||
}
|
||||
display.asyncExec(() -> {
|
||||
if (fTreeViewer.getInput() == input) {
|
||||
setInput(alt);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
final String msg = IndexUI.getFileNotIndexedMessage(input);
|
||||
display.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (fTreeViewer.getInput() == input) {
|
||||
setMessage(msg);
|
||||
fTreeViewer.setInput(null);
|
||||
}
|
||||
display.asyncExec(() -> {
|
||||
if (fTreeViewer.getInput() == input) {
|
||||
setMessage(msg);
|
||||
fTreeViewer.setInput(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -298,16 +288,12 @@ public class IBViewPart extends ViewPart implements IShowInSource, IShowInTarget
|
|||
|
||||
bindingService = PlatformUI.getWorkbench().getService(IBindingService.class);
|
||||
if (bindingService != null) {
|
||||
bindingManagerListener = new IBindingManagerListener() {
|
||||
@Override
|
||||
public void bindingManagerChanged(BindingManagerEvent event) {
|
||||
if (event.isActiveBindingsChanged()) {
|
||||
String keyBinding = bindingService
|
||||
.getBestActiveBindingFormattedFor(IWorkbenchCommandConstants.EDIT_DELETE);
|
||||
if (keyBinding != null) {
|
||||
fRemoveFromViewAction
|
||||
.setText(IBMessages.IBViewPart_RemoveFromView_label + '\t' + keyBinding);
|
||||
}
|
||||
bindingManagerListener = event -> {
|
||||
if (event.isActiveBindingsChanged()) {
|
||||
String keyBinding = bindingService
|
||||
.getBestActiveBindingFormattedFor(IWorkbenchCommandConstants.EDIT_DELETE);
|
||||
if (keyBinding != null) {
|
||||
fRemoveFromViewAction.setText(IBMessages.IBViewPart_RemoveFromView_label + '\t' + keyBinding);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -435,12 +421,7 @@ public class IBViewPart extends ViewPart implements IShowInSource, IShowInTarget
|
|||
private void createContextMenu() {
|
||||
MenuManager manager = new MenuManager();
|
||||
manager.setRemoveAllWhenShown(true);
|
||||
manager.addMenuListener(new IMenuListener() {
|
||||
@Override
|
||||
public void menuAboutToShow(IMenuManager m) {
|
||||
onContextMenuAboutToShow(m);
|
||||
}
|
||||
});
|
||||
manager.addMenuListener(m -> onContextMenuAboutToShow(m));
|
||||
Menu menu = manager.createContextMenu(fTreeViewer.getControl());
|
||||
fTreeViewer.getControl().setMenu(menu);
|
||||
IWorkbenchPartSite site = getSite();
|
||||
|
@ -461,12 +442,7 @@ public class IBViewPart extends ViewPart implements IShowInSource, IShowInTarget
|
|||
fTreeViewer.setContentProvider(fContentProvider);
|
||||
fTreeViewer.setLabelProvider(fLabelProvider);
|
||||
fTreeViewer.setAutoExpandLevel(2);
|
||||
fTreeViewer.addOpenListener(new IOpenListener() {
|
||||
@Override
|
||||
public void open(OpenEvent event) {
|
||||
onShowInclude(event.getSelection());
|
||||
}
|
||||
});
|
||||
fTreeViewer.addOpenListener(event -> onShowInclude(event.getSelection()));
|
||||
}
|
||||
|
||||
private void createInfoPage() {
|
||||
|
|
|
@ -48,9 +48,6 @@ import org.eclipse.jface.action.IMenuManager;
|
|||
import org.eclipse.jface.action.IToolBarManager;
|
||||
import org.eclipse.jface.action.MenuManager;
|
||||
import org.eclipse.jface.action.Separator;
|
||||
import org.eclipse.jface.viewers.DoubleClickEvent;
|
||||
import org.eclipse.jface.viewers.IDoubleClickListener;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.jface.viewers.TreeViewer;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
|
@ -331,12 +328,7 @@ public class IndexView extends ViewPart implements PDOM.IListener, IElementChang
|
|||
getSite().registerContextMenu(menuMgr, viewer);
|
||||
|
||||
getSite().setSelectionProvider(viewer);
|
||||
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
handleSelectionChanged(event);
|
||||
}
|
||||
});
|
||||
viewer.addSelectionChangedListener(event -> handleSelectionChanged(event));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -367,12 +359,7 @@ public class IndexView extends ViewPart implements PDOM.IListener, IElementChang
|
|||
private void hookContextMenu() {
|
||||
MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
|
||||
menuMgr.setRemoveAllWhenShown(true);
|
||||
menuMgr.addMenuListener(new IMenuListener() {
|
||||
@Override
|
||||
public void menuAboutToShow(IMenuManager manager) {
|
||||
IndexView.this.fillContextMenu(manager);
|
||||
}
|
||||
});
|
||||
menuMgr.addMenuListener(manager -> IndexView.this.fillContextMenu(manager));
|
||||
Menu menu = menuMgr.createContextMenu(viewer.getControl());
|
||||
viewer.getControl().setMenu(menu);
|
||||
getSite().registerContextMenu(menuMgr, viewer);
|
||||
|
@ -393,12 +380,7 @@ public class IndexView extends ViewPart implements PDOM.IListener, IElementChang
|
|||
}
|
||||
|
||||
private void hookDoubleClickAction() {
|
||||
viewer.addDoubleClickListener(new IDoubleClickListener() {
|
||||
@Override
|
||||
public void doubleClick(DoubleClickEvent event) {
|
||||
openDefinitionAction.run();
|
||||
}
|
||||
});
|
||||
viewer.addDoubleClickListener(event -> openDefinitionAction.run());
|
||||
}
|
||||
|
||||
private void contributeToActionBars() {
|
||||
|
@ -426,13 +408,10 @@ public class IndexView extends ViewPart implements PDOM.IListener, IElementChang
|
|||
private void requestUpdate() {
|
||||
if (!fUpdateRequested) {
|
||||
fUpdateRequested = true;
|
||||
viewer.getControl().getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fUpdateRequested = false;
|
||||
if (!viewer.getControl().isDisposed()) {
|
||||
contentProvider.recompute();
|
||||
}
|
||||
viewer.getControl().getDisplay().asyncExec(() -> {
|
||||
fUpdateRequested = false;
|
||||
if (!viewer.getControl().isDisposed()) {
|
||||
contentProvider.recompute();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -81,33 +81,24 @@ public class ProjectLanguageMappingPropertyPage extends PropertyPage {
|
|||
|
||||
fetchWorkspaceMappings();
|
||||
fInheritedMappingWidget.createContents(group, null);
|
||||
fInheritedMappingsChangeListener = new ILanguageMappingChangeListener() {
|
||||
@Override
|
||||
public void handleLanguageMappingChangeEvent(final ILanguageMappingChangeEvent event) {
|
||||
if (event.getType() == ILanguageMappingChangeEvent.TYPE_WORKSPACE) {
|
||||
if (ProjectLanguageMappingPropertyPage.this.isControlCreated()) {
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!ProjectLanguageMappingPropertyPage.this.getControl().isDisposed()) {
|
||||
fetchWorkspaceMappings();
|
||||
fInheritedMappingWidget.refreshMappings();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if (event.getType() == ILanguageMappingChangeEvent.TYPE_PROJECT) {
|
||||
if (ProjectLanguageMappingPropertyPage.this.isControlCreated()) {
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!ProjectLanguageMappingPropertyPage.this.getControl().isDisposed()) {
|
||||
fetchMappings(event.getProject());
|
||||
fMappingWidget.refreshMappings();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
fInheritedMappingsChangeListener = event -> {
|
||||
if (event.getType() == ILanguageMappingChangeEvent.TYPE_WORKSPACE) {
|
||||
if (ProjectLanguageMappingPropertyPage.this.isControlCreated()) {
|
||||
Display.getDefault().asyncExec(() -> {
|
||||
if (!ProjectLanguageMappingPropertyPage.this.getControl().isDisposed()) {
|
||||
fetchWorkspaceMappings();
|
||||
fInheritedMappingWidget.refreshMappings();
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if (event.getType() == ILanguageMappingChangeEvent.TYPE_PROJECT) {
|
||||
if (ProjectLanguageMappingPropertyPage.this.isControlCreated()) {
|
||||
Display.getDefault().asyncExec(() -> {
|
||||
if (!ProjectLanguageMappingPropertyPage.this.getControl().isDisposed()) {
|
||||
fetchMappings(event.getProject());
|
||||
fMappingWidget.refreshMappings();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -39,11 +39,9 @@ import org.eclipse.core.resources.IResource;
|
|||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
|
||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.ui.IMemento;
|
||||
|
@ -70,46 +68,35 @@ public class CNavigatorContentProvider extends CViewContentProvider implements I
|
|||
IMemento memento = commonContentExtensionSite.getMemento();
|
||||
restoreState(memento);
|
||||
|
||||
fPropertyChangeListener = new IPropertyChangeListener() {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent event) {
|
||||
boolean refreshViewer = false;
|
||||
String property = event.getProperty();
|
||||
Object newValue = event.getNewValue();
|
||||
fPropertyChangeListener = event -> {
|
||||
boolean refreshViewer = false;
|
||||
String property = event.getProperty();
|
||||
Object newValue = event.getNewValue();
|
||||
|
||||
if (property.equals(PreferenceConstants.PREF_SHOW_CU_CHILDREN)) {
|
||||
boolean showCUChildren = newValue instanceof Boolean ? ((Boolean) newValue).booleanValue() : false;
|
||||
setProvideMembers(showCUChildren);
|
||||
refreshViewer = true;
|
||||
} else if (property.equals(PreferenceConstants.CVIEW_GROUP_INCLUDES)) {
|
||||
boolean groupIncludes = newValue instanceof Boolean ? ((Boolean) newValue).booleanValue() : false;
|
||||
setIncludesGrouping(groupIncludes);
|
||||
refreshViewer = true;
|
||||
} else if (property.equals(PreferenceConstants.CVIEW_GROUP_MACROS)) {
|
||||
boolean groupMacros = newValue instanceof Boolean ? ((Boolean) newValue).booleanValue() : false;
|
||||
setMacroGrouping(groupMacros);
|
||||
refreshViewer = true;
|
||||
}
|
||||
if (property.equals(PreferenceConstants.PREF_SHOW_CU_CHILDREN)) {
|
||||
boolean showCUChildren = newValue instanceof Boolean ? ((Boolean) newValue).booleanValue() : false;
|
||||
setProvideMembers(showCUChildren);
|
||||
refreshViewer = true;
|
||||
} else if (property.equals(PreferenceConstants.CVIEW_GROUP_INCLUDES)) {
|
||||
boolean groupIncludes = newValue instanceof Boolean ? ((Boolean) newValue).booleanValue() : false;
|
||||
setIncludesGrouping(groupIncludes);
|
||||
refreshViewer = true;
|
||||
} else if (property.equals(PreferenceConstants.CVIEW_GROUP_MACROS)) {
|
||||
boolean groupMacros = newValue instanceof Boolean ? ((Boolean) newValue).booleanValue() : false;
|
||||
setMacroGrouping(groupMacros);
|
||||
refreshViewer = true;
|
||||
}
|
||||
|
||||
if (refreshViewer && getViewer() != null) {
|
||||
getViewer().refresh();
|
||||
}
|
||||
if (refreshViewer && getViewer() != null) {
|
||||
getViewer().refresh();
|
||||
}
|
||||
};
|
||||
CUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(fPropertyChangeListener);
|
||||
|
||||
// Note that this listener listens to CCorePlugin preferences
|
||||
fPreferenceChangeListener = new IPreferenceChangeListener() {
|
||||
@Override
|
||||
public void preferenceChange(PreferenceChangeEvent event) {
|
||||
if (event.getKey().equals(CCorePreferenceConstants.SHOW_SOURCE_ROOTS_AT_TOP_LEVEL_OF_PROJECT)) {
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getViewer().refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
fPreferenceChangeListener = event -> {
|
||||
if (event.getKey().equals(CCorePreferenceConstants.SHOW_SOURCE_ROOTS_AT_TOP_LEVEL_OF_PROJECT)) {
|
||||
Display.getDefault().asyncExec(() -> getViewer().refresh());
|
||||
}
|
||||
};
|
||||
InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID).addPreferenceChangeListener(fPreferenceChangeListener);
|
||||
|
|
|
@ -33,7 +33,6 @@ import org.eclipse.core.resources.IFile;
|
|||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
||||
|
@ -114,13 +113,10 @@ public class CNavigatorDropAdapterAssistant extends CommonDropAdapterAssistant {
|
|||
// Run the import operation asynchronously.
|
||||
// Otherwise the drag source (e.g., Windows Explorer) will be blocked
|
||||
// while the operation executes. Fixes bug 35796.
|
||||
Display.getCurrent().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getShell().forceActive();
|
||||
CopyFilesAndFoldersOperation op = new CopyFilesAndFoldersOperation(getShell());
|
||||
op.copyOrLinkFiles(names, destination, dropOperation);
|
||||
}
|
||||
Display.getCurrent().asyncExec(() -> {
|
||||
getShell().forceActive();
|
||||
CopyFilesAndFoldersOperation op = new CopyFilesAndFoldersOperation(getShell());
|
||||
op.copyOrLinkFiles(names, destination, dropOperation);
|
||||
});
|
||||
} else if (event.detail == DND.DROP_COPY || event.detail == DND.DROP_LINK) {
|
||||
return performResourceCopy(dropAdapter, getShell(), resources);
|
||||
|
@ -363,14 +359,11 @@ public class CNavigatorDropAdapterAssistant extends CommonDropAdapterAssistant {
|
|||
}
|
||||
}
|
||||
final ICElement[] siblings = neighbours;
|
||||
IRunnableWithProgress runnable = new IRunnableWithProgress() {
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||
try {
|
||||
CoreModel.getDefault().getCModel().copy(cElements, containers, siblings, null, false, monitor);
|
||||
} catch (CModelException e) {
|
||||
throw new InvocationTargetException(e);
|
||||
}
|
||||
IRunnableWithProgress runnable = monitor -> {
|
||||
try {
|
||||
CoreModel.getDefault().getCModel().copy(cElements, containers, siblings, null, false, monitor);
|
||||
} catch (CModelException e) {
|
||||
throw new InvocationTargetException(e);
|
||||
}
|
||||
};
|
||||
run(runnable);
|
||||
|
@ -403,14 +396,11 @@ public class CNavigatorDropAdapterAssistant extends CommonDropAdapterAssistant {
|
|||
}
|
||||
}
|
||||
final ICElement[] siblings = neighbours;
|
||||
IRunnableWithProgress runnable = new IRunnableWithProgress() {
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||
try {
|
||||
CoreModel.getDefault().getCModel().move(cElements, containers, siblings, null, false, monitor);
|
||||
} catch (CModelException e) {
|
||||
throw new InvocationTargetException(e);
|
||||
}
|
||||
IRunnableWithProgress runnable = monitor -> {
|
||||
try {
|
||||
CoreModel.getDefault().getCModel().move(cElements, containers, siblings, null, false, monitor);
|
||||
} catch (CModelException e) {
|
||||
throw new InvocationTargetException(e);
|
||||
}
|
||||
};
|
||||
run(runnable);
|
||||
|
|
|
@ -50,11 +50,9 @@ import org.eclipse.swt.widgets.Button;
|
|||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Link;
|
||||
import org.eclipse.swt.widgets.List;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.dialogs.PreferencesUtil;
|
||||
import org.osgi.framework.Bundle;
|
||||
|
@ -314,12 +312,9 @@ public class CEditorPreferencePage extends AbstractPreferencePage {
|
|||
String text = PreferencesMessages.CEditorPreferencePage_link;
|
||||
Link link = new Link(parent, SWT.NONE);
|
||||
link.setText(text);
|
||||
link.addListener(SWT.Selection, new Listener() {
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
String u = event.text;
|
||||
PreferencesUtil.createPreferenceDialogOn(getShell(), u, null, null);
|
||||
}
|
||||
link.addListener(SWT.Selection, event -> {
|
||||
String u = event.text;
|
||||
PreferencesUtil.createPreferenceDialogOn(getShell(), u, null, null);
|
||||
});
|
||||
// TODO replace by link-specific tooltips when
|
||||
// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=88866 gets fixed
|
||||
|
@ -364,12 +359,9 @@ public class CEditorPreferencePage extends AbstractPreferencePage {
|
|||
for (String[] element : fAppearanceColorListModel) {
|
||||
fAppearanceColorList.add(element[0]);
|
||||
}
|
||||
fAppearanceColorList.getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fAppearanceColorList.select(0);
|
||||
handleAppearanceColorListSelection();
|
||||
}
|
||||
fAppearanceColorList.getDisplay().asyncExec(() -> {
|
||||
fAppearanceColorList.select(0);
|
||||
handleAppearanceColorListSelection();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -29,9 +29,7 @@ import org.eclipse.swt.layout.GridData;
|
|||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Link;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.ui.PartInitException;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.browser.IWebBrowser;
|
||||
|
@ -98,27 +96,19 @@ public class IncludePragmasBlock extends OptionsConfigurationBlock {
|
|||
String text = PreferencesMessages.IncludePragmasBlock_description;
|
||||
Link link = new Link(parent, SWT.NONE);
|
||||
link.setText(text);
|
||||
link.addListener(SWT.Selection, new Listener() {
|
||||
@Override
|
||||
public void handleEvent(final Event event) {
|
||||
BusyIndicator.showWhile(null, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
URL url = new URL(event.text);
|
||||
IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
|
||||
IWebBrowser browser = browserSupport.getExternalBrowser();
|
||||
browser.openURL(url);
|
||||
} catch (PartInitException e) {
|
||||
// TODO(sprigogin): Should we show an error dialog?
|
||||
CUIPlugin.log(e.getStatus());
|
||||
} catch (MalformedURLException e) {
|
||||
CUIPlugin.log(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
link.addListener(SWT.Selection, event -> BusyIndicator.showWhile(null, () -> {
|
||||
try {
|
||||
URL url = new URL(event.text);
|
||||
IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
|
||||
IWebBrowser browser = browserSupport.getExternalBrowser();
|
||||
browser.openURL(url);
|
||||
} catch (PartInitException e1) {
|
||||
// TODO(sprigogin): Should we show an error dialog?
|
||||
CUIPlugin.log(e1.getStatus());
|
||||
} catch (MalformedURLException e2) {
|
||||
CUIPlugin.log(e2);
|
||||
}
|
||||
});
|
||||
}));
|
||||
// TODO replace by link-specific tooltips when
|
||||
// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=88866 is fixed
|
||||
link.setToolTipText(PreferencesMessages.IncludePragmasBlock_link_tooltip);
|
||||
|
|
|
@ -78,12 +78,7 @@ public class RefactoringExecutionHelper {
|
|||
if (status.getSeverity() >= fStopSeverity) {
|
||||
final boolean[] canceled = { false };
|
||||
if (fForked) {
|
||||
fParent.getDisplay().syncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
canceled[0] = showStatusDialog(status);
|
||||
}
|
||||
});
|
||||
fParent.getDisplay().syncExec(() -> canceled[0] = showStatusDialog(status));
|
||||
} else {
|
||||
canceled[0] = showStatusDialog(status);
|
||||
}
|
||||
|
@ -186,12 +181,7 @@ public class RefactoringExecutionHelper {
|
|||
final ISchedulingRule rule = getSchedulingRule();
|
||||
try {
|
||||
try {
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
manager.beginRule(rule, null);
|
||||
}
|
||||
};
|
||||
Runnable r = () -> manager.beginRule(rule, null);
|
||||
BusyIndicator.showWhile(fParent.getDisplay(), r);
|
||||
} catch (OperationCanceledException e) {
|
||||
throw new InterruptedException(e.getMessage());
|
||||
|
|
|
@ -172,13 +172,10 @@ public class ParameterNamesInputPage extends UserInputWizardPage {
|
|||
if (shell != null) {
|
||||
Display display = shell.getDisplay();
|
||||
if (display != null) {
|
||||
display.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Control control = translationUnitPreview.getControl();
|
||||
if (control != null && !control.isDisposed()) {
|
||||
translationUnitPreview.setPreviewText(text);
|
||||
}
|
||||
display.asyncExec(() -> {
|
||||
Control control = translationUnitPreview.getControl();
|
||||
if (control != null && !control.isDisposed()) {
|
||||
translationUnitPreview.setPreviewText(text);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -52,15 +52,11 @@ import org.eclipse.swt.custom.StyledText;
|
|||
import org.eclipse.swt.events.ControlAdapter;
|
||||
import org.eclipse.swt.events.ControlEvent;
|
||||
import org.eclipse.swt.events.ControlListener;
|
||||
import org.eclipse.swt.events.DisposeEvent;
|
||||
import org.eclipse.swt.events.DisposeListener;
|
||||
import org.eclipse.swt.events.KeyEvent;
|
||||
import org.eclipse.swt.events.KeyListener;
|
||||
import org.eclipse.swt.events.MouseAdapter;
|
||||
import org.eclipse.swt.events.MouseEvent;
|
||||
import org.eclipse.swt.events.MouseListener;
|
||||
import org.eclipse.swt.events.PaintEvent;
|
||||
import org.eclipse.swt.events.PaintListener;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.ShellAdapter;
|
||||
|
@ -102,29 +98,25 @@ public class RenameInformationPopup implements IWidgetTokenKeeper, IWidgetTokenK
|
|||
fEditor.getSite().getShell().addControlListener(this);
|
||||
viewer.addTextListener(this);
|
||||
viewer.addViewportListener(this);
|
||||
fPopup.addDisposeListener(new DisposeListener() {
|
||||
@Override
|
||||
public void widgetDisposed(DisposeEvent e) {
|
||||
fEditor.getSite().getWorkbenchWindow().getPartService()
|
||||
.removePartListener(PopupVisibilityManager.this);
|
||||
if (!textWidget.isDisposed()) {
|
||||
textWidget.removeControlListener(PopupVisibilityManager.this);
|
||||
textWidget.removeMouseListener(PopupVisibilityManager.this);
|
||||
textWidget.removeKeyListener(PopupVisibilityManager.this);
|
||||
}
|
||||
fEditor.getSite().getShell().removeControlListener(PopupVisibilityManager.this);
|
||||
viewer.removeTextListener(PopupVisibilityManager.this);
|
||||
viewer.removeViewportListener(PopupVisibilityManager.this);
|
||||
if (fMenuImage != null) {
|
||||
fMenuImage.dispose();
|
||||
fMenuImage = null;
|
||||
}
|
||||
if (fMenuManager != null) {
|
||||
fMenuManager.dispose();
|
||||
fMenuManager = null;
|
||||
}
|
||||
fRenameLinkedMode.cancel();
|
||||
fPopup.addDisposeListener(e -> {
|
||||
fEditor.getSite().getWorkbenchWindow().getPartService().removePartListener(PopupVisibilityManager.this);
|
||||
if (!textWidget.isDisposed()) {
|
||||
textWidget.removeControlListener(PopupVisibilityManager.this);
|
||||
textWidget.removeMouseListener(PopupVisibilityManager.this);
|
||||
textWidget.removeKeyListener(PopupVisibilityManager.this);
|
||||
}
|
||||
fEditor.getSite().getShell().removeControlListener(PopupVisibilityManager.this);
|
||||
viewer.removeTextListener(PopupVisibilityManager.this);
|
||||
viewer.removeViewportListener(PopupVisibilityManager.this);
|
||||
if (fMenuImage != null) {
|
||||
fMenuImage.dispose();
|
||||
fMenuImage = null;
|
||||
}
|
||||
if (fMenuManager != null) {
|
||||
fMenuManager.dispose();
|
||||
fMenuManager = null;
|
||||
}
|
||||
fRenameLinkedMode.cancel();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -324,26 +316,18 @@ public class RenameInformationPopup implements IWidgetTokenKeeper, IWidgetTokenK
|
|||
return;
|
||||
|
||||
final Shell editorShell = fEditor.getSite().getShell();
|
||||
display.asyncExec(new Runnable() {
|
||||
display.asyncExec(() -> {
|
||||
// Post to UI thread since editor shell only gets activated after popup has lost focus
|
||||
@Override
|
||||
public void run() {
|
||||
Shell activeShell = display.getActiveShell();
|
||||
if (activeShell != editorShell) {
|
||||
fRenameLinkedMode.cancel();
|
||||
}
|
||||
Shell activeShell = display.getActiveShell();
|
||||
if (activeShell != editorShell) {
|
||||
fRenameLinkedMode.cancel();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (!MAC) { // carbon and cocoa draw their own border...
|
||||
fPopup.addPaintListener(new PaintListener() {
|
||||
@Override
|
||||
public void paintControl(PaintEvent pe) {
|
||||
pe.gc.drawPolygon(getPolygon(true));
|
||||
}
|
||||
});
|
||||
fPopup.addPaintListener(pe -> pe.gc.drawPolygon(getPolygon(true)));
|
||||
}
|
||||
|
||||
UIJob delayJob = new UIJob(display, RenameMessages.RenameInformationPopup_delayJobName) {
|
||||
|
|
|
@ -55,19 +55,16 @@ public class ToggleFileCreator {
|
|||
return context.getDefaultAnswer();
|
||||
}
|
||||
final boolean[] answer = new boolean[1];
|
||||
Runnable r = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Shell shell = CUIPlugin.getDefault().getWorkbench().getWorkbenchWindows()[0].getShell();
|
||||
String functionName;
|
||||
if (context.getDeclaration() != null) {
|
||||
functionName = context.getDeclaration().getRawSignature();
|
||||
} else {
|
||||
functionName = context.getDefinition().getDeclarator().getRawSignature();
|
||||
}
|
||||
answer[0] = MessageDialog.openQuestion(shell, Messages.ToggleFileCreator_NewImplFile,
|
||||
NLS.bind(Messages.ToggleFileCreator_CreateNewFilePrompt, getNewFileName(), functionName));
|
||||
Runnable r = () -> {
|
||||
Shell shell = CUIPlugin.getDefault().getWorkbench().getWorkbenchWindows()[0].getShell();
|
||||
String functionName;
|
||||
if (context.getDeclaration() != null) {
|
||||
functionName = context.getDeclaration().getRawSignature();
|
||||
} else {
|
||||
functionName = context.getDefinition().getDeclarator().getRawSignature();
|
||||
}
|
||||
answer[0] = MessageDialog.openQuestion(shell, Messages.ToggleFileCreator_NewImplFile,
|
||||
NLS.bind(Messages.ToggleFileCreator_CreateNewFilePrompt, getNewFileName(), functionName));
|
||||
};
|
||||
PlatformUI.getWorkbench().getDisplay().syncExec(r);
|
||||
return answer[0];
|
||||
|
|
|
@ -74,7 +74,6 @@ import org.eclipse.cdt.core.index.IIndexName;
|
|||
import org.eclipse.cdt.core.index.IndexFilter;
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ICElementVisitor;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.IInclude;
|
||||
import org.eclipse.cdt.core.model.ILanguage;
|
||||
|
@ -197,14 +196,11 @@ class OpenDeclarationsJob extends Job implements ASTRunnable {
|
|||
// Search for an element in the assembly file.
|
||||
// Some things in assembly files like macro definitions are
|
||||
// modelled in the C model, so those will be found here.
|
||||
fTranslationUnit.accept(new ICElementVisitor() {
|
||||
@Override
|
||||
public boolean visit(ICElement element) throws CoreException {
|
||||
if (element.getElementName().equals(fSelectedText)) {
|
||||
elems.add(element);
|
||||
}
|
||||
return true;
|
||||
fTranslationUnit.accept(element1 -> {
|
||||
if (element1.getElementName().equals(fSelectedText)) {
|
||||
elems.add(element1);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
// Search for a binding in the index.
|
||||
|
@ -812,14 +808,11 @@ class OpenDeclarationsJob extends Job implements ASTRunnable {
|
|||
final int offset = fileloc.getNodeOffset();
|
||||
final int length = fileloc.getNodeLength();
|
||||
|
||||
runInUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
fAction.open(path, offset, length);
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.log(e);
|
||||
}
|
||||
runInUIThread(() -> {
|
||||
try {
|
||||
fAction.open(path, offset, length);
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.log(e);
|
||||
}
|
||||
});
|
||||
return true;
|
||||
|
@ -834,14 +827,11 @@ class OpenDeclarationsJob extends Job implements ASTRunnable {
|
|||
}
|
||||
|
||||
private void openInclude(IPath path) {
|
||||
runInUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
fAction.open(path, 0, 0);
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.log(e);
|
||||
}
|
||||
runInUIThread(() -> {
|
||||
try {
|
||||
fAction.open(path, 0, 0);
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.log(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -877,15 +867,11 @@ class OpenDeclarationsJob extends Job implements ASTRunnable {
|
|||
} else if (paths.size() == 1) {
|
||||
openInclude(paths.get(0));
|
||||
} else {
|
||||
runInUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
IPath selected = OpenActionUtil.selectPath(paths,
|
||||
CEditorMessages.OpenDeclarationsAction_dialog_title,
|
||||
CEditorMessages.OpenDeclarationsAction_selectMessage);
|
||||
if (selected != null) {
|
||||
openInclude(selected);
|
||||
}
|
||||
runInUIThread(() -> {
|
||||
IPath selected = OpenActionUtil.selectPath(paths, CEditorMessages.OpenDeclarationsAction_dialog_title,
|
||||
CEditorMessages.OpenDeclarationsAction_selectMessage);
|
||||
if (selected != null) {
|
||||
openInclude(selected);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -282,12 +282,7 @@ public class CReconciler extends MonoReconciler {
|
|||
CCorePlugin.getIndexManager().addIndexerStateListener(fIndexerListener);
|
||||
CCorePlugin.getIndexManager().addIndexChangeListener(fIndexerListener);
|
||||
|
||||
fTriggerReconcilerJob = new SingletonJob("Trigger Reconciler", new Runnable() { //$NON-NLS-1$
|
||||
@Override
|
||||
public void run() {
|
||||
forceReconciling();
|
||||
}
|
||||
});
|
||||
fTriggerReconcilerJob = new SingletonJob("Trigger Reconciler", () -> forceReconciling()); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -80,12 +80,7 @@ public class CColorManager implements IColorManager {
|
|||
colorTable = new HashMap<>(10);
|
||||
fDisplayTable.put(display, colorTable);
|
||||
if (fAutoDisposeOnDisplayDispose) {
|
||||
display.disposeExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
dispose(display);
|
||||
}
|
||||
});
|
||||
display.disposeExec(() -> dispose(display));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -313,24 +313,21 @@ class THHierarchyModel {
|
|||
synchronized private void onJobDone(final THGraph graph, Job job) {
|
||||
if (fJob == job) {
|
||||
fJob = null;
|
||||
fDisplay.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fGraph = graph;
|
||||
THGraphNode inputNode = fGraph.getInputNode();
|
||||
if (!fGraph.isFileIndexed()) {
|
||||
fView.setMessage(IndexUI.getFileNotIndexedMessage(fInput));
|
||||
} else if (inputNode == null) {
|
||||
fView.setMessage(Messages.THHierarchyModel_errorComputingHierarchy);
|
||||
} else {
|
||||
if (fTypeToSelect == fInput) {
|
||||
fTypeToSelect = inputNode.getElement();
|
||||
}
|
||||
fInput = inputNode.getElement();
|
||||
fDisplay.asyncExec(() -> {
|
||||
fGraph = graph;
|
||||
THGraphNode inputNode = fGraph.getInputNode();
|
||||
if (!fGraph.isFileIndexed()) {
|
||||
fView.setMessage(IndexUI.getFileNotIndexedMessage(fInput));
|
||||
} else if (inputNode == null) {
|
||||
fView.setMessage(Messages.THHierarchyModel_errorComputingHierarchy);
|
||||
} else {
|
||||
if (fTypeToSelect == fInput) {
|
||||
fTypeToSelect = inputNode.getElement();
|
||||
}
|
||||
computeNodes();
|
||||
notifyEvent(END_OF_COMPUTATION);
|
||||
fInput = inputNode.getElement();
|
||||
}
|
||||
computeNodes();
|
||||
notifyEvent(END_OF_COMPUTATION);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,12 +121,8 @@ public class TypeHierarchyUI {
|
|||
IRegion reg = new Region(sel.getOffset(), sel.getLength());
|
||||
final ICElement[] elems = findInput(project, editorInput, reg);
|
||||
if (elems != null && elems.length == 2) {
|
||||
display.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
openInViewPart(editor.getSite().getWorkbenchWindow(), elems[0], elems[1]);
|
||||
}
|
||||
});
|
||||
display.asyncExec(() -> openInViewPart(editor.getSite().getWorkbenchWindow(), elems[0],
|
||||
elems[1]));
|
||||
} else {
|
||||
StatusLineHandler.showStatusLineMessage(editor.getSite(),
|
||||
Messages.TypeHierarchyUI_OpenFailure_message);
|
||||
|
|
|
@ -60,14 +60,11 @@ public class CoreUtility {
|
|||
}
|
||||
final Object[] ret = new Object[1];
|
||||
final CoreException[] exc = new CoreException[1];
|
||||
BusyIndicator.showWhile(null, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
ret[0] = element.createExecutableExtension(classAttribute);
|
||||
} catch (CoreException e) {
|
||||
exc[0] = e;
|
||||
}
|
||||
BusyIndicator.showWhile(null, () -> {
|
||||
try {
|
||||
ret[0] = element.createExecutableExtension(classAttribute);
|
||||
} catch (CoreException e) {
|
||||
exc[0] = e;
|
||||
}
|
||||
});
|
||||
if (exc[0] != null)
|
||||
|
|
|
@ -84,11 +84,6 @@ public class ImageDescriptorRegistry {
|
|||
}
|
||||
|
||||
private void hookDisplay() {
|
||||
fDisplay.disposeExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
dispose();
|
||||
}
|
||||
});
|
||||
fDisplay.disposeExec(() -> dispose());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,42 +33,30 @@ public abstract class StatusLineHandler {
|
|||
public static void showStatusLineMessage(final IWorkbenchSite site, final String message) {
|
||||
// run the code to update the status line on the Display thread
|
||||
// this way any other thread can invoke operationNotAvailable(String)
|
||||
CUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Runnable#run()
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
IStatusLineManager statusManager = null;
|
||||
if (site instanceof IViewSite) {
|
||||
statusManager = ((IViewSite) site).getActionBars().getStatusLineManager();
|
||||
} else if (site instanceof IEditorSite) {
|
||||
statusManager = ((IEditorSite) site).getActionBars().getStatusLineManager();
|
||||
}
|
||||
if (statusManager != null)
|
||||
statusManager.setErrorMessage(message);
|
||||
CUIPlugin.getStandardDisplay().asyncExec(() -> {
|
||||
IStatusLineManager statusManager = null;
|
||||
if (site instanceof IViewSite) {
|
||||
statusManager = ((IViewSite) site).getActionBars().getStatusLineManager();
|
||||
} else if (site instanceof IEditorSite) {
|
||||
statusManager = ((IEditorSite) site).getActionBars().getStatusLineManager();
|
||||
}
|
||||
if (statusManager != null)
|
||||
statusManager.setErrorMessage(message);
|
||||
});
|
||||
}
|
||||
|
||||
public static void clearStatusLine(final IWorkbenchSite site) {
|
||||
// run the code to update the status line on the Display thread
|
||||
// this way any other thread can invoke clearStatusLine()
|
||||
CUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Runnable#run()
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
IStatusLineManager statusManager = null;
|
||||
if (site instanceof IViewSite) {
|
||||
statusManager = ((IViewSite) site).getActionBars().getStatusLineManager();
|
||||
} else if (site instanceof IEditorSite) {
|
||||
statusManager = ((IEditorSite) site).getActionBars().getStatusLineManager();
|
||||
}
|
||||
if (statusManager != null)
|
||||
statusManager.setErrorMessage(""); //$NON-NLS-1$
|
||||
CUIPlugin.getStandardDisplay().asyncExec(() -> {
|
||||
IStatusLineManager statusManager = null;
|
||||
if (site instanceof IViewSite) {
|
||||
statusManager = ((IViewSite) site).getActionBars().getStatusLineManager();
|
||||
} else if (site instanceof IEditorSite) {
|
||||
statusManager = ((IEditorSite) site).getActionBars().getStatusLineManager();
|
||||
}
|
||||
if (statusManager != null)
|
||||
statusManager.setErrorMessage(""); //$NON-NLS-1$
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -343,12 +343,7 @@ public abstract class AsyncTreeContentProvider implements ITreeContentProvider {
|
|||
if (children != null) {
|
||||
final Object[] finalChildren = children;
|
||||
fChildNodes.put(parentElement, children);
|
||||
fDisplay.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
checkForAutoExpand(finalChildren);
|
||||
}
|
||||
});
|
||||
fDisplay.asyncExec(() -> checkForAutoExpand(finalChildren));
|
||||
}
|
||||
}
|
||||
return children;
|
||||
|
|
|
@ -69,12 +69,7 @@ public class ColoredViewersManager implements IPropertyChangeListener {
|
|||
|| property.equals(JFacePreferences.DECORATIONS_COLOR) || property.equals(HIGHLIGHT_BG_COLOR_NAME)
|
||||
|| property.equals(IWorkbenchPreferenceConstants.USE_COLORED_LABELS)
|
||||
|| property.equals(HIGHLIGHT_WRITE_BG_COLOR_NAME)) {
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
refreshAllViewers();
|
||||
}
|
||||
});
|
||||
Display.getDefault().asyncExec(() -> refreshAllViewers());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,12 +74,7 @@ public class EditorOpener {
|
|||
|
||||
private static void showStatus(final IWorkbenchPartSite site, int duration, String msg) {
|
||||
StatusLineHandler.showStatusLineMessage(site, msg);
|
||||
Display.getCurrent().timerExec(duration, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
StatusLineHandler.clearStatusLine(site);
|
||||
}
|
||||
});
|
||||
Display.getCurrent().timerExec(duration, () -> StatusLineHandler.clearStatusLine(site));
|
||||
}
|
||||
|
||||
private static void selectRegion(IPath filebufferKey, IRegion region, long timestamp, IEditorPart editor) {
|
||||
|
|
|
@ -30,12 +30,9 @@ public class ExtendedTreeViewer extends TreeViewer {
|
|||
}
|
||||
|
||||
public void refresh(final Object[] elements) {
|
||||
preservingSelection(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (int i = 0; i < elements.length; i++) {
|
||||
refresh(elements[i]);
|
||||
}
|
||||
preservingSelection(() -> {
|
||||
for (int i = 0; i < elements.length; i++) {
|
||||
refresh(elements[i]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -240,12 +240,7 @@ class IndexedFilesCache implements IIndexChangeListener, IIndexerStateListener,
|
|||
fIsDirty = false;
|
||||
final IWorkbench workbench = PlatformUI.getWorkbench();
|
||||
try {
|
||||
workbench.getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
workbench.getDecoratorManager().update(DECORATOR_ID);
|
||||
}
|
||||
});
|
||||
workbench.getDisplay().asyncExec(() -> workbench.getDecoratorManager().update(DECORATOR_ID));
|
||||
} catch (SWTException e) {
|
||||
// in case the display is no longer valid
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.eclipse.core.resources.IWorkspaceRunnable;
|
|||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.OperationCanceledException;
|
||||
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.wizard.Wizard;
|
||||
|
@ -50,14 +49,11 @@ public abstract class NewElementWizard extends Wizard implements INewWizard {
|
|||
if (activePage != null) {
|
||||
final Display display = getShell().getDisplay();
|
||||
if (display != null) {
|
||||
display.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
IDE.openEditor(activePage, resource, true);
|
||||
} catch (PartInitException e) {
|
||||
CUIPlugin.log(e);
|
||||
}
|
||||
display.asyncExec(() -> {
|
||||
try {
|
||||
IDE.openEditor(activePage, resource, true);
|
||||
} catch (PartInitException e) {
|
||||
CUIPlugin.log(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -89,12 +85,7 @@ public abstract class NewElementWizard extends Wizard implements INewWizard {
|
|||
|
||||
@Override
|
||||
public boolean performFinish() {
|
||||
IWorkspaceRunnable op = new IWorkspaceRunnable() {
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
|
||||
finishPage(monitor);
|
||||
}
|
||||
};
|
||||
IWorkspaceRunnable op = monitor -> finishPage(monitor);
|
||||
try {
|
||||
getContainer().run(canRunForked(), true, new WorkbenchRunnableAdapter(op, getSchedulingRule()));
|
||||
} catch (InvocationTargetException e) {
|
||||
|
|
|
@ -18,7 +18,6 @@ import java.util.ArrayList;
|
|||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICContainer;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ICElementVisitor;
|
||||
import org.eclipse.cdt.core.model.ICModel;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
|
@ -366,15 +365,12 @@ public class SourceFileSelectionDialog extends SelectionStatusDialog {
|
|||
|
||||
@Override
|
||||
public void create() {
|
||||
BusyIndicator.showWhile(null, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
superCreate();
|
||||
fViewer.setSelection(new StructuredSelection(getInitialElementSelections()), true);
|
||||
setPathFields(fInitialFolderName, fInitialFileName);
|
||||
fFileNameDialogField.setFocus();
|
||||
doStatusUpdate();
|
||||
}
|
||||
BusyIndicator.showWhile(null, () -> {
|
||||
superCreate();
|
||||
fViewer.setSelection(new StructuredSelection(getInitialElementSelections()), true);
|
||||
setPathFields(fInitialFolderName, fInitialFileName);
|
||||
fFileNameDialogField.setFocus();
|
||||
doStatusUpdate();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -516,28 +512,24 @@ public class SourceFileSelectionDialog extends SelectionStatusDialog {
|
|||
if (fInput != null) {
|
||||
final ICElement[] foundElem = { /*base_folder*/ null, /*exact_folder*/ null, /*exact_file*/ null };
|
||||
try {
|
||||
fInput.accept(new ICElementVisitor() {
|
||||
@Override
|
||||
public boolean visit(ICElement elem) {
|
||||
IPath path = elem.getPath();
|
||||
if (path.isPrefixOf(folderPath)) {
|
||||
if (foundElem[0] == null
|
||||
|| path.segmentCount() > foundElem[0].getPath().segmentCount()) {
|
||||
foundElem[0] = elem; /*base_folder*/
|
||||
}
|
||||
if (path.equals(folderPath)) {
|
||||
foundElem[1] = elem; /*exact_folder*/
|
||||
if (fInitialFileName == null)
|
||||
return false; // no need to search children
|
||||
} else if (fInitialFileName != null
|
||||
&& elem.getElementName().equals(fInitialFileName)) {
|
||||
foundElem[2] = elem; /*exact_file*/
|
||||
return false; // no need to search children
|
||||
}
|
||||
return true;
|
||||
fInput.accept(elem -> {
|
||||
IPath path = elem.getPath();
|
||||
if (path.isPrefixOf(folderPath)) {
|
||||
if (foundElem[0] == null
|
||||
|| path.segmentCount() > foundElem[0].getPath().segmentCount()) {
|
||||
foundElem[0] = elem; /*base_folder*/
|
||||
}
|
||||
return false;
|
||||
if (path.equals(folderPath)) {
|
||||
foundElem[1] = elem; /*exact_folder*/
|
||||
if (fInitialFileName == null)
|
||||
return false; // no need to search children
|
||||
} else if (fInitialFileName != null && elem.getElementName().equals(fInitialFileName)) {
|
||||
foundElem[2] = elem; /*exact_file*/
|
||||
return false; // no need to search children
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
ICElement selectedElement = foundElem[2]; /*exact_file*/
|
||||
|
|
|
@ -78,12 +78,7 @@ public class DialogField {
|
|||
*/
|
||||
public void postSetFocusOnDialogField(Display display) {
|
||||
if (display != null) {
|
||||
display.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setFocus();
|
||||
}
|
||||
});
|
||||
display.asyncExec(() -> setFocus());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -719,12 +719,9 @@ public class ListDialogField<T> extends DialogField {
|
|||
public void postSetSelection(final ISelection selection) {
|
||||
if (isOkToUse(fTableControl)) {
|
||||
Display d = fTableControl.getDisplay();
|
||||
d.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isOkToUse(fTableControl)) {
|
||||
selectElements(selection);
|
||||
}
|
||||
d.asyncExec(() -> {
|
||||
if (isOkToUse(fTableControl)) {
|
||||
selectElements(selection);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -706,12 +706,9 @@ public class TreeListDialogField<T> extends DialogField {
|
|||
public void postSetSelection(final ISelection selection) {
|
||||
if (isOkToUse(fTreeControl)) {
|
||||
Display d = fTreeControl.getDisplay();
|
||||
d.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isOkToUse(fTreeControl)) {
|
||||
selectElements(selection);
|
||||
}
|
||||
d.asyncExec(() -> {
|
||||
if (isOkToUse(fTreeControl)) {
|
||||
selectElements(selection);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -39,15 +39,12 @@ import org.eclipse.core.runtime.IAdaptable;
|
|||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.jface.viewers.CheckStateChangedEvent;
|
||||
import org.eclipse.jface.viewers.CheckboxTreeViewer;
|
||||
import org.eclipse.jface.viewers.ICheckStateListener;
|
||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
import org.eclipse.jface.viewers.ITreeViewerListener;
|
||||
import org.eclipse.jface.viewers.TreeExpansionEvent;
|
||||
import org.eclipse.jface.wizard.WizardPage;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.BusyIndicator;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
@ -111,12 +108,7 @@ public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPag
|
|||
|
||||
fWorkingSetName = new Text(composite, SWT.SINGLE | SWT.BORDER);
|
||||
fWorkingSetName.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
||||
fWorkingSetName.addModifyListener(new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
validateInput();
|
||||
}
|
||||
});
|
||||
fWorkingSetName.addModifyListener(e -> validateInput());
|
||||
fWorkingSetName.setFocus();
|
||||
|
||||
label = new Label(composite, SWT.WRAP);
|
||||
|
@ -143,12 +135,7 @@ public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPag
|
|||
|
||||
fTree.setInput(CoreModel.create(CUIPlugin.getWorkspace().getRoot()));
|
||||
|
||||
fTree.addCheckStateListener(new ICheckStateListener() {
|
||||
@Override
|
||||
public void checkStateChanged(CheckStateChangedEvent event) {
|
||||
handleCheckStateChange(event);
|
||||
}
|
||||
});
|
||||
fTree.addCheckStateListener(event -> handleCheckStateChange(event));
|
||||
|
||||
fTree.addTreeListener(new ITreeViewerListener() {
|
||||
@Override
|
||||
|
@ -159,12 +146,8 @@ public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPag
|
|||
public void treeExpanded(TreeExpansionEvent event) {
|
||||
final Object element = event.getElement();
|
||||
if (fTree.getGrayed(element) == false)
|
||||
BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setSubtreeChecked(element, fTree.getChecked(element), false);
|
||||
}
|
||||
});
|
||||
BusyIndicator.showWhile(getShell().getDisplay(),
|
||||
() -> setSubtreeChecked(element, fTree.getChecked(element), false));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -230,19 +213,16 @@ public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPag
|
|||
* @param event the checked state change event.
|
||||
*/
|
||||
void handleCheckStateChange(final CheckStateChangedEvent event) {
|
||||
BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
IAdaptable element = (IAdaptable) event.getElement();
|
||||
boolean state = event.getChecked();
|
||||
BusyIndicator.showWhile(getShell().getDisplay(), () -> {
|
||||
IAdaptable element = (IAdaptable) event.getElement();
|
||||
boolean state = event.getChecked();
|
||||
|
||||
fTree.setGrayed(element, false);
|
||||
if (isExpandable(element)) {
|
||||
setSubtreeChecked(element, state, true);
|
||||
}
|
||||
updateParentState(element, state);
|
||||
validateInput();
|
||||
fTree.setGrayed(element, false);
|
||||
if (isExpandable(element)) {
|
||||
setSubtreeChecked(element, state, true);
|
||||
}
|
||||
updateParentState(element, state);
|
||||
validateInput();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -289,76 +269,72 @@ public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPag
|
|||
* working set, if any.
|
||||
*/
|
||||
private void initializeCheckedState() {
|
||||
BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Object[] elements;
|
||||
if (fWorkingSet == null) {
|
||||
// Use current part's selection for initialization
|
||||
IWorkbenchPage page = CUIPlugin.getActivePage();
|
||||
if (page == null)
|
||||
return;
|
||||
BusyIndicator.showWhile(getShell().getDisplay(), () -> {
|
||||
Object[] elements;
|
||||
if (fWorkingSet == null) {
|
||||
// Use current part's selection for initialization
|
||||
IWorkbenchPage page = CUIPlugin.getActivePage();
|
||||
if (page == null)
|
||||
return;
|
||||
|
||||
IWorkbenchPart part = CUIPlugin.getActivePage().getActivePart();
|
||||
if (part == null)
|
||||
return;
|
||||
IWorkbenchPart part = CUIPlugin.getActivePage().getActivePart();
|
||||
if (part == null)
|
||||
return;
|
||||
|
||||
try {
|
||||
elements = SelectionConverter.getStructuredSelection(part).toArray();
|
||||
for (int i = 0; i < elements.length; i++) {
|
||||
if (elements[i] instanceof IResource) {
|
||||
ICElement ce = ((IResource) elements[i]).getAdapter(ICElement.class);
|
||||
if (ce != null && ce.exists()
|
||||
&& ce.getCProject().isOnSourceRoot((IResource) elements[i]))
|
||||
elements[i] = ce;
|
||||
try {
|
||||
elements = SelectionConverter.getStructuredSelection(part).toArray();
|
||||
for (int i1 = 0; i1 < elements.length; i1++) {
|
||||
if (elements[i1] instanceof IResource) {
|
||||
ICElement ce = ((IResource) elements[i1]).getAdapter(ICElement.class);
|
||||
if (ce != null && ce.exists() && ce.getCProject().isOnSourceRoot((IResource) elements[i1]))
|
||||
elements[i1] = ce;
|
||||
}
|
||||
}
|
||||
} catch (CModelException e) {
|
||||
return;
|
||||
}
|
||||
} else
|
||||
elements = fWorkingSet.getElements();
|
||||
|
||||
for (int i2 = 0; i2 < elements.length; i2++) {
|
||||
Object element1 = elements[i2];
|
||||
if (element1 instanceof IResource) {
|
||||
IProject project = ((IResource) element1).getProject();
|
||||
if (!project.isAccessible()) {
|
||||
elements[i2] = project;
|
||||
} else {
|
||||
// for backwards compatibility: adapt to ICElement if possible
|
||||
if (CoreModel.hasCNature(project)) {
|
||||
ICElement cElement = CoreModel.getDefault().create((IResource) element1);
|
||||
if (cElement != null) {
|
||||
elements[i2] = cElement;
|
||||
}
|
||||
}
|
||||
} catch (CModelException e) {
|
||||
return;
|
||||
}
|
||||
} else
|
||||
elements = fWorkingSet.getElements();
|
||||
|
||||
for (int i = 0; i < elements.length; i++) {
|
||||
Object element = elements[i];
|
||||
if (element instanceof IResource) {
|
||||
IProject project = ((IResource) element).getProject();
|
||||
if (!project.isAccessible()) {
|
||||
elements[i] = project;
|
||||
} else {
|
||||
// for backwards compatibility: adapt to ICElement if possible
|
||||
if (CoreModel.hasCNature(project)) {
|
||||
ICElement cElement = CoreModel.getDefault().create((IResource) element);
|
||||
if (cElement != null) {
|
||||
elements[i] = cElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (element instanceof ICElement) {
|
||||
ICProject cProject = ((ICElement) element).getCProject();
|
||||
if (cProject != null && !cProject.getProject().isAccessible())
|
||||
elements[i] = cProject.getProject();
|
||||
}
|
||||
} else if (element1 instanceof ICElement) {
|
||||
ICProject cProject = ((ICElement) element1).getCProject();
|
||||
if (cProject != null && !cProject.getProject().isAccessible())
|
||||
elements[i2] = cProject.getProject();
|
||||
}
|
||||
fTree.setCheckedElements(elements);
|
||||
HashSet<Object> parents = new HashSet<>();
|
||||
for (Object element : elements) {
|
||||
if (isExpandable(element))
|
||||
setSubtreeChecked(element, true, true);
|
||||
|
||||
if (element instanceof IAdaptable) {
|
||||
IResource resource = ((IAdaptable) element).getAdapter(IResource.class);
|
||||
if (resource != null && !resource.isAccessible())
|
||||
continue;
|
||||
}
|
||||
Object parent = fTreeContentProvider.getParent(element);
|
||||
if (parent != null)
|
||||
parents.add(parent);
|
||||
}
|
||||
|
||||
for (Object object : parents)
|
||||
updateObjectState(object, true);
|
||||
}
|
||||
fTree.setCheckedElements(elements);
|
||||
HashSet<Object> parents = new HashSet<>();
|
||||
for (Object element2 : elements) {
|
||||
if (isExpandable(element2))
|
||||
setSubtreeChecked(element2, true, true);
|
||||
|
||||
if (element2 instanceof IAdaptable) {
|
||||
IResource resource = ((IAdaptable) element2).getAdapter(IResource.class);
|
||||
if (resource != null && !resource.isAccessible())
|
||||
continue;
|
||||
}
|
||||
Object parent = fTreeContentProvider.getParent(element2);
|
||||
if (parent != null)
|
||||
parents.add(parent);
|
||||
}
|
||||
|
||||
for (Object object : parents)
|
||||
updateObjectState(object, true);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -20,14 +20,11 @@ import java.util.Iterator;
|
|||
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.jface.dialogs.ErrorDialog;
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.jface.dialogs.IInputValidator;
|
||||
import org.eclipse.jface.dialogs.InputDialog;
|
||||
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
|
@ -108,41 +105,37 @@ class WorkingSetConfigsController implements SelectionListener, ISelectionChange
|
|||
this.tree.setInput(workspace.getWorkingSets());
|
||||
|
||||
if (!workspace.getWorkingSets().isEmpty()) {
|
||||
tree.getTree().getDisplay().asyncExec(new Runnable() {
|
||||
tree.getTree().getDisplay().asyncExec(() -> {
|
||||
Object initialSelection;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Object initialSelection;
|
||||
ITreeContentProvider content = (ITreeContentProvider) tree.getContentProvider();
|
||||
|
||||
ITreeContentProvider content = (ITreeContentProvider) tree.getContentProvider();
|
||||
|
||||
if ((initialWorkingSet != null)
|
||||
&& Arrays.asList(content.getElements(tree.getInput())).contains(initialWorkingSet)) {
|
||||
initialSelection = initialWorkingSet;
|
||||
} else {
|
||||
// we have a most-recently-used working set. Just
|
||||
// take the first in tree order
|
||||
initialSelection = tree.getTree().getItem(0).getData();
|
||||
}
|
||||
|
||||
Object[] children = content.getChildren(initialSelection);
|
||||
IStructuredSelection sel;
|
||||
|
||||
if ((children == null) || (children.length == 0)) {
|
||||
// Shouldn't happen: there should at least be the
|
||||
// read-only config.
|
||||
// Can only select the initial working set
|
||||
sel = new StructuredSelection(initialSelection);
|
||||
} else {
|
||||
Object[] toSort = new Object[children.length];
|
||||
System.arraycopy(children, 0, toSort, 0, children.length);
|
||||
tree.getComparator().sort(tree, toSort);
|
||||
sel = new StructuredSelection(toSort[0]);
|
||||
}
|
||||
|
||||
// make the selection
|
||||
tree.setSelection(sel, true);
|
||||
if ((initialWorkingSet != null)
|
||||
&& Arrays.asList(content.getElements(tree.getInput())).contains(initialWorkingSet)) {
|
||||
initialSelection = initialWorkingSet;
|
||||
} else {
|
||||
// we have a most-recently-used working set. Just
|
||||
// take the first in tree order
|
||||
initialSelection = tree.getTree().getItem(0).getData();
|
||||
}
|
||||
|
||||
Object[] children = content.getChildren(initialSelection);
|
||||
IStructuredSelection sel;
|
||||
|
||||
if ((children == null) || (children.length == 0)) {
|
||||
// Shouldn't happen: there should at least be the
|
||||
// read-only config.
|
||||
// Can only select the initial working set
|
||||
sel = new StructuredSelection(initialSelection);
|
||||
} else {
|
||||
Object[] toSort = new Object[children.length];
|
||||
System.arraycopy(children, 0, toSort, 0, children.length);
|
||||
tree.getComparator().sort(tree, toSort);
|
||||
sel = new StructuredSelection(toSort[0]);
|
||||
}
|
||||
|
||||
// make the selection
|
||||
tree.setSelection(sel, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -288,18 +281,14 @@ class WorkingSetConfigsController implements SelectionListener, ISelectionChange
|
|||
private void addConfig() {
|
||||
InputDialog dlg = new InputDialog(tree.getTree().getShell(),
|
||||
WorkingSetMessages.WSConfigsController_addDlg_title, WorkingSetMessages.WSConfigsController_addDlg_msg,
|
||||
WorkingSetMessages.WSConfigsController_addDlg_defaultName, new IInputValidator() {
|
||||
|
||||
@Override
|
||||
public String isValid(String newText) {
|
||||
if (currentWorkingSet.getConfiguration(newText) != null) {
|
||||
return WorkingSetMessages.WSConfigsController_addDlg_nameExists;
|
||||
}
|
||||
if (newText.length() == 0) {
|
||||
return WorkingSetMessages.WSConfigsController_addDlg_emptyName;
|
||||
}
|
||||
return null;
|
||||
WorkingSetMessages.WSConfigsController_addDlg_defaultName, newText -> {
|
||||
if (currentWorkingSet.getConfiguration(newText) != null) {
|
||||
return WorkingSetMessages.WSConfigsController_addDlg_nameExists;
|
||||
}
|
||||
if (newText.length() == 0) {
|
||||
return WorkingSetMessages.WSConfigsController_addDlg_emptyName;
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
if (dlg.open() == IDialogConstants.OK_ID) {
|
||||
|
@ -331,21 +320,17 @@ class WorkingSetConfigsController implements SelectionListener, ISelectionChange
|
|||
private void renameConfig() {
|
||||
InputDialog dlg = new InputDialog(tree.getTree().getShell(),
|
||||
WorkingSetMessages.WSConfigsController_renameDlg_title,
|
||||
WorkingSetMessages.WSConfigsController_renameDlg_msg, currentConfig.getName(), new IInputValidator() {
|
||||
|
||||
@Override
|
||||
public String isValid(String newText) {
|
||||
if (newText.equals(currentConfig.getName())) {
|
||||
return ""; //$NON-NLS-1$
|
||||
}
|
||||
if (currentWorkingSet.getConfiguration(newText) != null) {
|
||||
return WorkingSetMessages.WSConfigsController_addDlg_nameExists;
|
||||
}
|
||||
if (newText.length() == 0) {
|
||||
return WorkingSetMessages.WSConfigsController_addDlg_emptyName;
|
||||
}
|
||||
return null;
|
||||
WorkingSetMessages.WSConfigsController_renameDlg_msg, currentConfig.getName(), newText -> {
|
||||
if (newText.equals(currentConfig.getName())) {
|
||||
return ""; //$NON-NLS-1$
|
||||
}
|
||||
if (currentWorkingSet.getConfiguration(newText) != null) {
|
||||
return WorkingSetMessages.WSConfigsController_addDlg_nameExists;
|
||||
}
|
||||
if (newText.length() == 0) {
|
||||
return WorkingSetMessages.WSConfigsController_addDlg_emptyName;
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
if (dlg.open() == IDialogConstants.OK_ID) {
|
||||
|
@ -403,14 +388,10 @@ class WorkingSetConfigsController implements SelectionListener, ISelectionChange
|
|||
|
||||
try {
|
||||
ProgressMonitorDialog dlg = new ProgressMonitorDialog(tree.getControl().getShell());
|
||||
dlg.run(true, true, new IRunnableWithProgress() {
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) {
|
||||
IStatus status = currentConfig.build(monitor);
|
||||
if (status.matches(IStatus.WARNING | IStatus.ERROR)) {
|
||||
problem[0] = status;
|
||||
}
|
||||
dlg.run(true, true, monitor -> {
|
||||
IStatus status = currentConfig.build(monitor);
|
||||
if (status.matches(IStatus.WARNING | IStatus.ERROR)) {
|
||||
problem[0] = status;
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -443,14 +443,11 @@ public class CElementContentProvider extends BaseCElementContentProvider
|
|||
if (pendingRefreshes.contains(r))
|
||||
return;
|
||||
pendingRefreshes.add(r);
|
||||
ctrl.getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
pendingRefreshes.remove(r);
|
||||
Control ctrl = fViewer.getControl();
|
||||
if (ctrl != null && !ctrl.isDisposed()) {
|
||||
r.refresh();
|
||||
}
|
||||
ctrl.getDisplay().asyncExec(() -> {
|
||||
pendingRefreshes.remove(r);
|
||||
Control ctrl1 = fViewer.getControl();
|
||||
if (ctrl1 != null && !ctrl1.isDisposed()) {
|
||||
r.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -100,12 +100,9 @@ public class CElementLabelProvider extends LabelProvider {
|
|||
fWorkbenchLabelProvider = new WorkbenchLabelProvider();
|
||||
} else {
|
||||
// Delay initialization
|
||||
CUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (fCElementLabelProvider != null) {
|
||||
fWorkbenchLabelProvider = new WorkbenchLabelProvider();
|
||||
}
|
||||
CUIPlugin.getStandardDisplay().asyncExec(() -> {
|
||||
if (fCElementLabelProvider != null) {
|
||||
fWorkbenchLabelProvider = new WorkbenchLabelProvider();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -46,7 +46,6 @@ import org.eclipse.core.filebuffers.ITextFileBufferManager;
|
|||
import org.eclipse.core.filebuffers.LocationKind;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
@ -274,12 +273,7 @@ public class FormatAllAction extends SelectionDispatchAction {
|
|||
}
|
||||
|
||||
PlatformUI.getWorkbench().getProgressService().run(true, true,
|
||||
new WorkbenchRunnableAdapter(new IWorkspaceRunnable() {
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) {
|
||||
doRunOnMultiple(tus, status, monitor);
|
||||
}
|
||||
})); // workspace lock
|
||||
new WorkbenchRunnableAdapter(monitor -> doRunOnMultiple(tus, status, monitor))); // workspace lock
|
||||
if (!status.isOK()) {
|
||||
String title = ActionMessages.FormatAllAction_multi_status_title;
|
||||
ErrorDialog.openError(getShell(), title, null, status);
|
||||
|
@ -413,12 +407,7 @@ public class FormatAllAction extends SelectionDispatchAction {
|
|||
|
||||
private void formatTranslationUnit(final ITextFileBuffer fileBuffer, final Map<String, Object> options) {
|
||||
if (fileBuffer.isShared()) {
|
||||
getShell().getDisplay().syncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
doFormat(fileBuffer.getDocument(), options);
|
||||
}
|
||||
});
|
||||
getShell().getDisplay().syncExec(() -> doFormat(fileBuffer.getDocument(), options));
|
||||
} else {
|
||||
doFormat(fileBuffer.getDocument(), options); // run in context thread
|
||||
}
|
||||
|
|
|
@ -305,12 +305,7 @@ public class MemberFilterActionGroup extends ActionGroup {
|
|||
}
|
||||
if (refresh) {
|
||||
fViewer.getControl().setRedraw(false);
|
||||
BusyIndicator.showWhile(fViewer.getControl().getDisplay(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fViewer.refresh();
|
||||
}
|
||||
});
|
||||
BusyIndicator.showWhile(fViewer.getControl().getDisplay(), () -> fViewer.refresh());
|
||||
fViewer.getControl().setRedraw(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
|
|||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||
import org.eclipse.jface.window.Window;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
|
@ -80,20 +79,13 @@ public class ManageConfigRunner implements IConfigManager {
|
|||
}
|
||||
|
||||
public IRunnableWithProgress getRunnable() {
|
||||
return new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() {
|
||||
@Override
|
||||
public void run(IProgressMonitor imonitor) throws InvocationTargetException, InterruptedException {
|
||||
CUIPlugin.getDefault().getShell().getDisplay().syncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
CoreModel.getDefault().setProjectDescription(prj, des);
|
||||
} catch (CoreException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new WorkspaceModifyDelegatingOperation(
|
||||
imonitor -> CUIPlugin.getDefault().getShell().getDisplay().syncExec(() -> {
|
||||
try {
|
||||
CoreModel.getDefault().setProjectDescription(prj, des);
|
||||
} catch (CoreException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -838,30 +838,27 @@ public class StructureTreeTab extends AbstractCPropertyTab {
|
|||
@Override
|
||||
public void updateData(ICResourceDescription rcfg) {
|
||||
cfg = rcfg;
|
||||
tree.getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
tree.removeAll();
|
||||
TreeItem ti = new TreeItem(tree, 0);
|
||||
ti.setText(0, Messages.StructureTreeTab_11);
|
||||
tree.update();
|
||||
tree.setRedraw(false);
|
||||
tree.removeAll();
|
||||
switch (combo.getSelectionIndex()) {
|
||||
case 0:
|
||||
update(cfg.getConfiguration().getProjectDescription());
|
||||
break;
|
||||
case 1:
|
||||
update(null, "ICConfigurationDescription", cfg.getConfiguration()); //$NON-NLS-1$
|
||||
break;
|
||||
case 2:
|
||||
update(null, "ICResourceDescription", cfg); //$NON-NLS-1$
|
||||
break;
|
||||
}
|
||||
} finally {
|
||||
tree.setRedraw(true);
|
||||
tree.getDisplay().asyncExec(() -> {
|
||||
try {
|
||||
tree.removeAll();
|
||||
TreeItem ti = new TreeItem(tree, 0);
|
||||
ti.setText(0, Messages.StructureTreeTab_11);
|
||||
tree.update();
|
||||
tree.setRedraw(false);
|
||||
tree.removeAll();
|
||||
switch (combo.getSelectionIndex()) {
|
||||
case 0:
|
||||
update(cfg.getConfiguration().getProjectDescription());
|
||||
break;
|
||||
case 1:
|
||||
update(null, "ICConfigurationDescription", cfg.getConfiguration()); //$NON-NLS-1$
|
||||
break;
|
||||
case 2:
|
||||
update(null, "ICResourceDescription", cfg); //$NON-NLS-1$
|
||||
break;
|
||||
}
|
||||
} finally {
|
||||
tree.setRedraw(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -238,57 +238,47 @@ public abstract class CDTCommonProjectWizard extends BasicNewResourceWizard
|
|||
|
||||
private IRunnableWithProgress getRunnable(boolean _defaults, final boolean onFinish) {
|
||||
final boolean defaults = _defaults;
|
||||
return new IRunnableWithProgress() {
|
||||
@Override
|
||||
public void run(IProgressMonitor imonitor) throws InvocationTargetException, InterruptedException {
|
||||
final Exception except[] = new Exception[1];
|
||||
getShell().getDisplay().syncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() {
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor)
|
||||
throws InvocationTargetException, InterruptedException {
|
||||
final IProgressMonitor fMonitor;
|
||||
if (monitor == null) {
|
||||
fMonitor = new NullProgressMonitor();
|
||||
} else {
|
||||
fMonitor = monitor;
|
||||
}
|
||||
fMonitor.beginTask(CUIPlugin.getResourceString("CProjectWizard.op_description"), 100); //$NON-NLS-1$
|
||||
fMonitor.worked(10);
|
||||
try {
|
||||
newProject = createIProject(lastProjectName, lastProjectLocation,
|
||||
new SubProgressMonitor(fMonitor, 40));
|
||||
if (newProject != null)
|
||||
fMainPage.h_selected.createProject(newProject, defaults, onFinish,
|
||||
new SubProgressMonitor(fMonitor, 40));
|
||||
fMonitor.worked(10);
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.log(e);
|
||||
} finally {
|
||||
fMonitor.done();
|
||||
}
|
||||
}
|
||||
});
|
||||
try {
|
||||
getContainer().run(false, true, op);
|
||||
} catch (InvocationTargetException e) {
|
||||
except[0] = e;
|
||||
} catch (InterruptedException e) {
|
||||
except[0] = e;
|
||||
}
|
||||
return imonitor -> {
|
||||
final Exception except[] = new Exception[1];
|
||||
getShell().getDisplay().syncExec(() -> {
|
||||
IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(monitor -> {
|
||||
final IProgressMonitor fMonitor;
|
||||
if (monitor == null) {
|
||||
fMonitor = new NullProgressMonitor();
|
||||
} else {
|
||||
fMonitor = monitor;
|
||||
}
|
||||
fMonitor.beginTask(CUIPlugin.getResourceString("CProjectWizard.op_description"), 100); //$NON-NLS-1$
|
||||
fMonitor.worked(10);
|
||||
try {
|
||||
newProject = createIProject(lastProjectName, lastProjectLocation,
|
||||
new SubProgressMonitor(fMonitor, 40));
|
||||
if (newProject != null)
|
||||
fMainPage.h_selected.createProject(newProject, defaults, onFinish,
|
||||
new SubProgressMonitor(fMonitor, 40));
|
||||
fMonitor.worked(10);
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.log(e);
|
||||
} finally {
|
||||
fMonitor.done();
|
||||
}
|
||||
});
|
||||
if (except[0] != null) {
|
||||
if (except[0] instanceof InvocationTargetException) {
|
||||
throw (InvocationTargetException) except[0];
|
||||
}
|
||||
if (except[0] instanceof InterruptedException) {
|
||||
throw (InterruptedException) except[0];
|
||||
}
|
||||
throw new InvocationTargetException(except[0]);
|
||||
try {
|
||||
getContainer().run(false, true, op);
|
||||
} catch (InvocationTargetException e1) {
|
||||
except[0] = e1;
|
||||
} catch (InterruptedException e2) {
|
||||
except[0] = e2;
|
||||
}
|
||||
});
|
||||
if (except[0] != null) {
|
||||
if (except[0] instanceof InvocationTargetException) {
|
||||
throw (InvocationTargetException) except[0];
|
||||
}
|
||||
if (except[0] instanceof InterruptedException) {
|
||||
throw (InterruptedException) except[0];
|
||||
}
|
||||
throw new InvocationTargetException(except[0]);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -331,12 +321,7 @@ public abstract class CDTCommonProjectWizard extends BasicNewResourceWizard
|
|||
newProject = CCorePlugin.getDefault().createCDTProject(description, newProjectHandle,
|
||||
new SubProgressMonitor(monitor, 25));
|
||||
} else {
|
||||
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
newProjectHandle.refreshLocal(IResource.DEPTH_INFINITE, monitor);
|
||||
}
|
||||
};
|
||||
IWorkspaceRunnable runnable = monitor1 -> newProjectHandle.refreshLocal(IResource.DEPTH_INFINITE, monitor1);
|
||||
workspace.run(runnable, root, IWorkspace.AVOID_UPDATE, new SubProgressMonitor(monitor, 25));
|
||||
newProject = newProjectHandle;
|
||||
}
|
||||
|
|
|
@ -209,53 +209,43 @@ public abstract class NewCProjectWizard extends BasicNewResourceWizard implement
|
|||
}
|
||||
|
||||
public IRunnableWithProgress getRunnable() {
|
||||
return new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() {
|
||||
@Override
|
||||
public void run(IProgressMonitor imonitor) throws InvocationTargetException, InterruptedException {
|
||||
final Exception except[] = new Exception[1];
|
||||
// ugly, need to make the wizard page run in a non ui thread so that this can go away!!!
|
||||
getShell().getDisplay().syncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() {
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor)
|
||||
throws InvocationTargetException, InterruptedException {
|
||||
final IProgressMonitor fMonitor;
|
||||
if (monitor == null) {
|
||||
fMonitor = new NullProgressMonitor();
|
||||
} else {
|
||||
fMonitor = monitor;
|
||||
}
|
||||
fMonitor.beginTask(CUIPlugin.getResourceString(OP_DESC), 3);
|
||||
doRunPrologue(new SubProgressMonitor(fMonitor, 1));
|
||||
try {
|
||||
doRun(new SubProgressMonitor(fMonitor, 1));
|
||||
} catch (CoreException e) {
|
||||
except[0] = e;
|
||||
}
|
||||
doRunEpilogue(new SubProgressMonitor(fMonitor, 1));
|
||||
fMonitor.done();
|
||||
}
|
||||
});
|
||||
try {
|
||||
getContainer().run(false, true, op);
|
||||
} catch (InvocationTargetException e) {
|
||||
except[0] = e;
|
||||
} catch (InterruptedException e) {
|
||||
except[0] = e;
|
||||
}
|
||||
return new WorkspaceModifyDelegatingOperation(imonitor -> {
|
||||
final Exception except[] = new Exception[1];
|
||||
// ugly, need to make the wizard page run in a non ui thread so that this can go away!!!
|
||||
getShell().getDisplay().syncExec(() -> {
|
||||
IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(monitor -> {
|
||||
final IProgressMonitor fMonitor;
|
||||
if (monitor == null) {
|
||||
fMonitor = new NullProgressMonitor();
|
||||
} else {
|
||||
fMonitor = monitor;
|
||||
}
|
||||
fMonitor.beginTask(CUIPlugin.getResourceString(OP_DESC), 3);
|
||||
doRunPrologue(new SubProgressMonitor(fMonitor, 1));
|
||||
try {
|
||||
doRun(new SubProgressMonitor(fMonitor, 1));
|
||||
} catch (CoreException e) {
|
||||
except[0] = e;
|
||||
}
|
||||
doRunEpilogue(new SubProgressMonitor(fMonitor, 1));
|
||||
fMonitor.done();
|
||||
});
|
||||
if (except[0] != null) {
|
||||
if (except[0] instanceof InvocationTargetException) {
|
||||
throw (InvocationTargetException) except[0];
|
||||
}
|
||||
if (except[0] instanceof InterruptedException) {
|
||||
throw (InterruptedException) except[0];
|
||||
}
|
||||
throw new InvocationTargetException(except[0]);
|
||||
try {
|
||||
getContainer().run(false, true, op);
|
||||
} catch (InvocationTargetException e1) {
|
||||
except[0] = e1;
|
||||
} catch (InterruptedException e2) {
|
||||
except[0] = e2;
|
||||
}
|
||||
});
|
||||
if (except[0] != null) {
|
||||
if (except[0] instanceof InvocationTargetException) {
|
||||
throw (InvocationTargetException) except[0];
|
||||
}
|
||||
if (except[0] instanceof InterruptedException) {
|
||||
throw (InterruptedException) except[0];
|
||||
}
|
||||
throw new InvocationTargetException(except[0]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ import org.eclipse.cdt.core.templateengine.TemplateEngineUtil;
|
|||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
|
@ -203,12 +202,9 @@ public class TemplateInputDialog extends Dialog {
|
|||
*/
|
||||
public void addTextListener(final Text aText) {
|
||||
|
||||
ModifyListener mListener = new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
String nameField = aText.getText();
|
||||
textChanged(nameField);
|
||||
}
|
||||
ModifyListener mListener = e -> {
|
||||
String nameField = aText.getText();
|
||||
textChanged(nameField);
|
||||
};
|
||||
|
||||
aText.addModifyListener(mListener);
|
||||
|
@ -257,14 +253,11 @@ public class TemplateInputDialog extends Dialog {
|
|||
public int popDuplicate() {
|
||||
|
||||
final int[] result = new int[] { 0 };
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MessageBox mBox = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_INFORMATION);
|
||||
mBox.setText(TemplatePreferencePage.Message);
|
||||
mBox.setMessage(TemplatePreferencePage.DuplicateEntry);
|
||||
result[0] = mBox.open();
|
||||
}
|
||||
Display.getDefault().syncExec(() -> {
|
||||
MessageBox mBox = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_INFORMATION);
|
||||
mBox.setText(TemplatePreferencePage.Message);
|
||||
mBox.setMessage(TemplatePreferencePage.DuplicateEntry);
|
||||
result[0] = mBox.open();
|
||||
});
|
||||
return result[0];
|
||||
}
|
||||
|
|
|
@ -39,21 +39,18 @@ public class DsfExtendedTerminateCommand extends DsfTerminateCommand {
|
|||
// Make sure we run on the UI thread.
|
||||
// We may not already be on the UI thread, for example, when GdbLaunch.terminate() is called
|
||||
// directly when closing a project.
|
||||
display.syncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Shell shell = display.getActiveShell();
|
||||
if (shell != null) {
|
||||
boolean confirmed = MessageDialog.openConfirm(shell,
|
||||
ActionMessages.DsfExtendedTerminateCommand_Confirm_Termination,
|
||||
ActionMessages.DsfExtendedTerminateCommand_Terminate_the_session);
|
||||
if (!confirmed) {
|
||||
request.cancel();
|
||||
return;
|
||||
}
|
||||
display.syncExec(() -> {
|
||||
Shell shell = display.getActiveShell();
|
||||
if (shell != null) {
|
||||
boolean confirmed = MessageDialog.openConfirm(shell,
|
||||
ActionMessages.DsfExtendedTerminateCommand_Confirm_Termination,
|
||||
ActionMessages.DsfExtendedTerminateCommand_Terminate_the_session);
|
||||
if (!confirmed) {
|
||||
request.cancel();
|
||||
return;
|
||||
}
|
||||
DsfExtendedTerminateCommand.super.execute(request);
|
||||
}
|
||||
DsfExtendedTerminateCommand.super.execute(request);
|
||||
});
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -72,12 +72,7 @@ public class ServiceEventWaitor<V> {
|
|||
assert eventClass != null;
|
||||
fSession = session;
|
||||
fEventTypeClass = eventClass;
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fSession.addServiceEventListener(ServiceEventWaitor.this, null);
|
||||
}
|
||||
};
|
||||
Runnable runnable = () -> fSession.addServiceEventListener(ServiceEventWaitor.this, null);
|
||||
try {
|
||||
fSession.getExecutor().submit(runnable).get();
|
||||
} catch (InterruptedException e) {
|
||||
|
@ -91,12 +86,7 @@ public class ServiceEventWaitor<V> {
|
|||
protected void finalize() throws Throwable {
|
||||
super.finalize();
|
||||
if (fEventTypeClass != null) {
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fSession.removeServiceEventListener(ServiceEventWaitor.this);
|
||||
}
|
||||
};
|
||||
Runnable runnable = () -> fSession.removeServiceEventListener(ServiceEventWaitor.this);
|
||||
fSession.getExecutor().submit(runnable).get();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,23 +117,19 @@ public class SyncUtil {
|
|||
public static void initialize(DsfSession session) throws Exception {
|
||||
fSession = session;
|
||||
|
||||
Runnable runnable = new Runnable() {
|
||||
Runnable runnable = () -> {
|
||||
DsfServicesTracker tracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
DsfServicesTracker tracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
fGdbControl = tracker.getService(IGDBControl.class);
|
||||
fRunControl = tracker.getService(IMIRunControl.class);
|
||||
fStack = tracker.getService(MIStack.class);
|
||||
fExpressions = tracker.getService(IExpressions.class);
|
||||
fProcessesService = tracker.getService(IGDBProcesses.class);
|
||||
fMemory = tracker.getService(IMemory.class);
|
||||
fCommandFactory = fGdbControl.getCommandFactory();
|
||||
fSourceLookup = tracker.getService(ISourceLookup.class);
|
||||
|
||||
fGdbControl = tracker.getService(IGDBControl.class);
|
||||
fRunControl = tracker.getService(IMIRunControl.class);
|
||||
fStack = tracker.getService(MIStack.class);
|
||||
fExpressions = tracker.getService(IExpressions.class);
|
||||
fProcessesService = tracker.getService(IGDBProcesses.class);
|
||||
fMemory = tracker.getService(IMemory.class);
|
||||
fCommandFactory = fGdbControl.getCommandFactory();
|
||||
fSourceLookup = tracker.getService(ISourceLookup.class);
|
||||
|
||||
tracker.dispose();
|
||||
}
|
||||
tracker.dispose();
|
||||
};
|
||||
fSession.getExecutor().submit(runnable).get();
|
||||
}
|
||||
|
@ -173,47 +169,41 @@ public class SyncUtil {
|
|||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fSession, MIStoppedEvent.class);
|
||||
|
||||
if (!reverse) {
|
||||
fRunControl.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// No need for a RequestMonitor since we will wait for the
|
||||
// ServiceEvent telling us the program has been suspended again
|
||||
switch (stepType) {
|
||||
case STEP_INTO:
|
||||
fGdbControl.queueCommand(fCommandFactory.createMIExecStep(dmc), null);
|
||||
break;
|
||||
case STEP_OVER:
|
||||
fGdbControl.queueCommand(fCommandFactory.createMIExecNext(dmc), null);
|
||||
break;
|
||||
case STEP_RETURN:
|
||||
fGdbControl.queueCommand(
|
||||
fCommandFactory.createMIExecFinish(fStack.createFrameDMContext(dmc, 0)), null);
|
||||
break;
|
||||
default:
|
||||
fail("Unsupported step type; " + stepType.toString());
|
||||
}
|
||||
fRunControl.getExecutor().submit(() -> {
|
||||
// No need for a RequestMonitor since we will wait for the
|
||||
// ServiceEvent telling us the program has been suspended again
|
||||
switch (stepType) {
|
||||
case STEP_INTO:
|
||||
fGdbControl.queueCommand(fCommandFactory.createMIExecStep(dmc), null);
|
||||
break;
|
||||
case STEP_OVER:
|
||||
fGdbControl.queueCommand(fCommandFactory.createMIExecNext(dmc), null);
|
||||
break;
|
||||
case STEP_RETURN:
|
||||
fGdbControl.queueCommand(fCommandFactory.createMIExecFinish(fStack.createFrameDMContext(dmc, 0)),
|
||||
null);
|
||||
break;
|
||||
default:
|
||||
fail("Unsupported step type; " + stepType.toString());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
fRunControl.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// No need for a RequestMonitor since we will wait for the
|
||||
// ServiceEvent telling us the program has been suspended again
|
||||
switch (stepType) {
|
||||
case STEP_INTO:
|
||||
fGdbControl.queueCommand(fCommandFactory.createMIExecReverseStep(dmc), null);
|
||||
break;
|
||||
case STEP_OVER:
|
||||
fGdbControl.queueCommand(fCommandFactory.createMIExecReverseNext(dmc), null);
|
||||
break;
|
||||
case STEP_RETURN:
|
||||
fGdbControl.queueCommand(
|
||||
fCommandFactory.createMIExecUncall(fStack.createFrameDMContext(dmc, 0)), null);
|
||||
break;
|
||||
default:
|
||||
fail("Unsupported step type; " + stepType.toString());
|
||||
}
|
||||
fRunControl.getExecutor().submit(() -> {
|
||||
// No need for a RequestMonitor since we will wait for the
|
||||
// ServiceEvent telling us the program has been suspended again
|
||||
switch (stepType) {
|
||||
case STEP_INTO:
|
||||
fGdbControl.queueCommand(fCommandFactory.createMIExecReverseStep(dmc), null);
|
||||
break;
|
||||
case STEP_OVER:
|
||||
fGdbControl.queueCommand(fCommandFactory.createMIExecReverseNext(dmc), null);
|
||||
break;
|
||||
case STEP_RETURN:
|
||||
fGdbControl.queueCommand(fCommandFactory.createMIExecUncall(fStack.createFrameDMContext(dmc, 0)),
|
||||
null);
|
||||
break;
|
||||
default:
|
||||
fail("Unsupported step type; " + stepType.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -281,14 +271,9 @@ public class SyncUtil {
|
|||
throws Throwable {
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fSession, MIStoppedEvent.class);
|
||||
|
||||
fRunControl.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// No need for a RequestMonitor since we will wait for the
|
||||
// ServiceEvent telling us the program has been suspended again
|
||||
fGdbControl.queueCommand(fCommandFactory.createMIExecContinue(dmc), null);
|
||||
}
|
||||
});
|
||||
// No need for a RequestMonitor since we will wait for the ServiceEvent telling us the program has been suspended again
|
||||
fRunControl.getExecutor()
|
||||
.submit(() -> fGdbControl.queueCommand(fCommandFactory.createMIExecContinue(dmc), null));
|
||||
|
||||
// Wait for the execution to suspend after the step
|
||||
return eventWaitor.waitForEvent(massagedTimeout);
|
||||
|
@ -308,14 +293,9 @@ public class SyncUtil {
|
|||
public static MIRunningEvent resume(final IExecutionDMContext dmc, int massagedTimeout) throws Throwable {
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitor = new ServiceEventWaitor<>(fSession, MIRunningEvent.class);
|
||||
|
||||
fRunControl.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// No need for a RequestMonitor since we will wait for the
|
||||
// ServiceEvent telling us the program has been resumed
|
||||
fGdbControl.queueCommand(fCommandFactory.createMIExecContinue(dmc), null);
|
||||
}
|
||||
});
|
||||
// No need for a RequestMonitor since we will wait for the ServiceEvent telling us the program has been suspended again
|
||||
fRunControl.getExecutor()
|
||||
.submit(() -> fGdbControl.queueCommand(fCommandFactory.createMIExecContinue(dmc), null));
|
||||
|
||||
// Wait for the execution to start after the step
|
||||
return eventWaitor.waitForEvent(massagedTimeout);
|
||||
|
@ -485,12 +465,7 @@ public class SyncUtil {
|
|||
|
||||
public static IExpressionDMContext createExpression(final IDMContext parentCtx, final String expression)
|
||||
throws Throwable {
|
||||
Callable<IExpressionDMContext> callable = new Callable<IExpressionDMContext>() {
|
||||
@Override
|
||||
public IExpressionDMContext call() throws Exception {
|
||||
return fExpressions.createExpression(parentCtx, expression);
|
||||
}
|
||||
};
|
||||
Callable<IExpressionDMContext> callable = () -> fExpressions.createExpression(parentCtx, expression);
|
||||
return fSession.getExecutor().submit(callable).get();
|
||||
}
|
||||
|
||||
|
@ -541,25 +516,17 @@ public class SyncUtil {
|
|||
|
||||
public static FormattedValueDMContext getFormattedValue(final IFormattedValues service,
|
||||
final IFormattedDataDMContext dmc, final String formatId) throws Throwable {
|
||||
Callable<FormattedValueDMContext> callable = new Callable<FormattedValueDMContext>() {
|
||||
@Override
|
||||
public FormattedValueDMContext call() throws Exception {
|
||||
return service.getFormattedValueContext(dmc, formatId);
|
||||
}
|
||||
};
|
||||
Callable<FormattedValueDMContext> callable = () -> service.getFormattedValueContext(dmc, formatId);
|
||||
return fSession.getExecutor().submit(callable).get();
|
||||
}
|
||||
|
||||
public static IMIExecutionDMContext createExecutionContext(final IContainerDMContext parentCtx, final int threadId)
|
||||
throws Throwable {
|
||||
Callable<IMIExecutionDMContext> callable = new Callable<IMIExecutionDMContext>() {
|
||||
@Override
|
||||
public IMIExecutionDMContext call() throws Exception {
|
||||
String threadIdStr = Integer.toString(threadId);
|
||||
IProcessDMContext processDmc = DMContexts.getAncestorOfType(parentCtx, IProcessDMContext.class);
|
||||
IThreadDMContext threadDmc = fProcessesService.createThreadContext(processDmc, threadIdStr);
|
||||
return fProcessesService.createExecutionContext(parentCtx, threadDmc, threadIdStr);
|
||||
}
|
||||
Callable<IMIExecutionDMContext> callable = () -> {
|
||||
String threadIdStr = Integer.toString(threadId);
|
||||
IProcessDMContext processDmc = DMContexts.getAncestorOfType(parentCtx, IProcessDMContext.class);
|
||||
IThreadDMContext threadDmc = fProcessesService.createThreadContext(processDmc, threadIdStr);
|
||||
return fProcessesService.createExecutionContext(parentCtx, threadDmc, threadIdStr);
|
||||
};
|
||||
return fSession.getExecutor().submit(callable).get();
|
||||
}
|
||||
|
|
|
@ -78,13 +78,10 @@ public class CommandLineArgsTest extends BaseParametrizedTestCase {
|
|||
super.doLaunch();
|
||||
|
||||
fSession = getGDBLaunch().getSession();
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
Runnable runnable = () -> {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
|
||||
fExpService = fServicesTracker.getService(IExpressions.class);
|
||||
}
|
||||
fExpService = fServicesTracker.getService(IExpressions.class);
|
||||
};
|
||||
fSession.getExecutor().submit(runnable).get();
|
||||
}
|
||||
|
|
|
@ -122,24 +122,21 @@ public class GDBConsoleBreakpointsTest extends BaseParametrizedTestCase {
|
|||
|
||||
super.doBeforeTest();
|
||||
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
Assert.assertTrue(fServicesTracker != null);
|
||||
Runnable runnable = () -> {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
Assert.assertTrue(fServicesTracker != null);
|
||||
|
||||
fCommandControl = fServicesTracker.getService(IGDBControl.class);
|
||||
Assert.assertTrue(fCommandControl != null);
|
||||
fCommandControl = fServicesTracker.getService(IGDBControl.class);
|
||||
Assert.assertTrue(fCommandControl != null);
|
||||
|
||||
fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
|
||||
Assert.assertTrue(fBreakpointService != null);
|
||||
fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
|
||||
Assert.assertTrue(fBreakpointService != null);
|
||||
|
||||
fBreakpointsSynchronizer = fServicesTracker.getService(MIBreakpointsSynchronizer.class);
|
||||
Assert.assertTrue(fBreakpointsSynchronizer != null);
|
||||
fBreakpointsSynchronizer = fServicesTracker.getService(MIBreakpointsSynchronizer.class);
|
||||
Assert.assertTrue(fBreakpointsSynchronizer != null);
|
||||
|
||||
// Register to breakpoint events
|
||||
fSession.addServiceEventListener(GDBConsoleBreakpointsTest.this, null);
|
||||
}
|
||||
// Register to breakpoint events
|
||||
fSession.addServiceEventListener(GDBConsoleBreakpointsTest.this, null);
|
||||
};
|
||||
fSession = getGDBLaunch().getSession();
|
||||
fSession.getExecutor().submit(runnable).get();
|
||||
|
|
|
@ -89,27 +89,24 @@ public class GDBConsoleSynchronizingTest extends BaseParametrizedTestCase {
|
|||
super.doBeforeTest();
|
||||
|
||||
fSession = getGDBLaunch().getSession();
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
Assert.assertTrue(fServicesTracker != null);
|
||||
Runnable runnable = () -> {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
Assert.assertTrue(fServicesTracker != null);
|
||||
|
||||
fCommandControl = fServicesTracker.getService(IGDBControl.class);
|
||||
Assert.assertTrue(fCommandControl != null);
|
||||
fCommandControl = fServicesTracker.getService(IGDBControl.class);
|
||||
Assert.assertTrue(fCommandControl != null);
|
||||
|
||||
fMemoryService = fServicesTracker.getService(IMemory.class);
|
||||
Assert.assertTrue(fMemoryService != null);
|
||||
fMemoryService = fServicesTracker.getService(IMemory.class);
|
||||
Assert.assertTrue(fMemoryService != null);
|
||||
|
||||
fExprService = fServicesTracker.getService(IExpressions.class);
|
||||
Assert.assertTrue(fExprService != null);
|
||||
fExprService = fServicesTracker.getService(IExpressions.class);
|
||||
Assert.assertTrue(fExprService != null);
|
||||
|
||||
fRunControl = fServicesTracker.getService(IRunControl.class);
|
||||
Assert.assertTrue(fRunControl != null);
|
||||
fRunControl = fServicesTracker.getService(IRunControl.class);
|
||||
Assert.assertTrue(fRunControl != null);
|
||||
|
||||
// Register to breakpoint events
|
||||
fSession.addServiceEventListener(GDBConsoleSynchronizingTest.this, null);
|
||||
}
|
||||
// Register to breakpoint events
|
||||
fSession.addServiceEventListener(GDBConsoleSynchronizingTest.this, null);
|
||||
};
|
||||
fSession.getExecutor().submit(runnable).get();
|
||||
}
|
||||
|
|
|
@ -80,15 +80,12 @@ public class GDBPatternMatchingExpressionsTest extends BaseParametrizedTestCase
|
|||
super.doBeforeTest();
|
||||
|
||||
fSession = getGDBLaunch().getSession();
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
Runnable runnable = () -> {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
|
||||
fExpService = fServicesTracker.getService(IMIExpressions.class);
|
||||
fExpService = fServicesTracker.getService(IMIExpressions.class);
|
||||
|
||||
fRegService = fServicesTracker.getService(IRegisters2.class);
|
||||
}
|
||||
fRegService = fServicesTracker.getService(IRegisters2.class);
|
||||
};
|
||||
fSession.getExecutor().submit(runnable).get();
|
||||
}
|
||||
|
|
|
@ -60,12 +60,9 @@ public class GDBProcessesTest extends BaseParametrizedTestCase {
|
|||
resolveLineTagLocations(SOURCE_NAME, MIRunControlTest.LINE_TAGS);
|
||||
|
||||
fSession = getGDBLaunch().getSession();
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
fProcService = fServicesTracker.getService(IMIProcesses.class);
|
||||
}
|
||||
Runnable runnable = () -> {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
fProcService = fServicesTracker.getService(IMIProcesses.class);
|
||||
};
|
||||
fSession.getExecutor().submit(runnable).get();
|
||||
}
|
||||
|
|
|
@ -167,24 +167,21 @@ public class GDBRemoteTracepointsTest extends BaseParametrizedTestCase {
|
|||
resolveLineTagLocations(SOURCE_NAME, LINE_TAGS);
|
||||
|
||||
fSession = getGDBLaunch().getSession();
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
Runnable runnable = () -> {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
|
||||
fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
|
||||
fGdbControl = fServicesTracker.getService(IGDBControl.class);
|
||||
fCommandFactory = fGdbControl.getCommandFactory();
|
||||
fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
|
||||
fGdbControl = fServicesTracker.getService(IGDBControl.class);
|
||||
fCommandFactory = fGdbControl.getCommandFactory();
|
||||
|
||||
// fTraceService = fServicesTracker.getService(ITraceControl.class);
|
||||
fSession.addServiceEventListener(GDBRemoteTracepointsTest.this, null);
|
||||
// fTraceService = fServicesTracker.getService(ITraceControl.class);
|
||||
fSession.addServiceEventListener(GDBRemoteTracepointsTest.this, null);
|
||||
|
||||
// Create a large array to make sure we don't run out
|
||||
fTracepoints = new IBreakpointDMContext[100];
|
||||
// Create a large array to make sure we don't run out
|
||||
fTracepoints = new IBreakpointDMContext[100];
|
||||
|
||||
// Run an initial test to check that everything is ok with GDB
|
||||
checkTraceInitialStatus();
|
||||
}
|
||||
// Run an initial test to check that everything is ok with GDB
|
||||
checkTraceInitialStatus();
|
||||
};
|
||||
fSession.getExecutor().submit(runnable).get();
|
||||
|
||||
|
|
|
@ -128,14 +128,11 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
|
|||
super.doLaunch();
|
||||
|
||||
fSession = getGDBLaunch().getSession();
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
Runnable runnable = () -> {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
|
||||
fExpService = fServicesTracker.getService(IExpressions.class);
|
||||
fGdbControl = fServicesTracker.getService(IGDBControl.class);
|
||||
}
|
||||
fExpService = fServicesTracker.getService(IExpressions.class);
|
||||
fGdbControl = fServicesTracker.getService(IGDBControl.class);
|
||||
};
|
||||
fSession.getExecutor().submit(runnable).get();
|
||||
|
||||
|
|
|
@ -187,23 +187,20 @@ public class MIBreakpointsTest extends BaseParametrizedTestCase {
|
|||
super.doBeforeTest();
|
||||
// Get a reference to the breakpoint service
|
||||
fSession = getGDBLaunch().getSession();
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
assert (fServicesTracker != null);
|
||||
fRunControl = fServicesTracker.getService(MIRunControl.class);
|
||||
assert (fRunControl != null);
|
||||
fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
|
||||
assert (fBreakpointService != null);
|
||||
fExpressionService = fServicesTracker.getService(IExpressions.class);
|
||||
assert (fExpressionService != null);
|
||||
fCommandControl = fServicesTracker.getService(IGDBControl.class);
|
||||
assert (fCommandControl != null);
|
||||
// Register to breakpoint events
|
||||
fRunControl.getSession().addServiceEventListener(MIBreakpointsTest.this, null);
|
||||
clearEventCounters();
|
||||
}
|
||||
Runnable runnable = () -> {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
assert (fServicesTracker != null);
|
||||
fRunControl = fServicesTracker.getService(MIRunControl.class);
|
||||
assert (fRunControl != null);
|
||||
fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
|
||||
assert (fBreakpointService != null);
|
||||
fExpressionService = fServicesTracker.getService(IExpressions.class);
|
||||
assert (fExpressionService != null);
|
||||
fCommandControl = fServicesTracker.getService(IGDBControl.class);
|
||||
assert (fCommandControl != null);
|
||||
// Register to breakpoint events
|
||||
fRunControl.getSession().addServiceEventListener(MIBreakpointsTest.this, null);
|
||||
clearEventCounters();
|
||||
};
|
||||
fSession.getExecutor().submit(runnable).get();
|
||||
IContainerDMContext containerDmc = SyncUtil.getContainerContext();
|
||||
|
|
|
@ -158,26 +158,23 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
|
|||
|
||||
// Get a reference to the breakpoint service
|
||||
fSession = getGDBLaunch().getSession();
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
assertNotNull(fServicesTracker);
|
||||
Runnable runnable = () -> {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
assertNotNull(fServicesTracker);
|
||||
|
||||
fRunControl = fServicesTracker.getService(MIRunControl.class);
|
||||
assertNotNull(fRunControl);
|
||||
fRunControl = fServicesTracker.getService(MIRunControl.class);
|
||||
assertNotNull(fRunControl);
|
||||
|
||||
fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
|
||||
assertNotNull(fBreakpointService);
|
||||
fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
|
||||
assertNotNull(fBreakpointService);
|
||||
|
||||
fExpressionService = fServicesTracker.getService(IExpressions.class);
|
||||
assertNotNull(fExpressionService);
|
||||
fExpressionService = fServicesTracker.getService(IExpressions.class);
|
||||
assertNotNull(fExpressionService);
|
||||
|
||||
// Register to receive breakpoint events
|
||||
fRunControl.getSession().addServiceEventListener(MICatchpointsTest.this, null);
|
||||
// Register to receive breakpoint events
|
||||
fRunControl.getSession().addServiceEventListener(MICatchpointsTest.this, null);
|
||||
|
||||
clearEventCounters();
|
||||
}
|
||||
clearEventCounters();
|
||||
};
|
||||
fSession.getExecutor().submit(runnable).get();
|
||||
|
||||
|
@ -201,12 +198,7 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
|
|||
public void doAfterTest() throws Exception {
|
||||
super.doAfterTest();
|
||||
if (fSession != null) {
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fRunControl.getSession().removeServiceEventListener(MICatchpointsTest.this);
|
||||
}
|
||||
};
|
||||
Runnable runnable = () -> fRunControl.getSession().removeServiceEventListener(MICatchpointsTest.this);
|
||||
fSession.getExecutor().submit(runnable).get();
|
||||
}
|
||||
// Clear the references (not strictly necessary)
|
||||
|
@ -365,12 +357,7 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
|
|||
|
||||
// Evaluate the expression (asynchronously)
|
||||
fWait.waitReset();
|
||||
fSession.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fExpressionService.getFormattedExpressionValue(formattedValueDMC, drm);
|
||||
}
|
||||
});
|
||||
fSession.getExecutor().submit(() -> fExpressionService.getFormattedExpressionValue(formattedValueDMC, drm));
|
||||
|
||||
// Wait for completion
|
||||
fWait.waitUntilDone(TestsPlugin.massageTimeout(5000));
|
||||
|
@ -411,12 +398,7 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
|
|||
|
||||
// Issue the breakpoint request
|
||||
fWait.waitReset();
|
||||
fBreakpointService.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fBreakpointService.getBreakpoints(context, drm);
|
||||
}
|
||||
});
|
||||
fBreakpointService.getExecutor().submit(() -> fBreakpointService.getBreakpoints(context, drm));
|
||||
|
||||
// Wait for completion
|
||||
fWait.waitUntilDone(TestsPlugin.massageTimeout(5000));
|
||||
|
@ -453,12 +435,7 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
|
|||
|
||||
// Issue the breakpoint request
|
||||
fWait.waitReset();
|
||||
fBreakpointService.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fBreakpointService.getBreakpointDMData(breakpoint, drm);
|
||||
}
|
||||
});
|
||||
fBreakpointService.getExecutor().submit(() -> fBreakpointService.getBreakpointDMData(breakpoint, drm));
|
||||
|
||||
// Wait for completion
|
||||
fWait.waitUntilDone(TestsPlugin.massageTimeout(5000));
|
||||
|
@ -496,12 +473,7 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
|
|||
};
|
||||
|
||||
// Issue the remove breakpoint request
|
||||
fBreakpointService.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fBreakpointService.insertBreakpoint(context, attributes, drm);
|
||||
}
|
||||
});
|
||||
fBreakpointService.getExecutor().submit(() -> fBreakpointService.insertBreakpoint(context, attributes, drm));
|
||||
|
||||
// Wait for the result and return the breakpoint id
|
||||
fWait.waitUntilDone(TestsPlugin.massageTimeout(5000));
|
||||
|
@ -534,12 +506,7 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
|
|||
};
|
||||
|
||||
// Issue the add breakpoint request
|
||||
fBreakpointService.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fBreakpointService.removeBreakpoint(breakpoint, rm);
|
||||
}
|
||||
});
|
||||
fBreakpointService.getExecutor().submit(() -> fBreakpointService.removeBreakpoint(breakpoint, rm));
|
||||
|
||||
// Wait for the result
|
||||
fWait.waitUntilDone(TestsPlugin.massageTimeout(5000));
|
||||
|
@ -572,12 +539,7 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
|
|||
};
|
||||
|
||||
// Issue the update breakpoint request
|
||||
fBreakpointService.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fBreakpointService.updateBreakpoint(breakpoint, delta, rm);
|
||||
}
|
||||
});
|
||||
fBreakpointService.getExecutor().submit(() -> fBreakpointService.updateBreakpoint(breakpoint, delta, rm));
|
||||
|
||||
// Wait for the result
|
||||
fWait.waitUntilDone(TestsPlugin.massageTimeout(5000));
|
||||
|
|
|
@ -89,19 +89,16 @@ public class MIDisassemblyTest extends BaseParametrizedTestCase {
|
|||
super.doBeforeTest();
|
||||
|
||||
fSession = getGDBLaunch().getSession();
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Get a reference to the memory service
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
assert (fServicesTracker != null);
|
||||
Runnable runnable = () -> {
|
||||
// Get a reference to the memory service
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
assert (fServicesTracker != null);
|
||||
|
||||
fDisassembly = fServicesTracker.getService(MIDisassembly.class);
|
||||
assert (fDisassembly != null);
|
||||
fDisassembly = fServicesTracker.getService(MIDisassembly.class);
|
||||
assert (fDisassembly != null);
|
||||
|
||||
fExpressionService = fServicesTracker.getService(IExpressions.class);
|
||||
assert (fExpressionService != null);
|
||||
}
|
||||
fExpressionService = fServicesTracker.getService(IExpressions.class);
|
||||
assert (fExpressionService != null);
|
||||
};
|
||||
fSession.getExecutor().submit(runnable).get();
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -104,29 +104,26 @@ public class MIMemoryTest extends BaseParametrizedTestCase {
|
|||
fMemoryDmc = (IMemoryDMContext) SyncUtil.getContainerContext();
|
||||
assert (fMemoryDmc != null);
|
||||
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Get a reference to the memory service
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
assert (fServicesTracker != null);
|
||||
Runnable runnable = () -> {
|
||||
// Get a reference to the memory service
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
assert (fServicesTracker != null);
|
||||
|
||||
fRunControl = fServicesTracker.getService(MIRunControl.class);
|
||||
assert (fRunControl != null);
|
||||
fRunControl = fServicesTracker.getService(MIRunControl.class);
|
||||
assert (fRunControl != null);
|
||||
|
||||
fMemoryService = fServicesTracker.getService(IMemory.class);
|
||||
assert (fMemoryService != null);
|
||||
fMemoryService = fServicesTracker.getService(IMemory.class);
|
||||
assert (fMemoryService != null);
|
||||
|
||||
fExpressionService = fServicesTracker.getService(IExpressions.class);
|
||||
assert (fExpressionService != null);
|
||||
fExpressionService = fServicesTracker.getService(IExpressions.class);
|
||||
assert (fExpressionService != null);
|
||||
|
||||
fSession.addServiceEventListener(MIMemoryTest.this, null);
|
||||
fBaseAddress = null;
|
||||
clearEventCounters();
|
||||
fSession.addServiceEventListener(MIMemoryTest.this, null);
|
||||
fBaseAddress = null;
|
||||
clearEventCounters();
|
||||
|
||||
fWordSize = SyncUtil.readAddressableSize(fMemoryDmc);
|
||||
fByteOrder = SyncUtil.getMemoryByteOrder(fMemoryDmc);
|
||||
}
|
||||
fWordSize = SyncUtil.readAddressableSize(fMemoryDmc);
|
||||
fByteOrder = SyncUtil.getMemoryByteOrder(fMemoryDmc);
|
||||
};
|
||||
fSession.getExecutor().submit(runnable).get();
|
||||
}
|
||||
|
|
|
@ -101,16 +101,13 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
|
|||
fSession = getGDBLaunch().getSession();
|
||||
resolveLineTagLocations(SOURCE_NAME, MIRunControlTest.LINE_TAGS);
|
||||
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// We obtain the services we need after the new
|
||||
// launch has been performed
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
Runnable runnable = () -> {
|
||||
// We obtain the services we need after the new
|
||||
// launch has been performed
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
|
||||
fRegService = (IRegisters2) fServicesTracker.getService(IRegisters.class);
|
||||
fRunControl = fServicesTracker.getService(IRunControl.class);
|
||||
}
|
||||
fRegService = (IRegisters2) fServicesTracker.getService(IRegisters.class);
|
||||
fRunControl = fServicesTracker.getService(IRunControl.class);
|
||||
};
|
||||
|
||||
fSession.getExecutor().submit(runnable).get();
|
||||
|
|
|
@ -65,14 +65,11 @@ public class MIRunControlReverseTest extends BaseParametrizedTestCase {
|
|||
|
||||
fSession = getGDBLaunch().getSession();
|
||||
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
fGDBCtrl = fServicesTracker.getService(IGDBControl.class);
|
||||
fRunCtrl = fServicesTracker.getService(IMIRunControl.class);
|
||||
fExpressions = fServicesTracker.getService(IExpressions.class);
|
||||
}
|
||||
Runnable runnable = () -> {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
fGDBCtrl = fServicesTracker.getService(IGDBControl.class);
|
||||
fRunCtrl = fServicesTracker.getService(IMIRunControl.class);
|
||||
fExpressions = fServicesTracker.getService(IExpressions.class);
|
||||
};
|
||||
fSession.getExecutor().submit(runnable).get();
|
||||
}
|
||||
|
|
|
@ -65,14 +65,11 @@ public class MIRunControlTargetAvailableTest extends BaseParametrizedTestCase {
|
|||
|
||||
final DsfSession session = getGDBLaunch().getSession();
|
||||
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), session.getId());
|
||||
fGDBCtrl = fServicesTracker.getService(IGDBControl.class);
|
||||
Runnable runnable = () -> {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), session.getId());
|
||||
fGDBCtrl = fServicesTracker.getService(IGDBControl.class);
|
||||
|
||||
fRunCtrl = fServicesTracker.getService(IMIRunControl.class);
|
||||
}
|
||||
fRunCtrl = fServicesTracker.getService(IMIRunControl.class);
|
||||
};
|
||||
session.getExecutor().submit(runnable).get();
|
||||
|
||||
|
|
|
@ -109,22 +109,19 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
|
|||
|
||||
final DsfSession session = getGDBLaunch().getSession();
|
||||
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), session.getId());
|
||||
fGDBCtrl = fServicesTracker.getService(IGDBControl.class);
|
||||
Runnable runnable = () -> {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), session.getId());
|
||||
fGDBCtrl = fServicesTracker.getService(IGDBControl.class);
|
||||
|
||||
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
||||
IProcessDMContext procDmc = procService.createProcessContext(fGDBCtrl.getContext(),
|
||||
MIProcesses.UNIQUE_GROUP_ID);
|
||||
fContainerDmc = procService.createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID);
|
||||
IThreadDMContext threadDmc = procService.createThreadContext(procDmc, "1");
|
||||
fThreadExecDmc = procService.createExecutionContext(fContainerDmc, threadDmc, "1");
|
||||
IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
|
||||
IProcessDMContext procDmc = procService.createProcessContext(fGDBCtrl.getContext(),
|
||||
MIProcesses.UNIQUE_GROUP_ID);
|
||||
fContainerDmc = procService.createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID);
|
||||
IThreadDMContext threadDmc = procService.createThreadContext(procDmc, "1");
|
||||
fThreadExecDmc = procService.createExecutionContext(fContainerDmc, threadDmc, "1");
|
||||
|
||||
fRunCtrl = fServicesTracker.getService(IMIRunControl.class);
|
||||
fBackEnd = fServicesTracker.getService(IGDBBackend.class);
|
||||
}
|
||||
fRunCtrl = fServicesTracker.getService(IMIRunControl.class);
|
||||
fBackEnd = fServicesTracker.getService(IGDBBackend.class);
|
||||
};
|
||||
session.getExecutor().submit(runnable).get();
|
||||
}
|
||||
|
@ -221,12 +218,7 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
|
|||
/*
|
||||
* Test getExecutionContexts() when only one thread exist.
|
||||
*/
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fRunCtrl.getExecutionContexts(containerDmc, rm);
|
||||
}
|
||||
});
|
||||
fRunCtrl.getExecutor().submit(() -> fRunCtrl.getExecutionContexts(containerDmc, rm));
|
||||
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
|
||||
Assert.assertTrue(wait.getMessage(), wait.isOK());
|
||||
|
||||
|
@ -287,12 +279,7 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
|
|||
/*
|
||||
* Test getExecutionContexts for a valid container DMC
|
||||
*/
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fRunCtrl.getExecutionContexts(containerDmc, rmExecutionCtxts);
|
||||
}
|
||||
});
|
||||
fRunCtrl.getExecutor().submit(() -> fRunCtrl.getExecutionContexts(containerDmc, rmExecutionCtxts));
|
||||
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
|
||||
Assert.assertTrue(wait.getMessage(), wait.isOK());
|
||||
wait.waitReset();
|
||||
|
@ -353,12 +340,8 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
|
|||
/*
|
||||
* Call getModelData for Execution DMC
|
||||
*/
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fRunCtrl.getExecutionData(((MIRunControl) fRunCtrl).createMIExecutionContext(containerDmc, "1"), rm);
|
||||
}
|
||||
});
|
||||
fRunCtrl.getExecutor().submit(() -> fRunCtrl
|
||||
.getExecutionData(((MIRunControl) fRunCtrl).createMIExecutionContext(containerDmc, "1"), rm));
|
||||
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
|
||||
Assert.assertTrue(wait.getMessage(), wait.isOK());
|
||||
|
||||
|
@ -403,12 +386,7 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
|
|||
/*
|
||||
* getModelData for Execution DMC
|
||||
*/
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fRunCtrl.getExecutionData(stoppedEvent.getDMContext(), rm);
|
||||
}
|
||||
});
|
||||
fRunCtrl.getExecutor().submit(() -> fRunCtrl.getExecutionData(stoppedEvent.getDMContext(), rm));
|
||||
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
|
||||
Assert.assertTrue(wait.getMessage(), wait.isOK());
|
||||
|
||||
|
@ -450,12 +428,7 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
|
|||
wait.waitFinished(getStatus());
|
||||
}
|
||||
};
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fRunCtrl.getExecutionData(stoppedEvent.getDMContext(), rm);
|
||||
}
|
||||
});
|
||||
fRunCtrl.getExecutor().submit(() -> fRunCtrl.getExecutionData(stoppedEvent.getDMContext(), rm));
|
||||
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
|
||||
Assert.assertTrue(wait.getMessage(), wait.isOK());
|
||||
|
||||
|
@ -497,12 +470,7 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
|
|||
}
|
||||
};
|
||||
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fRunCtrl.getExecutionData(fContainerDmc, rm);
|
||||
}
|
||||
});
|
||||
fRunCtrl.getExecutor().submit(() -> fRunCtrl.getExecutionData(fContainerDmc, rm));
|
||||
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
|
||||
Assert.assertTrue(wait.getMessage(), wait.isOK());
|
||||
|
||||
|
@ -534,13 +502,7 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
|
|||
}
|
||||
};
|
||||
// final IContainerDMContext ctxt = new GDBControlDMContext("-1", getClass().getName() + ":" + 1);
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Pass an invalid dmc
|
||||
fRunCtrl.getExecutionContexts(fContainerDmc, rm);
|
||||
}
|
||||
});
|
||||
fRunCtrl.getExecutor().submit(() -> fRunCtrl.getExecutionContexts(fContainerDmc, rm));
|
||||
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
|
||||
Assert.assertTrue(wait.getMessage(), !wait.isOK());
|
||||
|
||||
|
@ -585,12 +547,7 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
|
|||
|
||||
final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
|
||||
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fRunCtrl.resume(containerDmc, rm);
|
||||
}
|
||||
});
|
||||
fRunCtrl.getExecutor().submit(() -> fRunCtrl.resume(containerDmc, rm));
|
||||
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
|
||||
|
||||
try {
|
||||
|
@ -604,12 +561,9 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
|
|||
|
||||
wait.waitReset();
|
||||
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
wait.setReturnInfo(fRunCtrl.isSuspended(containerDmc));
|
||||
wait.waitFinished();
|
||||
}
|
||||
fRunCtrl.getExecutor().submit(() -> {
|
||||
wait.setReturnInfo(fRunCtrl.isSuspended(containerDmc));
|
||||
wait.waitFinished();
|
||||
});
|
||||
|
||||
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
|
||||
|
@ -632,12 +586,7 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
|
|||
final ServiceEventWaitor<IResumedDMEvent> eventWaitor = new ServiceEventWaitor<>(getGDBLaunch().getSession(),
|
||||
IResumedDMEvent.class);
|
||||
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fRunCtrl.resume(fContainerDmc, rm);
|
||||
}
|
||||
});
|
||||
fRunCtrl.getExecutor().submit(() -> fRunCtrl.resume(fContainerDmc, rm));
|
||||
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
|
||||
try {
|
||||
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(5000));
|
||||
|
@ -654,12 +603,9 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
|
|||
|
||||
final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
|
||||
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
wait.setReturnInfo(fRunCtrl.isSuspended(containerDmc));
|
||||
wait.waitFinished();
|
||||
}
|
||||
fRunCtrl.getExecutor().submit(() -> {
|
||||
wait.setReturnInfo(fRunCtrl.isSuspended(containerDmc));
|
||||
wait.waitFinished();
|
||||
});
|
||||
|
||||
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
|
||||
|
@ -685,18 +631,13 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
|
|||
ServiceEventWaitor<ISuspendedDMEvent> suspendedEventWaitor = new ServiceEventWaitor<>(
|
||||
getGDBLaunch().getSession(), ISuspendedDMEvent.class);
|
||||
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fRunCtrl.runToLine(fThreadExecDmc, SOURCE_NAME, getLineForTag("LINE_MAIN_ALL_THREADS_STARTED"), true,
|
||||
new RequestMonitor(fRunCtrl.getExecutor(), null) {
|
||||
@Override
|
||||
protected void handleCompleted() {
|
||||
wait.waitFinished(getStatus());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
fRunCtrl.getExecutor().submit(() -> fRunCtrl.runToLine(fThreadExecDmc, SOURCE_NAME,
|
||||
getLineForTag("LINE_MAIN_ALL_THREADS_STARTED"), true, new RequestMonitor(fRunCtrl.getExecutor(), null) {
|
||||
@Override
|
||||
protected void handleCompleted() {
|
||||
wait.waitFinished(getStatus());
|
||||
}
|
||||
}));
|
||||
|
||||
wait.waitUntilDone(TestsPlugin.massageTimeout(1000));
|
||||
Assert.assertTrue(wait.getMessage(), wait.isOK());
|
||||
|
@ -705,12 +646,9 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
|
|||
suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(10000));
|
||||
final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
|
||||
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
wait.setReturnInfo(fRunCtrl.isSuspended(containerDmc));
|
||||
wait.waitFinished();
|
||||
}
|
||||
fRunCtrl.getExecutor().submit(() -> {
|
||||
wait.setReturnInfo(fRunCtrl.isSuspended(containerDmc));
|
||||
wait.waitFinished();
|
||||
});
|
||||
|
||||
wait.waitUntilDone(TestsPlugin.massageTimeout(5000));
|
||||
|
@ -730,17 +668,13 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
|
|||
getGDBLaunch().getSession(), ISuspendedDMEvent.class);
|
||||
|
||||
// Resume the target
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fRunCtrl.resume(fThreadExecDmc, new RequestMonitor(fRunCtrl.getExecutor(), null) {
|
||||
fRunCtrl.getExecutor()
|
||||
.submit(() -> fRunCtrl.resume(fThreadExecDmc, new RequestMonitor(fRunCtrl.getExecutor(), null) {
|
||||
@Override
|
||||
protected void handleCompleted() {
|
||||
wait.waitFinished(getStatus());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}));
|
||||
wait.waitUntilDone(TestsPlugin.massageTimeout(1000));
|
||||
Assert.assertTrue(wait.getMessage(), wait.isOK());
|
||||
wait.waitReset();
|
||||
|
@ -752,17 +686,13 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
|
|||
// interrupts after the threads exit.
|
||||
// Ref: https://sourceware.org/bugzilla/show_bug.cgi?id=17627
|
||||
Thread.sleep(1000);
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fRunCtrl.suspend(fThreadExecDmc, new RequestMonitor(fRunCtrl.getExecutor(), null) {
|
||||
fRunCtrl.getExecutor()
|
||||
.submit(() -> fRunCtrl.suspend(fThreadExecDmc, new RequestMonitor(fRunCtrl.getExecutor(), null) {
|
||||
@Override
|
||||
protected void handleCompleted() {
|
||||
wait.waitFinished(getStatus());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
wait.waitUntilDone(TestsPlugin.massageTimeout(1000));
|
||||
Assert.assertTrue(wait.getMessage(), wait.isOK());
|
||||
|
@ -773,12 +703,9 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
|
|||
|
||||
// Double check that the target is in the suspended state
|
||||
final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
wait.setReturnInfo(fRunCtrl.isSuspended(containerDmc));
|
||||
wait.waitFinished();
|
||||
}
|
||||
fRunCtrl.getExecutor().submit(() -> {
|
||||
wait.setReturnInfo(fRunCtrl.isSuspended(containerDmc));
|
||||
wait.waitFinished();
|
||||
});
|
||||
wait.waitUntilDone(TestsPlugin.massageTimeout(2000));
|
||||
Assert.assertTrue("Target is running. It should have been suspended", (Boolean) wait.getReturnInfo());
|
||||
|
|
|
@ -73,14 +73,11 @@ public class OperationsWhileTargetIsRunningTest extends BaseParametrizedTestCase
|
|||
|
||||
final DsfSession session = getGDBLaunch().getSession();
|
||||
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), session.getId());
|
||||
Runnable runnable = () -> {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), session.getId());
|
||||
|
||||
fProcesses = fServicesTracker.getService(IGDBProcesses.class);
|
||||
fControl = fServicesTracker.getService(IGDBControl.class);
|
||||
}
|
||||
fProcesses = fServicesTracker.getService(IGDBProcesses.class);
|
||||
fControl = fServicesTracker.getService(IGDBControl.class);
|
||||
};
|
||||
session.getExecutor().submit(runnable).get();
|
||||
|
||||
|
@ -182,12 +179,9 @@ public class OperationsWhileTargetIsRunningTest extends BaseParametrizedTestCase
|
|||
|
||||
// Don't use a query here. The terminate, because it kills GDB, may not return right away
|
||||
// but that is ok because we wait for a shutdown event right after
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
IProcessDMContext processDmc = DMContexts.getAncestorOfType(fContainerDmc, IProcessDMContext.class);
|
||||
fProcesses.terminate(processDmc, new ImmediateRequestMonitor());
|
||||
}
|
||||
Runnable runnable = () -> {
|
||||
IProcessDMContext processDmc = DMContexts.getAncestorOfType(fContainerDmc, IProcessDMContext.class);
|
||||
fProcesses.terminate(processDmc, new ImmediateRequestMonitor());
|
||||
};
|
||||
fProcesses.getExecutor().execute(runnable);
|
||||
|
||||
|
@ -265,12 +259,7 @@ public class OperationsWhileTargetIsRunningTest extends BaseParametrizedTestCase
|
|||
|
||||
// Don't use a query here. Because GDB will be killed, the call to detach may not return right away
|
||||
// but that is ok because we wait for a shutdown event right after
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fProcesses.detachDebuggerFromProcess(fContainerDmc, new ImmediateRequestMonitor());
|
||||
}
|
||||
};
|
||||
Runnable runnable = () -> fProcesses.detachDebuggerFromProcess(fContainerDmc, new ImmediateRequestMonitor());
|
||||
fProcesses.getExecutor().execute(runnable);
|
||||
|
||||
// The shutdown must happen quickly, which will confirm that it was
|
||||
|
|
|
@ -115,12 +115,9 @@ public class PostMortemCoreTest extends BaseParametrizedTestCase {
|
|||
fMemoryDmc = (IMemoryDMContext) SyncUtil.getContainerContext();
|
||||
assert (fMemoryDmc != null);
|
||||
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
fExpService = fServicesTracker.getService(IExpressions.class);
|
||||
}
|
||||
Runnable runnable = () -> {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
fExpService = fServicesTracker.getService(IExpressions.class);
|
||||
};
|
||||
fSession.getExecutor().submit(runnable).get();
|
||||
}
|
||||
|
@ -526,107 +523,94 @@ public class PostMortemCoreTest extends BaseParametrizedTestCase {
|
|||
// Get the list of available format IDs for this expression and for
|
||||
// each one,
|
||||
// get the value of the expression
|
||||
fExpService.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fExpService.getAvailableFormats(exprDMC,
|
||||
new DataRequestMonitor<String[]>(fExpService.getExecutor(), null) {
|
||||
@Override
|
||||
protected void handleCompleted() {
|
||||
if (!isSuccess()) {
|
||||
wait.waitFinished(getStatus());
|
||||
} else {
|
||||
final String[] formatIds = getData();
|
||||
fExpService.getExecutor().submit(() -> fExpService.getAvailableFormats(exprDMC,
|
||||
new DataRequestMonitor<String[]>(fExpService.getExecutor(), null) {
|
||||
@Override
|
||||
protected void handleCompleted() {
|
||||
if (!isSuccess()) {
|
||||
wait.waitFinished(getStatus());
|
||||
} else {
|
||||
final String[] formatIds = getData();
|
||||
|
||||
// Now run the current sub-test using each of
|
||||
// the formats available for the type of
|
||||
// the expression in the sub-test.
|
||||
// Now run the current sub-test using each of
|
||||
// the formats available for the type of
|
||||
// the expression in the sub-test.
|
||||
|
||||
for (final String formatId : formatIds) {
|
||||
// Get a FormattedValueCMContext object for
|
||||
// the expression-formatID pair.
|
||||
final FormattedValueDMContext valueDmc = fExpService
|
||||
.getFormattedValueContext(exprDMC, formatId);
|
||||
for (final String formatId : formatIds) {
|
||||
// Get a FormattedValueCMContext object for
|
||||
// the expression-formatID pair.
|
||||
final FormattedValueDMContext valueDmc = fExpService
|
||||
.getFormattedValueContext(exprDMC, formatId);
|
||||
|
||||
// Increment the number of completed
|
||||
// requests to wait for, since we will send
|
||||
// multiple concurrent requests
|
||||
wait.increment();
|
||||
// Increment the number of completed
|
||||
// requests to wait for, since we will send
|
||||
// multiple concurrent requests
|
||||
wait.increment();
|
||||
|
||||
// Evaluate the expression represented by
|
||||
// the FormattedValueDMContext object
|
||||
// This actually evaluates the expression.
|
||||
fExpService.getFormattedExpressionValue(valueDmc,
|
||||
new DataRequestMonitor<FormattedValueDMData>(
|
||||
fExpService.getExecutor(), null) {
|
||||
@Override
|
||||
protected void handleCompleted() {
|
||||
if (!isSuccess()) {
|
||||
wait.waitFinished(getStatus());
|
||||
} else {
|
||||
// Evaluate the expression represented by
|
||||
// the FormattedValueDMContext object
|
||||
// This actually evaluates the expression.
|
||||
fExpService.getFormattedExpressionValue(valueDmc,
|
||||
new DataRequestMonitor<FormattedValueDMData>(fExpService.getExecutor(),
|
||||
null) {
|
||||
@Override
|
||||
protected void handleCompleted() {
|
||||
if (!isSuccess()) {
|
||||
wait.waitFinished(getStatus());
|
||||
} else {
|
||||
|
||||
// Get the
|
||||
// FormattedValueDMData
|
||||
// object from the waiter.
|
||||
FormattedValueDMData exprValueDMData = getData();
|
||||
// Get the
|
||||
// FormattedValueDMData
|
||||
// object from the waiter.
|
||||
FormattedValueDMData exprValueDMData = getData();
|
||||
|
||||
final String[] expectedValues = tests
|
||||
.get(expressionToEvaluate);
|
||||
final String[] expectedValues = tests.get(expressionToEvaluate);
|
||||
|
||||
// Check the value of the expression for correctness.
|
||||
String actualValue = exprValueDMData
|
||||
.getFormattedValue();
|
||||
String expectedValue;
|
||||
// Check the value of the expression for correctness.
|
||||
String actualValue = exprValueDMData.getFormattedValue();
|
||||
String expectedValue;
|
||||
|
||||
if (formatId.equals(IFormattedValues.HEX_FORMAT))
|
||||
expectedValue = expectedValues[0];
|
||||
else if (formatId.equals(IFormattedValues.OCTAL_FORMAT))
|
||||
expectedValue = expectedValues[1];
|
||||
else if (formatId
|
||||
.equals(IFormattedValues.BINARY_FORMAT))
|
||||
expectedValue = expectedValues[2];
|
||||
else if (formatId
|
||||
.equals(IFormattedValues.DECIMAL_FORMAT))
|
||||
expectedValue = expectedValues[3];
|
||||
else if (formatId
|
||||
.equals(IFormattedValues.NATURAL_FORMAT))
|
||||
expectedValue = expectedValues[4];
|
||||
else if (formatId.equals(MIExpressions.DETAILS_FORMAT))
|
||||
expectedValue = expectedValues[5];
|
||||
else
|
||||
expectedValue = "[Unrecognized format ID: "
|
||||
+ formatId + "]";
|
||||
if (formatId.equals(IFormattedValues.HEX_FORMAT))
|
||||
expectedValue = expectedValues[0];
|
||||
else if (formatId.equals(IFormattedValues.OCTAL_FORMAT))
|
||||
expectedValue = expectedValues[1];
|
||||
else if (formatId.equals(IFormattedValues.BINARY_FORMAT))
|
||||
expectedValue = expectedValues[2];
|
||||
else if (formatId.equals(IFormattedValues.DECIMAL_FORMAT))
|
||||
expectedValue = expectedValues[3];
|
||||
else if (formatId.equals(IFormattedValues.NATURAL_FORMAT))
|
||||
expectedValue = expectedValues[4];
|
||||
else if (formatId.equals(MIExpressions.DETAILS_FORMAT))
|
||||
expectedValue = expectedValues[5];
|
||||
else
|
||||
expectedValue = "[Unrecognized format ID: " + formatId
|
||||
+ "]";
|
||||
|
||||
if ((exact == false)
|
||||
&& (formatId
|
||||
.equals(IFormattedValues.NATURAL_FORMAT)
|
||||
|| formatId.equals(
|
||||
MIExpressions.DETAILS_FORMAT))
|
||||
&& (expectedValue.length() < actualValue
|
||||
.length())) {
|
||||
actualValue = actualValue.substring(0,
|
||||
expectedValue.length());
|
||||
}
|
||||
|
||||
if (actualValue.equalsIgnoreCase(expectedValue)) {
|
||||
wait.waitFinished();
|
||||
} else {
|
||||
String errorMsg = "Failed to correctly evalutate '"
|
||||
+ expressionToEvaluate + "': expected '"
|
||||
+ expectedValue + "', got '" + actualValue
|
||||
+ "'";
|
||||
wait.waitFinished(new Status(IStatus.ERROR,
|
||||
TestsPlugin.PLUGIN_ID, errorMsg, null));
|
||||
}
|
||||
}
|
||||
if ((exact == false)
|
||||
&& (formatId.equals(IFormattedValues.NATURAL_FORMAT)
|
||||
|| formatId
|
||||
.equals(MIExpressions.DETAILS_FORMAT))
|
||||
&& (expectedValue.length() < actualValue.length())) {
|
||||
actualValue = actualValue.substring(0,
|
||||
expectedValue.length());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (actualValue.equalsIgnoreCase(expectedValue)) {
|
||||
wait.waitFinished();
|
||||
} else {
|
||||
String errorMsg = "Failed to correctly evalutate '"
|
||||
+ expressionToEvaluate + "': expected '"
|
||||
+ expectedValue + "', got '" + actualValue + "'";
|
||||
wait.waitFinished(new Status(IStatus.ERROR,
|
||||
TestsPlugin.PLUGIN_ID, errorMsg, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}));
|
||||
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
|
||||
assertTrue(wait.getMessage(), wait.isOK());
|
||||
}
|
||||
|
|
|
@ -239,15 +239,11 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
|
|||
super.doLaunch();
|
||||
|
||||
final DsfSession session = getGDBLaunch().getSession();
|
||||
Runnable runnable = new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
DsfServicesTracker tracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), session.getId());
|
||||
fCommandControl = tracker.getService(IGDBControl.class);
|
||||
fCommandFactory = fCommandControl.getCommandFactory();
|
||||
tracker.dispose();
|
||||
}
|
||||
Runnable runnable = () -> {
|
||||
DsfServicesTracker tracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), session.getId());
|
||||
fCommandControl = tracker.getService(IGDBControl.class);
|
||||
fCommandFactory = fCommandControl.getCommandFactory();
|
||||
tracker.dispose();
|
||||
};
|
||||
session.getExecutor().submit(runnable).get();
|
||||
}
|
||||
|
|
|
@ -106,12 +106,9 @@ public class StepIntoSelectionTest extends BaseParametrizedTestCase {
|
|||
public void doBeforeTest() throws Exception {
|
||||
super.doBeforeTest();
|
||||
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
fRunCtrl = fServicesTracker.getService(IRunControl3.class);
|
||||
}
|
||||
Runnable runnable = () -> {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
fRunCtrl = fServicesTracker.getService(IRunControl3.class);
|
||||
};
|
||||
fSession = getGDBLaunch().getSession();
|
||||
fSession.getExecutor().submit(runnable).get();
|
||||
|
|
|
@ -222,8 +222,7 @@ public class TraceFileTest extends BaseParametrizedTestCase {
|
|||
|
||||
/**
|
||||
* This test sets up by first creating a trace file and importing it back
|
||||
* by calling {@link #testTraceFile} which also calls {@link #createTraceFile}
|
||||
|
||||
* by calling {@link #testTraceFile} which also calls {@link #createTraceFile}.
|
||||
* It then verifies that the tracepoint actions and platform tracepoints
|
||||
* created by {@link #testTraceFile()} are associated with the corresponding target
|
||||
* tracepoints and are not created a second time.
|
||||
|
@ -352,13 +351,10 @@ public class TraceFileTest extends BaseParametrizedTestCase {
|
|||
|
||||
// Initialize
|
||||
fSession = getGDBLaunch().getSession();
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
|
||||
fTraceService = fServicesTracker.getService(IGDBTraceControl.class);
|
||||
}
|
||||
Runnable runnable = () -> {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId());
|
||||
fBreakpointService = fServicesTracker.getService(IBreakpoints.class);
|
||||
fTraceService = fServicesTracker.getService(IGDBTraceControl.class);
|
||||
};
|
||||
fSession.getExecutor().submit(runnable).get();
|
||||
|
||||
|
@ -371,48 +367,39 @@ public class TraceFileTest extends BaseParametrizedTestCase {
|
|||
|
||||
private void startTracing() throws Throwable {
|
||||
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
|
||||
fSession.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fTraceService.getTraceStatus(fTraceTargetDmc,
|
||||
new DataRequestMonitor<ITraceStatusDMData>(fSession.getExecutor(), null) {
|
||||
@Override
|
||||
@ConfinedToDsfExecutor("fExecutor")
|
||||
protected void handleCompleted() {
|
||||
if (isSuccess() && getData().isTracingSupported()) {
|
||||
fTraceService.startTracing(fTraceTargetDmc,
|
||||
new RequestMonitor(fSession.getExecutor(), null) {
|
||||
@Override
|
||||
@ConfinedToDsfExecutor("fExecutor")
|
||||
protected void handleCompleted() {
|
||||
wait.waitFinished(getStatus());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
wait.waitFinished(getStatus());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
fSession.getExecutor().submit(() -> fTraceService.getTraceStatus(fTraceTargetDmc,
|
||||
new DataRequestMonitor<ITraceStatusDMData>(fSession.getExecutor(), null) {
|
||||
@Override
|
||||
@ConfinedToDsfExecutor("fExecutor")
|
||||
protected void handleCompleted() {
|
||||
if (isSuccess() && getData().isTracingSupported()) {
|
||||
fTraceService.startTracing(fTraceTargetDmc,
|
||||
new RequestMonitor(fSession.getExecutor(), null) {
|
||||
@Override
|
||||
@ConfinedToDsfExecutor("fExecutor")
|
||||
protected void handleCompleted() {
|
||||
wait.waitFinished(getStatus());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
wait.waitFinished(getStatus());
|
||||
}
|
||||
}
|
||||
}));
|
||||
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
|
||||
assertTrue(wait.getMessage(), wait.isOK());
|
||||
}
|
||||
|
||||
private void stopTracing() throws Throwable {
|
||||
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
|
||||
fSession.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fTraceService.stopTracing(fTraceTargetDmc, new RequestMonitor(fSession.getExecutor(), null) {
|
||||
fSession.getExecutor().submit(
|
||||
() -> fTraceService.stopTracing(fTraceTargetDmc, new RequestMonitor(fSession.getExecutor(), null) {
|
||||
@Override
|
||||
@ConfinedToDsfExecutor("fExecutor")
|
||||
protected void handleCompleted() {
|
||||
wait.waitFinished(getStatus());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}));
|
||||
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
|
||||
assertTrue(wait.getMessage(), wait.isOK());
|
||||
}
|
||||
|
@ -462,19 +449,14 @@ public class TraceFileTest extends BaseParametrizedTestCase {
|
|||
final Map<String, Object> attributes) throws InterruptedException {
|
||||
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
|
||||
|
||||
fSession.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fBreakpointService.insertBreakpoint(context, attributes,
|
||||
new DataRequestMonitor<IBreakpointDMContext>(fBreakpointService.getExecutor(), null) {
|
||||
@Override
|
||||
protected void handleCompleted() {
|
||||
wait.setReturnInfo(getData());
|
||||
wait.waitFinished(getStatus());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
fSession.getExecutor().submit(() -> fBreakpointService.insertBreakpoint(context, attributes,
|
||||
new DataRequestMonitor<IBreakpointDMContext>(fBreakpointService.getExecutor(), null) {
|
||||
@Override
|
||||
protected void handleCompleted() {
|
||||
wait.setReturnInfo(getData());
|
||||
wait.waitFinished(getStatus());
|
||||
}
|
||||
}));
|
||||
|
||||
// Wait for the result and return the breakpoint context
|
||||
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
|
||||
|
@ -487,18 +469,13 @@ public class TraceFileTest extends BaseParametrizedTestCase {
|
|||
final File traceFile = new Path(TRACE_FILE_PATH).toFile();
|
||||
final AsyncCompletionWaitor wait = new AsyncCompletionWaitor();
|
||||
|
||||
fSession.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fTraceService.saveTraceData(fTraceTargetDmc, traceFile.getAbsolutePath(), false,
|
||||
new RequestMonitor(fSession.getExecutor(), null) {
|
||||
@Override
|
||||
protected void handleCompleted() {
|
||||
wait.waitFinished(getStatus());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
fSession.getExecutor().submit(() -> fTraceService.saveTraceData(fTraceTargetDmc, traceFile.getAbsolutePath(),
|
||||
false, new RequestMonitor(fSession.getExecutor(), null) {
|
||||
@Override
|
||||
protected void handleCompleted() {
|
||||
wait.waitFinished(getStatus());
|
||||
}
|
||||
}));
|
||||
|
||||
// Wait for the result and verify the trace file is created
|
||||
wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER);
|
||||
|
|
|
@ -76,12 +76,9 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
|
||||
final DsfSession session = getGDBLaunch().getSession();
|
||||
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), session.getId());
|
||||
fMultiRun = fServicesTracker.getService(IMultiRunControl.class);
|
||||
}
|
||||
Runnable runnable = () -> {
|
||||
fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), session.getId());
|
||||
fMultiRun = fServicesTracker.getService(IMultiRunControl.class);
|
||||
};
|
||||
session.getExecutor().submit(runnable).get();
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue