1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-09 17:25:38 +02:00

2004-12-22 Alain Magloire

On going work to clean cdt.ui from misc. warnings
	and removing the deprecated interfaces in Eclipse-3.1
This commit is contained in:
Alain Magloire 2004-12-23 19:53:24 +00:00
parent aee9e0e44e
commit cc17803d62
17 changed files with 120 additions and 142 deletions

View file

@ -58,7 +58,11 @@ public class NewClassCodeGenerator {
private boolean fCreateIncludePaths = true;
public static class CodeGeneratorException extends Exception {
public CodeGeneratorException(String message) {
/**
* Comment for <code>serialVersionUID</code>
*/
private static final long serialVersionUID = 1L;
public CodeGeneratorException(String message) {
}
public CodeGeneratorException(Throwable e) {
}

View file

@ -780,7 +780,7 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
return null;
}
private void updateFilesFromClassName(String className) {
void updateFilesFromClassName(String className) {
String headerName = ""; //$NON-NLS-1$
String sourceName = ""; //$NON-NLS-1$
if (className.length() > 0) {
@ -922,9 +922,8 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
if (resType == IResource.PROJECT) {
status.setError(NewClassWizardMessages.getString("NewClassCreationWizardPage.warning.NotACProject")); //$NON-NLS-1$
return status;
} else {
status.setWarning(NewClassWizardMessages.getString("NewClassCreationWizardPage.warning.NotInACProject")); //$NON-NLS-1$
}
status.setWarning(NewClassWizardMessages.getString("NewClassCreationWizardPage.warning.NotInACProject")); //$NON-NLS-1$
}
ICElement e = CoreModel.getDefault().create(res.getFullPath());
if (CModelUtil.getSourceFolder(e) == null) {
@ -1018,25 +1017,24 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
status.setError(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.NamespaceExistsDifferentCase")); //$NON-NLS-1$
}
return status;
} else {
// look for other types
exactMatch = false;
for (int i = 0; i < types.length; ++i) {
ITypeInfo currType = types[i];
if (currType.getCElementType() != ICElement.C_NAMESPACE) {
exactMatch = currType.getQualifiedTypeName().equals(typeName);
if (exactMatch) {
// found a matching type
break;
}
}
}
if (exactMatch) {
status.setWarning(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.TypeMatchingNamespaceExists")); //$NON-NLS-1$
} else {
status.setWarning(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.TypeMatchingNamespaceExistsDifferentCase")); //$NON-NLS-1$
}
}
// look for other types
exactMatch = false;
for (int i = 0; i < types.length; ++i) {
ITypeInfo currType = types[i];
if (currType.getCElementType() != ICElement.C_NAMESPACE) {
exactMatch = currType.getQualifiedTypeName().equals(typeName);
if (exactMatch) {
// found a matching type
break;
}
}
}
if (exactMatch) {
status.setWarning(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.TypeMatchingNamespaceExists")); //$NON-NLS-1$
} else {
status.setWarning(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.TypeMatchingNamespaceExistsDifferentCase")); //$NON-NLS-1$
}
} else {
status.setWarning(NewClassWizardMessages.getString("NewClassCreationWizardPage.warning.NamespaceNotExists")); //$NON-NLS-1$
}
@ -1169,27 +1167,26 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
status.setError(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.ClassNameExistsDifferentCase")); //$NON-NLS-1$
}
return status;
} else {
// look for other types
exactMatch = false;
for (int i = 0; i < types.length; ++i) {
ITypeInfo currType = types[i];
if (currType.getCElementType() != ICElement.C_CLASS
&& currType.getCElementType() != ICElement.C_STRUCT) {
exactMatch = currType.getQualifiedTypeName().equals(fullyQualifiedName);
if (exactMatch) {
// found a matching type
break;
}
}
}
if (exactMatch) {
status.setError(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.TypeMatchingClassExists")); //$NON-NLS-1$
} else {
status.setError(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.TypeMatchingClassExistsDifferentCase")); //$NON-NLS-1$
}
return status;
}
// look for other types
exactMatch = false;
for (int i = 0; i < types.length; ++i) {
ITypeInfo currType = types[i];
if (currType.getCElementType() != ICElement.C_CLASS
&& currType.getCElementType() != ICElement.C_STRUCT) {
exactMatch = currType.getQualifiedTypeName().equals(fullyQualifiedName);
if (exactMatch) {
// found a matching type
break;
}
}
}
if (exactMatch) {
status.setError(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.TypeMatchingClassExists")); //$NON-NLS-1$
} else {
status.setError(NewClassWizardMessages.getString("NewClassCreationWizardPage.error.TypeMatchingClassExistsDifferentCase")); //$NON-NLS-1$
}
return status;
}
}
return status;
@ -1240,19 +1237,18 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
if (baseProject != null) {
if (baseProject.equals(project)) {
return true;
} else {
ITypeReference ref = type.getResolvedReference();
for (int i = 0; i < includePaths.length; ++i) {
IPath includePath = new Path(includePaths[i]);
if (ref != null) {
if (includePath.isPrefixOf(ref.getLocation()))
return true;
} else {
// we don't have the real location, so just check the project path
if (baseProject.getLocation().isPrefixOf(includePath))
return true;
}
}
}
ITypeReference ref = type.getResolvedReference();
for (int i = 0; i < includePaths.length; ++i) {
IPath includePath = new Path(includePaths[i]);
if (ref != null) {
if (includePath.isPrefixOf(ref.getLocation()))
return true;
} else {
// we don't have the real location, so just check the project path
if (baseProject.getLocation().isPrefixOf(includePath))
return true;
}
}
}
return false;
@ -2175,15 +2171,14 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
return null;
}
private IPath updateSourceFolderFromPath(IPath filePath) {
IPath updateSourceFolderFromPath(IPath filePath) {
ICElement folder = getSourceFolderFromPath(filePath);
if (folder != null) {
return folder.getPath();
} else {
IProject proj = PathUtil.getEnclosingProject(filePath);
if (proj != null)
return proj.getFullPath();
}
IProject proj = PathUtil.getEnclosingProject(filePath);
if (proj != null)
return proj.getFullPath();
return null;
}
}

View file

@ -64,24 +64,24 @@ import org.eclipse.ui.dialogs.SelectionStatusDialog;
public class SourceFileSelectionDialog extends SelectionStatusDialog {
private TreeViewer fViewer;
TreeViewer fViewer;
private final ITreeContentProvider fContentProvider = new CElementContentProvider();
private final ILabelProvider fLabelProvider = new CElementLabelProvider(CElementLabelProvider.SHOW_DEFAULT);
private IStatus fCurrStatus = new StatusInfo();
private IStatus fFolderNameStatus = new StatusInfo();
private IStatus fFileNameStatus = new StatusInfo();
private ICElement fInput;
IStatus fCurrStatus = new StatusInfo();
IStatus fFolderNameStatus = new StatusInfo();
IStatus fFileNameStatus = new StatusInfo();
ICElement fInput;
private int fWidth = 60;
private int fHeight = 18;
private StringDialogField fFolderNameDialogField;
private StringDialogField fFileNameDialogField;
StringDialogField fFolderNameDialogField;
StringDialogField fFileNameDialogField;
private IWorkspaceRoot fWorkspaceRoot;
private final FieldsAdapter fFieldsAdapter = new FieldsAdapter();
private ICElement fCurrentFolder = null;
private String fCurrentFileString = null;
private String fInitialFolderName = null;
private String fInitialFileName = null;
String fInitialFolderName = null;
String fInitialFileName = null;
private final class FieldsAdapter extends SelectionAdapter
implements ISelectionChangedListener, IDoubleClickListener, IDialogFieldListener {
@ -149,7 +149,7 @@ public class SourceFileSelectionDialog extends SelectionStatusDialog {
}
}
private static final Class[] FILTER_TYPES = new Class[] {
static final Class[] FILTER_TYPES = new Class[] {
ICModel.class,
ICProject.class,
ICContainer.class,
@ -247,7 +247,7 @@ public class SourceFileSelectionDialog extends SelectionStatusDialog {
updateStatus(StatusUtil.getMostSevere(status));
}
private IStatus folderNameChanged() {
IStatus folderNameChanged() {
StatusInfo status = new StatusInfo();
fCurrentFolder = null;
@ -277,9 +277,8 @@ public class SourceFileSelectionDialog extends SelectionStatusDialog {
if (resType == IResource.PROJECT) {
status.setError(NewClassWizardMessages.getString("SourceFileSelectionDialog.warning.NotACProject")); //$NON-NLS-1$
return status;
} else {
status.setWarning(NewClassWizardMessages.getString("SourceFileSelectionDialog.warning.NotInACProject")); //$NON-NLS-1$
}
status.setWarning(NewClassWizardMessages.getString("SourceFileSelectionDialog.warning.NotInACProject")); //$NON-NLS-1$
}
} else {
status.setError(NewClassWizardMessages.getFormattedString("SourceFileSelectionDialog.error.NotAFolder", str)); //$NON-NLS-1$
@ -292,7 +291,7 @@ public class SourceFileSelectionDialog extends SelectionStatusDialog {
return status;
}
private IStatus fileNameChanged() {
IStatus fileNameChanged() {
StatusInfo status = new StatusInfo();
fCurrentFileString = null;
@ -382,7 +381,7 @@ public class SourceFileSelectionDialog extends SelectionStatusDialog {
}
});
}
private void superCreate() {
void superCreate() {
super.create();
}
@ -496,7 +495,7 @@ public class SourceFileSelectionDialog extends SelectionStatusDialog {
return path;
}
private void setPathFields(String folderName, String fileName) {
void setPathFields(String folderName, String fileName) {
fFolderNameDialogField.setTextWithoutUpdate(folderName != null ? folderName : ""); //$NON-NLS-1$
fFileNameDialogField.setTextWithoutUpdate(fileName != null ? fileName : ""); //$NON-NLS-1$
fFolderNameStatus = folderNameChanged();

View file

@ -183,7 +183,7 @@ public class CheckedListDialogField extends ListDialogField {
}
private void doCheckStateChanged(CheckStateChangedEvent e) {
void doCheckStateChanged(CheckStateChangedEvent e) {
if (e.getChecked()) {
fCheckElements.add(e.getElement());
} else {

View file

@ -61,7 +61,7 @@ public class LinkToFileGroup extends StringButtonDialogField {
protected Button browseButton;
private Label resolvedPathLabelText;
private Label resolvedPathLabelData;
private boolean preventDialogFieldChanged = false;
boolean preventDialogFieldChanged = false;
public LinkToFileGroup(IStringButtonAdapter adapter, Listener listener) {
super(adapter);

View file

@ -94,14 +94,13 @@ public class SelectionButtonDialogFieldGroup extends DialogField {
buttonsgroup.setLayoutData(gd);
return new Control[] { label, buttonsgroup };
} else {
Composite buttonsgroup= getSelectionButtonsGroup(parent);
GridData gd= new GridData();
gd.horizontalSpan= nColumns;
buttonsgroup.setLayoutData(gd);
return new Control[] { buttonsgroup };
}
Composite buttonsgroup= getSelectionButtonsGroup(parent);
GridData gd= new GridData();
gd.horizontalSpan= nColumns;
buttonsgroup.setLayoutData(gd);
return new Control[] { buttonsgroup };
}
/*

View file

@ -69,7 +69,7 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
private static final int SOURCE_FOLDER_ID = 1;
protected static final int NEW_FILE_ID = 2;
private static final int ALL_FIELDS = SOURCE_FOLDER_ID | NEW_FILE_ID;
private int fLastFocusedField = 0;
int fLastFocusedField = 0;
private StringButtonDialogField fSourceFolderDialogField;
private IStatus fSourceFolderStatus;
private IStatus fNewFileStatus;
@ -380,9 +380,8 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
if (resType == IResource.PROJECT) {
status.setError(NewFileWizardMessages.getString("AbstractFileCreationWizardPage.warning.NotACProject")); //$NON-NLS-1$
return status;
} else {
status.setWarning(NewFileWizardMessages.getString("AbstractFileCreationWizardPage.warning.NotInACProject")); //$NON-NLS-1$
}
status.setWarning(NewFileWizardMessages.getString("AbstractFileCreationWizardPage.warning.NotInACProject")); //$NON-NLS-1$
}
ICElement e = CoreModel.getDefault().create(res.getFullPath());
if (CModelUtil.getSourceFolder(e) == null) {
@ -496,7 +495,7 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
*/
protected abstract void setFocus();
private IPath chooseSourceFolder(IPath initialPath) {
IPath chooseSourceFolder(IPath initialPath) {
ICElement initElement = getSourceFolderFromPath(initialPath);
if (initElement instanceof ISourceRoot) {
ICProject cProject = initElement.getCProject();

View file

@ -67,8 +67,8 @@ public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPag
private final static int SIZING_SELECTION_WIDGET_HEIGHT = 200;
private Text text;
private CheckboxTreeViewer tree;
private IWorkingSet workingSet;
CheckboxTreeViewer tree;
IWorkingSet workingSet;
private boolean firstCheck = false; // set to true if selection is set in setSelection
/**
@ -245,7 +245,7 @@ public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPag
*
* @param event the checked state change event.
*/
private void handleCheckStateChange(final CheckStateChangedEvent event) {
void handleCheckStateChange(final CheckStateChangedEvent event) {
BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
public void run() {
IResource resource = (IResource) event.getElement();
@ -343,7 +343,7 @@ public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPag
* @param checkExpandedState true=recurse into sub-containers and set the
* checked state. false=only set checked state of members of this container
*/
private void setSubtreeChecked(IContainer container, boolean state, boolean checkExpandedState) {
void setSubtreeChecked(IContainer container, boolean state, boolean checkExpandedState) {
// checked state is set lazily on expand, don't set it if container is collapsed
if (container.isAccessible() == false || (tree.getExpandedState(container) == false && state && checkExpandedState)) {
return;
@ -379,7 +379,7 @@ public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPag
* @param child the resource whose parent checked state should
* be set.
*/
private void updateParentState(IResource child) {
void updateParentState(IResource child) {
if (child == null || child.getParent() == null)
return;
@ -405,7 +405,7 @@ public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPag
* Validates the working set name and the checked state of the
* resource tree.
*/
private void validateInput() {
void validateInput() {
String errorMessage = null;
String newText = text.getText();

View file

@ -136,28 +136,26 @@ public class WorkingSetFilter extends ViewerFilter {
// compare Java elements
ICElement searchedElement= element;
while (scopeElement != null && searchedElement != null) {
if (searchedElement.equals(scopeElement))
if (searchedElement.equals(scopeElement)) {
return true;
else {
if (scopeElement instanceof ICProject && searchedElement instanceof ISourceRoot) {
// ISourceRoot pkgRoot= (ISourceRoot)searchedElement;
// if (pkgRoot.isExternal() && pkgRoot.isArchive()) {
// if (((ICProject)scopeElement).isOnClasspath(searchedElement))
// return true;
// }
}
searchedElement= searchedElement.getParent();
if (searchedElement != null && searchedElement.getElementType() == ICElement.C_UNIT) {
ITranslationUnit cu= (ITranslationUnit)searchedElement;
cu= CModelUtil.toOriginal(cu);
}
}
if (scopeElement instanceof ICProject && searchedElement instanceof ISourceRoot) {
// ISourceRoot pkgRoot= (ISourceRoot)searchedElement;
// if (pkgRoot.isExternal() && pkgRoot.isArchive()) {
// if (((ICProject)scopeElement).isOnClasspath(searchedElement))
// return true;
// }
}
searchedElement= searchedElement.getParent();
if (searchedElement != null && searchedElement.getElementType() == ICElement.C_UNIT) {
ITranslationUnit cu= (ITranslationUnit)searchedElement;
cu= CModelUtil.toOriginal(cu);
}
}
while (scopeElement != null && element != null) {
if (element.equals(scopeElement))
return true;
else
scopeElement= scopeElement.getParent();
scopeElement= scopeElement.getParent();
}
} else {
// compare resource paths

View file

@ -192,12 +192,12 @@ public class WorkingSetFilterActionGroup extends ActionGroup {
fMenuManager.addMenuListener(fMenuListener);
}
private void removePreviousLRUWorkingSetActions(IMenuManager mm) {
void removePreviousLRUWorkingSetActions(IMenuManager mm) {
for (int i= 1; i <= fLRUMenuCount; i++)
mm.remove(WorkingSetMenuContributionItem.getId(i));
}
private void addLRUWorkingSetActions(IMenuManager mm) {
void addLRUWorkingSetActions(IMenuManager mm) {
IWorkingSet[] workingSets= PlatformUI.getWorkbench().getWorkingSetManager().getRecentWorkingSets();
List sortedWorkingSets= Arrays.asList(workingSets);
Collections.sort(sortedWorkingSets, new WorkingSetComparator());
@ -240,7 +240,7 @@ public class WorkingSetFilterActionGroup extends ActionGroup {
/*
* Called by the working set change listener
*/
private void doPropertyChange(PropertyChangeEvent event) {
void doPropertyChange(PropertyChangeEvent event) {
String property= event.getProperty();
if (IWorkingSetManager.CHANGE_WORKING_SET_NAME_CHANGE.equals(property)) {
fChangeListener.propertyChange(event);

View file

@ -32,8 +32,8 @@ import org.eclipse.ui.PlatformUI;
public class WorkingSetMenuContributionItem extends ContributionItem {
private int fId;
private IWorkingSet fWorkingSet;
private WorkingSetFilterActionGroup fActionGroup;
IWorkingSet fWorkingSet;
WorkingSetFilterActionGroup fActionGroup;
private Image fImage;
/**

View file

@ -225,9 +225,8 @@ public class CElementSorter extends ViewerSorter {
if (root1 == null) {
if (root2 == null) {
return 0;
} else {
return 1;
}
return 1;
} else if (root2 == null) {
return -1;
}

View file

@ -86,10 +86,10 @@ public class CustomFiltersActionGroup extends ActionGroup {
class FilterActionMenuContributionItem extends ContributionItem {
private int fItemNumber;
private boolean fState;
private String fFilterId;
boolean fState;
String fFilterId;
private String fFilterName;
private CustomFiltersActionGroup fActionGroup;
CustomFiltersActionGroup fActionGroup;
/**
* Constructor for FilterActionMenuContributionItem.
@ -272,7 +272,7 @@ public class CustomFiltersActionGroup extends ActionGroup {
* @param filterId the id of the filter
* @param state the filter state
*/
private void setFilter(String filterId, boolean state) {
void setFilter(String filterId, boolean state) {
// Renew filter id in LRU stack
fLRUFilterIdsStack.remove(filterId);
fLRUFilterIdsStack.add(0, filterId);
@ -366,7 +366,7 @@ public class CustomFiltersActionGroup extends ActionGroup {
fMenuManager.addMenuListener(fMenuListener);
}
private void removePreviousLRUFilterActions(IMenuManager mm) {
void removePreviousLRUFilterActions(IMenuManager mm) {
if (fFilterIdsUsedInLastViewMenu == null)
return;
@ -374,7 +374,7 @@ public class CustomFiltersActionGroup extends ActionGroup {
mm.remove(fFilterIdsUsedInLastViewMenu[i]);
}
private void addLRUFilterActions(IMenuManager mm) {
void addLRUFilterActions(IMenuManager mm) {
if (fLRUFilterIdsStack.isEmpty()) {
fFilterIdsUsedInLastViewMenu= null;
return;
@ -704,7 +704,7 @@ public class CustomFiltersActionGroup extends ActionGroup {
// ---------- dialog related code ----------
private void openDialog() {
void openDialog() {
CustomFiltersDialog dialog= new CustomFiltersDialog(
fViewer.getControl().getShell(),
fTargetId,

View file

@ -54,7 +54,7 @@ public class MemberFilterActionGroup extends ActionGroup {
private MemberFilterAction[] fFilterActions;
private MemberFilter fFilter;
private StructuredViewer fViewer;
StructuredViewer fViewer;
private String fViewerId;
private boolean fInViewMenu;

View file

@ -205,9 +205,8 @@ public class OpenViewActionGroup extends ActionGroup {
public static boolean canActionBeAdded(ISelection selection) {
if(selection instanceof ITextSelection) {
return (((ITextSelection)selection).getLength() > 0);
} else {
return getElement(selection) != null;
}
return getElement(selection) != null;
}
private static ICElement getElement(ISelection sel) {

View file

@ -14,7 +14,6 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.internal.ui.IContextMenuConstants;
import org.eclipse.cdt.internal.ui.actions.ActionMessages;
import org.eclipse.cdt.internal.ui.editor.CEditor;
@ -22,13 +21,11 @@ import org.eclipse.cdt.internal.ui.refactoring.RefactoringMessages;
import org.eclipse.cdt.internal.ui.refactoring.actions.RedoRefactoringAction;
import org.eclipse.cdt.internal.ui.refactoring.actions.RenameRefactoringAction;
import org.eclipse.cdt.internal.ui.refactoring.actions.UndoRefactoringAction;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
@ -278,13 +275,4 @@ public class RefactoringActionGroup extends ActionGroup {
return 0;
}
private ICElement getEditorInput() {
return CUIPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(
fEditor.getEditorInput());
}
private IDocument getDocument() {
return CUIPlugin.getDefault().getDocumentProvider().
getDocument(fEditor.getEditorInput());
}
}

View file

@ -15,7 +15,6 @@ import org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.widgets.Composite;
@ -23,7 +22,6 @@ import org.eclipse.swt.widgets.Composite;
public abstract class NewCProjectWizardOptionPage extends WizardPage implements ICOptionContainer {
private TabFolderOptionBlock fOptionBlock;
private IPreferenceStore preferenceStore;
public NewCProjectWizardOptionPage(String pageName) {
this(pageName, null, null);