mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 14:12:10 +02:00
Bug 558474 - CleanUp deprecated methods in org.eclipse.cdt.ui
Reworked deprecated usages of SubProgressMonitor by SubMonitor (Part 5 Latest) Change-Id: Ia7a06893c5acda374f2045666447ec494b8fccdc Signed-off-by: Sergey Kovalchuk <sergei.kovalchuk@arsysop.ru>
This commit is contained in:
parent
711cb3c4b9
commit
4ec47dbc35
7 changed files with 89 additions and 122 deletions
|
@ -26,7 +26,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.ProgressMonitorWrapper;
|
import org.eclipse.core.runtime.ProgressMonitorWrapper;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
import org.eclipse.core.runtime.SubMonitor;
|
||||||
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.ProgressMonitorDialog;
|
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
||||||
|
@ -144,14 +144,13 @@ public class ChangeExceptionHandler {
|
||||||
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
|
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run(IProgressMonitor monitor) throws CoreException {
|
public void run(IProgressMonitor monitor) throws CoreException {
|
||||||
monitor.beginTask("", 11); //$NON-NLS-1$
|
SubMonitor subMonitor = SubMonitor.convert(monitor, 11);
|
||||||
try {
|
try {
|
||||||
undo.initializeValidationData(new NotCancelableProgressMonitor(new SubProgressMonitor(monitor, 1)));
|
undo.initializeValidationData(new NotCancelableProgressMonitor(subMonitor.split(1)));
|
||||||
if (undo.isValid(new SubProgressMonitor(monitor, 1)).hasFatalError()) {
|
if (undo.isValid(subMonitor.split(1)).hasFatalError()) {
|
||||||
monitor.done();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
undo.perform(new SubProgressMonitor(monitor, 9));
|
undo.perform(subMonitor.split(9));
|
||||||
} finally {
|
} finally {
|
||||||
undo.dispose();
|
undo.dispose();
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
import org.eclipse.core.runtime.SubMonitor;
|
||||||
import org.eclipse.search.core.text.TextSearchEngine;
|
import org.eclipse.search.core.text.TextSearchEngine;
|
||||||
import org.eclipse.search.core.text.TextSearchMatchAccess;
|
import org.eclipse.search.core.text.TextSearchMatchAccess;
|
||||||
import org.eclipse.search.core.text.TextSearchRequestor;
|
import org.eclipse.search.core.text.TextSearchRequestor;
|
||||||
|
@ -262,6 +262,7 @@ public class TextSearchWrapper {
|
||||||
*/
|
*/
|
||||||
public IStatus searchWord(IFile[] filesToSearch, int scope, IFile scopeAnchor, String workingSet, String[] patterns,
|
public IStatus searchWord(IFile[] filesToSearch, int scope, IFile scopeAnchor, String workingSet, String[] patterns,
|
||||||
String word, IProgressMonitor monitor, final List<CRefactoringMatch> target) {
|
String word, IProgressMonitor monitor, final List<CRefactoringMatch> target) {
|
||||||
|
SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
|
||||||
int startPos = target.size();
|
int startPos = target.size();
|
||||||
TextSearchEngine engine = TextSearchEngine.create();
|
TextSearchEngine engine = TextSearchEngine.create();
|
||||||
StringBuilder searchPattern = new StringBuilder(word.length() + 8);
|
StringBuilder searchPattern = new StringBuilder(word.length() + 8);
|
||||||
|
@ -285,14 +286,15 @@ public class TextSearchWrapper {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
IStatus result = engine.search(searchscope, requestor, pattern, new SubProgressMonitor(monitor, 95));
|
IStatus result = engine.search(searchscope, requestor, pattern, subMonitor.split(95));
|
||||||
categorizeMatches(target.subList(startPos, target.size()), new SubProgressMonitor(monitor, 5));
|
categorizeMatches(target.subList(startPos, target.size()), subMonitor.split(5));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void categorizeMatches(List<CRefactoringMatch> matches, IProgressMonitor monitor) {
|
public void categorizeMatches(List<CRefactoringMatch> matches, IProgressMonitor monitor) {
|
||||||
monitor.beginTask(RenameMessages.TextSearch_monitor_categorizeMatches, matches.size());
|
SubMonitor subMonitor = SubMonitor.convert(monitor, RenameMessages.TextSearch_monitor_categorizeMatches,
|
||||||
|
matches.size());
|
||||||
IFile file = null;
|
IFile file = null;
|
||||||
ArrayList<int[]> locations = null;
|
ArrayList<int[]> locations = null;
|
||||||
for (Iterator<CRefactoringMatch> iter = matches.iterator(); iter.hasNext();) {
|
for (Iterator<CRefactoringMatch> iter = matches.iterator(); iter.hasNext();) {
|
||||||
|
@ -304,7 +306,7 @@ public class TextSearchWrapper {
|
||||||
computeLocations(file, locations);
|
computeLocations(file, locations);
|
||||||
}
|
}
|
||||||
match.setLocation(findLocation(match, locations));
|
match.setLocation(findLocation(match, locations));
|
||||||
monitor.worked(1);
|
subMonitor.worked(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ 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.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.MultiStatus;
|
import org.eclipse.core.runtime.MultiStatus;
|
||||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
import org.eclipse.core.runtime.SubMonitor;
|
||||||
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.MessageDialog;
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
|
@ -327,7 +327,7 @@ public class TeamProjectIndexExportWizardPage extends WizardPage implements List
|
||||||
IRunnableWithProgress op = new IRunnableWithProgress() {
|
IRunnableWithProgress op = new IRunnableWithProgress() {
|
||||||
@Override
|
@Override
|
||||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||||
monitor.beginTask("", projects.length); //$NON-NLS-1$
|
SubMonitor subMonitor = SubMonitor.convert(monitor, projects.length);
|
||||||
for (ICProject project : projects) {
|
for (ICProject project : projects) {
|
||||||
TeamPDOMExportOperation op = new TeamPDOMExportOperation(project);
|
TeamPDOMExportOperation op = new TeamPDOMExportOperation(project);
|
||||||
op.setTargetLocation(dest);
|
op.setTargetLocation(dest);
|
||||||
|
@ -335,7 +335,7 @@ public class TeamProjectIndexExportWizardPage extends WizardPage implements List
|
||||||
op.setOptions(TeamPDOMExportOperation.EXPORT_OPTION_RESOURCE_SNAPSHOT);
|
op.setOptions(TeamPDOMExportOperation.EXPORT_OPTION_RESOURCE_SNAPSHOT);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
op.run(new SubProgressMonitor(monitor, 1));
|
op.run(subMonitor.split(1));
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
status.merge(e.getStatus());
|
status.merge(e.getStatus());
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,9 +51,8 @@ import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.MultiStatus;
|
import org.eclipse.core.runtime.MultiStatus;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
|
||||||
import org.eclipse.core.runtime.OperationCanceledException;
|
import org.eclipse.core.runtime.OperationCanceledException;
|
||||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
import org.eclipse.core.runtime.SubMonitor;
|
||||||
import org.eclipse.jface.action.IAction;
|
import org.eclipse.jface.action.IAction;
|
||||||
import org.eclipse.jface.dialogs.ErrorDialog;
|
import org.eclipse.jface.dialogs.ErrorDialog;
|
||||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||||
|
@ -338,13 +337,8 @@ public class FormatAllAction extends SelectionDispatchAction {
|
||||||
|
|
||||||
private void doRunOnMultiple(ITranslationUnit[] tus, MultiStatus status, IProgressMonitor monitor)
|
private void doRunOnMultiple(ITranslationUnit[] tus, MultiStatus status, IProgressMonitor monitor)
|
||||||
throws OperationCanceledException {
|
throws OperationCanceledException {
|
||||||
if (monitor == null) {
|
SubMonitor subMonitor = SubMonitor.convert(monitor, ActionMessages.FormatAllAction_operation_description,
|
||||||
monitor = new NullProgressMonitor();
|
tus.length * 4);
|
||||||
}
|
|
||||||
monitor.setTaskName(ActionMessages.FormatAllAction_operation_description);
|
|
||||||
|
|
||||||
monitor.beginTask("", tus.length * 4); //$NON-NLS-1$
|
|
||||||
try {
|
|
||||||
Map<String, Object> lastOptions = null;
|
Map<String, Object> lastOptions = null;
|
||||||
ICProject lastProject = null;
|
ICProject lastProject = null;
|
||||||
|
|
||||||
|
@ -373,36 +367,28 @@ public class FormatAllAction extends SelectionDispatchAction {
|
||||||
lastOptions.put(DefaultCodeFormatterConstants.FORMATTER_LANGUAGE, language);
|
lastOptions.put(DefaultCodeFormatterConstants.FORMATTER_LANGUAGE, language);
|
||||||
lastOptions.put(DefaultCodeFormatterConstants.FORMATTER_CURRENT_FILE, tu.getResource());
|
lastOptions.put(DefaultCodeFormatterConstants.FORMATTER_CURRENT_FILE, tu.getResource());
|
||||||
|
|
||||||
if (monitor.isCanceled()) {
|
|
||||||
throw new OperationCanceledException();
|
|
||||||
}
|
|
||||||
|
|
||||||
ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager();
|
ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager();
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
manager.connect(path, LocationKind.IFILE, new SubProgressMonitor(monitor, 1));
|
manager.connect(path, LocationKind.IFILE, subMonitor.split(1));
|
||||||
|
subMonitor.subTask(path.makeRelative().toString());
|
||||||
monitor.subTask(path.makeRelative().toString());
|
|
||||||
ITextFileBuffer fileBuffer = manager.getTextFileBuffer(path, LocationKind.IFILE);
|
ITextFileBuffer fileBuffer = manager.getTextFileBuffer(path, LocationKind.IFILE);
|
||||||
boolean wasDirty = fileBuffer.isDirty();
|
boolean wasDirty = fileBuffer.isDirty();
|
||||||
|
|
||||||
formatTranslationUnit(fileBuffer, lastOptions);
|
formatTranslationUnit(fileBuffer, lastOptions);
|
||||||
|
|
||||||
if (fileBuffer.isDirty() && !wasDirty) {
|
if (fileBuffer.isDirty() && !wasDirty) {
|
||||||
fileBuffer.commit(new SubProgressMonitor(monitor, 2), false);
|
fileBuffer.commit(subMonitor.split(2), false);
|
||||||
} else {
|
} else {
|
||||||
monitor.worked(2);
|
subMonitor.worked(2);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
manager.disconnect(path, LocationKind.IFILE, new SubProgressMonitor(monitor, 1));
|
manager.disconnect(path, LocationKind.IFILE, subMonitor.split(1));
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
status.add(e.getStatus());
|
status.add(e.getStatus());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
monitor.done();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void formatTranslationUnit(final ITextFileBuffer fileBuffer, final Map<String, Object> options) {
|
private void formatTranslationUnit(final ITextFileBuffer fileBuffer, final Map<String, Object> options) {
|
||||||
|
|
|
@ -39,10 +39,9 @@ import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
import org.eclipse.core.runtime.IExtension;
|
import org.eclipse.core.runtime.IExtension;
|
||||||
import org.eclipse.core.runtime.IExtensionPoint;
|
import org.eclipse.core.runtime.IExtensionPoint;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.Preferences;
|
import org.eclipse.core.runtime.Preferences;
|
||||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
import org.eclipse.core.runtime.SubMonitor;
|
||||||
import org.eclipse.jface.layout.PixelConverter;
|
import org.eclipse.jface.layout.PixelConverter;
|
||||||
import org.eclipse.jface.viewers.LabelProvider;
|
import org.eclipse.jface.viewers.LabelProvider;
|
||||||
import org.eclipse.jface.viewers.StructuredSelection;
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
|
@ -225,10 +224,7 @@ public class BinaryParserBlock extends AbstractBinaryParserPage {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void performApply(IProgressMonitor monitor) throws CoreException {
|
public void performApply(IProgressMonitor monitor) throws CoreException {
|
||||||
if (monitor == null) {
|
SubMonitor subMonitor = SubMonitor.convert(monitor, CUIMessages.BinaryParserBlock_settingBinaryParser, 2);
|
||||||
monitor = new NullProgressMonitor();
|
|
||||||
}
|
|
||||||
monitor.beginTask(CUIMessages.BinaryParserBlock_settingBinaryParser, 2);
|
|
||||||
List<BinaryParserConfiguration> parsers = binaryList.getElements();
|
List<BinaryParserConfiguration> parsers = binaryList.getElements();
|
||||||
final List<BinaryParserConfiguration> selected = new ArrayList<>(); // must do this to get proper order.
|
final List<BinaryParserConfiguration> selected = new ArrayList<>(); // must do this to get proper order.
|
||||||
for (int i = 0; i < parsers.size(); i++) {
|
for (int i = 0; i < parsers.size(); i++) {
|
||||||
|
@ -241,13 +237,14 @@ public class BinaryParserBlock extends AbstractBinaryParserPage {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException {
|
public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException {
|
||||||
|
SubMonitor subMonitor = SubMonitor.convert(monitor, 2);
|
||||||
if (initialSelected == null || !selected.equals(initialSelected)) {
|
if (initialSelected == null || !selected.equals(initialSelected)) {
|
||||||
descriptor.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID);
|
descriptor.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID);
|
||||||
for (int i = 0; i < selected.size(); i++) {
|
for (int i = 0; i < selected.size(); i++) {
|
||||||
descriptor.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, selected.get(i).getID());
|
descriptor.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, selected.get(i).getID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
monitor.worked(1);
|
subMonitor.worked(1);
|
||||||
// Give a chance to the contributions to save.
|
// Give a chance to the contributions to save.
|
||||||
// We have to do it last to make sure the parser id
|
// We have to do it last to make sure the parser id
|
||||||
// is save
|
// is save
|
||||||
|
@ -255,13 +252,13 @@ public class BinaryParserBlock extends AbstractBinaryParserPage {
|
||||||
for (int i = 0; i < selected.size(); i++) {
|
for (int i = 0; i < selected.size(); i++) {
|
||||||
ICOptionPage page = getBinaryParserPage(selected.get(i).getID());
|
ICOptionPage page = getBinaryParserPage(selected.get(i).getID());
|
||||||
if (page != null && page.getControl() != null) {
|
if (page != null && page.getControl() != null) {
|
||||||
page.performApply(new SubProgressMonitor(monitor, 1));
|
page.performApply(subMonitor.split(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
CCorePlugin.getDefault().getCDescriptorManager().runDescriptorOperation(getContainer().getProject(), op,
|
CCorePlugin.getDefault().getCDescriptorManager().runDescriptorOperation(getContainer().getProject(), op,
|
||||||
monitor);
|
subMonitor.split(2));
|
||||||
} else {
|
} else {
|
||||||
if (initialSelected == null || !selected.equals(initialSelected)) {
|
if (initialSelected == null || !selected.equals(initialSelected)) {
|
||||||
Preferences store = getContainer().getPreferences();
|
Preferences store = getContainer().getPreferences();
|
||||||
|
@ -269,17 +266,16 @@ public class BinaryParserBlock extends AbstractBinaryParserPage {
|
||||||
store.setValue(CCorePlugin.PREF_BINARY_PARSER, arrayToString(selected.toArray()));
|
store.setValue(CCorePlugin.PREF_BINARY_PARSER, arrayToString(selected.toArray()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
monitor.worked(1);
|
subMonitor.worked(1);
|
||||||
// Give a chance to the contributions to save.
|
// Give a chance to the contributions to save.
|
||||||
for (int i = 0; i < selected.size(); i++) {
|
for (int i = 0; i < selected.size(); i++) {
|
||||||
ICOptionPage page = getBinaryParserPage(selected.get(i).getID());
|
ICOptionPage page = getBinaryParserPage(selected.get(i).getID());
|
||||||
if (page != null && page.getControl() != null) {
|
if (page != null && page.getControl() != null) {
|
||||||
page.performApply(new SubProgressMonitor(monitor, 1));
|
page.performApply(subMonitor.split(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
initialSelected = selected;
|
initialSelected = selected;
|
||||||
monitor.done();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,8 +24,7 @@ import org.eclipse.core.resources.IWorkspace;
|
||||||
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.NullProgressMonitor;
|
import org.eclipse.core.runtime.SubMonitor;
|
||||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
|
||||||
import org.eclipse.jface.viewers.CheckboxTableViewer;
|
import org.eclipse.jface.viewers.CheckboxTableViewer;
|
||||||
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
@ -168,20 +167,13 @@ public class ReferenceBlock extends AbstractCOptionPage {
|
||||||
IProject[] refProjects = getReferencedProjects();
|
IProject[] refProjects = getReferencedProjects();
|
||||||
if (refProjects != null) {
|
if (refProjects != null) {
|
||||||
IProject project = getContainer().getProject();
|
IProject project = getContainer().getProject();
|
||||||
if (monitor == null) {
|
SubMonitor subMonitor = SubMonitor.convert(monitor, CUIMessages.ReferenceBlock_task_ReferenceProjects, 1);
|
||||||
monitor = new NullProgressMonitor();
|
|
||||||
}
|
|
||||||
monitor.beginTask(CUIMessages.ReferenceBlock_task_ReferenceProjects, 1);
|
|
||||||
try {
|
|
||||||
IProjectDescription description = project.getDescription();
|
IProjectDescription description = project.getDescription();
|
||||||
description.setReferencedProjects(refProjects);
|
description.setReferencedProjects(refProjects);
|
||||||
project.setDescription(description, new SubProgressMonitor(monitor, 1));
|
project.setDescription(description, subMonitor.split(1));
|
||||||
} catch (CoreException e) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void performDefaults() {
|
public void performDefaults() {
|
||||||
initializeValues();
|
initializeValues();
|
||||||
|
|
|
@ -22,8 +22,7 @@ import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.cdt.utils.ui.controls.TabFolderLayout;
|
import org.eclipse.cdt.utils.ui.controls.TabFolderLayout;
|
||||||
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.NullProgressMonitor;
|
import org.eclipse.core.runtime.SubMonitor;
|
||||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
|
||||||
import org.eclipse.osgi.util.NLS;
|
import org.eclipse.osgi.util.NLS;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
|
@ -151,25 +150,18 @@ public abstract class TabFolderOptionBlock {
|
||||||
public boolean performApply(IProgressMonitor monitor) {
|
public boolean performApply(IProgressMonitor monitor) {
|
||||||
if (initializingTabs)
|
if (initializingTabs)
|
||||||
return false;
|
return false;
|
||||||
if (monitor == null) {
|
SubMonitor subMonitor = SubMonitor.convert(monitor, pages.size());
|
||||||
monitor = new NullProgressMonitor();
|
|
||||||
}
|
|
||||||
monitor.beginTask("", pages.size()); //$NON-NLS-1$
|
|
||||||
try {
|
|
||||||
Iterator<ICOptionPage> iter = pages.iterator();
|
Iterator<ICOptionPage> iter = pages.iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
ICOptionPage tab = iter.next();
|
ICOptionPage tab = iter.next();
|
||||||
try {
|
try {
|
||||||
tab.performApply(new SubProgressMonitor(monitor, 1));
|
tab.performApply(subMonitor.split(1));
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CUIPlugin.errorDialog(composite.getShell(), CUIMessages.TabFolderOptionBlock_error,
|
CUIPlugin.errorDialog(composite.getShell(), CUIMessages.TabFolderOptionBlock_error,
|
||||||
CUIMessages.TabFolderOptionBlock_error_settingOptions, e, true);
|
CUIMessages.TabFolderOptionBlock_error_settingOptions, e, true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
monitor.done();
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue