mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 09:16:02 +02:00
update to support new console extension plus removed IPropertyStore
in core changing it to use the plaform property store.
This commit is contained in:
parent
291832e206
commit
4956853ad0
45 changed files with 294 additions and 1244 deletions
|
@ -26,6 +26,7 @@ import org.eclipse.cdt.core.model.CModelException;
|
|||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ElementChangedEvent;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ICResource;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.core.model.ICElementDelta;
|
||||
import org.eclipse.cdt.core.model.IElementChangedListener;
|
||||
|
@ -250,7 +251,7 @@ public class IndexManager implements IElementChangedListener {
|
|||
|
||||
if (kind == ICElementDelta.REMOVED) {
|
||||
try {
|
||||
IResource resource = ((ICElement)element).getCorrespondingResource();
|
||||
IResource resource = ((ICResource)element).getResource();
|
||||
removeResource(resource);
|
||||
} catch (CModelException e) {
|
||||
}
|
||||
|
@ -258,7 +259,7 @@ public class IndexManager implements IElementChangedListener {
|
|||
|
||||
if (kind == ICElementDelta.ADDED) {
|
||||
try {
|
||||
IResource resource = ((ICElement)element).getCorrespondingResource();
|
||||
IResource resource = ((ICResource)element).getResource();
|
||||
addResource(resource);
|
||||
} catch (CModelException e) {
|
||||
}
|
||||
|
@ -266,7 +267,7 @@ public class IndexManager implements IElementChangedListener {
|
|||
|
||||
if (element instanceof ITranslationUnit) {
|
||||
if (kind == ICElementDelta.CHANGED) {
|
||||
IResource resource = ((ICElement)element).getCorrespondingResource();
|
||||
IResource resource = ((ICResource)element).getResource();
|
||||
addResource(resource);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ public class CoreModel {
|
|||
* Creates an ICElement form and IPath.
|
||||
* Returns null if not found.
|
||||
*/
|
||||
public ICElement create(IPath path) {
|
||||
public ICResource create(IPath path) {
|
||||
return manager.create(path);
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ public class CoreModel {
|
|||
* Creates an ICElement form and IFile.
|
||||
* Returns null if not found.
|
||||
*/
|
||||
public ICElement create(IFile file) {
|
||||
public ICFile create(IFile file) {
|
||||
return manager.create(file);
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ public class CoreModel {
|
|||
* Creates an ICElement form and IFolder.
|
||||
* Returns null if not found.
|
||||
*/
|
||||
public ICElement create(IFolder folder) {
|
||||
public ICFolder create(IFolder folder) {
|
||||
return manager.create(folder);
|
||||
}
|
||||
|
||||
|
@ -109,30 +109,22 @@ public class CoreModel {
|
|||
* Creates an ICElement form and IProject.
|
||||
* Returns null if not found.
|
||||
*/
|
||||
public ICElement create(IProject project) {
|
||||
public ICProject create(IProject project) {
|
||||
return manager.create(project);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an ICElement form and IWorkspaceRoot.
|
||||
* Returns null if not found.
|
||||
*/
|
||||
public ICElement create(IWorkspaceRoot root) {
|
||||
return manager.create(root);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an ICElement form and IResource.
|
||||
* Returns null if not found.
|
||||
*/
|
||||
public ICElement create(IResource resource) {
|
||||
public ICResource create(IResource resource) {
|
||||
return manager.create(resource);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default ICRoot.
|
||||
*/
|
||||
public ICElement getCRoot() {
|
||||
public ICRoot getCRoot() {
|
||||
return manager.getCRoot();
|
||||
}
|
||||
|
||||
|
|
|
@ -185,20 +185,6 @@ public interface ICElement extends IAdaptable {
|
|||
*/
|
||||
boolean exists();
|
||||
|
||||
/**
|
||||
* Returns the resource that corresponds directly to this element,
|
||||
* or <code>null</code> if there is no resource that corresponds to
|
||||
* this element.
|
||||
* <p>
|
||||
* For example, the corresponding resource for an <code>ATranslationUnit</code>
|
||||
* is its underlying <code>IFile</code>.
|
||||
*
|
||||
* @return the corresponding resource, or <code>null</code> if none
|
||||
* @exception CModelException if this element does not exist or if an
|
||||
* exception occurs while accessing its corresponding resource
|
||||
*/
|
||||
IResource getCorrespondingResource() throws CModelException;
|
||||
|
||||
/**
|
||||
* Returns the name of this element.
|
||||
*
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.eclipse.core.resources.IFile;
|
|||
/**
|
||||
* A C File Resource.
|
||||
*/
|
||||
public interface ICFile extends IParent, ICElement {
|
||||
public interface ICFile extends IParent, ICResource, ICElement {
|
||||
|
||||
public boolean isBinary();
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.eclipse.core.resources.IFolder;
|
|||
/**
|
||||
* A C Folder Resource.
|
||||
*/
|
||||
public interface ICFolder extends IParent, ICElement {
|
||||
public interface ICFolder extends IParent, ICResource, ICElement {
|
||||
|
||||
public IFolder getFolder();
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ package org.eclipse.cdt.core.model;
|
|||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
import org.eclipse.cdt.internal.CCorePlugin;
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,7 +17,7 @@ import org.eclipse.core.runtime.IPath;
|
|||
* @see CCore#create(org.eclipse.core.resources.IProject)
|
||||
* @see IBuildEntry
|
||||
*/
|
||||
public interface ICProject extends IParent, ICElement {
|
||||
public interface ICProject extends IParent, ICResource, ICElement {
|
||||
|
||||
/**
|
||||
* Returns the <code>ICElement</code> corresponding to the given
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* (c) Copyright QNX Software System Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
package org.eclipse.cdt.core.model;
|
||||
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
||||
public interface ICResource extends IParent, ICElement {
|
||||
/**
|
||||
* Returns the resource that corresponds directly to this element,
|
||||
* <p>
|
||||
* For example, the corresponding resource for an <code>ATranslationUnit</code>
|
||||
* is its underlying <code>IFile</code>.
|
||||
*
|
||||
* @return the corresponding resource.
|
||||
* @exception CModelException if this element does not exist or if an
|
||||
* exception occurs while accessing its corresponding resource
|
||||
*/
|
||||
public IResource getResource() throws CModelException;
|
||||
}
|
|
@ -22,7 +22,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
|||
*
|
||||
* @see CCore#create(org.eclipse.core.resources.IWorkspaceRoot)
|
||||
*/
|
||||
public interface ICRoot extends ICElement, IParent {
|
||||
public interface ICRoot extends ICResource, ICElement, IParent {
|
||||
/**
|
||||
* Copies the given elements to the specified container(s).
|
||||
* If one container is specified, all elements are copied to that
|
||||
|
|
|
@ -65,9 +65,9 @@ public class ArchiveContainer extends Parent implements IArchiveContainer {
|
|||
// return null;
|
||||
//}
|
||||
|
||||
public IResource getCorrespondingResource() {
|
||||
return null;
|
||||
}
|
||||
// public IResource getCorrespondingResource() {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
void addChildIfLib(IFile file) {
|
||||
CModelManager factory = CModelManager.getDefault();
|
||||
|
|
|
@ -6,13 +6,13 @@ package org.eclipse.cdt.internal.core.model;
|
|||
*/
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.core.resources.IResourceDelta;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.IBinary;
|
||||
import org.eclipse.cdt.core.model.IArchive;
|
||||
import org.eclipse.cdt.core.model.ICElementDelta;
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.IArchive;
|
||||
import org.eclipse.cdt.core.model.IBinary;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ICElementDelta;
|
||||
import org.eclipse.cdt.core.model.ICResource;
|
||||
import org.eclipse.core.resources.IResourceDelta;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -102,12 +102,8 @@ public class CElementDelta implements ICElementDelta {
|
|||
|
||||
// if a child delta is added to a translation unit delta or below,
|
||||
// it's a fine grained delta
|
||||
try {
|
||||
if (fChangedElement.getCorrespondingResource() == null) {
|
||||
fineGrained();
|
||||
}
|
||||
} catch (CModelException e) {
|
||||
e.printStackTrace();
|
||||
if (!(fChangedElement instanceof ICResource)) {
|
||||
fineGrained();
|
||||
}
|
||||
|
||||
if (fAffectedChildren.length == 0) {
|
||||
|
|
|
@ -6,41 +6,44 @@ package org.eclipse.cdt.internal.core.model;
|
|||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ElementChangedEvent;
|
||||
import org.eclipse.cdt.core.model.IArchive;
|
||||
import org.eclipse.cdt.core.model.IBinary;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ICElementDelta;
|
||||
import org.eclipse.cdt.core.model.ICFile;
|
||||
import org.eclipse.cdt.core.model.ICFolder;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.ICResource;
|
||||
import org.eclipse.cdt.core.model.ICRoot;
|
||||
import org.eclipse.cdt.core.model.IElementChangedListener;
|
||||
import org.eclipse.cdt.core.model.IParent;
|
||||
import org.eclipse.cdt.utils.elf.AR;
|
||||
import org.eclipse.cdt.utils.elf.Elf;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IProjectDescription;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IResourceChangeEvent;
|
||||
import org.eclipse.core.resources.IResourceChangeListener;
|
||||
import org.eclipse.core.resources.IResourceDelta;
|
||||
import org.eclipse.core.resources.IResourceStatus;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.resources.IResourceDelta;
|
||||
import org.eclipse.core.resources.IResourceChangeEvent;
|
||||
import org.eclipse.core.resources.IResourceChangeListener;
|
||||
import org.eclipse.core.resources.IResourceStatus;
|
||||
import org.eclipse.core.resources.IProjectDescription;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.IArchive;
|
||||
import org.eclipse.cdt.core.model.IBinary;
|
||||
import org.eclipse.cdt.core.model.IElementChangedListener;
|
||||
import org.eclipse.cdt.core.model.ElementChangedEvent;
|
||||
import org.eclipse.cdt.core.model.ICElementDelta;
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
|
||||
import org.eclipse.cdt.utils.elf.Elf;
|
||||
import org.eclipse.cdt.utils.elf.AR;
|
||||
|
||||
public class CModelManager implements IResourceChangeListener {
|
||||
|
||||
// FIXME: Get it from the plugin class.
|
||||
|
@ -95,15 +98,15 @@ public class CModelManager implements IResourceChangeListener {
|
|||
* Returns the CRoot for the given workspace, creating
|
||||
* it if it does not yet exist.
|
||||
*/
|
||||
public ICElement getCRoot(IWorkspaceRoot root) {
|
||||
public ICRoot getCRoot(IWorkspaceRoot root) {
|
||||
return create(root);
|
||||
}
|
||||
|
||||
public ICElement getCRoot () {
|
||||
public ICRoot getCRoot () {
|
||||
return create(ResourcesPlugin.getWorkspace().getRoot());
|
||||
}
|
||||
|
||||
public ICElement create (IPath path) {
|
||||
public ICResource create (IPath path) {
|
||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||
// Assume it is fullpath relative to workspace
|
||||
IResource res = root.findMember(path);
|
||||
|
@ -118,7 +121,7 @@ public class CModelManager implements IResourceChangeListener {
|
|||
return create (res);
|
||||
}
|
||||
|
||||
public ICElement create (IResource resource) {
|
||||
public ICResource create (IResource resource) {
|
||||
if (resource == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -137,7 +140,7 @@ public class CModelManager implements IResourceChangeListener {
|
|||
}
|
||||
}
|
||||
|
||||
public ICElement create(ICElement parent, IResource resource) {
|
||||
public ICResource create(ICElement parent, IResource resource) {
|
||||
int type = resource.getType();
|
||||
switch (type) {
|
||||
case IResource.PROJECT :
|
||||
|
@ -153,76 +156,76 @@ public class CModelManager implements IResourceChangeListener {
|
|||
}
|
||||
}
|
||||
|
||||
public ICElement create(IFile file) {
|
||||
public ICFile create(IFile file) {
|
||||
IResource parent = file.getParent();
|
||||
ICElement celement = null;
|
||||
ICElement cparent = null;
|
||||
if (parent instanceof IFolder) {
|
||||
celement = create ((IFolder)parent);
|
||||
cparent = create ((IFolder)parent);
|
||||
} else if (parent instanceof IProject) {
|
||||
celement = create ((IProject)parent);
|
||||
cparent = create ((IProject)parent);
|
||||
}
|
||||
if (celement != null)
|
||||
return create (celement, file);
|
||||
return celement;
|
||||
if (cparent != null)
|
||||
return (ICFile) create (cparent, file);
|
||||
return null;
|
||||
}
|
||||
|
||||
public synchronized ICElement create(ICElement parent, IFile file) {
|
||||
ICElement celement = (ICElement)fParsedResources.get(file);
|
||||
if (celement == null) {
|
||||
public synchronized ICFile create(ICElement parent, IFile file) {
|
||||
ICFile cfile = (ICFile)fParsedResources.get(file);
|
||||
if (cfile == null) {
|
||||
if (file.exists()) {
|
||||
if (isArchive(file)) {
|
||||
celement = new Archive(parent, file);
|
||||
cfile = new Archive(parent, file);
|
||||
} else if (isBinary(file)) {
|
||||
celement = new Binary(parent, file);
|
||||
cfile = new Binary(parent, file);
|
||||
} else if (isTranslationUnit(file)) {
|
||||
celement = new TranslationUnit(parent, file);
|
||||
cfile = new TranslationUnit(parent, file);
|
||||
} else {
|
||||
celement = new CFile(parent, file);
|
||||
cfile = new CFile(parent, file);
|
||||
}
|
||||
fParsedResources.put(file, celement);
|
||||
fParsedResources.put(file, cfile);
|
||||
}
|
||||
}
|
||||
// Added also to the Containers
|
||||
if (celement != null) {
|
||||
if (celement instanceof IArchive) {
|
||||
CProject cproj = (CProject)celement.getCProject();
|
||||
if (cfile != null) {
|
||||
if (cfile instanceof IArchive) {
|
||||
CProject cproj = (CProject)cfile.getCProject();
|
||||
ArchiveContainer container = (ArchiveContainer)cproj.getArchiveContainer();
|
||||
container.addChild(celement);
|
||||
} else if (celement instanceof IBinary) {
|
||||
IBinary bin = (IBinary)celement;
|
||||
container.addChild(cfile);
|
||||
} else if (cfile instanceof IBinary) {
|
||||
IBinary bin = (IBinary)cfile;
|
||||
if (bin.isExecutable() || bin.isSharedLib()) {
|
||||
CProject cproj = (CProject)celement.getCProject();
|
||||
CProject cproj = (CProject)cfile.getCProject();
|
||||
BinaryContainer container = (BinaryContainer)cproj.getBinaryContainer();
|
||||
container.addChild(bin);
|
||||
}
|
||||
}
|
||||
}
|
||||
return celement;
|
||||
return cfile;
|
||||
}
|
||||
|
||||
public ICElement create(IFolder folder) {
|
||||
public ICFolder create(IFolder folder) {
|
||||
IResource parent = folder.getParent();
|
||||
ICElement celement = null;
|
||||
ICElement cparent = null;
|
||||
if (parent instanceof IFolder) {
|
||||
celement = create ((IFolder)parent);
|
||||
cparent = create ((IFolder)parent);
|
||||
} else if (parent instanceof IProject) {
|
||||
celement = create ((IProject)parent);
|
||||
cparent = create ((IProject)parent);
|
||||
}
|
||||
if (celement != null)
|
||||
return create (celement, folder);
|
||||
return celement;
|
||||
if (cparent != null)
|
||||
return (ICFolder) create (cparent, folder);
|
||||
return null;
|
||||
}
|
||||
|
||||
public synchronized ICElement create(ICElement parent, IFolder folder) {
|
||||
ICElement celement = (ICElement)fParsedResources.get(folder);
|
||||
if (celement == null) {
|
||||
celement = new CFolder(parent, folder);
|
||||
fParsedResources.put(folder, celement);
|
||||
public synchronized ICFolder create(ICElement parent, IFolder folder) {
|
||||
ICFolder cfolder = (ICFolder)fParsedResources.get(folder);
|
||||
if (cfolder == null) {
|
||||
cfolder = new CFolder(parent, folder);
|
||||
fParsedResources.put(folder, cfolder);
|
||||
}
|
||||
return celement;
|
||||
return cfolder;
|
||||
}
|
||||
|
||||
public ICElement create(IProject project) {
|
||||
public ICProject create(IProject project) {
|
||||
IResource parent = project.getParent();
|
||||
ICElement celement = null;
|
||||
if (parent instanceof IWorkspaceRoot) {
|
||||
|
@ -231,24 +234,24 @@ public class CModelManager implements IResourceChangeListener {
|
|||
return create(celement, project);
|
||||
}
|
||||
|
||||
public synchronized ICElement create(ICElement parent, IProject project) {
|
||||
ICElement celement = (ICElement)fParsedResources.get(project);
|
||||
if (celement == null) {
|
||||
public synchronized ICProject create(ICElement parent, IProject project) {
|
||||
ICProject cproject = (ICProject)fParsedResources.get(project);
|
||||
if (cproject == null) {
|
||||
if (hasCNature(project)) {
|
||||
celement = new CProject(parent, project);
|
||||
fParsedResources.put(project, celement);
|
||||
cproject = new CProject(parent, project);
|
||||
fParsedResources.put(project, cproject);
|
||||
}
|
||||
}
|
||||
return celement;
|
||||
return cproject;
|
||||
}
|
||||
|
||||
public ICElement create(IWorkspaceRoot root) {
|
||||
ICElement celement = (ICElement)fParsedResources.get(root);
|
||||
if (celement == null) {
|
||||
celement = new CRoot(root);
|
||||
fParsedResources.put(root, celement);
|
||||
public ICRoot create(IWorkspaceRoot root) {
|
||||
ICRoot croot = (ICRoot)fParsedResources.get(root);
|
||||
if (croot == null) {
|
||||
croot = new CRoot(root);
|
||||
fParsedResources.put(root, croot);
|
||||
}
|
||||
return celement;
|
||||
return croot;
|
||||
}
|
||||
|
||||
public static void addCNature(IProject project, IProgressMonitor monitor) throws CModelException {
|
||||
|
|
|
@ -9,10 +9,11 @@ import org.eclipse.core.resources.IResource;
|
|||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
||||
import org.eclipse.cdt.core.model.*;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
|
||||
public abstract class CResource extends Parent {
|
||||
public abstract class CResource extends Parent implements ICResource {
|
||||
|
||||
public CResource (ICElement parent, IPath path, int type) {
|
||||
// Check if the file is under the workspace.
|
||||
|
@ -36,5 +37,9 @@ public abstract class CResource extends Parent {
|
|||
return resource;
|
||||
}
|
||||
|
||||
public IResource getResource() throws CModelException {
|
||||
return resource;
|
||||
}
|
||||
|
||||
protected abstract CElementInfo createElementInfo ();
|
||||
}
|
||||
|
|
|
@ -5,12 +5,12 @@ package org.eclipse.cdt.internal.core.model;
|
|||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.IParent;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
|
|
@ -5,15 +5,15 @@ package org.eclipse.cdt.internal.core.model;
|
|||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.ICResource;
|
||||
import org.eclipse.cdt.core.model.ICRoot;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.ICRoot;
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
|
||||
public class CRoot extends CResource implements ICRoot {
|
||||
|
||||
public CRoot(IWorkspaceRoot root) {
|
||||
|
@ -54,8 +54,7 @@ public class CRoot extends CResource implements ICRoot {
|
|||
|
||||
public void copy(ICElement[] elements, ICElement[] containers, ICElement[] siblings,
|
||||
String[] renamings, boolean replace, IProgressMonitor monitor) throws CModelException {
|
||||
if (elements != null && elements[0] != null
|
||||
&& elements[0].getCorrespondingResource() != null ) {
|
||||
if (elements != null && elements[0] != null && elements[0] instanceof ICResource ) {
|
||||
runOperation(new CopyResourceElementsOperation(elements, containers, replace), elements, siblings, renamings, monitor);
|
||||
} else {
|
||||
throw new CModelException (new CModelStatus());
|
||||
|
@ -65,8 +64,7 @@ public class CRoot extends CResource implements ICRoot {
|
|||
|
||||
public void delete(ICElement[] elements, boolean force, IProgressMonitor monitor)
|
||||
throws CModelException {
|
||||
if (elements != null && elements[0] != null
|
||||
&& elements[0].getCorrespondingResource() != null) {
|
||||
if (elements != null && elements[0] != null && elements[0] instanceof ICResource) {
|
||||
runOperation(new DeleteResourceElementsOperation(elements, force), monitor);
|
||||
} else {
|
||||
throw new CModelException (new CModelStatus());
|
||||
|
@ -76,8 +74,7 @@ public class CRoot extends CResource implements ICRoot {
|
|||
|
||||
public void move(ICElement[] elements, ICElement[] containers, ICElement[] siblings,
|
||||
String[] renamings, boolean replace, IProgressMonitor monitor) throws CModelException {
|
||||
if (elements != null && elements[0] != null
|
||||
&& elements[0].getCorrespondingResource() == null) {
|
||||
if (elements != null && elements[0] != null && elements[0] instanceof ICResource ) {
|
||||
runOperation(new MoveResourceElementsOperation(elements, containers, replace), elements, siblings, renamings, monitor);
|
||||
} else {
|
||||
throw new CModelException (new CModelStatus());
|
||||
|
@ -87,8 +84,7 @@ public class CRoot extends CResource implements ICRoot {
|
|||
|
||||
public void rename(ICElement[] elements, ICElement[] destinations, String[] renamings,
|
||||
boolean force, IProgressMonitor monitor) throws CModelException {
|
||||
if (elements != null && elements[0] != null
|
||||
&& elements[0].getCorrespondingResource() == null) {
|
||||
if (elements != null && elements[0] != null && elements[0] instanceof ICResource) {
|
||||
runOperation(new RenameResourceElementsOperation(elements, destinations,
|
||||
renamings, force), monitor);
|
||||
} else {
|
||||
|
|
|
@ -6,21 +6,21 @@ package org.eclipse.cdt.internal.core.model;
|
|||
*/
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ICElementDelta;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.ICModelStatus;
|
||||
import org.eclipse.cdt.core.model.ICModelStatusConstants;
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.ICResource;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
|
||||
/**
|
||||
* This operation copies/moves/renames a collection of resources from their current
|
||||
|
@ -126,9 +126,9 @@ public class CopyResourceElementsOperation extends MultiOperation {
|
|||
String destName = (newName != null) ? newName : source.getElementName();
|
||||
|
||||
// copy resource
|
||||
IFile sourceResource = (IFile)source.getCorrespondingResource();
|
||||
IFile sourceResource = (IFile)((ICResource)source).getResource();
|
||||
// can be an IFolder or an IProject
|
||||
IContainer destFolder = (IContainer)dest.getCorrespondingResource();
|
||||
IContainer destFolder = (IContainer)((ICResource)dest).getResource();
|
||||
IFile destFile = destFolder.getFile(new Path(destName));
|
||||
if (!destFile.equals(sourceResource)) {
|
||||
try {
|
||||
|
@ -185,7 +185,7 @@ public class CopyResourceElementsOperation extends MultiOperation {
|
|||
*/
|
||||
protected void processElement(ICElement element) throws CModelException {
|
||||
ICElement dest = getDestinationParent(element);
|
||||
if (element.getCorrespondingResource() != null) {
|
||||
if (element instanceof ICResource) {
|
||||
processResource(element, dest);
|
||||
//fCreatedElements.add(dest.getCompilationUnit(element.getElementName()));
|
||||
} else {
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.eclipse.core.resources.IFile;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ICResource;
|
||||
import org.eclipse.cdt.core.model.ISourceRange;
|
||||
import org.eclipse.cdt.core.model.ISourceReference;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
|
@ -142,7 +143,7 @@ public abstract class CreateElementInTUOperation extends CModelOperation {
|
|||
insertElement();
|
||||
if (fCreationOccurred) {
|
||||
//a change has really occurred
|
||||
IFile file = (IFile)unit.getCorrespondingResource();
|
||||
IFile file = (IFile)((ICResource)unit).getResource();
|
||||
StringBuffer buffer = getContent(file);
|
||||
switch (fReplacementLength) {
|
||||
case -1 :
|
||||
|
|
|
@ -6,8 +6,9 @@ package org.eclipse.cdt.internal.core.model;
|
|||
*/
|
||||
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ICResource;
|
||||
|
||||
/**
|
||||
* This operation deletes a collection of resources and all of their children.
|
||||
|
@ -36,7 +37,7 @@ public class DeleteResourceElementsOperation extends MultiOperation {
|
|||
* <code>deletePackageFragment</code> depending on the type of <code>element</code>.
|
||||
*/
|
||||
protected void processElement(ICElement element) throws CModelException {
|
||||
deleteResource(element.getCorrespondingResource(), fForce);
|
||||
deleteResource(((ICResource)element).getResource(), fForce);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,4 +5,5 @@ cnature.name=C Nature
|
|||
ccnature.name=C++ Nature
|
||||
CProblemMarker.name=C Problem
|
||||
CBuildCommand.name=C Builder Command
|
||||
CBuildConsole.name=C Builder Console
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
name="%pluginName"
|
||||
version="1.0.0"
|
||||
provider-name="%providerName"
|
||||
class="org.eclipse.cdt.internal.CCorePlugin">
|
||||
class="org.eclipse.cdt.core.CCorePlugin">
|
||||
|
||||
<runtime>
|
||||
<library name="cdtcore.jar">
|
||||
|
@ -27,6 +27,7 @@
|
|||
|
||||
|
||||
<extension-point id="CBuildCommand" name="%CBuildCommand.name"/>
|
||||
<extension-point id="CBuildConsole" name="%CBuildConsole.name"/>
|
||||
|
||||
<extension
|
||||
id="cbuilder"
|
||||
|
|
|
@ -13,11 +13,10 @@ import org.eclipse.core.runtime.IConfigurationElement;
|
|||
import org.eclipse.core.runtime.IExtension;
|
||||
import org.eclipse.core.runtime.IExtensionPoint;
|
||||
import org.eclipse.core.runtime.Plugin;
|
||||
import org.eclipse.core.runtime.Preferences;
|
||||
import org.eclipse.core.runtime.QualifiedName;
|
||||
|
||||
import org.eclipse.cdt.core.resources.IBuildInfo;
|
||||
import org.eclipse.cdt.core.resources.IPropertyStore;
|
||||
import org.eclipse.cdt.internal.CCorePlugin;
|
||||
|
||||
public class BuildInfoFactory {
|
||||
public static final String LOCATION = "buildLocation";
|
||||
|
@ -30,7 +29,7 @@ public class BuildInfoFactory {
|
|||
public static abstract class Store implements IBuildInfo {
|
||||
public String getBuildLocation() {
|
||||
if ( isDefaultBuildCmd() ) {
|
||||
Plugin plugin = CCorePlugin.getDefaultPlugin();
|
||||
Plugin plugin = CCorePlugin.getDefault();
|
||||
if (plugin != null) {
|
||||
IExtensionPoint extension = plugin.getDescriptor().getExtensionPoint("CBuildCommand");
|
||||
if (extension != null) {
|
||||
|
@ -107,14 +106,14 @@ public class BuildInfoFactory {
|
|||
}
|
||||
|
||||
public static class Preference extends Store {
|
||||
IPropertyStore prefs;
|
||||
Preferences prefs;
|
||||
|
||||
public Preference() {
|
||||
prefs = CCorePlugin.getDefault().getPropertyStore();
|
||||
prefs = CCorePlugin.getDefault().getPluginPreferences();
|
||||
}
|
||||
|
||||
public void putValue(String name, String value) {
|
||||
prefs.putValue(name, value);
|
||||
prefs.setValue(name, value);
|
||||
}
|
||||
|
||||
public String getString(String property) {
|
||||
|
|
|
@ -9,8 +9,6 @@ import org.eclipse.core.resources.IProject;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
||||
import org.eclipse.cdt.internal.CCorePlugin;
|
||||
import org.eclipse.cdt.core.*;
|
||||
|
||||
|
||||
public class CCProjectNature extends CProjectNature {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package org.eclipse.cdt.internal;
|
||||
package org.eclipse.cdt.core;
|
||||
|
||||
/*
|
||||
* (c) Copyright IBM Corp. 2000, 2001.
|
||||
|
@ -9,25 +9,22 @@ import java.text.MessageFormat;
|
|||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import org.eclipse.cdt.core.index.IndexModel;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.resources.IConsole;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.core.runtime.IExtension;
|
||||
import org.eclipse.core.runtime.IExtensionPoint;
|
||||
import org.eclipse.core.runtime.IPluginDescriptor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Plugin;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
|
||||
import org.eclipse.cdt.core.resources.ICPlugin;
|
||||
import org.eclipse.cdt.core.resources.IConsole;
|
||||
import org.eclipse.cdt.core.resources.IMessageDialog;
|
||||
import org.eclipse.cdt.core.resources.IPropertyStore;
|
||||
import org.eclipse.cdt.core.ConsoleOutputStream;
|
||||
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.index.IndexModel;
|
||||
|
||||
|
||||
public class CCorePlugin extends AbstractPlugin implements ICPlugin {
|
||||
public class CCorePlugin extends Plugin {
|
||||
|
||||
public static final String PLUGIN_ID= "org.eclipse.cdt.core";
|
||||
public static final String BUILDER_ID= PLUGIN_ID + ".cbuilder";
|
||||
|
@ -71,15 +68,7 @@ public class CCorePlugin extends AbstractPlugin implements ICPlugin {
|
|||
return fgResourceBundle;
|
||||
}
|
||||
|
||||
public static Plugin getDefaultPlugin() {
|
||||
return fgCPlugin;
|
||||
}
|
||||
|
||||
public static ICPlugin getDefault() {
|
||||
ICPlugin plugin;
|
||||
if ((plugin = (ICPlugin)fgCPlugin.getAdapter(ICPlugin.class)) != null) {
|
||||
return plugin;
|
||||
}
|
||||
public static CCorePlugin getDefault() {
|
||||
return fgCPlugin;
|
||||
}
|
||||
|
||||
|
@ -90,53 +79,13 @@ public class CCorePlugin extends AbstractPlugin implements ICPlugin {
|
|||
public static void log(IStatus status) {
|
||||
((Plugin)getDefault()).getLog().log(status);
|
||||
}
|
||||
|
||||
public IPropertyStore getPropertyStore() {
|
||||
return getPreferenceStore();
|
||||
}
|
||||
|
||||
|
||||
// ------ CPlugin
|
||||
|
||||
public IMessageDialog getMessageDialog() {
|
||||
return new IMessageDialog() {
|
||||
public void openError(String title, String msg) {
|
||||
System.err.println(title +": " +msg);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private IConsole fConsoleDocument;
|
||||
|
||||
public CCorePlugin(IPluginDescriptor descriptor) {
|
||||
super(descriptor);
|
||||
fgCPlugin= this;
|
||||
/*
|
||||
fModel = new ACDebugModel() {
|
||||
public Object createPresentation() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getIdentifier() {
|
||||
return PLUGIN_ID;
|
||||
}
|
||||
|
||||
public IMarker createBreakpoint( final IResource resource,
|
||||
final Map attributes,
|
||||
final String markerType ) throws CoreException {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
*/
|
||||
fConsoleDocument= new IConsole() {
|
||||
public void clear() {
|
||||
}
|
||||
|
||||
public ConsoleOutputStream getOutputStream() {
|
||||
return new ConsoleOutputStream();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see Plugin#shutdown
|
||||
|
@ -157,15 +106,28 @@ public class CCorePlugin extends AbstractPlugin implements ICPlugin {
|
|||
getIndexModel();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AbstractPlugin#initializeDefaultPreferences
|
||||
*/
|
||||
protected void initializeDefaultPreferences(IPropertyStore store) {
|
||||
super.initializeDefaultPreferences(store);
|
||||
}
|
||||
|
||||
public IConsole getConsole() {
|
||||
return fConsoleDocument;
|
||||
public IConsole getConsole() throws CoreException {
|
||||
IConsole consoleDocument = null;
|
||||
|
||||
IExtensionPoint extension = getDescriptor().getExtensionPoint("CBuildConsole");
|
||||
if (extension != null) {
|
||||
IExtension[] extensions = extension.getExtensions();
|
||||
for(int i = 0; i < extensions.length; i++){
|
||||
IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
|
||||
consoleDocument = (IConsole)configElements[0].createExecutableExtension("class");
|
||||
}
|
||||
}
|
||||
if ( consoleDocument == null ) {
|
||||
return new IConsole() {
|
||||
public void clear() {
|
||||
}
|
||||
|
||||
public ConsoleOutputStream getOutputStream() {
|
||||
return new ConsoleOutputStream();
|
||||
}
|
||||
};
|
||||
}
|
||||
return consoleDocument;
|
||||
}
|
||||
|
||||
public CoreModel getCoreModel() {
|
||||
|
@ -174,11 +136,5 @@ public class CCorePlugin extends AbstractPlugin implements ICPlugin {
|
|||
|
||||
public IndexModel getIndexModel() {
|
||||
return IndexModel.getDefault();
|
||||
}
|
||||
|
||||
/*
|
||||
public ACDebugModel getDebugModel() {
|
||||
return fModel;
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
|
@ -17,8 +17,6 @@ import org.eclipse.core.runtime.Path;
|
|||
import org.eclipse.core.runtime.Plugin;
|
||||
|
||||
import org.eclipse.cdt.core.resources.IBuildInfo;
|
||||
import org.eclipse.cdt.internal.CCorePlugin;
|
||||
import org.eclipse.cdt.core.*;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ package org.eclipse.cdt.core.resources;
|
|||
*/
|
||||
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.model.ICModelMarker;
|
||||
import org.eclipse.cdt.internal.CCorePlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
package org.eclipse.cdt.core.resources;
|
||||
|
||||
/*
|
||||
* (c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
|
||||
public interface ICPlugin extends IAdaptable {
|
||||
IMessageDialog getMessageDialog();
|
||||
IPropertyStore getPropertyStore();
|
||||
IConsole getConsole();
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
package org.eclipse.cdt.core.resources;
|
||||
|
||||
/*
|
||||
* (c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
public interface IMessageDialog {
|
||||
void openError(String title, String message);
|
||||
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
package org.eclipse.cdt.core.resources;
|
||||
|
||||
/*
|
||||
* (c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
public interface IPropertyStore {
|
||||
public static final boolean BOOLEAN_DEFAULT_DEFAULT = false;
|
||||
public static final double DOUBLE_DEFAULT_DEFAULT = 0.0;
|
||||
public static final float FLOAT_DEFAULT_DEFAULT = 0.0f;
|
||||
public static final int INT_DEFAULT_DEFAULT = 0;
|
||||
public static final long LONG_DEFAULT_DEFAULT = 0L;
|
||||
public static final String STRING_DEFAULT_DEFAULT = new String();
|
||||
|
||||
public static final String TRUE = "true";
|
||||
public static final String FALSE = "false";
|
||||
|
||||
String getString(String name);
|
||||
void setDefault(String name, String def);
|
||||
void putValue(String name, String value);
|
||||
|
||||
}
|
||||
|
|
@ -1,247 +0,0 @@
|
|||
package org.eclipse.cdt.internal;
|
||||
|
||||
/*
|
||||
* (c) Copyright IBM Corp. 2000, 2001.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
import org.eclipse.cdt.core.resources.*;
|
||||
import org.eclipse.core.runtime.*;
|
||||
import java.net.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Abstract base class for plug-ins that integrate with the Eclipse platform UI.
|
||||
* <p>
|
||||
* Subclasses obtain the following capabilities:
|
||||
* </p>
|
||||
* <p>
|
||||
* Preferences
|
||||
* <ul>
|
||||
* <li> Preferences are read the first time <code>getPreferenceStore</code> is
|
||||
* called. </li>
|
||||
* <li> Preferences are found in the file whose name is given by the constant
|
||||
* <code>FN_PREF_STORE</code>. A preference file is looked for in the plug-in's
|
||||
* read/write state area.</li>
|
||||
* <li> Subclasses should reimplement <code>initializeDefaultPreferences</code>
|
||||
* to set up any default values for preferences. These are the values
|
||||
* typically used if the user presses the Default button in a preference
|
||||
* dialog. </li>
|
||||
* <li> The plug-in's install directory is checked for a file whose name is given by
|
||||
* <code>FN_DEFAULT_PREFERENCES</code>.
|
||||
* This allows a plug-in to ship with a read-only copy of a preference file
|
||||
* containing default values for certain settings different from the
|
||||
* hard-wired default ones (perhaps as a result of localizing, or for a
|
||||
* common configuration).</li>
|
||||
* <li> Plug-in code can call <code>savePreferenceStore</code> to cause
|
||||
* non-default settings to be saved back to the file in the plug-in's
|
||||
* read/write state area. </li>
|
||||
* <li> Preferences are also saved automatically on plug-in shutdown.</li>
|
||||
* </ul>
|
||||
* Dialogs
|
||||
* <ul>
|
||||
* <li> Dialog store are read the first time <code>getDialogSettings</code> is
|
||||
* called.</li>
|
||||
* <li> The dialog store allows the plug-in to "record" important choices made
|
||||
* by the user in a wizard or dialog, so that the next time the
|
||||
* wizard/dialog is used the widgets can be defaulted to better values. A
|
||||
* wizard could also use it to record the last 5 values a user entered into
|
||||
* an editable combo - to show "recent values". </li>
|
||||
* <li> The dialog store is found in the file whose name is given by the
|
||||
* constant <code>FN_DIALOG_STORE</code>. A dialog store file is first
|
||||
* looked for in the plug-in's read/write state area; if not found there,
|
||||
* the plug-in's install directory is checked.
|
||||
* This allows a plug-in to ship with a read-only copy of a dialog store
|
||||
* file containing initial values for certain settings.</li>
|
||||
* <li> Plug-in code can call <code>saveDialogSettings</code> to cause settings to
|
||||
* be saved in the plug-in's read/write state area. A plug-in may opt to do
|
||||
* this each time a wizard or dialog is closed to ensure the latest
|
||||
* information is always safe on disk. </li>
|
||||
* <li> Dialog settings are also saved automatically on plug-in shutdown.</li>
|
||||
* </ul>
|
||||
* Images
|
||||
* <ul>
|
||||
* <li> A typical UI plug-in will have some images that are used very frequently
|
||||
* and so need to be cached and shared. The plug-in's image registry
|
||||
* provides a central place for a plug-in to store its common images.
|
||||
* Images managed by the registry are created lazily as needed, and will be
|
||||
* automatically disposed of when the plug-in shuts down. Note that the
|
||||
* number of registry images should be kept to a minimum since many OSs
|
||||
* have severe limits on the number of images that can be in memory at once.
|
||||
* </ul>
|
||||
* <p>
|
||||
* For easy access to your plug-in object, use the singleton pattern. Declare a
|
||||
* static variable in your plug-in class for the singleton. Store the first
|
||||
* (and only) instance of the plug-in class in the singleton when it is created.
|
||||
* Then access the singleton when needed through a static <code>getDefault</code>
|
||||
* method.
|
||||
* </p>
|
||||
*/
|
||||
public abstract class AbstractPlugin extends Plugin
|
||||
{
|
||||
/**
|
||||
* The name of the preference storage file (value
|
||||
* <code>"pref_store.ini"</code>).
|
||||
*/
|
||||
private static final String FN_PREF_STORE= "pref_store.ini";//$NON-NLS-1$
|
||||
/**
|
||||
* The name of the default preference settings file (value
|
||||
* <code>"preferences.ini"</code>).
|
||||
*/
|
||||
private static final String FN_DEFAULT_PREFERENCES= "preferences.ini";//$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Storage for preferences; <code>null</code> if not yet initialized.
|
||||
*/
|
||||
private PreferenceStore preferenceStore = null;
|
||||
|
||||
/**
|
||||
* Creates an abstract plug-in runtime object for the given plug-in descriptor.
|
||||
* <p>
|
||||
* Note that instances of plug-in runtime classes are automatically created
|
||||
* by the platform in the course of plug-in activation.
|
||||
* </p>
|
||||
*
|
||||
* @param descriptor the plug-in descriptor
|
||||
*/
|
||||
public AbstractPlugin(IPluginDescriptor descriptor) {
|
||||
super(descriptor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the preference store for this UI plug-in.
|
||||
* This preference store is used to hold persistent settings for this plug-in in
|
||||
* the context of a workbench. Some of these settings will be user controlled,
|
||||
* whereas others may be internal setting that are never exposed to the user.
|
||||
* <p>
|
||||
* If an error occurs reading the preference store, an empty preference store is
|
||||
* quietly created, initialized with defaults, and returned.
|
||||
* </p>
|
||||
* <p>
|
||||
* Subclasses should reimplement <code>initializeDefaultPreferences</code> if
|
||||
* they have custom graphic images to load.
|
||||
* </p>
|
||||
*
|
||||
* @return the preference store
|
||||
*/
|
||||
public IPropertyStore getPreferenceStore() {
|
||||
if (preferenceStore == null) {
|
||||
loadPreferenceStore();
|
||||
initializeDefaultPreferences(preferenceStore);
|
||||
initializePluginPreferences(preferenceStore);
|
||||
}
|
||||
return preferenceStore;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initializes a preference store with default preference values
|
||||
* for this plug-in.
|
||||
* <p>
|
||||
* This method is called after the preference store is initially loaded
|
||||
* (default values are never stored in preference stores).
|
||||
* <p><p>
|
||||
* The default implementation of this method does nothing.
|
||||
* Subclasses should reimplement this method if the plug-in has any preferences.
|
||||
* </p>
|
||||
*
|
||||
* @param store the preference store to fill
|
||||
*/
|
||||
protected void initializeDefaultPreferences(IPropertyStore store) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets default preferences defined in the plugin directory.
|
||||
* If there are no default preferences defined, or some other
|
||||
* problem occurs, we fail silently.
|
||||
*/
|
||||
private void initializePluginPreferences(IPropertyStore store) {
|
||||
URL baseURL = getDescriptor().getInstallURL();
|
||||
|
||||
URL iniURL= null;
|
||||
try {
|
||||
iniURL = new URL(baseURL, FN_DEFAULT_PREFERENCES);
|
||||
} catch (MalformedURLException e) {
|
||||
return;
|
||||
}
|
||||
|
||||
Properties ini = new Properties();
|
||||
InputStream is = null;
|
||||
try {
|
||||
is = iniURL.openStream();
|
||||
ini.load(is);
|
||||
}
|
||||
catch (IOException e) {
|
||||
// Cannot read ini file;
|
||||
return;
|
||||
}
|
||||
finally {
|
||||
try {
|
||||
if (is != null)
|
||||
is.close();
|
||||
} catch (IOException e) {}
|
||||
}
|
||||
|
||||
Enumeration enum = ini.propertyNames();
|
||||
while (enum.hasMoreElements()) {
|
||||
String key = (String)enum.nextElement();
|
||||
store.setDefault(key, ini.getProperty(key));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the preference store for this plug-in.
|
||||
* The default implementation looks for a standard named file in the
|
||||
* plug-in's read/write state area. If no file is found or a problem
|
||||
* occurs, a new empty preference store is silently created.
|
||||
* <p>
|
||||
* This framework method may be overridden, although this is typically
|
||||
* unnecessary.
|
||||
* </p>
|
||||
*/
|
||||
protected void loadPreferenceStore() {
|
||||
String readWritePath = getStateLocation().append(FN_PREF_STORE).toOSString();
|
||||
preferenceStore = new PreferenceStore(readWritePath);
|
||||
try {
|
||||
preferenceStore.load();
|
||||
}
|
||||
catch (IOException e) {
|
||||
// Load failed, perhaps because the file does not yet exist.
|
||||
// At any rate we just return and leave the store empty.
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves this plug-in's preference store.
|
||||
* Any problems which arise are silently ignored.
|
||||
*/
|
||||
protected void savePreferenceStore() {
|
||||
if (preferenceStore == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
preferenceStore.save(); // the store knows its filename - no need to pass it
|
||||
}
|
||||
catch (IOException e) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The <code>AbstractPlugin</code> implementation of this <code>Plugin</code>
|
||||
* method saves this plug-in's preference and dialog stores and shuts down
|
||||
* its image registry (if they are in use). Subclasses may extend this method,
|
||||
* but must send super first.
|
||||
*/
|
||||
public void shutdown() throws CoreException {
|
||||
super.shutdown();
|
||||
savePreferenceStore();
|
||||
preferenceStore = null;
|
||||
}
|
||||
|
||||
public Object getAdapter(Class adapter) {
|
||||
return Platform.getAdapterManager().getAdapter(this, adapter);
|
||||
}
|
||||
|
||||
}
|
|
@ -4,7 +4,4 @@
|
|||
# All Rights Reserved.
|
||||
#
|
||||
################################################
|
||||
|
||||
CApplicationLauncher.error.title=Error Launching Application
|
||||
CApplicationLauncher.error.message=Unable to Launch Application
|
||||
|
|
@ -1,504 +0,0 @@
|
|||
package org.eclipse.cdt.internal;
|
||||
/*
|
||||
* (c) Copyright IBM Corp. 2000, 2001.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import org.eclipse.cdt.core.resources.*;
|
||||
//import org.eclipse.jface.util.*;
|
||||
|
||||
/**
|
||||
* A concrete preference store implementation based on an internal
|
||||
* <code>java.util.Properties</code> object, with support for
|
||||
* persisting the non-default preference values to files or streams.
|
||||
* <p>
|
||||
* This class was not designed to be subclassed.
|
||||
* </p>
|
||||
*
|
||||
* @see IPreferenceStore
|
||||
*/
|
||||
public class PreferenceStore implements IPropertyStore {
|
||||
|
||||
|
||||
/**
|
||||
* The mapping from preference name to
|
||||
* preference value (represented as strings).
|
||||
*/
|
||||
private Properties properties;
|
||||
|
||||
/**
|
||||
* The mapping from preference name to
|
||||
* default preference value (represented as strings);
|
||||
* <code>null</code> if none.
|
||||
*/
|
||||
private Properties defaultProperties;
|
||||
|
||||
/**
|
||||
* Indicates whether a value as been changed by <code>setToDefault</code>
|
||||
* or <code>setValue</code>; initially <code>true</code>.
|
||||
*/
|
||||
private boolean dirty = true;
|
||||
|
||||
/**
|
||||
* The file name used by the <code>load</code> method to load a property
|
||||
* file. This filename is used to save the properties file when <code>save</code>
|
||||
* is called.
|
||||
*/
|
||||
private String filename;
|
||||
/**
|
||||
* Creates an empty preference store.
|
||||
* <p>
|
||||
* Use the methods <code>load(InputStream)</code> and
|
||||
* <code>save(InputStream)</code> to load and store this
|
||||
* preference store.
|
||||
* </p>
|
||||
* @see #load(java.io.InputStream)
|
||||
* @see #store(java.io.InputStream)
|
||||
*/
|
||||
public PreferenceStore() {
|
||||
defaultProperties = new Properties();
|
||||
properties = new Properties(defaultProperties);
|
||||
}
|
||||
/**
|
||||
* Creates an empty preference store that loads from and saves to the
|
||||
* a file.
|
||||
* <p>
|
||||
* Use the methods <code>load()</code> and <code>save()</code> to load and store this
|
||||
* preference store.
|
||||
* </p>
|
||||
*
|
||||
* @param filename the file name
|
||||
* @see #load()
|
||||
* @see #store()
|
||||
*/
|
||||
public PreferenceStore(String filename) {
|
||||
this();
|
||||
this.filename = filename;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public boolean contains(String name) {
|
||||
return (properties.containsKey(name) || defaultProperties.containsKey(name));
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public boolean getBoolean(String name) {
|
||||
return getBoolean(properties, name);
|
||||
}
|
||||
/**
|
||||
* Helper function: gets boolean for a given name.
|
||||
*/
|
||||
private boolean getBoolean(Properties p, String name) {
|
||||
String value = p != null ? p.getProperty(name) : null;
|
||||
if (value == null)
|
||||
return BOOLEAN_DEFAULT_DEFAULT;
|
||||
if (value.equals(IPropertyStore.TRUE))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public boolean getDefaultBoolean(String name) {
|
||||
return getBoolean(defaultProperties, name);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public double getDefaultDouble(String name) {
|
||||
return getDouble(defaultProperties, name);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public float getDefaultFloat(String name) {
|
||||
return getFloat(defaultProperties, name);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public int getDefaultInt(String name) {
|
||||
return getInt(defaultProperties, name);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public long getDefaultLong(String name) {
|
||||
return getLong(defaultProperties, name);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public String getDefaultString(String name) {
|
||||
return getString(defaultProperties, name);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public double getDouble(String name) {
|
||||
return getDouble(properties, name);
|
||||
}
|
||||
/**
|
||||
* Helper function: gets double for a given name.
|
||||
*/
|
||||
private double getDouble(Properties p, String name) {
|
||||
String value = p != null ? p.getProperty(name) : null;
|
||||
if (value == null)
|
||||
return DOUBLE_DEFAULT_DEFAULT;
|
||||
double ival = DOUBLE_DEFAULT_DEFAULT;
|
||||
try {
|
||||
ival = new Double(value).doubleValue();
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
return ival;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public float getFloat(String name) {
|
||||
return getFloat(properties, name);
|
||||
}
|
||||
/**
|
||||
* Helper function: gets float for a given name.
|
||||
*/
|
||||
private float getFloat(Properties p, String name) {
|
||||
String value = p != null ? p.getProperty(name) : null;
|
||||
if (value == null)
|
||||
return FLOAT_DEFAULT_DEFAULT;
|
||||
float ival = FLOAT_DEFAULT_DEFAULT;
|
||||
try {
|
||||
ival = new Float(value).floatValue();
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
return ival;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public int getInt(String name) {
|
||||
return getInt(properties, name);
|
||||
}
|
||||
/**
|
||||
* Helper function: gets int for a given name.
|
||||
*/
|
||||
private int getInt(Properties p, String name) {
|
||||
String value = p != null ? p.getProperty(name) : null;
|
||||
if (value == null)
|
||||
return INT_DEFAULT_DEFAULT;
|
||||
int ival = 0;
|
||||
try {
|
||||
ival = Integer.parseInt(value);
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
return ival;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public long getLong(String name) {
|
||||
return getLong(properties, name);
|
||||
}
|
||||
/**
|
||||
* Helper function: gets long for a given name.
|
||||
*/
|
||||
private long getLong(Properties p, String name) {
|
||||
String value = p != null ? p.getProperty(name) : null;
|
||||
if (value == null)
|
||||
return LONG_DEFAULT_DEFAULT;
|
||||
long ival = LONG_DEFAULT_DEFAULT;
|
||||
try {
|
||||
ival = Long.parseLong(value);
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
return ival;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public String getString(String name) {
|
||||
return getString(properties, name);
|
||||
}
|
||||
/**
|
||||
* Helper function: gets string for a given name.
|
||||
*/
|
||||
private String getString(Properties p, String name) {
|
||||
String value = p != null ? p.getProperty(name) : null;
|
||||
if (value == null)
|
||||
return STRING_DEFAULT_DEFAULT;
|
||||
return value;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public boolean isDefault(String name) {
|
||||
return (!properties.containsKey(name) && defaultProperties.containsKey(name));
|
||||
}
|
||||
/**
|
||||
* Prints the contents of this preference store to the given print stream.
|
||||
*
|
||||
* @param out the print stream
|
||||
*/
|
||||
public void list(PrintStream out) {
|
||||
properties.list(out);
|
||||
}
|
||||
/**
|
||||
* Prints the contents of this preference store to the given print writer.
|
||||
*
|
||||
* @param out the print writer
|
||||
*/
|
||||
public void list(PrintWriter out) {
|
||||
properties.list(out);
|
||||
}
|
||||
/**
|
||||
* Loads this preference store from the file established in the constructor
|
||||
* <code>PreferenceStore(java.lang.String)</code> (or by <code>setFileName</code>).
|
||||
* Default preference values are not affected.
|
||||
*
|
||||
* @exception java.io.IOException if there is a problem loading this store
|
||||
*/
|
||||
public void load() throws IOException {
|
||||
if (filename == null)
|
||||
throw new IOException("File name not specified");//$NON-NLS-1$
|
||||
FileInputStream in = new FileInputStream(filename);
|
||||
load(in);
|
||||
in.close();
|
||||
}
|
||||
/**
|
||||
* Loads this preference store from the given input stream. Default preference
|
||||
* values are not affected.
|
||||
*
|
||||
* @param in the input stream
|
||||
* @exception java.io.IOException if there is a problem loading this store
|
||||
*/
|
||||
public void load(InputStream in) throws IOException {
|
||||
properties.load(in);
|
||||
dirty = false;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public boolean needsSaving() {
|
||||
return dirty;
|
||||
}
|
||||
/**
|
||||
* Returns an enumeration of all preferences known to this store which
|
||||
* have current values other than their default value.
|
||||
*
|
||||
* @return an array of preference names
|
||||
*/
|
||||
public String[] preferenceNames() {
|
||||
ArrayList list = new ArrayList();
|
||||
Enumeration enum = properties.propertyNames();
|
||||
while (enum.hasMoreElements()) {
|
||||
list.add(enum.nextElement());
|
||||
}
|
||||
return (String[])list.toArray(new String[list.size()]);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public void putValue(String name, String value) {
|
||||
setValue(properties, name, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the non-default-valued preferences known to this preference
|
||||
* store to the file from which they were originally loaded.
|
||||
*
|
||||
* @exception java.io.IOException if there is a problem saving this store
|
||||
*/
|
||||
public void save() throws IOException {
|
||||
if (filename == null)
|
||||
throw new IOException("File name not specified");//$NON-NLS-1$
|
||||
FileOutputStream out = null;
|
||||
try {
|
||||
out = new FileOutputStream(filename);
|
||||
save(out, null);
|
||||
} finally {
|
||||
if (out != null)
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Saves this preference store to the given output stream. The
|
||||
* given string is inserted as header information.
|
||||
*
|
||||
* @param out the output stream
|
||||
* @param header the header
|
||||
* @exception java.io.IOException if there is a problem saving this store
|
||||
*/
|
||||
public void save(OutputStream out, String header) throws IOException {
|
||||
properties.store(out, header);
|
||||
dirty = false;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public void setDefault(String name, double value) {
|
||||
setValue(defaultProperties, name, value);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public void setDefault(String name, float value) {
|
||||
setValue(defaultProperties, name, value);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public void setDefault(String name, int value) {
|
||||
setValue(defaultProperties, name, value);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public void setDefault(String name, long value) {
|
||||
setValue(defaultProperties, name, value);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public void setDefault(String name, String value) {
|
||||
setValue(defaultProperties, name, value);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public void setDefault(String name, boolean value) {
|
||||
setValue(defaultProperties, name, value);
|
||||
}
|
||||
/**
|
||||
* Sets the name of the file used when loading and storing this preference store.
|
||||
* <p>
|
||||
* Afterward, the methods <code>load()</code> and <code>save()</code> can be used
|
||||
* to load and store this preference store.
|
||||
* </p>
|
||||
*
|
||||
* @param filename the file name
|
||||
* @see #load()
|
||||
* @see #store()
|
||||
*/
|
||||
public void setFilename(String name) {
|
||||
filename = name;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public void setToDefault(String name) {
|
||||
// do nothing ... since we have not defined a
|
||||
// firePropertyChangeEvent. Without it,
|
||||
// this method does nothing anyway ... so
|
||||
// why do all this work?
|
||||
|
||||
// Object oldValue = properties.get(name);
|
||||
// properties.remove(name);
|
||||
// dirty = true;
|
||||
// Object newValue = null;
|
||||
// if (defaultProperties != null){
|
||||
// newValue = defaultProperties.get(name);
|
||||
// }
|
||||
// firePropertyChangeEvent(name, oldValue, newValue);
|
||||
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public void setValue(String name, double value) {
|
||||
double oldValue = getDouble(name);
|
||||
if (oldValue != value) {
|
||||
setValue(properties, name, value);
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public void setValue(String name, float value) {
|
||||
float oldValue = getFloat(name);
|
||||
if (oldValue != value) {
|
||||
setValue(properties, name, value);
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public void setValue(String name, int value) {
|
||||
int oldValue = getInt(name);
|
||||
if (oldValue != value) {
|
||||
setValue(properties, name, value);
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public void setValue(String name, long value) {
|
||||
long oldValue = getLong(name);
|
||||
if (oldValue != value) {
|
||||
setValue(properties, name, value);
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public void setValue(String name, String value) {
|
||||
String oldValue = getString(name);
|
||||
if (oldValue == null || !oldValue.equals(value)) {
|
||||
setValue(properties, name, value);
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* Method declared on IPreferenceStore.
|
||||
*/
|
||||
public void setValue(String name, boolean value) {
|
||||
boolean oldValue = getBoolean(name);
|
||||
if (oldValue != value) {
|
||||
setValue(properties, name, value);
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Helper method: sets string for a given name.
|
||||
*/
|
||||
private void setValue(Properties p, String name, double value) {
|
||||
p.put(name, Double.toString(value));
|
||||
}
|
||||
/**
|
||||
* Helper method: sets string for a given name.
|
||||
*/
|
||||
private void setValue(Properties p, String name, float value) {
|
||||
p.put(name, Float.toString(value));
|
||||
}
|
||||
/**
|
||||
* Helper method: sets string for a given name.
|
||||
*/
|
||||
private void setValue(Properties p, String name, int value) {
|
||||
p.put(name, Integer.toString(value));
|
||||
}
|
||||
/**
|
||||
* Helper method: sets string for a given name.
|
||||
*/
|
||||
private void setValue(Properties p, String name, long value) {
|
||||
p.put(name, Long.toString(value));
|
||||
}
|
||||
/**
|
||||
* Helper method: sets string for a given name.
|
||||
*/
|
||||
private void setValue(Properties p, String name, String value) {
|
||||
p.put(name, value);
|
||||
}
|
||||
/**
|
||||
* Helper method: sets string for a given name.
|
||||
*/
|
||||
private void setValue(Properties p, String name, boolean value) {
|
||||
p.put(name, value == true ? IPropertyStore.TRUE : IPropertyStore.FALSE);
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
package org.eclipse.cdt.internal;
|
||||
|
||||
/*
|
||||
* (c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
import org.eclipse.cdt.core.resources.*;
|
||||
import org.eclipse.core.resources.*;
|
||||
import org.eclipse.core.runtime.QualifiedName;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
public class ResourcePropertyStore implements IPropertyStore {
|
||||
private IResource resource;
|
||||
private String pluginID;
|
||||
|
||||
public ResourcePropertyStore(IResource resource, String pluginID) {
|
||||
this.resource = resource;
|
||||
this.pluginID = pluginID;
|
||||
}
|
||||
|
||||
public String getString(String name) {
|
||||
QualifiedName qName = new QualifiedName(pluginID, name);
|
||||
try {
|
||||
return resource.getPersistentProperty(qName);
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setDefault(String name, String def) {
|
||||
}
|
||||
|
||||
public void putValue(String name, String value) {
|
||||
QualifiedName qName = new QualifiedName(pluginID, name);
|
||||
try {
|
||||
resource.setPersistentProperty(qName, value);
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -27,8 +27,6 @@ import org.eclipse.core.runtime.SubProgressMonitor;
|
|||
import org.eclipse.cdt.core.model.ICModelMarker;
|
||||
import org.eclipse.cdt.core.resources.ACBuilder;
|
||||
import org.eclipse.cdt.core.resources.IConsole;
|
||||
import org.eclipse.cdt.core.resources.IPropertyStore;
|
||||
import org.eclipse.cdt.internal.CCorePlugin;
|
||||
import org.eclipse.cdt.internal.errorparsers.ErrorParserManager;
|
||||
import org.eclipse.cdt.core.*;
|
||||
import org.eclipse.cdt.core.resources.*;
|
||||
|
@ -39,11 +37,9 @@ public class CBuilder extends ACBuilder {
|
|||
|
||||
private static final String BUILD_ERROR= "CBuilder.build_error";
|
||||
|
||||
private IPropertyStore fPreferenceStore;
|
||||
private ErrorParserManager fErrorParserManager;
|
||||
|
||||
public CBuilder() {
|
||||
fPreferenceStore= CCorePlugin.getDefault().getPropertyStore();
|
||||
fErrorParserManager= new ErrorParserManager(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
|
||||
import org.eclipse.cdt.internal.CCorePlugin;
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -22,8 +22,8 @@ import org.eclipse.core.runtime.CoreException;
|
|||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.resources.ACBuilder;
|
||||
import org.eclipse.cdt.internal.CCorePlugin;
|
||||
public class ErrorParserManager {
|
||||
|
||||
private static String PREF_ERROR_PARSER= "errorOutputParser";
|
||||
|
@ -92,7 +92,7 @@ public class ErrorParserManager {
|
|||
|
||||
private void readPreferences() {
|
||||
fErrorParsers.clear();
|
||||
String parserNames= CCorePlugin.getDefault().getPropertyStore().getString(PREF_ERROR_PARSER);
|
||||
String parserNames= CCorePlugin.getDefault().getPluginPreferences().getString(PREF_ERROR_PARSER);
|
||||
if (parserNames != null && parserNames.length() > 0) {
|
||||
StringTokenizer tok= new StringTokenizer(parserNames, ";");
|
||||
while (tok.hasMoreElements()) {
|
||||
|
@ -133,7 +133,7 @@ public class ErrorParserManager {
|
|||
buf.append(fErrorParsers.get(i).getClass().getName());
|
||||
buf.append(';');
|
||||
}
|
||||
CCorePlugin.getDefault().getPropertyStore().putValue(PREF_ERROR_PARSER, buf.toString());
|
||||
CCorePlugin.getDefault().getPluginPreferences().setValue(PREF_ERROR_PARSER, buf.toString());
|
||||
}
|
||||
|
||||
protected void collectFiles(IContainer parent, List result) {
|
||||
|
|
|
@ -29,23 +29,23 @@
|
|||
<extension-point id="CCompletionContributor" name="%completionContributorName"/>
|
||||
<extension-point id="CElementFilters" name="%elementFiltersName"/>
|
||||
<!-- =========================================================================== -->
|
||||
<!-- Extension Implementation: must implement org.eclipse.jface.text.ITextHover -->
|
||||
<!-- Purpose: Provide a perspective specific text hovering for CEditor files -->
|
||||
<!-- Extension point: org.eclipse.cdt.ui.textHovers -->
|
||||
<!-- Purpose: Provide a perspective specific text hovering for CEditor files -->
|
||||
<!-- Extension Implementation: must implement org.eclipse.jface.text.ITextHover -->
|
||||
<!-- =========================================================================== -->
|
||||
<extension-point id="textHovers" name="%textHoversName"/>
|
||||
<!-- =========================================================================== -->
|
||||
<!-- must implement org.eclipse.cdt.ui.ICEditorContextMenuAction -->
|
||||
<!-- Extension Implementation: -->
|
||||
<!-- Purpose: Provide an action for the CEditor's context menu -->
|
||||
<!-- Extension point: org.eclipse.cdt.ui.editorActions -->
|
||||
<!-- Purpose: Provide an action for the CEditor's context menu -->
|
||||
<!-- Extension Implementation: -->
|
||||
<!-- must implement org.eclipse.cdt.ui.ICEditorContextMenuAction -->
|
||||
<!-- =========================================================================== -->
|
||||
<extension-point id="editorActions" name="%editorActionsName"/>
|
||||
<!-- =========================================================================== -->
|
||||
<!-- must implement org.eclipse.cdt.ui.ICEditorRulerAction -->
|
||||
<!-- Extension Implementation: -->
|
||||
<!-- Purpose: Provide an action for the CEditor's ruler -->
|
||||
<!-- Extension point: org.eclipse.cdt.ui.editorRulerActions -->
|
||||
<!-- Purpose: Provide an action for the CEditor's ruler -->
|
||||
<!-- Extension Implementation: -->
|
||||
<!-- must implement org.eclipse.cdt.ui.ICEditorRulerAction -->
|
||||
<!-- =========================================================================== -->
|
||||
<extension-point id="editorRulerActions" name="%editorRulerActionsName"/>
|
||||
|
||||
|
@ -148,8 +148,8 @@
|
|||
id="org.eclipse.cdt.ui.CView">
|
||||
</view>
|
||||
</extension>
|
||||
<!-- The wizards -->
|
||||
<!-- For C Wizards -->
|
||||
<!-- The wizards -->
|
||||
<extension
|
||||
point="org.eclipse.ui.newWizards">
|
||||
<category
|
||||
|
@ -246,14 +246,6 @@
|
|||
</filter>
|
||||
</page>
|
||||
</extension>
|
||||
<!--
|
||||
<page
|
||||
objectClass="org.eclipse.core.resources.IFile"
|
||||
name="%CLaunchingPropertyPage.executionArguments.name"
|
||||
class="org.eclipse.cdt.internal.ui.preferences.CLaunchingPropertyPage"
|
||||
id="org.eclipse.cdt.ui.preferences.CLaunchingPropertyPage">
|
||||
</page>
|
||||
-->
|
||||
<!--
|
||||
<extension
|
||||
point="org.eclipse.debug.core.launchers">
|
||||
|
@ -267,6 +259,14 @@
|
|||
id="org.eclipse.cdt.core.CApplicationLauncher">
|
||||
</launcher>
|
||||
</extension>
|
||||
-->
|
||||
<!--
|
||||
<page
|
||||
objectClass="org.eclipse.core.resources.IFile"
|
||||
name="%CLaunchingPropertyPage.executionArguments.name"
|
||||
class="org.eclipse.cdt.internal.ui.preferences.CLaunchingPropertyPage"
|
||||
id="org.eclipse.cdt.ui.preferences.CLaunchingPropertyPage">
|
||||
</page>
|
||||
-->
|
||||
<extension
|
||||
point="org.eclipse.ui.popupMenus">
|
||||
|
@ -398,5 +398,10 @@
|
|||
id="org.eclipse.cdt.ui">
|
||||
</debugModelPresentation>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.cdt.core.CBuildConsole">
|
||||
<CBuildConsole class="org.eclipse.cdt.internal.ui.CConsole">
|
||||
</CBuildConsole>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* (c) Copyright QNX Software System Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
package org.eclipse.cdt.internal.ui;
|
||||
|
||||
import org.eclipse.cdt.core.ConsoleOutputStream;
|
||||
import org.eclipse.cdt.core.resources.IConsole;
|
||||
|
||||
public class CConsole implements IConsole {
|
||||
|
||||
/**
|
||||
* Constructor for CConsole.
|
||||
*/
|
||||
public CConsole() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.core.resources.IConsole#clear()
|
||||
*/
|
||||
public void clear() {
|
||||
CPlugin.getDefault().getConsole().clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.core.resources.IConsole#getOutputStream()
|
||||
*/
|
||||
public ConsoleOutputStream getOutputStream() {
|
||||
return CPlugin.getDefault().getConsole().getOutputStream();
|
||||
}
|
||||
}
|
|
@ -5,6 +5,11 @@ package org.eclipse.cdt.internal.ui;
|
|||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.IBinary;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ICFile;
|
||||
import org.eclipse.cdt.core.model.ICResource;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
@ -15,11 +20,6 @@ import org.eclipse.ui.views.properties.FilePropertySource;
|
|||
import org.eclipse.ui.views.properties.IPropertySource;
|
||||
import org.eclipse.ui.views.properties.ResourcePropertySource;
|
||||
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.IBinary;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ICFile;
|
||||
|
||||
/**
|
||||
* Implements basic UI support for C elements.
|
||||
*/
|
||||
|
@ -61,9 +61,10 @@ public class CElementAdapterFactory implements IAdapterFactory {
|
|||
}
|
||||
} else {
|
||||
try {
|
||||
res = celem.getCorrespondingResource();
|
||||
if (res != null)
|
||||
if ( celem instanceof ICResource ) {
|
||||
res = ((ICResource)celem).getResource();
|
||||
return new ResourcePropertySource(res);
|
||||
}
|
||||
} catch (CModelException e) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,14 +33,11 @@ import org.eclipse.ui.IWorkbenchWindow;
|
|||
import org.eclipse.ui.PartInitException;
|
||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.ConsoleOutputStream;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.resources.ICPlugin;
|
||||
import org.eclipse.cdt.core.resources.IConsole;
|
||||
import org.eclipse.cdt.core.resources.IMessageDialog;
|
||||
import org.eclipse.cdt.core.resources.IPropertyStore;
|
||||
import org.eclipse.cdt.internal.CCorePlugin;
|
||||
import org.eclipse.cdt.internal.ui.cview.CView;
|
||||
import org.eclipse.cdt.internal.ui.editor.CDocumentProvider;
|
||||
import org.eclipse.cdt.internal.ui.editor.asm.AsmTextTools;
|
||||
|
@ -51,7 +48,7 @@ import org.eclipse.cdt.internal.ui.util.ImageDescriptorRegistry;
|
|||
import org.eclipse.cdt.internal.ui.util.ProblemMarkerManager;
|
||||
|
||||
|
||||
public class CPlugin extends AbstractUIPlugin implements ICPlugin {
|
||||
public class CPlugin extends AbstractUIPlugin {
|
||||
|
||||
public static final String PLUGIN_ID= "org.eclipse.cdt.ui";
|
||||
public static final String PLUGIN_CORE_ID= "org.eclipse.cdt.core";
|
||||
|
@ -133,14 +130,6 @@ public class CPlugin extends AbstractUIPlugin implements ICPlugin {
|
|||
}
|
||||
|
||||
// ------ CPlugin
|
||||
|
||||
public IMessageDialog getMessageDialog() {
|
||||
return new IMessageDialog() {
|
||||
public void openError(String title, String msg) {
|
||||
MessageDialog.openError(getActiveWorkbenchShell(), title, msg);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private ConsoleDocument fConsoleDocument;
|
||||
private CoreModel fCoreModel;
|
||||
|
@ -214,27 +203,6 @@ public class CPlugin extends AbstractUIPlugin implements ICPlugin {
|
|||
}
|
||||
}
|
||||
|
||||
private IPropertyStore fPropertyStore;
|
||||
|
||||
public IPropertyStore getPropertyStore() {
|
||||
if (fPropertyStore == null) {
|
||||
fPropertyStore = new IPropertyStore() {
|
||||
public String getString(String name) {
|
||||
return getPreferenceStore().getString(name);
|
||||
}
|
||||
public void putValue(String name, String value) {
|
||||
getPreferenceStore().putValue(name, value);
|
||||
}
|
||||
public void setDefault(String name, String def) {
|
||||
getPreferenceStore().setDefault(name, def);
|
||||
}
|
||||
};
|
||||
}
|
||||
return fPropertyStore;
|
||||
}
|
||||
|
||||
// protected ACDebugModel fModel;
|
||||
|
||||
public CPlugin(IPluginDescriptor descriptor) {
|
||||
super(descriptor);
|
||||
fgCPlugin= this;
|
||||
|
@ -321,7 +289,6 @@ public class CPlugin extends AbstractUIPlugin implements ICPlugin {
|
|||
IAdapterManager manager= Platform.getAdapterManager();
|
||||
manager.registerAdapters(new ResourceAdapterFactory(), IResource.class);
|
||||
manager.registerAdapters(new CElementAdapterFactory(), ICElement.class);
|
||||
manager.registerAdapters(new PluginAdapterFactory(), CCorePlugin.class);
|
||||
CPluginImages.initialize();
|
||||
|
||||
}
|
||||
|
@ -348,15 +315,6 @@ public class CPlugin extends AbstractUIPlugin implements ICPlugin {
|
|||
return fCoreModel;
|
||||
}
|
||||
|
||||
public Object getAdapter(Class adapter) {
|
||||
return Platform.getAdapterManager().getAdapter(this, adapter);
|
||||
}
|
||||
|
||||
/*
|
||||
public ACDebugModel getDebugModel() {
|
||||
return fModel;
|
||||
}
|
||||
*/
|
||||
public static String getPluginId() {
|
||||
return PLUGIN_ID;
|
||||
}
|
||||
|
|
|
@ -7,18 +7,16 @@ package org.eclipse.cdt.internal.ui;
|
|||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ICModelMarker;
|
||||
import org.eclipse.cdt.core.model.ICResource;
|
||||
import org.eclipse.cdt.core.model.ISourceRange;
|
||||
import org.eclipse.cdt.core.model.ISourceReference;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
import org.eclipse.jface.text.Position;
|
||||
import org.eclipse.jface.text.source.Annotation;
|
||||
import org.eclipse.jface.text.source.IAnnotationModel;
|
||||
|
||||
import org.eclipse.ui.texteditor.MarkerAnnotation;
|
||||
import org.eclipse.ui.texteditor.MarkerUtilities;
|
||||
|
||||
|
@ -43,9 +41,9 @@ public class ErrorTickAdornmentProvider implements IAdornmentProvider {
|
|||
switch (type) {
|
||||
case ICElement.C_PROJECT:
|
||||
case ICElement.C_FOLDER:
|
||||
return getErrorTicksFromMarkers(element.getCorrespondingResource(), IResource.DEPTH_INFINITE, null);
|
||||
return getErrorTicksFromMarkers(((ICResource)element).getResource(), IResource.DEPTH_INFINITE, null);
|
||||
case ICElement.C_FILE:
|
||||
return getErrorTicksFromMarkers(element.getCorrespondingResource(), IResource.DEPTH_ONE, null);
|
||||
return getErrorTicksFromMarkers(((ICResource)element).getResource(), IResource.DEPTH_ONE, null);
|
||||
case ICElement.C_FUNCTION:
|
||||
case ICElement.C_CLASS:
|
||||
case ICElement.C_UNION:
|
||||
|
@ -56,7 +54,7 @@ public class ErrorTickAdornmentProvider implements IAdornmentProvider {
|
|||
if (tu != null && tu.exists()) {
|
||||
// I assume that only source elements in compilation unit can have markers
|
||||
ISourceRange range= ((ISourceReference)element).getSourceRange();
|
||||
return getErrorTicksFromMarkers(tu.getCorrespondingResource(), IResource.DEPTH_ONE, range);
|
||||
return getErrorTicksFromMarkers(tu.getResource(), IResource.DEPTH_ONE, range);
|
||||
}
|
||||
default:
|
||||
}
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
package org.eclipse.cdt.internal.ui;
|
||||
|
||||
/*
|
||||
* (c) Copyright IBM Corp. 2000, 2001.
|
||||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
import org.eclipse.cdt.core.resources.*;
|
||||
import org.eclipse.cdt.internal.CCorePlugin;
|
||||
import org.eclipse.core.runtime.IAdapterFactory;
|
||||
|
||||
//import org.eclipse.cdt.core.model.ICElement;
|
||||
//import org.eclipse.cdt.core.model.CCore;
|
||||
|
||||
public class PluginAdapterFactory implements IAdapterFactory {
|
||||
|
||||
private static Class[] PROPERTIES= new Class[] {
|
||||
ICPlugin.class
|
||||
};
|
||||
|
||||
//private static CCore fgCElementFactory= CCore.getDefault();
|
||||
|
||||
/**
|
||||
* @see IAdapterFactory#getAdapterList
|
||||
*/
|
||||
public Class[] getAdapterList() {
|
||||
return PROPERTIES;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IAdapterFactory#getAdapter
|
||||
*/
|
||||
public Object getAdapter(Object element, Class key) {
|
||||
if (ICPlugin.class.equals(key)) {
|
||||
if (element instanceof CCorePlugin) {
|
||||
return CPlugin.getDefault();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -46,7 +46,7 @@ public class CElementFilters {
|
|||
if (definedFilters == null) {
|
||||
// Overide the default by the user preference
|
||||
CPlugin plugin = CPlugin.getDefault();
|
||||
String storedPatterns= plugin.getPropertyStore().getString(FILTERS_TAG);
|
||||
String storedPatterns= plugin.getPluginPreferences().getString(FILTERS_TAG);
|
||||
|
||||
if (storedPatterns.length() > 0) {
|
||||
StringTokenizer entries = new StringTokenizer(storedPatterns, COMMA_SEPARATOR);
|
||||
|
|
|
@ -7,7 +7,7 @@ package org.eclipse.cdt.internal.ui.dialogs;
|
|||
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
|
||||
import org.eclipse.cdt.internal.CCorePlugin;
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
|
||||
/**
|
||||
* A settable IStatus
|
||||
|
|
|
@ -5,12 +5,20 @@ package org.eclipse.cdt.internal.ui.preferences;
|
|||
* All Rights Reserved.
|
||||
*/
|
||||
|
||||
import org.eclipse.cdt.internal.ui.CPlugin;
|
||||
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.StatusTool;
|
||||
import org.eclipse.cdt.ui.wizards.ReferenceBlock;
|
||||
import org.eclipse.cdt.ui.wizards.SettingsBlock;
|
||||
import org.eclipse.cdt.utils.ui.controls.TabFolderLayout;
|
||||
import org.eclipse.cdt.utils.ui.swt.IValidation;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.layout.FillLayout;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
|
@ -20,15 +28,6 @@ import org.eclipse.ui.dialogs.PropertyPage;
|
|||
import org.eclipse.ui.help.DialogPageContextComputer;
|
||||
import org.eclipse.ui.help.WorkbenchHelp;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.CPlugin;
|
||||
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.StatusTool;
|
||||
import org.eclipse.cdt.ui.wizards.ReferenceBlock;
|
||||
import org.eclipse.cdt.ui.wizards.SettingsBlock;
|
||||
import org.eclipse.cdt.utils.ui.swt.IValidation;
|
||||
import org.eclipse.cdt.utils.ui.controls.TabFolderLayout;
|
||||
|
||||
public class CProjectPropertyPage extends PropertyPage implements IStatusChangeListener, IValidation {
|
||||
|
||||
private static final String MSG_NOCPROJECT= "CProjectPropertyPage.nocproject";
|
||||
|
@ -40,7 +39,7 @@ public class CProjectPropertyPage extends PropertyPage implements IStatusChangeL
|
|||
|
||||
protected Control createContents(Composite parent) {
|
||||
Composite composite= new Composite(parent, SWT.NONE);
|
||||
composite.setLayout(new GridLayout());
|
||||
composite.setLayout(new FillLayout());
|
||||
|
||||
IProject project= getProject();
|
||||
if (!project.isOpen()) {
|
||||
|
@ -55,8 +54,6 @@ public class CProjectPropertyPage extends PropertyPage implements IStatusChangeL
|
|||
private void contentForCProject(Composite parent) {
|
||||
folder = new TabFolder(parent, SWT.NONE);
|
||||
folder.setLayout(new TabFolderLayout());
|
||||
GridData gdFolder= new GridData(GridData.FILL_HORIZONTAL);
|
||||
folder.setLayoutData(gdFolder);
|
||||
|
||||
referenceBlock = new ReferenceBlock(this, getProject());
|
||||
TabItem item = new TabItem(folder, SWT.NONE);
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.eclipse.ui.model.WorkbenchLabelProvider;
|
|||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.internal.ui.CPlugin;
|
||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||
import org.eclipse.cdt.utils.ui.swt.IValidation;
|
||||
|
||||
public class ReferenceBlock implements IWizardTab {
|
||||
|
@ -59,14 +60,9 @@ public class ReferenceBlock implements IWizardTab {
|
|||
lbldata.horizontalSpan = 1;
|
||||
label.setLayoutData(lbldata);
|
||||
|
||||
referenceProjectsViewer = new CheckboxTableViewer(composite, SWT.BORDER);
|
||||
GridData data = new GridData();
|
||||
data.horizontalAlignment = GridData.FILL;
|
||||
data.grabExcessHorizontalSpace = true;
|
||||
referenceProjectsViewer = ControlFactory.createListViewer
|
||||
(composite, null, SWT.DEFAULT, SWT.DEFAULT, GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
|
||||
|
||||
data.heightHint = getDefaultFontHeight( referenceProjectsViewer.getTable(),
|
||||
PROJECT_LIST_MULTIPLIER);
|
||||
referenceProjectsViewer.getTable().setLayoutData(data);
|
||||
referenceProjectsViewer.setLabelProvider(new WorkbenchLabelProvider());
|
||||
referenceProjectsViewer.setContentProvider(getContentProvider());
|
||||
referenceProjectsViewer.setInput(ResourcesPlugin.getWorkspace());
|
||||
|
@ -96,11 +92,11 @@ public class ReferenceBlock implements IWizardTab {
|
|||
if (!(element instanceof IWorkspace))
|
||||
return new Object[0];
|
||||
ArrayList aList = new ArrayList(15);
|
||||
IProject[] projects = ((IWorkspace)element).getRoot().getProjects();
|
||||
final IProject[] projects = ((IWorkspace)element).getRoot().getProjects();
|
||||
for (int i = 0; i < projects.length; i++) {
|
||||
if (CoreModel.hasCNature(projects[i])) {
|
||||
// Do not show the actual project being look at
|
||||
if (project != null && project.equals(projects[i])) {
|
||||
if ((project != null) && project.equals(projects[i])) {
|
||||
continue;
|
||||
}
|
||||
aList.add(projects[i]);
|
||||
|
|
Loading…
Add table
Reference in a new issue