mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Work for Library entries.. In Progress
This commit is contained in:
parent
680b56fd9b
commit
87b6836f3a
4 changed files with 213 additions and 7 deletions
|
@ -39,8 +39,8 @@ class CPElementLabelProvider extends LabelProvider {
|
||||||
fCreateLabel = CPathEntryMessages.getString("CPListLabelProvider.willbecreated"); //$NON-NLS-1$
|
fCreateLabel = CPathEntryMessages.getString("CPListLabelProvider.willbecreated"); //$NON-NLS-1$
|
||||||
fRegistry = CUIPlugin.getImageDescriptorRegistry();
|
fRegistry = CUIPlugin.getImageDescriptorRegistry();
|
||||||
|
|
||||||
fLibIcon = CPluginImages.DESC_OBJS_ARCHIVE;
|
fExtLibIcon = fLibIcon = CPluginImages.DESC_OBJS_ARCHIVE;
|
||||||
fLibWSrcIcon = CPluginImages.DESC_OBJS_ARCHIVE_WSRC;
|
fExtLibWSrcIcon = fLibWSrcIcon = CPluginImages.DESC_OBJS_ARCHIVE_WSRC;
|
||||||
fIncludeIcon = CPluginImages.DESC_OBJS_INCLUDES_FOLDER;
|
fIncludeIcon = CPluginImages.DESC_OBJS_INCLUDES_FOLDER;
|
||||||
fMacroIcon = CPluginImages.DESC_OBJS_MACRO;
|
fMacroIcon = CPluginImages.DESC_OBJS_MACRO;
|
||||||
fFolderImage = CPluginImages.DESC_OBJS_SOURCE_ROOT;
|
fFolderImage = CPluginImages.DESC_OBJS_SOURCE_ROOT;
|
||||||
|
@ -238,8 +238,7 @@ class CPElementLabelProvider extends LabelProvider {
|
||||||
} else if (element instanceof CPElementAttribute) {
|
} else if (element instanceof CPElementAttribute) {
|
||||||
String key = ((CPElementAttribute)element).getKey();
|
String key = ((CPElementAttribute)element).getKey();
|
||||||
if (key.equals(CPElement.SOURCEATTACHMENT)) {
|
if (key.equals(CPElement.SOURCEATTACHMENT)) {
|
||||||
// return
|
return fRegistry.get(CPluginImages.DESC_OBJS_SOURCE_ATTACH_ATTRIB);
|
||||||
// fRegistry.get(CPluginImages.DESC_OBJS_SOURCE_ATTACH_ATTRIB);
|
|
||||||
} else if (key.equals(CPElement.EXCLUSION)) {
|
} else if (key.equals(CPElement.EXCLUSION)) {
|
||||||
return CPluginImages.get(CPluginImages.IMG_OBJS_EXCLUDSION_FILTER_ATTRIB);
|
return CPluginImages.get(CPluginImages.IMG_OBJS_EXCLUDSION_FILTER_ATTRIB);
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,6 +149,8 @@ ProjectsEntryPage.projects.checkall.button=Select &All
|
||||||
ProjectsEntryWorkbookPage.projects.uncheckall.button=&Deselect All
|
ProjectsEntryWorkbookPage.projects.uncheckall.button=&Deselect All
|
||||||
|
|
||||||
# ------- LibrariesWorkbookPage-------
|
# ------- LibrariesWorkbookPage-------
|
||||||
|
LibrariesEntryPage.title=&Libraries
|
||||||
|
LibrariesEntryPage.description=
|
||||||
LibrariesEntryPage.libraries.label=Libraries on the build path:
|
LibrariesEntryPage.libraries.label=Libraries on the build path:
|
||||||
LibrariesEntryPage.libraries.remove.button=&Remove
|
LibrariesEntryPage.libraries.remove.button=&Remove
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,203 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* Copyright (c) 2002,2003,2004 QNX Software Systems and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Common Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/cpl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* QNX Software Systems - Initial API and implementation
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.core.model.IPathEntry;
|
||||||
|
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||||
|
import org.eclipse.cdt.internal.ui.util.PixelConverter;
|
||||||
|
import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
|
||||||
|
import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
|
||||||
|
import org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter;
|
||||||
|
import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
|
||||||
|
import org.eclipse.cdt.internal.ui.wizards.dialogfields.ListDialogField;
|
||||||
|
import org.eclipse.cdt.internal.ui.wizards.dialogfields.TreeListDialogField;
|
||||||
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.events.KeyEvent;
|
||||||
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CPathLibraryEntryPage
|
||||||
|
*/
|
||||||
|
public class CPathLibraryEntryPage extends CPathBasePage {
|
||||||
|
|
||||||
|
private ListDialogField fCPathList;
|
||||||
|
private ICProject fCurrCProject;
|
||||||
|
private TreeListDialogField fLibrariesList;
|
||||||
|
|
||||||
|
private IWorkspaceRoot fWorkspaceRoot;
|
||||||
|
|
||||||
|
private final int IDX_ADD = 0;
|
||||||
|
private final int IDX_EDIT = 2;
|
||||||
|
private final int IDX_REMOVE = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param title
|
||||||
|
*/
|
||||||
|
public CPathLibraryEntryPage(ListDialogField cPathList) {
|
||||||
|
super(CPathEntryMessages.getString("LibrariesEntryPage.title")); //$NON-NLS-1$
|
||||||
|
setDescription(CPathEntryMessages.getString("LibrariesEntryPage.description")); //$NON-NLS-1$
|
||||||
|
|
||||||
|
fWorkspaceRoot = CUIPlugin.getWorkspace().getRoot();
|
||||||
|
fCPathList = cPathList;
|
||||||
|
|
||||||
|
LibrariesAdapter adapter = new LibrariesAdapter();
|
||||||
|
|
||||||
|
String[] buttonLabels= new String[] {
|
||||||
|
/* IDX_ADDLIB*/ CPathEntryMessages.getString("LibrariesEntryPage.libraries.addworkspacelib.button"), //$NON-NLS-1$
|
||||||
|
/* IDX_ADDEXT */ CPathEntryMessages.getString("LibrariesEntryPage.libraries.addextlib.button"), //$NON-NLS-1$
|
||||||
|
/* */ null,
|
||||||
|
/* IDX_EDIT */ CPathEntryMessages.getString("LibrariesEntryPage.libraries.edit.button"), //$NON-NLS-1$
|
||||||
|
/* IDX_REMOVE */ CPathEntryMessages.getString("LibrariesEntryPage.libraries.remove.button") //$NON-NLS-1$
|
||||||
|
};
|
||||||
|
|
||||||
|
fLibrariesList = new TreeListDialogField(adapter, buttonLabels, new CPElementLabelProvider());
|
||||||
|
fLibrariesList.setDialogFieldListener(adapter);
|
||||||
|
fLibrariesList.setLabelText(CPathEntryMessages.getString("LibrariesEntryPage.libraries.label")); //$NON-NLS-1$
|
||||||
|
|
||||||
|
fLibrariesList.setViewerSorter(new CPElementSorter());
|
||||||
|
fLibrariesList.enableButton(IDX_EDIT, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Image getImage() {
|
||||||
|
return CPluginImages.get(CPluginImages.IMG_OBJS_ARCHIVE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(ICProject cproject) {
|
||||||
|
fCurrCProject = cproject;
|
||||||
|
updateLibrariesList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateLibrariesList() {
|
||||||
|
//List cpelements= fLibrariesList.getElements();
|
||||||
|
List cpelements = filterList(fCPathList.getElements());
|
||||||
|
List libelements= new ArrayList(cpelements.size());
|
||||||
|
|
||||||
|
int nElements= cpelements.size();
|
||||||
|
for (int i= 0; i < nElements; i++) {
|
||||||
|
CPElement cpe= (CPElement)cpelements.get(i);
|
||||||
|
if (isEntryKind(cpe.getEntryKind())) {
|
||||||
|
libelements.add(cpe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fLibrariesList.setElements(libelements);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.ui.dialogs.cpaths.CPathBasePage#getSelection()
|
||||||
|
*/
|
||||||
|
public List getSelection() {
|
||||||
|
return fLibrariesList.getSelectedElements();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.ui.dialogs.cpaths.CPathBasePage#setSelection(java.util.List)
|
||||||
|
*/
|
||||||
|
public void setSelection(List selElements) {
|
||||||
|
fLibrariesList.selectElements(new StructuredSelection(selElements));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.ui.dialogs.cpaths.CPathBasePage#isEntryKind(int)
|
||||||
|
*/
|
||||||
|
public boolean isEntryKind(int kind) {
|
||||||
|
return kind == IPathEntry.CDT_LIBRARY || kind == IPathEntry.CDT_CONTAINER;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performApply(org.eclipse.core.runtime.IProgressMonitor)
|
||||||
|
*/
|
||||||
|
public void performApply(IProgressMonitor monitor) throws CoreException {
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.ui.dialogs.ICOptionPage#performDefaults()
|
||||||
|
*/
|
||||||
|
public void performDefaults() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
|
||||||
|
*/
|
||||||
|
public void createControl(Composite parent) {
|
||||||
|
PixelConverter converter = new PixelConverter(parent);
|
||||||
|
Composite composite = new Composite(parent, SWT.NONE);
|
||||||
|
|
||||||
|
LayoutUtil.doDefaultLayout(composite, new DialogField[] {fLibrariesList}, true);
|
||||||
|
LayoutUtil.setHorizontalGrabbing(fLibrariesList.getTreeControl(null));
|
||||||
|
|
||||||
|
int buttonBarWidth = converter.convertWidthInCharsToPixels(24);
|
||||||
|
fLibrariesList.setButtonsMinWidth(buttonBarWidth);
|
||||||
|
|
||||||
|
fLibrariesList.getTreeViewer().setSorter(new CPElementSorter());
|
||||||
|
|
||||||
|
setControl(composite);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class LibrariesAdapter implements IDialogFieldListener, ITreeListAdapter {
|
||||||
|
|
||||||
|
private final Object[] EMPTY_ARR= new Object[0];
|
||||||
|
|
||||||
|
// -------- IListAdapter --------
|
||||||
|
public void customButtonPressed(TreeListDialogField field, int index) {
|
||||||
|
//libraryPageCustomButtonPressed(field, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void selectionChanged(TreeListDialogField field) {
|
||||||
|
//libraryPageSelectionChanged(field);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void doubleClicked(TreeListDialogField field) {
|
||||||
|
//libraryPageDoubleClicked(field);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void keyPressed(TreeListDialogField field, KeyEvent event) {
|
||||||
|
//libraryPageKeyPressed(field, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object[] getChildren(TreeListDialogField field, Object element) {
|
||||||
|
if (element instanceof CPElement) {
|
||||||
|
return ((CPElement) element).getChildren();
|
||||||
|
}
|
||||||
|
return EMPTY_ARR;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getParent(TreeListDialogField field, Object element) {
|
||||||
|
if (element instanceof CPElementAttribute) {
|
||||||
|
return ((CPElementAttribute) element).getParent();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasChildren(TreeListDialogField field, Object element) {
|
||||||
|
return (element instanceof CPElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- IDialogFieldListener --------
|
||||||
|
|
||||||
|
public void dialogFieldChanged(DialogField field) {
|
||||||
|
//libaryPageDialogFieldChanged(field);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -31,7 +31,7 @@ public class CPathTabBlock extends AbstractPathOptionBlock {
|
||||||
private CPathProjectsEntryPage fProjectsPage;
|
private CPathProjectsEntryPage fProjectsPage;
|
||||||
private CPathOutputEntryPage fOutputPage;
|
private CPathOutputEntryPage fOutputPage;
|
||||||
private CPathContainerEntryPage fContainerPage;
|
private CPathContainerEntryPage fContainerPage;
|
||||||
//private LibrariesWorkbookPage fLibrariesPage;
|
private CPathLibraryEntryPage fLibrariesPage;
|
||||||
|
|
||||||
private CPathOrderExportPage fOrderExportPage;
|
private CPathOrderExportPage fOrderExportPage;
|
||||||
|
|
||||||
|
@ -82,6 +82,8 @@ public class CPathTabBlock extends AbstractPathOptionBlock {
|
||||||
addPage(fOutputPage);
|
addPage(fOutputPage);
|
||||||
fProjectsPage = new CPathProjectsEntryPage(fCPathList);
|
fProjectsPage = new CPathProjectsEntryPage(fCPathList);
|
||||||
addPage(fProjectsPage);
|
addPage(fProjectsPage);
|
||||||
|
fLibrariesPage = new CPathLibraryEntryPage(fCPathList);
|
||||||
|
addPage(fLibrariesPage);
|
||||||
fContainerPage = new CPathContainerEntryPage(fCPathList);
|
fContainerPage = new CPathContainerEntryPage(fCPathList);
|
||||||
addPage(fContainerPage);
|
addPage(fContainerPage);
|
||||||
fOrderExportPage = new CPathOrderExportPage(fCPathList);
|
fOrderExportPage = new CPathOrderExportPage(fCPathList);
|
||||||
|
@ -100,7 +102,7 @@ public class CPathTabBlock extends AbstractPathOptionBlock {
|
||||||
fOutputPage.init(getCProject());
|
fOutputPage.init(getCProject());
|
||||||
fProjectsPage.init(getCProject());
|
fProjectsPage.init(getCProject());
|
||||||
fContainerPage.init(getCProject());
|
fContainerPage.init(getCProject());
|
||||||
//fLibrariesPage.init(fCurrCProject);
|
fLibrariesPage.init(getCProject());
|
||||||
}
|
}
|
||||||
Dialog.applyDialogFont(control);
|
Dialog.applyDialogFont(control);
|
||||||
return control;
|
return control;
|
||||||
|
@ -125,7 +127,7 @@ public class CPathTabBlock extends AbstractPathOptionBlock {
|
||||||
fOutputPage.init(getCProject());
|
fOutputPage.init(getCProject());
|
||||||
fProjectsPage.init(getCProject());
|
fProjectsPage.init(getCProject());
|
||||||
fContainerPage.init(getCProject());
|
fContainerPage.init(getCProject());
|
||||||
// fLibrariesPage.init(fCurrCProject);
|
fLibrariesPage.init(getCProject());
|
||||||
}
|
}
|
||||||
|
|
||||||
doStatusLineUpdate();
|
doStatusLineUpdate();
|
||||||
|
|
Loading…
Add table
Reference in a new issue