mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
cpath ui update
This commit is contained in:
parent
4aecba2e95
commit
f12fae4a2a
24 changed files with 419 additions and 349 deletions
|
@ -1,11 +1,10 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2002, 2003, 2004 QNX Software Systems Ltd. and others. All
|
* Copyright (c) 2004 QNX Software Systems and others. All rights reserved. This
|
||||||
* rights reserved. This program and the accompanying materials are made
|
* program and the accompanying materials are made available under the terms of
|
||||||
* available under the terms of the Common Public License v1.0 which accompanies
|
* the Common Public License v1.0 which accompanies this distribution, and is
|
||||||
* this distribution, and is available at
|
* available at http://www.eclipse.org/legal/cpl-v10.html
|
||||||
* http://www.eclipse.org/legal/cpl-v10.html
|
|
||||||
*
|
*
|
||||||
* Contributors: QNX Software Systems - Initial API and implementation
|
* Contributors: QNX Software Systems - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
||||||
|
|
||||||
|
|
|
@ -510,7 +510,7 @@ public class CPElement {
|
||||||
elem.setAttribute(BASE, base);
|
elem.setAttribute(BASE, base);
|
||||||
elem.setExported(curr.isExported());
|
elem.setExported(curr.isExported());
|
||||||
|
|
||||||
if (project.exists()) {
|
if (project != null && project.exists()) {
|
||||||
elem.setIsMissing(isMissing);
|
elem.setIsMissing(isMissing);
|
||||||
}
|
}
|
||||||
return elem;
|
return elem;
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 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;
|
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -11,8 +19,8 @@ import org.eclipse.jface.viewers.Viewer;
|
||||||
import org.eclipse.jface.viewers.ViewerFilter;
|
import org.eclipse.jface.viewers.ViewerFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Viewer filter for archive selection dialogs. Archives are files with file
|
* Viewer filter for archive selection dialogs. Archives are files with file extension '.so', '.dll' and '.a'. The filter is not
|
||||||
* extension '.so', '.dll' and '.a'. The filter is not case sensitive.
|
* case sensitive.
|
||||||
*/
|
*/
|
||||||
public class CPElementFilter extends ViewerFilter {
|
public class CPElementFilter extends ViewerFilter {
|
||||||
|
|
||||||
|
@ -22,8 +30,7 @@ public class CPElementFilter extends ViewerFilter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param excludedFiles
|
* @param excludedFiles
|
||||||
* Excluded paths will not pass the filter. <code>null</code> is
|
* Excluded paths will not pass the filter. <code>null</code> is allowed if no files should be excluded.
|
||||||
* allowed if no files should be excluded.
|
|
||||||
* @param recusive
|
* @param recusive
|
||||||
* Folders are only shown if, searched recursivly, contain an archive
|
* Folders are only shown if, searched recursivly, contain an archive
|
||||||
*/
|
*/
|
||||||
|
@ -39,7 +46,6 @@ public class CPElementFilter extends ViewerFilter {
|
||||||
this(null, kind, exportedOnly);
|
this(null, kind, exportedOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @see ViewerFilter#select
|
* @see ViewerFilter#select
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -16,7 +16,6 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||||
import org.eclipse.cdt.internal.ui.util.ImageDescriptorRegistry;
|
import org.eclipse.cdt.internal.ui.util.ImageDescriptorRegistry;
|
||||||
import org.eclipse.cdt.ui.CElementImageDescriptor;
|
import org.eclipse.cdt.ui.CElementImageDescriptor;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.core.resources.IContainer;
|
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
@ -29,7 +28,7 @@ import org.eclipse.ui.ide.IDE;
|
||||||
|
|
||||||
class CPElementLabelProvider extends LabelProvider {
|
class CPElementLabelProvider extends LabelProvider {
|
||||||
|
|
||||||
private String fNewLabel, fClassLabel, fCreateLabel;
|
private String fNewLabel, fCreateLabel;
|
||||||
private ImageDescriptor fIncludeIcon, fMacroIcon, fLibWSrcIcon, fLibIcon, fExtLibIcon, fExtLibWSrcIcon;
|
private ImageDescriptor fIncludeIcon, fMacroIcon, fLibWSrcIcon, fLibIcon, fExtLibIcon, fExtLibWSrcIcon;
|
||||||
private ImageDescriptor fFolderImage, fOutputImage, fProjectImage, fContainerImage;
|
private ImageDescriptor fFolderImage, fOutputImage, fProjectImage, fContainerImage;
|
||||||
|
|
||||||
|
@ -37,7 +36,6 @@ class CPElementLabelProvider extends LabelProvider {
|
||||||
|
|
||||||
public CPElementLabelProvider() {
|
public CPElementLabelProvider() {
|
||||||
fNewLabel = CPathEntryMessages.getString("CPListLabelProvider.new"); //$NON-NLS-1$
|
fNewLabel = CPathEntryMessages.getString("CPListLabelProvider.new"); //$NON-NLS-1$
|
||||||
fClassLabel = CPathEntryMessages.getString("CPListLabelProvider.classcontainer"); //$NON-NLS-1$
|
|
||||||
fCreateLabel = CPathEntryMessages.getString("CPListLabelProvider.willbecreated"); //$NON-NLS-1$
|
fCreateLabel = CPathEntryMessages.getString("CPListLabelProvider.willbecreated"); //$NON-NLS-1$
|
||||||
fRegistry = CUIPlugin.getImageDescriptorRegistry();
|
fRegistry = CUIPlugin.getImageDescriptorRegistry();
|
||||||
|
|
||||||
|
@ -107,25 +105,7 @@ class CPElementLabelProvider extends LabelProvider {
|
||||||
IPath path = cpentry.getPath();
|
IPath path = cpentry.getPath();
|
||||||
switch (cpentry.getEntryKind()) {
|
switch (cpentry.getEntryKind()) {
|
||||||
case IPathEntry.CDT_LIBRARY :
|
case IPathEntry.CDT_LIBRARY :
|
||||||
{
|
|
||||||
IResource resource = cpentry.getResource();
|
|
||||||
if (resource instanceof IContainer) {
|
|
||||||
StringBuffer buf = new StringBuffer(path.makeRelative().toString());
|
|
||||||
buf.append(' ');
|
|
||||||
buf.append(fClassLabel);
|
|
||||||
if (!resource.exists()) {
|
|
||||||
buf.append(' ');
|
|
||||||
if (cpentry.isMissing()) {
|
|
||||||
buf.append(fCreateLabel);
|
|
||||||
} else {
|
|
||||||
buf.append(fNewLabel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return buf.toString();
|
|
||||||
}
|
|
||||||
// should not come here
|
|
||||||
return path.makeRelative().toString();
|
return path.makeRelative().toString();
|
||||||
}
|
|
||||||
case IPathEntry.CDT_PROJECT :
|
case IPathEntry.CDT_PROJECT :
|
||||||
return path.lastSegment();
|
return path.lastSegment();
|
||||||
case IPathEntry.CDT_INCLUDE :
|
case IPathEntry.CDT_INCLUDE :
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2002, 2003, 2004 QNX Software Systems Ltd. and others. All
|
* Copyright (c) 2004 QNX Software Systems and others. All rights reserved. This
|
||||||
* rights reserved. This program and the accompanying materials are made
|
* program and the accompanying materials are made available under the terms of
|
||||||
* available under the terms of the Common Public License v1.0 which
|
* the Common Public License v1.0 which accompanies this distribution, and is
|
||||||
* accompanies this distribution, and is available at
|
* available at http://www.eclipse.org/legal/cpl-v10.html
|
||||||
* http://www.eclipse.org/legal/cpl-v10.html
|
|
||||||
*
|
*
|
||||||
* Contributors: QNX Software Systems - Initial API and implementation
|
* Contributors: QNX Software Systems - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2002, 2003, 2004 QNX Software Systems Ltd. and others. All
|
* Copyright (c) 2004 QNX Software Systems and others. All rights reserved. This
|
||||||
* rights reserved. This program and the accompanying materials are made
|
* program and the accompanying materials are made available under the terms of
|
||||||
* available under the terms of the Common Public License v1.0 which
|
* the Common Public License v1.0 which accompanies this distribution, and is
|
||||||
* accompanies this distribution, and is available at
|
* available at http://www.eclipse.org/legal/cpl-v10.html
|
||||||
* http://www.eclipse.org/legal/cpl-v10.html
|
|
||||||
*
|
*
|
||||||
* Contributors: QNX Software Systems - Initial API and implementation
|
* Contributors: QNX Software Systems - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
||||||
|
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.IPathEntry;
|
import org.eclipse.cdt.core.model.IPathEntry;
|
||||||
|
@ -17,21 +18,29 @@ import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.cdt.ui.wizards.ICPathContainerPage;
|
import org.eclipse.cdt.ui.wizards.ICPathContainerPage;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
|
import org.eclipse.core.runtime.IExtension;
|
||||||
import org.eclipse.core.runtime.IExtensionPoint;
|
import org.eclipse.core.runtime.IExtensionPoint;
|
||||||
|
import org.eclipse.core.runtime.IPluginDescriptor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
|
import org.eclipse.swt.SWTException;
|
||||||
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
|
||||||
public class CPathContainerDescriptor implements IContainerDescriptor {
|
public class CPathContainerDescriptor implements IContainerDescriptor {
|
||||||
|
|
||||||
private IConfigurationElement fConfigElement;
|
private IConfigurationElement fConfigElement;
|
||||||
|
|
||||||
private static final String ATT_EXTENSION = "PathContainerPage"; //$NON-NLS-1$
|
private static final String ATT_EXTENSION = "PathContainerPage"; //$NON-NLS-1$
|
||||||
|
|
||||||
private static final String ATT_ID = "id"; //$NON-NLS-1$
|
private static final String ATT_ID = "id"; //$NON-NLS-1$
|
||||||
private static final String ATT_NAME = "name"; //$NON-NLS-1$
|
private static final String ATT_NAME = "name"; //$NON-NLS-1$
|
||||||
|
private static final String ATT_ICON = "icon"; //$NON-NLS-1$
|
||||||
private static final String ATT_PAGE_CLASS = "class"; //$NON-NLS-1$
|
private static final String ATT_PAGE_CLASS = "class"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private Image pageImage;
|
||||||
|
|
||||||
public CPathContainerDescriptor(IConfigurationElement configElement) throws CoreException {
|
public CPathContainerDescriptor(IConfigurationElement configElement) throws CoreException {
|
||||||
super();
|
super();
|
||||||
fConfigElement = configElement;
|
fConfigElement = configElement;
|
||||||
|
@ -41,10 +50,12 @@ public class CPathContainerDescriptor implements IContainerDescriptor {
|
||||||
String pageClassName = configElement.getAttribute(ATT_PAGE_CLASS);
|
String pageClassName = configElement.getAttribute(ATT_PAGE_CLASS);
|
||||||
|
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
throw new CoreException(new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, 0, "Invalid extension (missing name): " + id, null)); //$NON-NLS-1$
|
throw new CoreException(new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, 0, "Invalid extension (missing name): " + id, //$NON-NLS-1$
|
||||||
|
null));
|
||||||
}
|
}
|
||||||
if (pageClassName == null) {
|
if (pageClassName == null) {
|
||||||
throw new CoreException(new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, 0, "Invalid extension (missing page class name): " + id, null)); //$NON-NLS-1$
|
throw new CoreException(new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, 0,
|
||||||
|
"Invalid extension (missing page class name): " + id, null)); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +65,8 @@ public class CPathContainerDescriptor implements IContainerDescriptor {
|
||||||
return (ICPathContainerPage) elem;
|
return (ICPathContainerPage) elem;
|
||||||
} else {
|
} else {
|
||||||
String id = fConfigElement.getAttribute(ATT_ID);
|
String id = fConfigElement.getAttribute(ATT_ID);
|
||||||
throw new CoreException(new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, 0, "Invalid extension (page not of type IClasspathContainerPage): " + id, null)); //$NON-NLS-1$
|
throw new CoreException(new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, 0,
|
||||||
|
"Invalid extension (page not of type IClasspathContainerPage): " + id, null)); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,6 +74,36 @@ public class CPathContainerDescriptor implements IContainerDescriptor {
|
||||||
return fConfigElement.getAttribute(ATT_NAME);
|
return fConfigElement.getAttribute(ATT_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Image getImage() {
|
||||||
|
if (pageImage == null) {
|
||||||
|
String imageName = fConfigElement.getAttribute(ATT_ICON);
|
||||||
|
if (imageName != null) {
|
||||||
|
IExtension extension = fConfigElement.getDeclaringExtension();
|
||||||
|
IPluginDescriptor pd = extension.getDeclaringPluginDescriptor();
|
||||||
|
Image image = getImageFromPlugin(pd, imageName);
|
||||||
|
pageImage = image;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pageImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Image getImageFromPlugin(IPluginDescriptor pluginDescriptor, String subdirectoryAndFilename) {
|
||||||
|
URL installURL = pluginDescriptor.getInstallURL();
|
||||||
|
return getImageFromURL(installURL, subdirectoryAndFilename);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Image getImageFromURL(URL installURL, String subdirectoryAndFilename) {
|
||||||
|
Image image = null;
|
||||||
|
try {
|
||||||
|
URL newURL = new URL(installURL, subdirectoryAndFilename);
|
||||||
|
ImageDescriptor desc = ImageDescriptor.createFromURL(newURL);
|
||||||
|
image = desc.createImage();
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
} catch (SWTException e) {
|
||||||
|
}
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
public String getPageClass() {
|
public String getPageClass() {
|
||||||
return fConfigElement.getAttribute(ATT_PAGE_CLASS);
|
return fConfigElement.getAttribute(ATT_PAGE_CLASS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2002, 2003, 2004 QNX Software Systems Ltd. and others. All
|
* Copyright (c) 2004 QNX Software Systems and others. All rights reserved. This
|
||||||
* rights reserved. This program and the accompanying materials are made
|
* program and the accompanying materials are made available under the terms of
|
||||||
* available under the terms of the Common Public License v1.0 which
|
* the Common Public License v1.0 which accompanies this distribution, and is
|
||||||
* accompanies this distribution, and is available at
|
* available at http://www.eclipse.org/legal/cpl-v10.html
|
||||||
* http://www.eclipse.org/legal/cpl-v10.html
|
|
||||||
*
|
*
|
||||||
* Contributors: QNX Software Systems - Initial API and implementation
|
* Contributors: QNX Software Systems - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
||||||
|
|
||||||
|
@ -22,11 +21,12 @@ import org.eclipse.jface.viewers.IDoubleClickListener;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||||
import org.eclipse.jface.viewers.LabelProvider;
|
import org.eclipse.jface.viewers.LabelProvider;
|
||||||
import org.eclipse.jface.viewers.ListViewer;
|
|
||||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||||
|
import org.eclipse.jface.viewers.TableViewer;
|
||||||
import org.eclipse.jface.viewers.ViewerSorter;
|
import org.eclipse.jface.viewers.ViewerSorter;
|
||||||
import org.eclipse.jface.wizard.WizardPage;
|
import org.eclipse.jface.wizard.WizardPage;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.graphics.Image;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,16 +37,27 @@ public class CPathContainerSelectionPage extends WizardPage {
|
||||||
private static final String DIALOGSTORE_CONTAINER_IDX= "index"; //$NON-NLS-1$
|
private static final String DIALOGSTORE_CONTAINER_IDX= "index"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
||||||
private static class ClasspathContainerLabelProvider extends LabelProvider {
|
private static class CPathContainerLabelProvider extends LabelProvider {
|
||||||
public String getText(Object element) {
|
public String getText(Object element) {
|
||||||
return ((IContainerDescriptor) element).getName();
|
return ((IContainerDescriptor) element).getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Image getImage(Object element) {
|
||||||
|
return ((IContainerDescriptor) element).getImage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ClasspathContainerSorter extends ViewerSorter {
|
private static class CPathContainerSorter extends ViewerSorter {
|
||||||
|
|
||||||
|
public int category(Object element) {
|
||||||
|
if ( element instanceof ProjectContainerDescriptor) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ListViewer fListViewer;
|
private TableViewer fListViewer;
|
||||||
private IContainerDescriptor[] fContainers;
|
private IContainerDescriptor[] fContainers;
|
||||||
private IDialogSettings fDialogSettings;
|
private IDialogSettings fDialogSettings;
|
||||||
|
|
||||||
|
@ -75,10 +86,10 @@ public class CPathContainerSelectionPage extends WizardPage {
|
||||||
* @see IDialogPage#createControl(Composite)
|
* @see IDialogPage#createControl(Composite)
|
||||||
*/
|
*/
|
||||||
public void createControl(Composite parent) {
|
public void createControl(Composite parent) {
|
||||||
fListViewer= new ListViewer(parent, SWT.SINGLE | SWT.BORDER);
|
fListViewer= new TableViewer(parent, SWT.SINGLE | SWT.BORDER);
|
||||||
fListViewer.setLabelProvider(new ClasspathContainerLabelProvider());
|
fListViewer.setLabelProvider(new CPathContainerLabelProvider());
|
||||||
fListViewer.setContentProvider(new ListContentProvider());
|
fListViewer.setContentProvider(new ListContentProvider());
|
||||||
fListViewer.setSorter(new ClasspathContainerSorter());
|
fListViewer.setSorter(new CPathContainerSorter());
|
||||||
fListViewer.setInput(Arrays.asList(fContainers));
|
fListViewer.setInput(Arrays.asList(fContainers));
|
||||||
fListViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
fListViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||||
public void selectionChanged(SelectionChangedEvent event) {
|
public void selectionChanged(SelectionChangedEvent event) {
|
||||||
|
@ -95,10 +106,10 @@ public class CPathContainerSelectionPage extends WizardPage {
|
||||||
if (selectionIndex >= fContainers.length) {
|
if (selectionIndex >= fContainers.length) {
|
||||||
selectionIndex= 0;
|
selectionIndex= 0;
|
||||||
}
|
}
|
||||||
fListViewer.getList().select(selectionIndex);
|
fListViewer.getTable().select(selectionIndex);
|
||||||
validatePage();
|
validatePage();
|
||||||
setControl(fListViewer.getList());
|
setControl(fListViewer.getTable());
|
||||||
Dialog.applyDialogFont(fListViewer.getList());
|
Dialog.applyDialogFont(fListViewer.getTable());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -135,7 +146,7 @@ public class CPathContainerSelectionPage extends WizardPage {
|
||||||
*/
|
*/
|
||||||
public void setVisible(boolean visible) {
|
public void setVisible(boolean visible) {
|
||||||
if (!visible && fListViewer != null) {
|
if (!visible && fListViewer != null) {
|
||||||
fDialogSettings.put(DIALOGSTORE_CONTAINER_IDX, fListViewer.getList().getSelectionIndex());
|
fDialogSettings.put(DIALOGSTORE_CONTAINER_IDX, fListViewer.getTable().getSelectionIndex());
|
||||||
}
|
}
|
||||||
super.setVisible(visible);
|
super.setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2003 IBM Corporation and others. All rights reserved.
|
* Copyright (c) 2004 QNX Software Systems and others. All rights reserved. This
|
||||||
* This program and the accompanying materials are made available under the
|
* program and the accompanying materials are made available under the terms of
|
||||||
* terms of the Common Public License v1.0 which accompanies this distribution,
|
* the Common Public License v1.0 which accompanies this distribution, and is
|
||||||
* and is available at http://www.eclipse.org/legal/cpl-v10.html
|
* available at http://www.eclipse.org/legal/cpl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors: IBM Corporation - initial API and implementation
|
* Contributors: QNX Software Systems - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.core.model.IPathEntry;
|
import org.eclipse.cdt.core.model.IPathEntry;
|
||||||
import org.eclipse.cdt.internal.ui.util.ExceptionHandler;
|
import org.eclipse.cdt.internal.ui.util.ExceptionHandler;
|
||||||
import org.eclipse.cdt.internal.ui.util.PixelConverter;
|
import org.eclipse.cdt.internal.ui.util.PixelConverter;
|
||||||
|
@ -33,8 +33,8 @@ public class CPathContainerWizard extends Wizard {
|
||||||
private IPathEntry[] fNewEntries;
|
private IPathEntry[] fNewEntries;
|
||||||
private IPathEntry[] fContainerEntries;
|
private IPathEntry[] fContainerEntries;
|
||||||
private ICPathContainerPage fContainerPage;
|
private ICPathContainerPage fContainerPage;
|
||||||
private ICProject fCurrProject;
|
private ICElement fCurrElement;
|
||||||
private IPathEntry[] fCurrClasspath;
|
private IPathEntry[] fCurrCPath;
|
||||||
private CPathFilterPage fFilterPage;
|
private CPathFilterPage fFilterPage;
|
||||||
|
|
||||||
private CPathContainerSelectionPage fSelectionWizardPage;
|
private CPathContainerSelectionPage fSelectionWizardPage;
|
||||||
|
@ -43,26 +43,26 @@ public class CPathContainerWizard extends Wizard {
|
||||||
/**
|
/**
|
||||||
* Constructor for ClasspathContainerWizard.
|
* Constructor for ClasspathContainerWizard.
|
||||||
*/
|
*/
|
||||||
public CPathContainerWizard(IPathEntry entryToEdit, ICProject currProject, IPathEntry[] currEntries) {
|
public CPathContainerWizard(IPathEntry entryToEdit, ICElement currElement, IPathEntry[] currEntries) {
|
||||||
this(entryToEdit, null, currProject, currEntries, -1);
|
this(entryToEdit, null, currElement, currEntries, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for ClasspathContainerWizard.
|
* Constructor for ClasspathContainerWizard.
|
||||||
*/
|
*/
|
||||||
public CPathContainerWizard(IContainerDescriptor pageDesc, ICProject currProject, IPathEntry[] currEntries) {
|
public CPathContainerWizard(IContainerDescriptor pageDesc, ICElement currElement, IPathEntry[] currEntries) {
|
||||||
this(null, pageDesc, currProject, currEntries, -1);
|
this(null, pageDesc, currElement, currEntries, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CPathContainerWizard(IPathEntry entryToEdit, IContainerDescriptor pageDesc, ICProject currProject,
|
public CPathContainerWizard(IPathEntry entryToEdit, IContainerDescriptor pageDesc, ICElement currElement,
|
||||||
IPathEntry[] currEntries, int filterType) {
|
IPathEntry[] currEntries, int filterType) {
|
||||||
fEntryToEdit = entryToEdit;
|
fEntryToEdit = entryToEdit;
|
||||||
fPageDesc = pageDesc;
|
fPageDesc = pageDesc;
|
||||||
fNewEntries = null;
|
fNewEntries = null;
|
||||||
|
|
||||||
fFilterType = filterType;
|
fFilterType = filterType;
|
||||||
fCurrProject = currProject;
|
fCurrElement = currElement;
|
||||||
fCurrClasspath = currEntries;
|
fCurrCPath = currEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPathEntry getEntriesParent() {
|
public IPathEntry getEntriesParent() {
|
||||||
|
@ -85,10 +85,9 @@ public class CPathContainerWizard extends Wizard {
|
||||||
public boolean performFinish() {
|
public boolean performFinish() {
|
||||||
if (fContainerPage != null) {
|
if (fContainerPage != null) {
|
||||||
if (fContainerPage.finish()) {
|
if (fContainerPage.finish()) {
|
||||||
|
fContainerEntries = fContainerPage.getContainerEntries();
|
||||||
if (fFilterType != -1 && fFilterPage.isPageComplete()) {
|
if (fFilterType != -1 && fFilterPage.isPageComplete()) {
|
||||||
fNewEntries = fFilterPage.getSelectedEntries();
|
fNewEntries = fFilterPage.getSelectedEntries();
|
||||||
} else {
|
|
||||||
fContainerEntries = fContainerPage.getContainerEntries();
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -126,7 +125,8 @@ public class CPathContainerWizard extends Wizard {
|
||||||
addPage(fContainerPage);
|
addPage(fContainerPage);
|
||||||
}
|
}
|
||||||
if (fFilterType != -1) {
|
if (fFilterType != -1) {
|
||||||
fFilterPage = new CPathFilterPage(fCurrProject, fFilterType);
|
fFilterPage = new CPathFilterPage(fCurrElement, fFilterType);
|
||||||
|
addPage(fFilterPage);
|
||||||
}
|
}
|
||||||
super.addPages();
|
super.addPages();
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ public class CPathContainerWizard extends Wizard {
|
||||||
if (containerPage == null) {
|
if (containerPage == null) {
|
||||||
containerPage = new CPathContainerDefaultPage();
|
containerPage = new CPathContainerDefaultPage();
|
||||||
}
|
}
|
||||||
containerPage.initialize(fCurrProject, fCurrClasspath);
|
containerPage.initialize(fCurrElement.getCProject(), fCurrCPath);
|
||||||
containerPage.setSelection(fEntryToEdit);
|
containerPage.setSelection(fEntryToEdit);
|
||||||
containerPage.setWizard(this);
|
containerPage.setWizard(this);
|
||||||
return containerPage;
|
return containerPage;
|
||||||
|
@ -162,9 +162,10 @@ public class CPathContainerWizard extends Wizard {
|
||||||
fContainerPage = getContainerPage(selected);
|
fContainerPage = getContainerPage(selected);
|
||||||
return fContainerPage;
|
return fContainerPage;
|
||||||
} else if (page == fContainerPage) {
|
} else if (page == fContainerPage) {
|
||||||
if ( fContainerPage.getContainerEntries().length > 0 ) {
|
if ( fContainerPage.getContainerEntries().length > 0 && fContainerPage.getContainerEntries()[0] != null) {
|
||||||
fFilterPage.setParentEntry(fContainerPage.getContainerEntries()[0]);
|
fFilterPage.setParentEntry(fContainerPage.getContainerEntries()[0]);
|
||||||
}
|
}
|
||||||
|
return fFilterPage;
|
||||||
}
|
}
|
||||||
return super.getNextPage(page);
|
return super.getNextPage(page);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2002, 2003, 2004 QNX Software Systems Ltd. and others. All
|
* Copyright (c) 2004 QNX Software Systems and others. All rights reserved. This
|
||||||
* rights reserved. This program and the accompanying materials are made
|
* program and the accompanying materials are made available under the terms of
|
||||||
* available under the terms of the Common Public License v1.0 which accompanies
|
* the Common Public License v1.0 which accompanies this distribution, and is
|
||||||
* this distribution, and is available at
|
* available at http://www.eclipse.org/legal/cpl-v10.html
|
||||||
* http://www.eclipse.org/legal/cpl-v10.html
|
|
||||||
*
|
*
|
||||||
* Contributors: QNX Software Systems - Initial API and implementation
|
* Contributors: QNX Software Systems - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,40 @@ CPathsPropertyPage.unsavedchanges.button.save=Apply
|
||||||
CPathsPropertyPage.unsavedchanges.button.discard=Discard
|
CPathsPropertyPage.unsavedchanges.button.discard=Discard
|
||||||
CPathsPropertyPage.unsavedchanges.button.ignore=Apply Later
|
CPathsPropertyPage.unsavedchanges.button.ignore=Apply Later
|
||||||
|
|
||||||
|
|
||||||
BuildPathsBlock.tab.libraries=&Libraries
|
BuildPathsBlock.tab.libraries=&Libraries
|
||||||
|
|
||||||
ProjectContainer.label=Project Path Entries
|
|
||||||
|
# ------- CPathFilterPage-------
|
||||||
|
|
||||||
|
CPathFilterPage.title=Container Paths
|
||||||
|
CPathFilterPage.description=Select path which are to be contributed to the project.
|
||||||
|
CPathFilterPage.label=C/C++ Container path:
|
||||||
|
|
||||||
|
# ------- CPathContainerSelectionPage-------
|
||||||
|
|
||||||
|
CPathContainerSelectionPage.title=Add Contributed
|
||||||
|
CPathContainerSelectionPage.description=Select the library type to add.
|
||||||
|
|
||||||
|
# ------- CPathContainerWizard-------
|
||||||
|
|
||||||
|
CPathContainerWizard.pagecreationerror.title= Library Wizard
|
||||||
|
CPathContainerWizard.pagecreationerror.message=Wizard page creation failed. Check log for details.
|
||||||
|
|
||||||
|
# ------- CPathContainerDefaultPage-------
|
||||||
|
|
||||||
|
CPathContainerDefaultPage.title=C/C++ Path Container
|
||||||
|
CPathContainerDefaultPage.description=Edit the C/C++ container path. First segment is the container type.
|
||||||
|
CPathContainerDefaultPage.path.label=&C/C++ path container path:
|
||||||
|
CPathContainerDefaultPage.path.error.enterpath=Enter path.
|
||||||
|
CPathContainerDefaultPage.path.error.invalidpath=Invalid path.
|
||||||
|
CPathContainerDefaultPage.path.error.needssegment=Path needs at least one segment.
|
||||||
|
CPathContainerDefaultPage.path.error.alreadyexists=Entry already exists.
|
||||||
|
|
||||||
|
# -------- ProjectContainerPage ---------
|
||||||
|
ProjectContainer.label=C/C++ Project Path Entries
|
||||||
|
ProjectContainerPage.title=C/C++ Project Path Entries
|
||||||
|
ProjectContainerPage.description=Select the C/C++ Project which contains path entries to be contributed to this project.
|
||||||
|
ProjectContainerPage.label=C/C++ Projects:
|
||||||
|
|
||||||
# -------- ExtendingCPathBasePage ---------
|
# -------- ExtendingCPathBasePage ---------
|
||||||
ExtendingCPathBasePage.editSourcePaths=Edit Source Paths...
|
ExtendingCPathBasePage.editSourcePaths=Edit Source Paths...
|
||||||
|
@ -50,6 +80,10 @@ IncludeEntryPage.addExternal.title=Add External Include Path
|
||||||
IncludeEntryPage.addExternal.message=Include path:
|
IncludeEntryPage.addExternal.message=Include path:
|
||||||
IncludeEntryPage.ContainerDialog.new.title=Contributed Include Path Selection
|
IncludeEntryPage.ContainerDialog.new.title=Contributed Include Path Selection
|
||||||
IncludeEntryPage.ContainerDialog.edit.title=Contributed Include Path Selection
|
IncludeEntryPage.ContainerDialog.edit.title=Contributed Include Path Selection
|
||||||
|
IncludeEntryPage.fromWorkspaceDialog.new.title=New Include Path from Workspace
|
||||||
|
IncludeEntryPage.fromWorkspaceDialog.new.description=Select a folder as a include path from the workspace.
|
||||||
|
IncludeEntryPage.fromWorkspaceDialog.edit.title=Edit Include Path from Workspace
|
||||||
|
IncludeEntryPage.fromWorkspaceDialog.edit.description=Select a folder as a include path from the workspace.
|
||||||
|
|
||||||
# ------- BuildPathsBlock -------
|
# ------- BuildPathsBlock -------
|
||||||
CPathsBlock.path.up.button=&Up
|
CPathsBlock.path.up.button=&Up
|
||||||
|
@ -180,8 +214,6 @@ ExclusionPatternEntryDialog.ChooseExclusionPattern.description=&Choose a folder
|
||||||
|
|
||||||
# ------- CPListLabelProvider -------
|
# ------- CPListLabelProvider -------
|
||||||
CPListLabelProvider.new=(new)
|
CPListLabelProvider.new=(new)
|
||||||
CPListLabelProvider.classcontainer=(class folder)
|
|
||||||
CPListLabelProvider.twopart={0} - {1}
|
|
||||||
CPListLabelProvider.willbecreated=(will be created)
|
CPListLabelProvider.willbecreated=(will be created)
|
||||||
CPListLabelProvider.none=(None)
|
CPListLabelProvider.none=(None)
|
||||||
CPListLabelProvider.source_attachment.label=Source attachment:
|
CPListLabelProvider.source_attachment.label=Source attachment:
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/*
|
/*******************************************************************************
|
||||||
* Created on Apr 26, 2004
|
* Copyright (c) 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
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002,2003 QNX Software Systems Ltd.
|
* Contributors: QNX Software Systems - initial API and implementation
|
||||||
*
|
******************************************************************************/
|
||||||
* Contributors:
|
|
||||||
* QNX Software Systems - Initial API and implementation
|
|
||||||
***********************************************************************/
|
|
||||||
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -13,9 +13,11 @@ import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
import org.eclipse.cdt.core.model.CModelException;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.model.IPathEntry;
|
import org.eclipse.cdt.core.model.IPathEntry;
|
||||||
import org.eclipse.cdt.core.model.IPathEntryContainer;
|
import org.eclipse.cdt.core.model.IPathEntryContainer;
|
||||||
|
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||||
import org.eclipse.cdt.internal.ui.viewsupport.ListContentProvider;
|
import org.eclipse.cdt.internal.ui.viewsupport.ListContentProvider;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
@ -23,9 +25,6 @@ import org.eclipse.jface.dialogs.Dialog;
|
||||||
import org.eclipse.jface.viewers.CheckStateChangedEvent;
|
import org.eclipse.jface.viewers.CheckStateChangedEvent;
|
||||||
import org.eclipse.jface.viewers.CheckboxTableViewer;
|
import org.eclipse.jface.viewers.CheckboxTableViewer;
|
||||||
import org.eclipse.jface.viewers.ICheckStateListener;
|
import org.eclipse.jface.viewers.ICheckStateListener;
|
||||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
|
||||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
|
||||||
import org.eclipse.jface.wizard.WizardPage;
|
import org.eclipse.jface.wizard.WizardPage;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
|
@ -33,22 +32,25 @@ import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
|
||||||
|
|
||||||
public class CPathFilterPage extends WizardPage {
|
public class CPathFilterPage extends WizardPage {
|
||||||
|
|
||||||
private final int fFilterType;
|
private final int fFilterType;
|
||||||
|
|
||||||
private CheckboxTableViewer viewer;
|
private CheckboxTableViewer viewer;
|
||||||
private IPathEntry fParentEntry;
|
private IPathEntry fParentEntry;
|
||||||
private List fPaths;
|
private List fPaths;
|
||||||
private ICProject fCProject;
|
private ICElement fCElement;
|
||||||
|
|
||||||
protected CPathFilterPage(ICProject cProject, int filterType) {
|
protected CPathFilterPage(ICElement cElement, int filterType) {
|
||||||
super("CPathFilterPage"); //$NON-NLS-1$
|
super("CPathFilterPage"); //$NON-NLS-1$
|
||||||
|
setTitle(CPathEntryMessages.getString("CPathFilterPage.title")); //$NON-NLS-1$
|
||||||
|
setDescription(CPathEntryMessages.getString("CPathFilterPage.description")); //$NON-NLS-1$
|
||||||
|
setImageDescriptor(CPluginImages.DESC_WIZBAN_ADD_LIBRARY);
|
||||||
fFilterType = filterType;
|
fFilterType = filterType;
|
||||||
fCProject = cProject;
|
fCElement = cElement;
|
||||||
|
validatePage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void createControl(Composite parent) {
|
public void createControl(Composite parent) {
|
||||||
Composite container = new Composite(parent, SWT.NULL);
|
Composite container = new Composite(parent, SWT.NULL);
|
||||||
GridLayout layout = new GridLayout();
|
GridLayout layout = new GridLayout();
|
||||||
|
@ -59,21 +61,13 @@ public class CPathFilterPage extends WizardPage {
|
||||||
GridData gd = new GridData();
|
GridData gd = new GridData();
|
||||||
gd.horizontalSpan = 2;
|
gd.horizontalSpan = 2;
|
||||||
label.setLayoutData(gd);
|
label.setLayoutData(gd);
|
||||||
viewer =
|
viewer = CheckboxTableViewer.newCheckList(container, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
|
||||||
CheckboxTableViewer.newCheckList(
|
|
||||||
container,
|
|
||||||
SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
|
|
||||||
viewer.setContentProvider(new ListContentProvider());
|
viewer.setContentProvider(new ListContentProvider());
|
||||||
viewer.setLabelProvider(new CPElementLabelProvider());
|
viewer.setLabelProvider(new CPElementLabelProvider());
|
||||||
viewer.addCheckStateListener(new ICheckStateListener() {
|
viewer.addCheckStateListener(new ICheckStateListener() {
|
||||||
|
|
||||||
public void checkStateChanged(CheckStateChangedEvent event) {
|
public void checkStateChanged(CheckStateChangedEvent event) {
|
||||||
// Prevent user to change checkbox states
|
validatePage();
|
||||||
viewer.setChecked(event.getElement(), !event.getChecked());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
|
||||||
public void selectionChanged(SelectionChangedEvent e) {
|
|
||||||
handleSelectionChanged((IStructuredSelection) e.getSelection());
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
viewer.addFilter(new CPElementFilter(fFilterType, true));
|
viewer.addFilter(new CPElementFilter(fFilterType, true));
|
||||||
|
@ -85,13 +79,11 @@ public class CPathFilterPage extends WizardPage {
|
||||||
Dialog.applyDialogFont(container);
|
Dialog.applyDialogFont(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setVisible(boolean visible) {
|
public void setVisible(boolean visible) {
|
||||||
if (fPaths != null) {
|
if (fPaths != null) {
|
||||||
viewer.setInput(fPaths);
|
viewer.setInput(fPaths);
|
||||||
}
|
}
|
||||||
}
|
super.setVisible(visible);
|
||||||
protected void handleSelectionChanged(IStructuredSelection selection) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParentEntry(IPathEntry entry) {
|
public void setParentEntry(IPathEntry entry) {
|
||||||
|
@ -107,15 +99,28 @@ public class CPathFilterPage extends WizardPage {
|
||||||
}
|
}
|
||||||
} else if (fParentEntry.getEntryKind() == IPathEntry.CDT_CONTAINER) {
|
} else if (fParentEntry.getEntryKind() == IPathEntry.CDT_CONTAINER) {
|
||||||
try {
|
try {
|
||||||
IPathEntryContainer container = CoreModel.getPathEntryContainer(fParentEntry.getPath(), fCProject);
|
IPathEntryContainer container = CoreModel.getPathEntryContainer(fParentEntry.getPath(), fCElement.getCProject());
|
||||||
fPaths = Arrays.asList(container.getPathEntries());
|
fPaths = Arrays.asList(container.getPathEntries());
|
||||||
} catch (CModelException e) {
|
} catch (CModelException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method validatePage.
|
||||||
|
*/
|
||||||
|
private void validatePage() {
|
||||||
|
setPageComplete(getSelectedEntries().length > 0);
|
||||||
|
}
|
||||||
|
|
||||||
public IPathEntry[] getSelectedEntries() {
|
public IPathEntry[] getSelectedEntries() {
|
||||||
return (IPathEntry[]) viewer.getCheckedElements();
|
if (viewer != null) {
|
||||||
|
Object[] paths = viewer.getCheckedElements();
|
||||||
|
IPathEntry[] entries = new IPathEntry[paths.length];
|
||||||
|
System.arraycopy(paths, 0, entries, 0, entries.length);
|
||||||
|
return entries;
|
||||||
|
}
|
||||||
|
return new IPathEntry[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
/*
|
/*******************************************************************************
|
||||||
* Created on Apr 26, 2004
|
* Copyright (c) 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
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002,2003 QNX Software Systems Ltd.
|
* Contributors: QNX Software Systems - initial API and implementation
|
||||||
*
|
******************************************************************************/
|
||||||
* Contributors:
|
|
||||||
* QNX Software Systems - Initial API and implementation
|
|
||||||
***********************************************************************/
|
|
||||||
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
||||||
|
|
||||||
import org.eclipse.jface.wizard.Wizard;
|
import org.eclipse.jface.wizard.Wizard;
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2002, 2003, 2004 QNX Software Systems Ltd. and others. All
|
* Copyright (c) 2004 QNX Software Systems and others. All rights reserved. This
|
||||||
* rights reserved. This program and the accompanying materials are made
|
* program and the accompanying materials are made available under the terms of
|
||||||
* available under the terms of the Common Public License v1.0 which accompanies
|
* the Common Public License v1.0 which accompanies this distribution, and is
|
||||||
* this distribution, and is available at
|
* available at http://www.eclipse.org/legal/cpl-v10.html
|
||||||
* http://www.eclipse.org/legal/cpl-v10.html
|
|
||||||
*
|
*
|
||||||
* Contributors: QNX Software Systems - Initial API and implementation
|
* Contributors: QNX Software Systems - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
||||||
|
|
||||||
|
@ -220,7 +219,8 @@ public class CPathIncludeEntryPage extends ExtendedCPathBasePage {
|
||||||
title = CPathEntryMessages.getString("IncludeEntryPage.ContainerDialog.edit.title"); //$NON-NLS-1$
|
title = CPathEntryMessages.getString("IncludeEntryPage.ContainerDialog.edit.title"); //$NON-NLS-1$
|
||||||
elem = existing.getPathEntry();
|
elem = existing.getPathEntry();
|
||||||
}
|
}
|
||||||
CPathContainerWizard wizard = new CPathContainerWizard(elem, null, fCurrCProject, getRawClasspath(), IPathEntry.CDT_INCLUDE);
|
CPathContainerWizard wizard = new CPathContainerWizard(elem, null, (ICElement)getSelection().get(0), getRawClasspath(),
|
||||||
|
IPathEntry.CDT_INCLUDE);
|
||||||
wizard.setWindowTitle(title);
|
wizard.setWindowTitle(title);
|
||||||
if (CPathContainerWizard.openWizard(getShell(), wizard) == Window.OK) {
|
if (CPathContainerWizard.openWizard(getShell(), wizard) == Window.OK) {
|
||||||
IPathEntry parent = wizard.getEntriesParent();
|
IPathEntry parent = wizard.getEntriesParent();
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2002, 2003, 2004 QNX Software Systems Ltd. and others. All
|
* Copyright (c) 2004 QNX Software Systems and others. All rights reserved. This
|
||||||
* rights reserved. This program and the accompanying materials are made
|
* program and the accompanying materials are made available under the terms of
|
||||||
* available under the terms of the Common Public License v1.0 which accompanies
|
* the Common Public License v1.0 which accompanies this distribution, and is
|
||||||
* this distribution, and is available at
|
* available at http://www.eclipse.org/legal/cpl-v10.html
|
||||||
* http://www.eclipse.org/legal/cpl-v10.html
|
|
||||||
*
|
*
|
||||||
* Contributors: QNX Software Systems - Initial API and implementation
|
* Contributors: QNX Software Systems - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
||||||
|
|
||||||
|
@ -47,6 +46,7 @@ public class CPathSymbolEntryPage extends ExtendedCPathBasePage {
|
||||||
addSymbol();
|
addSymbol();
|
||||||
break;
|
break;
|
||||||
case IDX_ADD_CONTRIBUTED :
|
case IDX_ADD_CONTRIBUTED :
|
||||||
|
addContributed();
|
||||||
break;
|
break;
|
||||||
case IDX_EDIT :
|
case IDX_EDIT :
|
||||||
if (canEdit(selected)) {
|
if (canEdit(selected)) {
|
||||||
|
@ -156,7 +156,8 @@ public class CPathSymbolEntryPage extends ExtendedCPathBasePage {
|
||||||
title = CPathEntryMessages.getString("SymbolEntryPage.ContainerDialog.edit.title"); //$NON-NLS-1$
|
title = CPathEntryMessages.getString("SymbolEntryPage.ContainerDialog.edit.title"); //$NON-NLS-1$
|
||||||
elem = existing.getPathEntry();
|
elem = existing.getPathEntry();
|
||||||
}
|
}
|
||||||
CPathContainerWizard wizard = new CPathContainerWizard(elem, null, fCurrCProject, getRawClasspath(), IPathEntry.CDT_INCLUDE);
|
CPathContainerWizard wizard = new CPathContainerWizard(elem, null, (ICElement)getSelection().get(0), getRawClasspath(),
|
||||||
|
IPathEntry.CDT_MACRO);
|
||||||
wizard.setWindowTitle(title);
|
wizard.setWindowTitle(title);
|
||||||
if (CPathContainerWizard.openWizard(getShell(), wizard) == Window.OK) {
|
if (CPathContainerWizard.openWizard(getShell(), wizard) == Window.OK) {
|
||||||
IPathEntry parent = wizard.getEntriesParent();
|
IPathEntry parent = wizard.getEntriesParent();
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2003 IBM Corporation and others.
|
* Copyright (c) 2004 QNX Software Systems and others. All rights reserved. This
|
||||||
* All rights reserved. This program and the accompanying materials
|
* program and the accompanying materials are made available under the terms of
|
||||||
* are made available under the terms of the Common Public License v1.0
|
* the Common Public License v1.0 which accompanies this distribution, and is
|
||||||
* which accompanies this distribution, and is available at
|
* available at http://www.eclipse.org/legal/cpl-v10.html
|
||||||
* http://www.eclipse.org/legal/cpl-v10.html
|
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors: QNX Software Systems - initial API and implementation
|
||||||
* IBM Corporation - initial API and implementation
|
******************************************************************************/
|
||||||
*******************************************************************************/
|
|
||||||
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2003 IBM Corporation and others. All rights reserved.
|
* Copyright (c) 2004 QNX Software Systems and others. All rights reserved. This
|
||||||
* This program and the accompanying materials are made available under the
|
* program and the accompanying materials are made available under the terms of
|
||||||
* terms of the Common Public License v1.0 which accompanies this distribution,
|
* the Common Public License v1.0 which accompanies this distribution, and is
|
||||||
* and is available at http://www.eclipse.org/legal/cpl-v10.html
|
* available at http://www.eclipse.org/legal/cpl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors: IBM Corporation - initial API and implementation
|
* Contributors: QNX Software Systems - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2002, 2003, 2004 QNX Software Systems Ltd. and others. All
|
* Copyright (c) 2004 QNX Software Systems and others. All rights reserved. This
|
||||||
* rights reserved. This program and the accompanying materials are made
|
* program and the accompanying materials are made available under the terms of
|
||||||
* available under the terms of the Common Public License v1.0 which accompanies
|
* the Common Public License v1.0 which accompanies this distribution, and is
|
||||||
* this distribution, and is available at
|
* available at http://www.eclipse.org/legal/cpl-v10.html
|
||||||
* http://www.eclipse.org/legal/cpl-v10.html
|
|
||||||
*
|
*
|
||||||
* Contributors: QNX Software Systems - Initial API and implementation
|
* Contributors: QNX Software Systems - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,22 @@
|
||||||
/*
|
/*******************************************************************************
|
||||||
* Created on Apr 27, 2004
|
* Copyright (c) 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
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002,2003 QNX Software Systems Ltd.
|
* Contributors: QNX Software Systems - initial API and implementation
|
||||||
*
|
******************************************************************************/
|
||||||
* Contributors:
|
|
||||||
* QNX Software Systems - Initial API and implementation
|
|
||||||
***********************************************************************/
|
|
||||||
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.IPathEntry;
|
import org.eclipse.cdt.core.model.IPathEntry;
|
||||||
import org.eclipse.cdt.ui.wizards.ICPathContainerPage;
|
import org.eclipse.cdt.ui.wizards.ICPathContainerPage;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
|
||||||
public interface IContainerDescriptor {
|
public interface IContainerDescriptor {
|
||||||
|
|
||||||
public abstract ICPathContainerPage createPage() throws CoreException;
|
public ICPathContainerPage createPage() throws CoreException;
|
||||||
public abstract String getName();
|
public String getName();
|
||||||
public abstract boolean canEdit(IPathEntry entry);
|
public Image getImage();
|
||||||
|
public boolean canEdit(IPathEntry entry);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2002, 2003, 2004 QNX Software Systems Ltd. and others. All
|
* Copyright (c) 2004 QNX Software Systems and others. All rights reserved. This
|
||||||
* rights reserved. This program and the accompanying materials are made
|
* program and the accompanying materials are made available under the terms of
|
||||||
* available under the terms of the Common Public License v1.0 which
|
* the Common Public License v1.0 which accompanies this distribution, and is
|
||||||
* accompanies this distribution, and is available at
|
* available at http://www.eclipse.org/legal/cpl-v10.html
|
||||||
* http://www.eclipse.org/legal/cpl-v10.html
|
|
||||||
*
|
*
|
||||||
* Contributors: QNX Software Systems - Initial API and implementation
|
* Contributors: QNX Software Systems - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2002, 2003, 2004 QNX Software Systems Ltd. and others. All
|
* Copyright (c) 2004 QNX Software Systems and others. All rights reserved. This
|
||||||
* rights reserved. This program and the accompanying materials are made
|
* program and the accompanying materials are made available under the terms of
|
||||||
* available under the terms of the Common Public License v1.0 which accompanies
|
* the Common Public License v1.0 which accompanies this distribution, and is
|
||||||
* this distribution, and is available at
|
* available at http://www.eclipse.org/legal/cpl-v10.html
|
||||||
* http://www.eclipse.org/legal/cpl-v10.html
|
|
||||||
*
|
*
|
||||||
* Contributors: QNX Software Systems - Initial API and implementation
|
* Contributors: QNX Software Systems - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2003 IBM Corporation and others. All rights reserved.
|
* Copyright (c) 2004 QNX Software Systems and others. All rights reserved. This
|
||||||
* This program and the accompanying materials are made available under the
|
* program and the accompanying materials are made available under the terms of
|
||||||
* terms of the Common Public License v1.0 which accompanies this distribution,
|
* the Common Public License v1.0 which accompanies this distribution, and is
|
||||||
* and is available at http://www.eclipse.org/legal/cpl-v10.html
|
* available at http://www.eclipse.org/legal/cpl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors: IBM Corporation - initial API and implementation
|
* Contributors: QNX Software Systems - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2003 IBM Corporation and others. All rights reserved.
|
* Copyright (c) 2004 QNX Software Systems and others. All rights reserved. This
|
||||||
* This program and the accompanying materials are made available under the
|
* program and the accompanying materials are made available under the terms of
|
||||||
* terms of the Common Public License v1.0 which accompanies this distribution,
|
* the Common Public License v1.0 which accompanies this distribution, and is
|
||||||
* and is available at http://www.eclipse.org/legal/cpl-v10.html
|
* available at http://www.eclipse.org/legal/cpl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors: IBM Corporation - initial API and implementation
|
* Contributors: QNX Software Systems - initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,19 @@
|
||||||
/*
|
/*******************************************************************************
|
||||||
* Created on Apr 27, 2004
|
* Copyright (c) 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
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002,2003 QNX Software Systems Ltd.
|
* Contributors: QNX Software Systems - initial API and implementation
|
||||||
*
|
******************************************************************************/
|
||||||
* Contributors:
|
|
||||||
* QNX Software Systems - Initial API and implementation
|
|
||||||
***********************************************************************/
|
|
||||||
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.IPathEntry;
|
import org.eclipse.cdt.core.model.IPathEntry;
|
||||||
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.cdt.ui.wizards.ICPathContainerPage;
|
import org.eclipse.cdt.ui.wizards.ICPathContainerPage;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
import org.eclipse.ui.ide.IDE;
|
||||||
|
|
||||||
public class ProjectContainerDescriptor implements IContainerDescriptor {
|
public class ProjectContainerDescriptor implements IContainerDescriptor {
|
||||||
private int fFilterType;
|
private int fFilterType;
|
||||||
|
@ -27,6 +30,11 @@ public class ProjectContainerDescriptor implements IContainerDescriptor {
|
||||||
return CPathEntryMessages.getString("ProjectContainer.label"); //$NON-NLS-1$
|
return CPathEntryMessages.getString("ProjectContainer.label"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Image getImage() {
|
||||||
|
return CUIPlugin.getDefault().getWorkbench().getSharedImages().getImage(IDE.SharedImages.IMG_OBJ_PROJECT);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public boolean canEdit(IPathEntry entry) {
|
public boolean canEdit(IPathEntry entry) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,30 @@
|
||||||
/***********************************************************************************************************************************
|
/*******************************************************************************
|
||||||
* Created on Apr 27, 2004
|
* Copyright (c) 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
|
||||||
*
|
*
|
||||||
* Copyright (c) 2002,2003 QNX Software Systems Ltd.
|
* Contributors: QNX Software Systems - initial API and implementation
|
||||||
*
|
******************************************************************************/
|
||||||
* Contributors: QNX Software Systems - Initial API and implementation
|
|
||||||
**********************************************************************************************************************************/
|
|
||||||
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
import org.eclipse.cdt.core.model.CModelException;
|
||||||
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.model.IPathEntry;
|
import org.eclipse.cdt.core.model.IPathEntry;
|
||||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.internal.ui.util.SelectionUtil;
|
||||||
|
import org.eclipse.cdt.internal.ui.viewsupport.ListContentProvider;
|
||||||
import org.eclipse.cdt.ui.wizards.ICPathContainerPage;
|
import org.eclipse.cdt.ui.wizards.ICPathContainerPage;
|
||||||
import org.eclipse.jface.viewers.CheckStateChangedEvent;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.CheckboxTableViewer;
|
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||||
import org.eclipse.jface.viewers.ICheckStateListener;
|
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||||
import org.eclipse.jface.viewers.StructuredSelection;
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
|
import org.eclipse.jface.viewers.TableViewer;
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
import org.eclipse.jface.viewers.ViewerFilter;
|
import org.eclipse.jface.viewers.ViewerFilter;
|
||||||
import org.eclipse.jface.wizard.WizardPage;
|
import org.eclipse.jface.wizard.WizardPage;
|
||||||
|
@ -28,60 +33,14 @@ import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.ui.model.WorkbenchContentProvider;
|
import org.eclipse.ui.model.WorkbenchLabelProvider;
|
||||||
|
|
||||||
public class ProjectContainerPage extends WizardPage implements ICPathContainerPage {
|
public class ProjectContainerPage extends WizardPage implements ICPathContainerPage {
|
||||||
|
|
||||||
private int fFilterType;
|
private int fFilterType;
|
||||||
private CheckboxTableViewer viewer;
|
private TableViewer viewer;
|
||||||
private ICProject fCProject;
|
private ICProject fCProject;
|
||||||
|
|
||||||
private class WorkbenchCPathContentProvider extends WorkbenchContentProvider {
|
|
||||||
|
|
||||||
public Object[] getChildren(Object element) {
|
|
||||||
if (element instanceof ICProject) {
|
|
||||||
try {
|
|
||||||
IPathEntry[] entries = ((ICProject) element).getRawPathEntries();
|
|
||||||
List list = new ArrayList(entries.length);
|
|
||||||
for (int i = 0; i < entries.length; i++) {
|
|
||||||
if (fFilterType == entries[i].getEntryKind() && entries[i].isExported()) {
|
|
||||||
list.add(CPElement.createFromExisting(entries[i], (ICProject) element));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return list.toArray();
|
|
||||||
} catch (CModelException e) {
|
|
||||||
CUIPlugin.getDefault().log(e);
|
|
||||||
return new Object[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return super.getChildren(element);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasChildren(Object element) {
|
|
||||||
if (element instanceof ICProject) {
|
|
||||||
try {
|
|
||||||
IPathEntry[] entries = ((ICProject) element).getRawPathEntries();
|
|
||||||
for (int i = 0; i < entries.length; i++) {
|
|
||||||
if (fFilterType == entries[i].getEntryKind() && entries[i].isExported()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (CModelException e) {
|
|
||||||
CUIPlugin.getDefault().log(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return super.hasChildren(element);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getParent(Object element) {
|
|
||||||
if (element instanceof CPElement) {
|
|
||||||
return ((CPElement) element).getCProject().getProject();
|
|
||||||
}
|
|
||||||
return super.getParent(element);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ProjectContainerPage(int filterType) {
|
protected ProjectContainerPage(int filterType) {
|
||||||
super("projectContainerPage"); //$NON-NLS-1$
|
super("projectContainerPage"); //$NON-NLS-1$
|
||||||
setTitle(CPathEntryMessages.getString("ProjectContainerPage.title")); //$NON-NLS-1$
|
setTitle(CPathEntryMessages.getString("ProjectContainerPage.title")); //$NON-NLS-1$
|
||||||
|
@ -100,9 +59,16 @@ public class ProjectContainerPage extends WizardPage implements ICPathContainerP
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPathEntry[] getContainerEntries() {
|
public IPathEntry[] getContainerEntries() {
|
||||||
return /*viewer != null ? (IPathEntry[]) viewer.getCheckedElements(): */new IPathEntry[0];
|
if (viewer != null) {
|
||||||
|
ISelection selection = viewer.getSelection();
|
||||||
|
ICProject project = (ICProject)SelectionUtil.getSingleElement(selection);
|
||||||
|
if (project != null) {
|
||||||
|
return new IPathEntry[]{CoreModel.newProjectEntry(project.getPath())};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return new IPathEntry[0];
|
||||||
|
|
||||||
|
}
|
||||||
public void setSelection(IPathEntry containerEntry) {
|
public void setSelection(IPathEntry containerEntry) {
|
||||||
if (containerEntry != null) {
|
if (containerEntry != null) {
|
||||||
viewer.setSelection(new StructuredSelection(containerEntry));
|
viewer.setSelection(new StructuredSelection(containerEntry));
|
||||||
|
@ -120,12 +86,13 @@ public class ProjectContainerPage extends WizardPage implements ICPathContainerP
|
||||||
GridData gd = new GridData();
|
GridData gd = new GridData();
|
||||||
gd.horizontalSpan = 2;
|
gd.horizontalSpan = 2;
|
||||||
label.setLayoutData(gd);
|
label.setLayoutData(gd);
|
||||||
viewer = CheckboxTableViewer.newCheckList(container, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
|
viewer = new TableViewer(container, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
|
||||||
viewer.setContentProvider(new WorkbenchCPathContentProvider());
|
|
||||||
viewer.setLabelProvider(new CPElementLabelProvider());
|
|
||||||
viewer.addCheckStateListener(new ICheckStateListener() {
|
|
||||||
|
|
||||||
public void checkStateChanged(CheckStateChangedEvent event) {
|
viewer.setContentProvider(new ListContentProvider());
|
||||||
|
viewer.setLabelProvider(new WorkbenchLabelProvider());
|
||||||
|
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||||
|
|
||||||
|
public void selectionChanged(SelectionChangedEvent event) {
|
||||||
validatePage();
|
validatePage();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -136,13 +103,36 @@ public class ProjectContainerPage extends WizardPage implements ICPathContainerP
|
||||||
viewer.addFilter(new ViewerFilter() {
|
viewer.addFilter(new ViewerFilter() {
|
||||||
|
|
||||||
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
||||||
return true;
|
return !element.equals(fCProject);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
setControl(container);
|
setControl(container);
|
||||||
|
initializeView();
|
||||||
validatePage();
|
validatePage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initializeView() {
|
||||||
|
List list = new ArrayList();
|
||||||
|
List current;
|
||||||
|
try {
|
||||||
|
current = Arrays.asList(fCProject.getRawPathEntries());
|
||||||
|
ICProject[] cProjects = CoreModel.getDefault().getCModel().getCProjects();
|
||||||
|
for (int i = 0; i < cProjects.length; i++) {
|
||||||
|
if (!cProjects[i].equals(fCProject) && !current.contains(CoreModel.newProjectEntry(cProjects[i].getPath()))) {
|
||||||
|
IPathEntry[] projEntries = cProjects[i].getRawPathEntries();
|
||||||
|
for (int j = 0; j < projEntries.length; j++) {
|
||||||
|
if (projEntries[j].getEntryKind() == fFilterType && projEntries[j].isExported()) {
|
||||||
|
list.add(cProjects[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (CModelException e) {
|
||||||
|
}
|
||||||
|
viewer.setInput(list);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method validatePage.
|
* Method validatePage.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue