mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Cleanup label provider hierarchy
This commit is contained in:
parent
7149e81403
commit
adb747feb2
4 changed files with 25 additions and 36 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2002, 2006 QNX Software Systems and others.
|
||||
* Copyright (c) 2002, 2007 QNX Software Systems 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
|
||||
|
@ -7,25 +7,28 @@
|
|||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Anton Leherbauer (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.cview;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.IIncludeReference;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.internal.ui.viewsupport.CElementImageProvider;
|
||||
import org.eclipse.cdt.internal.ui.viewsupport.StandardCElementLabelProvider;
|
||||
import org.eclipse.cdt.ui.CElementImageDescriptor;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.IIncludeReference;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.ui.CElementImageDescriptor;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.viewsupport.AppearanceAwareLabelProvider;
|
||||
import org.eclipse.cdt.internal.ui.viewsupport.CElementImageProvider;
|
||||
|
||||
/*
|
||||
* CViewLabelProvider
|
||||
*/
|
||||
public class CViewLabelProvider extends StandardCElementLabelProvider {
|
||||
public class CViewLabelProvider extends AppearanceAwareLabelProvider {
|
||||
|
||||
public CViewLabelProvider(int textFlags, int imageFlags) {
|
||||
super(textFlags, imageFlags);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2006 QNX Software Systems and others.
|
||||
* Copyright (c) 2005, 2007 QNX Software Systems 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
|
||||
|
@ -37,7 +37,6 @@ import org.eclipse.cdt.internal.ui.util.ProblemTreeViewer;
|
|||
import org.eclipse.cdt.internal.ui.viewsupport.AppearanceAwareLabelProvider;
|
||||
import org.eclipse.cdt.internal.ui.viewsupport.CElementLabels;
|
||||
import org.eclipse.cdt.internal.ui.viewsupport.DecoratingCLabelProvider;
|
||||
import org.eclipse.cdt.internal.ui.viewsupport.StandardCElementLabelProvider;
|
||||
|
||||
/**
|
||||
* Control which shows outline information in C/C++ editor. Based on
|
||||
|
@ -83,7 +82,7 @@ public class COutlineInformationControl extends AbstractInformationControl {
|
|||
fSortingAction= new LexicalSortingAction(treeViewer);
|
||||
treeViewer.addFilter(new NamePatternFilter());
|
||||
treeViewer.setLabelProvider(new DecoratingCLabelProvider(
|
||||
new StandardCElementLabelProvider(TEXT_FLAGS, IMAGE_FLAGS), true));
|
||||
new AppearanceAwareLabelProvider(TEXT_FLAGS, IMAGE_FLAGS), true));
|
||||
treeViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
|
||||
return treeViewer;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2006 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 2007 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
|
||||
|
@ -8,16 +8,16 @@
|
|||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Anton Leherbauer (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.viewsupport;
|
||||
|
||||
import org.eclipse.cdt.ui.PreferenceConstants;
|
||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||
|
||||
/**
|
||||
* CUILabelProvider that respects settings from the Appearance preference page.
|
||||
* Triggers a viewer update when a preference changes.
|
||||
* Triggers a viewer update when a preference changes (currently none).
|
||||
*/
|
||||
public class AppearanceAwareLabelProvider extends CUILabelProvider implements IPropertyChangeListener {
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class AppearanceAwareLabelProvider extends CUILabelProvider implements IP
|
|||
public AppearanceAwareLabelProvider(int textFlags, int imageFlags) {
|
||||
super(textFlags, imageFlags);
|
||||
initMasks();
|
||||
PreferenceConstants.getPreferenceStore().addPropertyChangeListener(this);
|
||||
// PreferenceConstants.getPreferenceStore().addPropertyChangeListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -44,15 +44,7 @@ public class AppearanceAwareLabelProvider extends CUILabelProvider implements IP
|
|||
}
|
||||
|
||||
private void initMasks() {
|
||||
// IPreferenceStore store= PreferenceConstants.getPreferenceStore();
|
||||
fTextFlagMask= -1;
|
||||
// if (!store.getBoolean(PreferenceConstants.APPEARANCE_METHOD_RETURNTYPE)) {
|
||||
// fTextFlagMask ^= CElementLabels.M_APP_RETURNTYPE;
|
||||
// }
|
||||
// if (!store.getBoolean(PreferenceConstants.APPEARANCE_COMPRESS_PACKAGE_NAMES)) {
|
||||
// fTextFlagMask ^= CElementLabels.P_COMPRESSED;
|
||||
// }
|
||||
|
||||
fImageFlagMask= -1;
|
||||
}
|
||||
|
||||
|
@ -60,33 +52,25 @@ public class AppearanceAwareLabelProvider extends CUILabelProvider implements IP
|
|||
* @see IPropertyChangeListener#propertyChange(PropertyChangeEvent)
|
||||
*/
|
||||
public void propertyChange(PropertyChangeEvent event) {
|
||||
// String property= event.getProperty();
|
||||
// if (property.equals(PreferenceConstants.APPEARANCE_METHOD_RETURNTYPE)
|
||||
// || property.equals(PreferenceConstants.APPEARANCE_PKG_NAME_PATTERN_FOR_PKG_VIEW)
|
||||
// || property.equals(PreferenceConstants.APPEARANCE_COMPRESS_PACKAGE_NAMES)) {
|
||||
// initMasks();
|
||||
// LabelProviderChangedEvent lpEvent= new LabelProviderChangedEvent(this, null); // refresh all
|
||||
// fireLabelProviderChanged(lpEvent);
|
||||
// }
|
||||
}
|
||||
|
||||
/*
|
||||
* @see IBaseLabelProvider#dispose()
|
||||
*/
|
||||
public void dispose() {
|
||||
PreferenceConstants.getPreferenceStore().removePropertyChangeListener(this);
|
||||
// PreferenceConstants.getPreferenceStore().removePropertyChangeListener(this);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
/*
|
||||
* @see JavaUILabelProvider#evaluateImageFlags()
|
||||
* @see CUILabelProvider#evaluateImageFlags()
|
||||
*/
|
||||
protected int evaluateImageFlags(Object element) {
|
||||
return getImageFlags() & fImageFlagMask;
|
||||
}
|
||||
|
||||
/*
|
||||
* @see JavaUILabelProvider#evaluateTextFlags()
|
||||
* @see CUILabelProvider#evaluateTextFlags()
|
||||
*/
|
||||
protected int evaluateTextFlags(Object element) {
|
||||
return getTextFlags() & fTextFlagMask;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2006 QNX Software Systems and others.
|
||||
* Copyright (c) 2000, 2007 QNX Software Systems 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
|
||||
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Anton Leherbauer (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.viewsupport;
|
||||
|
||||
|
@ -19,6 +20,8 @@ import org.eclipse.jface.util.PropertyChangeEvent;
|
|||
/**
|
||||
* CElementLabelProvider that respects settings from the Appearance preference page.
|
||||
* Triggers a viewer update when a preference changes.
|
||||
*
|
||||
* @deprecated Use {@link AppearanceAwareLabelProvider} instead.
|
||||
*/
|
||||
public class StandardCElementLabelProvider extends AppearanceAwareLabelProvider implements IPropertyChangeListener {
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue