mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
bug 286080: org.eclipse.cdt.internal.ui.dialogs.StatusDialog class deprecated in favor of platform one
This commit is contained in:
parent
0884f2e607
commit
aebfe7a190
7 changed files with 32 additions and 147 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2008 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2009 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -11,148 +11,21 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.dialogs;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
|
||||
/**
|
||||
* @deprecated. This class is deprecated since CDT 6.1. Use {@link org.eclipse.jface.dialogs.StatusDialog} instead.
|
||||
*
|
||||
* An abstract base class for dialogs with a status bar and ok/cancel buttons.
|
||||
* The status message must be passed over as StatusInfo object and can be
|
||||
* an error, warning or ok. The OK button is enabled or disabled depending
|
||||
* on the status.
|
||||
*/
|
||||
public abstract class StatusDialog extends Dialog {
|
||||
|
||||
private Button fOkButton;
|
||||
private MessageLine fStatusLine;
|
||||
private IStatus fLastStatus;
|
||||
private String fTitle;
|
||||
private Image fImage;
|
||||
|
||||
/**
|
||||
* Creates an instane of a status dialog.
|
||||
*/
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class StatusDialog extends org.eclipse.jface.dialogs.StatusDialog {
|
||||
public StatusDialog(Shell parent) {
|
||||
super(parent);
|
||||
setHelpAvailable(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the dialog's status line to reflect the given status.
|
||||
* It is save to call this method before the dialog has been opened.
|
||||
*/
|
||||
protected void updateStatus(IStatus status) {
|
||||
fLastStatus= status;
|
||||
if (fStatusLine != null && !fStatusLine.isDisposed()) {
|
||||
updateButtonsEnableState(status);
|
||||
fStatusLine.setErrorMessage(status.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last status.
|
||||
*/
|
||||
public IStatus getStatus() {
|
||||
return fLastStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the status of the ok button to reflect the given status.
|
||||
* Subclasses may override this method to update additional buttons.
|
||||
* @param status the status.
|
||||
*/
|
||||
protected void updateButtonsEnableState(IStatus status) {
|
||||
if (fOkButton != null && !fOkButton.isDisposed())
|
||||
fOkButton.setEnabled(!status.matches(IStatus.ERROR));
|
||||
}
|
||||
|
||||
/*
|
||||
* @see Window#create(Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void configureShell(Shell shell) {
|
||||
super.configureShell(shell);
|
||||
if (fTitle != null)
|
||||
shell.setText(fTitle);
|
||||
}
|
||||
|
||||
/*
|
||||
* @see Window#create()
|
||||
*/
|
||||
@Override
|
||||
public void create() {
|
||||
super.create();
|
||||
if (fLastStatus != null) {
|
||||
// policy: dialogs are not allowed to come up with an error message
|
||||
if (fLastStatus.matches(IStatus.ERROR)) {
|
||||
StatusInfo status= new StatusInfo();
|
||||
status.setError(""); //$NON-NLS-1$
|
||||
fLastStatus= status;
|
||||
}
|
||||
updateStatus(fLastStatus);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @see Dialog#createButtonsForButtonBar(Composite)
|
||||
*/
|
||||
@Override
|
||||
protected void createButtonsForButtonBar(Composite parent) {
|
||||
fOkButton= createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
|
||||
createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
|
||||
}
|
||||
|
||||
/*
|
||||
* @see Dialog#createButtonBar(Composite)
|
||||
*/
|
||||
@Override
|
||||
protected Control createButtonBar(Composite parent) {
|
||||
Composite composite= new Composite(parent, SWT.NULL);
|
||||
GridLayout layout= new GridLayout();
|
||||
layout.numColumns= 1;
|
||||
layout.marginHeight= 0;
|
||||
layout.marginWidth= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
|
||||
composite.setLayout(layout);
|
||||
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
fStatusLine= new MessageLine(composite);
|
||||
fStatusLine.setAlignment(SWT.LEFT);
|
||||
fStatusLine.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
fStatusLine.setErrorMessage(null);
|
||||
|
||||
super.createButtonBar(composite);
|
||||
return composite;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the title for this dialog.
|
||||
* @param title the title.
|
||||
*/
|
||||
public void setTitle(String title) {
|
||||
fTitle= title != null ? title : ""; //$NON-NLS-1$
|
||||
Shell shell= getShell();
|
||||
if ((shell != null) && !shell.isDisposed())
|
||||
shell.setText(fTitle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the image for this dialog.
|
||||
* @param image the image.
|
||||
*/
|
||||
public void setImage(Image image) {
|
||||
fImage= image;
|
||||
Shell shell= getShell();
|
||||
if ((shell != null) && !shell.isDisposed())
|
||||
shell.setImage(fImage);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.eclipse.core.resources.IResource;
|
|||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.jface.dialogs.StatusDialog;
|
||||
import org.eclipse.jface.viewers.ILabelProvider;
|
||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
import org.eclipse.jface.viewers.LabelProvider;
|
||||
|
@ -42,7 +43,6 @@ import org.eclipse.ui.views.navigator.ResourceComparator;
|
|||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.StatusDialog;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.TypedElementSelectionValidator;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.TypedViewerFilter;
|
||||
import org.eclipse.cdt.internal.ui.util.ImageDescriptorRegistry;
|
||||
|
@ -121,6 +121,8 @@ public class ExclusionPatternDialog extends StatusDialog {
|
|||
fExclusionPatternList.setElements(elements);
|
||||
fExclusionPatternList.selectFirstElement();
|
||||
fExclusionPatternList.enableButton(IDX_ADD_MULTIPLE, fCurrSourceFolder != null);
|
||||
|
||||
setHelpAvailable(false);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.eclipse.core.resources.IResource;
|
|||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.jface.dialogs.StatusDialog;
|
||||
import org.eclipse.jface.viewers.ILabelProvider;
|
||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
import org.eclipse.jface.viewers.ViewerFilter;
|
||||
|
@ -37,7 +38,6 @@ import org.eclipse.ui.model.WorkbenchContentProvider;
|
|||
import org.eclipse.ui.model.WorkbenchLabelProvider;
|
||||
import org.eclipse.ui.views.navigator.ResourceComparator;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.dialogs.StatusDialog;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.TypedElementSelectionValidator;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.TypedViewerFilter;
|
||||
|
@ -89,6 +89,8 @@ public class ExclusionPatternEntryDialog extends StatusDialog {
|
|||
} else {
|
||||
fExclusionPatternDialog.setText(patternToEdit.toString());
|
||||
}
|
||||
|
||||
setHelpAvailable(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.eclipse.core.resources.IResource;
|
|||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.jface.dialogs.StatusDialog;
|
||||
import org.eclipse.osgi.util.NLS;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
|
@ -26,7 +27,6 @@ import org.eclipse.swt.widgets.Composite;
|
|||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.dialogs.StatusDialog;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
|
||||
|
@ -81,6 +81,8 @@ public class NewSourceFolderDialog extends StatusDialog {
|
|||
}
|
||||
fUseFolderButton.setSelection(useFolders);
|
||||
fUseProjectButton.setSelection(!useFolders);
|
||||
|
||||
setHelpAvailable(false);
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
|
|
|
@ -13,22 +13,24 @@ package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
|||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.ILibraryEntry;
|
||||
import org.eclipse.cdt.core.model.IPathEntry;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.StatusDialog;
|
||||
import org.eclipse.cdt.internal.ui.util.ExceptionHandler;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
||||
import org.eclipse.jface.dialogs.StatusDialog;
|
||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.ILibraryEntry;
|
||||
import org.eclipse.cdt.core.model.IPathEntry;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener;
|
||||
import org.eclipse.cdt.internal.ui.util.ExceptionHandler;
|
||||
|
||||
/**
|
||||
* A dialog to configure the source attachment of a library (library and zip archive).
|
||||
*
|
||||
|
@ -66,6 +68,7 @@ public class SourceAttachmentDialog extends StatusDialog {
|
|||
fSourceAttachmentBlock= new SourceAttachmentBlock(listener, entry, project);
|
||||
|
||||
setTitle(CPathEntryMessages.SourceAttachmentDialog_title);
|
||||
setHelpAvailable(false);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.eclipse.core.resources.IResource;
|
|||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.jface.dialogs.StatusDialog;
|
||||
import org.eclipse.jface.viewers.ILabelProvider;
|
||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
import org.eclipse.jface.viewers.LabelProvider;
|
||||
|
@ -29,7 +30,6 @@ import org.eclipse.jface.window.Window;
|
|||
import org.eclipse.osgi.util.NLS;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.layout.FillLayout;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
@ -44,7 +44,6 @@ import org.eclipse.ui.views.navigator.ResourceComparator;
|
|||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.StatusDialog;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.TypedElementSelectionValidator;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.TypedViewerFilter;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.cpaths.CPathEntryMessages;
|
||||
|
@ -109,6 +108,8 @@ public class ExPatternDialog extends StatusDialog {
|
|||
fExclusionPatternList.setElements(elements);
|
||||
fExclusionPatternList.selectFirstElement();
|
||||
fExclusionPatternList.enableButton(IDX_ADD_MULTIPLE, fCurrSourceFolder != null);
|
||||
|
||||
setHelpAvailable(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.eclipse.core.resources.IResource;
|
|||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.jface.dialogs.StatusDialog;
|
||||
import org.eclipse.jface.viewers.ILabelProvider;
|
||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
import org.eclipse.jface.viewers.ViewerFilter;
|
||||
|
@ -38,7 +39,6 @@ import org.eclipse.ui.model.WorkbenchContentProvider;
|
|||
import org.eclipse.ui.model.WorkbenchLabelProvider;
|
||||
import org.eclipse.ui.views.navigator.ResourceComparator;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.dialogs.StatusDialog;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.TypedElementSelectionValidator;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.TypedViewerFilter;
|
||||
|
@ -94,6 +94,8 @@ public class ExPatternEntryDialog extends StatusDialog {
|
|||
} else {
|
||||
fExclusionPatternDialog.setText(patternToEdit.toString());
|
||||
}
|
||||
|
||||
setHelpAvailable(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue