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