mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +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.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.ElementChangedEvent;
|
import org.eclipse.cdt.core.model.ElementChangedEvent;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
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.ITranslationUnit;
|
||||||
import org.eclipse.cdt.core.model.ICElementDelta;
|
import org.eclipse.cdt.core.model.ICElementDelta;
|
||||||
import org.eclipse.cdt.core.model.IElementChangedListener;
|
import org.eclipse.cdt.core.model.IElementChangedListener;
|
||||||
|
@ -250,7 +251,7 @@ public class IndexManager implements IElementChangedListener {
|
||||||
|
|
||||||
if (kind == ICElementDelta.REMOVED) {
|
if (kind == ICElementDelta.REMOVED) {
|
||||||
try {
|
try {
|
||||||
IResource resource = ((ICElement)element).getCorrespondingResource();
|
IResource resource = ((ICResource)element).getResource();
|
||||||
removeResource(resource);
|
removeResource(resource);
|
||||||
} catch (CModelException e) {
|
} catch (CModelException e) {
|
||||||
}
|
}
|
||||||
|
@ -258,7 +259,7 @@ public class IndexManager implements IElementChangedListener {
|
||||||
|
|
||||||
if (kind == ICElementDelta.ADDED) {
|
if (kind == ICElementDelta.ADDED) {
|
||||||
try {
|
try {
|
||||||
IResource resource = ((ICElement)element).getCorrespondingResource();
|
IResource resource = ((ICResource)element).getResource();
|
||||||
addResource(resource);
|
addResource(resource);
|
||||||
} catch (CModelException e) {
|
} catch (CModelException e) {
|
||||||
}
|
}
|
||||||
|
@ -266,7 +267,7 @@ public class IndexManager implements IElementChangedListener {
|
||||||
|
|
||||||
if (element instanceof ITranslationUnit) {
|
if (element instanceof ITranslationUnit) {
|
||||||
if (kind == ICElementDelta.CHANGED) {
|
if (kind == ICElementDelta.CHANGED) {
|
||||||
IResource resource = ((ICElement)element).getCorrespondingResource();
|
IResource resource = ((ICResource)element).getResource();
|
||||||
addResource(resource);
|
addResource(resource);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class CoreModel {
|
||||||
* Creates an ICElement form and IPath.
|
* Creates an ICElement form and IPath.
|
||||||
* Returns null if not found.
|
* Returns null if not found.
|
||||||
*/
|
*/
|
||||||
public ICElement create(IPath path) {
|
public ICResource create(IPath path) {
|
||||||
return manager.create(path);
|
return manager.create(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ public class CoreModel {
|
||||||
* Creates an ICElement form and IFile.
|
* Creates an ICElement form and IFile.
|
||||||
* Returns null if not found.
|
* Returns null if not found.
|
||||||
*/
|
*/
|
||||||
public ICElement create(IFile file) {
|
public ICFile create(IFile file) {
|
||||||
return manager.create(file);
|
return manager.create(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ public class CoreModel {
|
||||||
* Creates an ICElement form and IFolder.
|
* Creates an ICElement form and IFolder.
|
||||||
* Returns null if not found.
|
* Returns null if not found.
|
||||||
*/
|
*/
|
||||||
public ICElement create(IFolder folder) {
|
public ICFolder create(IFolder folder) {
|
||||||
return manager.create(folder);
|
return manager.create(folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,30 +109,22 @@ public class CoreModel {
|
||||||
* Creates an ICElement form and IProject.
|
* Creates an ICElement form and IProject.
|
||||||
* Returns null if not found.
|
* Returns null if not found.
|
||||||
*/
|
*/
|
||||||
public ICElement create(IProject project) {
|
public ICProject create(IProject project) {
|
||||||
return manager.create(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.
|
* Creates an ICElement form and IResource.
|
||||||
* Returns null if not found.
|
* Returns null if not found.
|
||||||
*/
|
*/
|
||||||
public ICElement create(IResource resource) {
|
public ICResource create(IResource resource) {
|
||||||
return manager.create(resource);
|
return manager.create(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the default ICRoot.
|
* Returns the default ICRoot.
|
||||||
*/
|
*/
|
||||||
public ICElement getCRoot() {
|
public ICRoot getCRoot() {
|
||||||
return manager.getCRoot();
|
return manager.getCRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -185,20 +185,6 @@ public interface ICElement extends IAdaptable {
|
||||||
*/
|
*/
|
||||||
boolean exists();
|
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.
|
* Returns the name of this element.
|
||||||
*
|
*
|
||||||
|
|
|
@ -10,7 +10,7 @@ import org.eclipse.core.resources.IFile;
|
||||||
/**
|
/**
|
||||||
* A C File Resource.
|
* A C File Resource.
|
||||||
*/
|
*/
|
||||||
public interface ICFile extends IParent, ICElement {
|
public interface ICFile extends IParent, ICResource, ICElement {
|
||||||
|
|
||||||
public boolean isBinary();
|
public boolean isBinary();
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import org.eclipse.core.resources.IFolder;
|
||||||
/**
|
/**
|
||||||
* A C Folder Resource.
|
* A C Folder Resource.
|
||||||
*/
|
*/
|
||||||
public interface ICFolder extends IParent, ICElement {
|
public interface ICFolder extends IParent, ICResource, ICElement {
|
||||||
|
|
||||||
public IFolder getFolder();
|
public IFolder getFolder();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ package org.eclipse.cdt.core.model;
|
||||||
* All Rights Reserved.
|
* 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 CCore#create(org.eclipse.core.resources.IProject)
|
||||||
* @see IBuildEntry
|
* @see IBuildEntry
|
||||||
*/
|
*/
|
||||||
public interface ICProject extends IParent, ICElement {
|
public interface ICProject extends IParent, ICResource, ICElement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the <code>ICElement</code> corresponding to the given
|
* 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)
|
* @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).
|
* Copies the given elements to the specified container(s).
|
||||||
* If one container is specified, all elements are copied to that
|
* If one container is specified, all elements are copied to that
|
||||||
|
|
|
@ -65,9 +65,9 @@ public class ArchiveContainer extends Parent implements IArchiveContainer {
|
||||||
// return null;
|
// return null;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
public IResource getCorrespondingResource() {
|
// public IResource getCorrespondingResource() {
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
|
|
||||||
void addChildIfLib(IFile file) {
|
void addChildIfLib(IFile file) {
|
||||||
CModelManager factory = CModelManager.getDefault();
|
CModelManager factory = CModelManager.getDefault();
|
||||||
|
|
|
@ -6,13 +6,13 @@ package org.eclipse.cdt.internal.core.model;
|
||||||
*/
|
*/
|
||||||
import java.util.ArrayList;
|
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.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,13 +102,9 @@ public class CElementDelta implements ICElementDelta {
|
||||||
|
|
||||||
// if a child delta is added to a translation unit delta or below,
|
// if a child delta is added to a translation unit delta or below,
|
||||||
// it's a fine grained delta
|
// it's a fine grained delta
|
||||||
try {
|
if (!(fChangedElement instanceof ICResource)) {
|
||||||
if (fChangedElement.getCorrespondingResource() == null) {
|
|
||||||
fineGrained();
|
fineGrained();
|
||||||
}
|
}
|
||||||
} catch (CModelException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fAffectedChildren.length == 0) {
|
if (fAffectedChildren.length == 0) {
|
||||||
fAffectedChildren = new ICElementDelta[] {child};
|
fAffectedChildren = new ICElementDelta[] {child};
|
||||||
|
|
|
@ -6,41 +6,44 @@ package org.eclipse.cdt.internal.core.model;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
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.IFile;
|
||||||
import org.eclipse.core.resources.IFolder;
|
import org.eclipse.core.resources.IFolder;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.resources.IProjectDescription;
|
||||||
import org.eclipse.core.resources.IResource;
|
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.IWorkspace;
|
||||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
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.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
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 {
|
public class CModelManager implements IResourceChangeListener {
|
||||||
|
|
||||||
// FIXME: Get it from the plugin class.
|
// FIXME: Get it from the plugin class.
|
||||||
|
@ -95,15 +98,15 @@ public class CModelManager implements IResourceChangeListener {
|
||||||
* Returns the CRoot for the given workspace, creating
|
* Returns the CRoot for the given workspace, creating
|
||||||
* it if it does not yet exist.
|
* it if it does not yet exist.
|
||||||
*/
|
*/
|
||||||
public ICElement getCRoot(IWorkspaceRoot root) {
|
public ICRoot getCRoot(IWorkspaceRoot root) {
|
||||||
return create(root);
|
return create(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICElement getCRoot () {
|
public ICRoot getCRoot () {
|
||||||
return create(ResourcesPlugin.getWorkspace().getRoot());
|
return create(ResourcesPlugin.getWorkspace().getRoot());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICElement create (IPath path) {
|
public ICResource create (IPath path) {
|
||||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
// Assume it is fullpath relative to workspace
|
// Assume it is fullpath relative to workspace
|
||||||
IResource res = root.findMember(path);
|
IResource res = root.findMember(path);
|
||||||
|
@ -118,7 +121,7 @@ public class CModelManager implements IResourceChangeListener {
|
||||||
return create (res);
|
return create (res);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICElement create (IResource resource) {
|
public ICResource create (IResource resource) {
|
||||||
if (resource == null) {
|
if (resource == null) {
|
||||||
return 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();
|
int type = resource.getType();
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case IResource.PROJECT :
|
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();
|
IResource parent = file.getParent();
|
||||||
ICElement celement = null;
|
ICElement cparent = null;
|
||||||
if (parent instanceof IFolder) {
|
if (parent instanceof IFolder) {
|
||||||
celement = create ((IFolder)parent);
|
cparent = create ((IFolder)parent);
|
||||||
} else if (parent instanceof IProject) {
|
} else if (parent instanceof IProject) {
|
||||||
celement = create ((IProject)parent);
|
cparent = create ((IProject)parent);
|
||||||
}
|
}
|
||||||
if (celement != null)
|
if (cparent != null)
|
||||||
return create (celement, file);
|
return (ICFile) create (cparent, file);
|
||||||
return celement;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized ICElement create(ICElement parent, IFile file) {
|
public synchronized ICFile create(ICElement parent, IFile file) {
|
||||||
ICElement celement = (ICElement)fParsedResources.get(file);
|
ICFile cfile = (ICFile)fParsedResources.get(file);
|
||||||
if (celement == null) {
|
if (cfile == null) {
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
if (isArchive(file)) {
|
if (isArchive(file)) {
|
||||||
celement = new Archive(parent, file);
|
cfile = new Archive(parent, file);
|
||||||
} else if (isBinary(file)) {
|
} else if (isBinary(file)) {
|
||||||
celement = new Binary(parent, file);
|
cfile = new Binary(parent, file);
|
||||||
} else if (isTranslationUnit(file)) {
|
} else if (isTranslationUnit(file)) {
|
||||||
celement = new TranslationUnit(parent, file);
|
cfile = new TranslationUnit(parent, file);
|
||||||
} else {
|
} else {
|
||||||
celement = new CFile(parent, file);
|
cfile = new CFile(parent, file);
|
||||||
}
|
}
|
||||||
fParsedResources.put(file, celement);
|
fParsedResources.put(file, cfile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Added also to the Containers
|
// Added also to the Containers
|
||||||
if (celement != null) {
|
if (cfile != null) {
|
||||||
if (celement instanceof IArchive) {
|
if (cfile instanceof IArchive) {
|
||||||
CProject cproj = (CProject)celement.getCProject();
|
CProject cproj = (CProject)cfile.getCProject();
|
||||||
ArchiveContainer container = (ArchiveContainer)cproj.getArchiveContainer();
|
ArchiveContainer container = (ArchiveContainer)cproj.getArchiveContainer();
|
||||||
container.addChild(celement);
|
container.addChild(cfile);
|
||||||
} else if (celement instanceof IBinary) {
|
} else if (cfile instanceof IBinary) {
|
||||||
IBinary bin = (IBinary)celement;
|
IBinary bin = (IBinary)cfile;
|
||||||
if (bin.isExecutable() || bin.isSharedLib()) {
|
if (bin.isExecutable() || bin.isSharedLib()) {
|
||||||
CProject cproj = (CProject)celement.getCProject();
|
CProject cproj = (CProject)cfile.getCProject();
|
||||||
BinaryContainer container = (BinaryContainer)cproj.getBinaryContainer();
|
BinaryContainer container = (BinaryContainer)cproj.getBinaryContainer();
|
||||||
container.addChild(bin);
|
container.addChild(bin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return celement;
|
return cfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICElement create(IFolder folder) {
|
public ICFolder create(IFolder folder) {
|
||||||
IResource parent = folder.getParent();
|
IResource parent = folder.getParent();
|
||||||
ICElement celement = null;
|
ICElement cparent = null;
|
||||||
if (parent instanceof IFolder) {
|
if (parent instanceof IFolder) {
|
||||||
celement = create ((IFolder)parent);
|
cparent = create ((IFolder)parent);
|
||||||
} else if (parent instanceof IProject) {
|
} else if (parent instanceof IProject) {
|
||||||
celement = create ((IProject)parent);
|
cparent = create ((IProject)parent);
|
||||||
}
|
}
|
||||||
if (celement != null)
|
if (cparent != null)
|
||||||
return create (celement, folder);
|
return (ICFolder) create (cparent, folder);
|
||||||
return celement;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized ICElement create(ICElement parent, IFolder folder) {
|
public synchronized ICFolder create(ICElement parent, IFolder folder) {
|
||||||
ICElement celement = (ICElement)fParsedResources.get(folder);
|
ICFolder cfolder = (ICFolder)fParsedResources.get(folder);
|
||||||
if (celement == null) {
|
if (cfolder == null) {
|
||||||
celement = new CFolder(parent, folder);
|
cfolder = new CFolder(parent, folder);
|
||||||
fParsedResources.put(folder, celement);
|
fParsedResources.put(folder, cfolder);
|
||||||
}
|
}
|
||||||
return celement;
|
return cfolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICElement create(IProject project) {
|
public ICProject create(IProject project) {
|
||||||
IResource parent = project.getParent();
|
IResource parent = project.getParent();
|
||||||
ICElement celement = null;
|
ICElement celement = null;
|
||||||
if (parent instanceof IWorkspaceRoot) {
|
if (parent instanceof IWorkspaceRoot) {
|
||||||
|
@ -231,24 +234,24 @@ public class CModelManager implements IResourceChangeListener {
|
||||||
return create(celement, project);
|
return create(celement, project);
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized ICElement create(ICElement parent, IProject project) {
|
public synchronized ICProject create(ICElement parent, IProject project) {
|
||||||
ICElement celement = (ICElement)fParsedResources.get(project);
|
ICProject cproject = (ICProject)fParsedResources.get(project);
|
||||||
if (celement == null) {
|
if (cproject == null) {
|
||||||
if (hasCNature(project)) {
|
if (hasCNature(project)) {
|
||||||
celement = new CProject(parent, project);
|
cproject = new CProject(parent, project);
|
||||||
fParsedResources.put(project, celement);
|
fParsedResources.put(project, cproject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return celement;
|
return cproject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICElement create(IWorkspaceRoot root) {
|
public ICRoot create(IWorkspaceRoot root) {
|
||||||
ICElement celement = (ICElement)fParsedResources.get(root);
|
ICRoot croot = (ICRoot)fParsedResources.get(root);
|
||||||
if (celement == null) {
|
if (croot == null) {
|
||||||
celement = new CRoot(root);
|
croot = new CRoot(root);
|
||||||
fParsedResources.put(root, celement);
|
fParsedResources.put(root, croot);
|
||||||
}
|
}
|
||||||
return celement;
|
return croot;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addCNature(IProject project, IProgressMonitor monitor) throws CModelException {
|
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.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.IPath;
|
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.ICElement;
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
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) {
|
public CResource (ICElement parent, IPath path, int type) {
|
||||||
// Check if the file is under the workspace.
|
// Check if the file is under the workspace.
|
||||||
|
@ -36,5 +37,9 @@ public abstract class CResource extends Parent {
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IResource getResource() throws CModelException {
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract CElementInfo createElementInfo ();
|
protected abstract CElementInfo createElementInfo ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,12 @@ package org.eclipse.cdt.internal.core.model;
|
||||||
* All Rights Reserved.
|
* 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.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,14 +5,14 @@ package org.eclipse.cdt.internal.core.model;
|
||||||
* All Rights Reserved.
|
* All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
import org.eclipse.cdt.core.model.CModelException;
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
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.ICResource;
|
||||||
import org.eclipse.cdt.core.model.ICRoot;
|
import org.eclipse.cdt.core.model.ICRoot;
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
|
||||||
public class CRoot extends CResource implements ICRoot {
|
public class CRoot extends CResource implements ICRoot {
|
||||||
|
|
||||||
|
@ -54,8 +54,7 @@ public class CRoot extends CResource implements ICRoot {
|
||||||
|
|
||||||
public void copy(ICElement[] elements, ICElement[] containers, ICElement[] siblings,
|
public void copy(ICElement[] elements, ICElement[] containers, ICElement[] siblings,
|
||||||
String[] renamings, boolean replace, IProgressMonitor monitor) throws CModelException {
|
String[] renamings, boolean replace, IProgressMonitor monitor) throws CModelException {
|
||||||
if (elements != null && elements[0] != null
|
if (elements != null && elements[0] != null && elements[0] instanceof ICResource ) {
|
||||||
&& elements[0].getCorrespondingResource() != null ) {
|
|
||||||
runOperation(new CopyResourceElementsOperation(elements, containers, replace), elements, siblings, renamings, monitor);
|
runOperation(new CopyResourceElementsOperation(elements, containers, replace), elements, siblings, renamings, monitor);
|
||||||
} else {
|
} else {
|
||||||
throw new CModelException (new CModelStatus());
|
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)
|
public void delete(ICElement[] elements, boolean force, IProgressMonitor monitor)
|
||||||
throws CModelException {
|
throws CModelException {
|
||||||
if (elements != null && elements[0] != null
|
if (elements != null && elements[0] != null && elements[0] instanceof ICResource) {
|
||||||
&& elements[0].getCorrespondingResource() != null) {
|
|
||||||
runOperation(new DeleteResourceElementsOperation(elements, force), monitor);
|
runOperation(new DeleteResourceElementsOperation(elements, force), monitor);
|
||||||
} else {
|
} else {
|
||||||
throw new CModelException (new CModelStatus());
|
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,
|
public void move(ICElement[] elements, ICElement[] containers, ICElement[] siblings,
|
||||||
String[] renamings, boolean replace, IProgressMonitor monitor) throws CModelException {
|
String[] renamings, boolean replace, IProgressMonitor monitor) throws CModelException {
|
||||||
if (elements != null && elements[0] != null
|
if (elements != null && elements[0] != null && elements[0] instanceof ICResource ) {
|
||||||
&& elements[0].getCorrespondingResource() == null) {
|
|
||||||
runOperation(new MoveResourceElementsOperation(elements, containers, replace), elements, siblings, renamings, monitor);
|
runOperation(new MoveResourceElementsOperation(elements, containers, replace), elements, siblings, renamings, monitor);
|
||||||
} else {
|
} else {
|
||||||
throw new CModelException (new CModelStatus());
|
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,
|
public void rename(ICElement[] elements, ICElement[] destinations, String[] renamings,
|
||||||
boolean force, IProgressMonitor monitor) throws CModelException {
|
boolean force, IProgressMonitor monitor) throws CModelException {
|
||||||
if (elements != null && elements[0] != null
|
if (elements != null && elements[0] != null && elements[0] instanceof ICResource) {
|
||||||
&& elements[0].getCorrespondingResource() == null) {
|
|
||||||
runOperation(new RenameResourceElementsOperation(elements, destinations,
|
runOperation(new RenameResourceElementsOperation(elements, destinations,
|
||||||
renamings, force), monitor);
|
renamings, force), monitor);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -6,21 +6,21 @@ package org.eclipse.cdt.internal.core.model;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.cdt.core.model.CModelException;
|
||||||
import org.eclipse.core.resources.IContainer;
|
|
||||||
import org.eclipse.core.runtime.Path;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.core.model.ICElementDelta;
|
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.ICModelStatus;
|
||||||
import org.eclipse.cdt.core.model.ICModelStatusConstants;
|
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
|
* 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();
|
String destName = (newName != null) ? newName : source.getElementName();
|
||||||
|
|
||||||
// copy resource
|
// copy resource
|
||||||
IFile sourceResource = (IFile)source.getCorrespondingResource();
|
IFile sourceResource = (IFile)((ICResource)source).getResource();
|
||||||
// can be an IFolder or an IProject
|
// 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));
|
IFile destFile = destFolder.getFile(new Path(destName));
|
||||||
if (!destFile.equals(sourceResource)) {
|
if (!destFile.equals(sourceResource)) {
|
||||||
try {
|
try {
|
||||||
|
@ -185,7 +185,7 @@ public class CopyResourceElementsOperation extends MultiOperation {
|
||||||
*/
|
*/
|
||||||
protected void processElement(ICElement element) throws CModelException {
|
protected void processElement(ICElement element) throws CModelException {
|
||||||
ICElement dest = getDestinationParent(element);
|
ICElement dest = getDestinationParent(element);
|
||||||
if (element.getCorrespondingResource() != null) {
|
if (element instanceof ICResource) {
|
||||||
processResource(element, dest);
|
processResource(element, dest);
|
||||||
//fCreatedElements.add(dest.getCompilationUnit(element.getElementName()));
|
//fCreatedElements.add(dest.getCompilationUnit(element.getElementName()));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
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.ISourceRange;
|
||||||
import org.eclipse.cdt.core.model.ISourceReference;
|
import org.eclipse.cdt.core.model.ISourceReference;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
|
@ -142,7 +143,7 @@ public abstract class CreateElementInTUOperation extends CModelOperation {
|
||||||
insertElement();
|
insertElement();
|
||||||
if (fCreationOccurred) {
|
if (fCreationOccurred) {
|
||||||
//a change has really occurred
|
//a change has really occurred
|
||||||
IFile file = (IFile)unit.getCorrespondingResource();
|
IFile file = (IFile)((ICResource)unit).getResource();
|
||||||
StringBuffer buffer = getContent(file);
|
StringBuffer buffer = getContent(file);
|
||||||
switch (fReplacementLength) {
|
switch (fReplacementLength) {
|
||||||
case -1 :
|
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.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.
|
* 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>.
|
* <code>deletePackageFragment</code> depending on the type of <code>element</code>.
|
||||||
*/
|
*/
|
||||||
protected void processElement(ICElement element) throws CModelException {
|
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
|
ccnature.name=C++ Nature
|
||||||
CProblemMarker.name=C Problem
|
CProblemMarker.name=C Problem
|
||||||
CBuildCommand.name=C Builder Command
|
CBuildCommand.name=C Builder Command
|
||||||
|
CBuildConsole.name=C Builder Console
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
name="%pluginName"
|
name="%pluginName"
|
||||||
version="1.0.0"
|
version="1.0.0"
|
||||||
provider-name="%providerName"
|
provider-name="%providerName"
|
||||||
class="org.eclipse.cdt.internal.CCorePlugin">
|
class="org.eclipse.cdt.core.CCorePlugin">
|
||||||
|
|
||||||
<runtime>
|
<runtime>
|
||||||
<library name="cdtcore.jar">
|
<library name="cdtcore.jar">
|
||||||
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
<extension-point id="CBuildCommand" name="%CBuildCommand.name"/>
|
<extension-point id="CBuildCommand" name="%CBuildCommand.name"/>
|
||||||
|
<extension-point id="CBuildConsole" name="%CBuildConsole.name"/>
|
||||||
|
|
||||||
<extension
|
<extension
|
||||||
id="cbuilder"
|
id="cbuilder"
|
||||||
|
|
|
@ -13,11 +13,10 @@ import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
import org.eclipse.core.runtime.IExtension;
|
import org.eclipse.core.runtime.IExtension;
|
||||||
import org.eclipse.core.runtime.IExtensionPoint;
|
import org.eclipse.core.runtime.IExtensionPoint;
|
||||||
import org.eclipse.core.runtime.Plugin;
|
import org.eclipse.core.runtime.Plugin;
|
||||||
|
import org.eclipse.core.runtime.Preferences;
|
||||||
import org.eclipse.core.runtime.QualifiedName;
|
import org.eclipse.core.runtime.QualifiedName;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.resources.IBuildInfo;
|
import org.eclipse.cdt.core.resources.IBuildInfo;
|
||||||
import org.eclipse.cdt.core.resources.IPropertyStore;
|
|
||||||
import org.eclipse.cdt.internal.CCorePlugin;
|
|
||||||
|
|
||||||
public class BuildInfoFactory {
|
public class BuildInfoFactory {
|
||||||
public static final String LOCATION = "buildLocation";
|
public static final String LOCATION = "buildLocation";
|
||||||
|
@ -30,7 +29,7 @@ public class BuildInfoFactory {
|
||||||
public static abstract class Store implements IBuildInfo {
|
public static abstract class Store implements IBuildInfo {
|
||||||
public String getBuildLocation() {
|
public String getBuildLocation() {
|
||||||
if ( isDefaultBuildCmd() ) {
|
if ( isDefaultBuildCmd() ) {
|
||||||
Plugin plugin = CCorePlugin.getDefaultPlugin();
|
Plugin plugin = CCorePlugin.getDefault();
|
||||||
if (plugin != null) {
|
if (plugin != null) {
|
||||||
IExtensionPoint extension = plugin.getDescriptor().getExtensionPoint("CBuildCommand");
|
IExtensionPoint extension = plugin.getDescriptor().getExtensionPoint("CBuildCommand");
|
||||||
if (extension != null) {
|
if (extension != null) {
|
||||||
|
@ -107,14 +106,14 @@ public class BuildInfoFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Preference extends Store {
|
public static class Preference extends Store {
|
||||||
IPropertyStore prefs;
|
Preferences prefs;
|
||||||
|
|
||||||
public Preference() {
|
public Preference() {
|
||||||
prefs = CCorePlugin.getDefault().getPropertyStore();
|
prefs = CCorePlugin.getDefault().getPluginPreferences();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void putValue(String name, String value) {
|
public void putValue(String name, String value) {
|
||||||
prefs.putValue(name, value);
|
prefs.setValue(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getString(String property) {
|
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.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.CCorePlugin;
|
|
||||||
import org.eclipse.cdt.core.*;
|
|
||||||
|
|
||||||
|
|
||||||
public class CCProjectNature extends CProjectNature {
|
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.
|
* (c) Copyright IBM Corp. 2000, 2001.
|
||||||
|
@ -9,25 +9,22 @@ import java.text.MessageFormat;
|
||||||
import java.util.MissingResourceException;
|
import java.util.MissingResourceException;
|
||||||
import java.util.ResourceBundle;
|
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.IWorkspace;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
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.IPluginDescriptor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Plugin;
|
import org.eclipse.core.runtime.Plugin;
|
||||||
import org.eclipse.core.runtime.Status;
|
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;
|
public class CCorePlugin extends Plugin {
|
||||||
import org.eclipse.cdt.core.index.IndexModel;
|
|
||||||
|
|
||||||
|
|
||||||
public class CCorePlugin extends AbstractPlugin implements ICPlugin {
|
|
||||||
|
|
||||||
public static final String PLUGIN_ID= "org.eclipse.cdt.core";
|
public static final String PLUGIN_ID= "org.eclipse.cdt.core";
|
||||||
public static final String BUILDER_ID= PLUGIN_ID + ".cbuilder";
|
public static final String BUILDER_ID= PLUGIN_ID + ".cbuilder";
|
||||||
|
@ -71,15 +68,7 @@ public class CCorePlugin extends AbstractPlugin implements ICPlugin {
|
||||||
return fgResourceBundle;
|
return fgResourceBundle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Plugin getDefaultPlugin() {
|
public static CCorePlugin getDefault() {
|
||||||
return fgCPlugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ICPlugin getDefault() {
|
|
||||||
ICPlugin plugin;
|
|
||||||
if ((plugin = (ICPlugin)fgCPlugin.getAdapter(ICPlugin.class)) != null) {
|
|
||||||
return plugin;
|
|
||||||
}
|
|
||||||
return fgCPlugin;
|
return fgCPlugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,53 +80,13 @@ public class CCorePlugin extends AbstractPlugin implements ICPlugin {
|
||||||
((Plugin)getDefault()).getLog().log(status);
|
((Plugin)getDefault()).getLog().log(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPropertyStore getPropertyStore() {
|
|
||||||
return getPreferenceStore();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------ CPlugin
|
// ------ 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) {
|
public CCorePlugin(IPluginDescriptor descriptor) {
|
||||||
super(descriptor);
|
super(descriptor);
|
||||||
fgCPlugin= this;
|
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
|
* @see Plugin#shutdown
|
||||||
*/
|
*/
|
||||||
|
@ -157,15 +106,28 @@ public class CCorePlugin extends AbstractPlugin implements ICPlugin {
|
||||||
getIndexModel();
|
getIndexModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public IConsole getConsole() throws CoreException {
|
||||||
* @see AbstractPlugin#initializeDefaultPreferences
|
IConsole consoleDocument = null;
|
||||||
*/
|
|
||||||
protected void initializeDefaultPreferences(IPropertyStore store) {
|
IExtensionPoint extension = getDescriptor().getExtensionPoint("CBuildConsole");
|
||||||
super.initializeDefaultPreferences(store);
|
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 IConsole getConsole() {
|
public ConsoleOutputStream getOutputStream() {
|
||||||
return fConsoleDocument;
|
return new ConsoleOutputStream();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return consoleDocument;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreModel getCoreModel() {
|
public CoreModel getCoreModel() {
|
||||||
|
@ -175,10 +137,4 @@ public class CCorePlugin extends AbstractPlugin implements ICPlugin {
|
||||||
public IndexModel getIndexModel() {
|
public IndexModel getIndexModel() {
|
||||||
return IndexModel.getDefault();
|
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.core.runtime.Plugin;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.resources.IBuildInfo;
|
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.core.model.ICModelMarker;
|
||||||
import org.eclipse.cdt.internal.CCorePlugin;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
||||||
import org.eclipse.core.resources.IResource;
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -5,6 +5,3 @@
|
||||||
#
|
#
|
||||||
################################################
|
################################################
|
||||||
|
|
||||||
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.model.ICModelMarker;
|
||||||
import org.eclipse.cdt.core.resources.ACBuilder;
|
import org.eclipse.cdt.core.resources.ACBuilder;
|
||||||
import org.eclipse.cdt.core.resources.IConsole;
|
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.internal.errorparsers.ErrorParserManager;
|
||||||
import org.eclipse.cdt.core.*;
|
import org.eclipse.cdt.core.*;
|
||||||
import org.eclipse.cdt.core.resources.*;
|
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 static final String BUILD_ERROR= "CBuilder.build_error";
|
||||||
|
|
||||||
private IPropertyStore fPreferenceStore;
|
|
||||||
private ErrorParserManager fErrorParserManager;
|
private ErrorParserManager fErrorParserManager;
|
||||||
|
|
||||||
public CBuilder() {
|
public CBuilder() {
|
||||||
fPreferenceStore= CCorePlugin.getDefault().getPropertyStore();
|
|
||||||
fErrorParserManager= new ErrorParserManager(this);
|
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.Status;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
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.IPath;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.resources.ACBuilder;
|
import org.eclipse.cdt.core.resources.ACBuilder;
|
||||||
import org.eclipse.cdt.internal.CCorePlugin;
|
|
||||||
public class ErrorParserManager {
|
public class ErrorParserManager {
|
||||||
|
|
||||||
private static String PREF_ERROR_PARSER= "errorOutputParser";
|
private static String PREF_ERROR_PARSER= "errorOutputParser";
|
||||||
|
@ -92,7 +92,7 @@ public class ErrorParserManager {
|
||||||
|
|
||||||
private void readPreferences() {
|
private void readPreferences() {
|
||||||
fErrorParsers.clear();
|
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) {
|
if (parserNames != null && parserNames.length() > 0) {
|
||||||
StringTokenizer tok= new StringTokenizer(parserNames, ";");
|
StringTokenizer tok= new StringTokenizer(parserNames, ";");
|
||||||
while (tok.hasMoreElements()) {
|
while (tok.hasMoreElements()) {
|
||||||
|
@ -133,7 +133,7 @@ public class ErrorParserManager {
|
||||||
buf.append(fErrorParsers.get(i).getClass().getName());
|
buf.append(fErrorParsers.get(i).getClass().getName());
|
||||||
buf.append(';');
|
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) {
|
protected void collectFiles(IContainer parent, List result) {
|
||||||
|
|
|
@ -29,23 +29,23 @@
|
||||||
<extension-point id="CCompletionContributor" name="%completionContributorName"/>
|
<extension-point id="CCompletionContributor" name="%completionContributorName"/>
|
||||||
<extension-point id="CElementFilters" name="%elementFiltersName"/>
|
<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 -->
|
<!-- 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"/>
|
<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 -->
|
<!-- 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"/>
|
<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 -->
|
<!-- 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"/>
|
<extension-point id="editorRulerActions" name="%editorRulerActionsName"/>
|
||||||
|
|
||||||
|
@ -148,8 +148,8 @@
|
||||||
id="org.eclipse.cdt.ui.CView">
|
id="org.eclipse.cdt.ui.CView">
|
||||||
</view>
|
</view>
|
||||||
</extension>
|
</extension>
|
||||||
<!-- The wizards -->
|
|
||||||
<!-- For C Wizards -->
|
<!-- For C Wizards -->
|
||||||
|
<!-- The wizards -->
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.newWizards">
|
point="org.eclipse.ui.newWizards">
|
||||||
<category
|
<category
|
||||||
|
@ -246,14 +246,6 @@
|
||||||
</filter>
|
</filter>
|
||||||
</page>
|
</page>
|
||||||
</extension>
|
</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
|
<extension
|
||||||
point="org.eclipse.debug.core.launchers">
|
point="org.eclipse.debug.core.launchers">
|
||||||
|
@ -267,6 +259,14 @@
|
||||||
id="org.eclipse.cdt.core.CApplicationLauncher">
|
id="org.eclipse.cdt.core.CApplicationLauncher">
|
||||||
</launcher>
|
</launcher>
|
||||||
</extension>
|
</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
|
<extension
|
||||||
point="org.eclipse.ui.popupMenus">
|
point="org.eclipse.ui.popupMenus">
|
||||||
|
@ -398,5 +398,10 @@
|
||||||
id="org.eclipse.cdt.ui">
|
id="org.eclipse.cdt.ui">
|
||||||
</debugModelPresentation>
|
</debugModelPresentation>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.cdt.core.CBuildConsole">
|
||||||
|
<CBuildConsole class="org.eclipse.cdt.internal.ui.CConsole">
|
||||||
|
</CBuildConsole>
|
||||||
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</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.
|
* 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.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
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.IPropertySource;
|
||||||
import org.eclipse.ui.views.properties.ResourcePropertySource;
|
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.
|
* Implements basic UI support for C elements.
|
||||||
*/
|
*/
|
||||||
|
@ -61,9 +61,10 @@ public class CElementAdapterFactory implements IAdapterFactory {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
res = celem.getCorrespondingResource();
|
if ( celem instanceof ICResource ) {
|
||||||
if (res != null)
|
res = ((ICResource)celem).getResource();
|
||||||
return new ResourcePropertySource(res);
|
return new ResourcePropertySource(res);
|
||||||
|
}
|
||||||
} catch (CModelException e) {
|
} catch (CModelException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,14 +33,11 @@ import org.eclipse.ui.IWorkbenchWindow;
|
||||||
import org.eclipse.ui.PartInitException;
|
import org.eclipse.ui.PartInitException;
|
||||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.ConsoleOutputStream;
|
import org.eclipse.cdt.core.ConsoleOutputStream;
|
||||||
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.ICElement;
|
||||||
import org.eclipse.cdt.core.resources.ICPlugin;
|
|
||||||
import org.eclipse.cdt.core.resources.IConsole;
|
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.cview.CView;
|
||||||
import org.eclipse.cdt.internal.ui.editor.CDocumentProvider;
|
import org.eclipse.cdt.internal.ui.editor.CDocumentProvider;
|
||||||
import org.eclipse.cdt.internal.ui.editor.asm.AsmTextTools;
|
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;
|
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_ID= "org.eclipse.cdt.ui";
|
||||||
public static final String PLUGIN_CORE_ID= "org.eclipse.cdt.core";
|
public static final String PLUGIN_CORE_ID= "org.eclipse.cdt.core";
|
||||||
|
@ -134,14 +131,6 @@ public class CPlugin extends AbstractUIPlugin implements ICPlugin {
|
||||||
|
|
||||||
// ------ CPlugin
|
// ------ CPlugin
|
||||||
|
|
||||||
public IMessageDialog getMessageDialog() {
|
|
||||||
return new IMessageDialog() {
|
|
||||||
public void openError(String title, String msg) {
|
|
||||||
MessageDialog.openError(getActiveWorkbenchShell(), title, msg);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private ConsoleDocument fConsoleDocument;
|
private ConsoleDocument fConsoleDocument;
|
||||||
private CoreModel fCoreModel;
|
private CoreModel fCoreModel;
|
||||||
private CDocumentProvider fDocumentProvider;
|
private CDocumentProvider fDocumentProvider;
|
||||||
|
@ -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) {
|
public CPlugin(IPluginDescriptor descriptor) {
|
||||||
super(descriptor);
|
super(descriptor);
|
||||||
fgCPlugin= this;
|
fgCPlugin= this;
|
||||||
|
@ -321,7 +289,6 @@ public class CPlugin extends AbstractUIPlugin implements ICPlugin {
|
||||||
IAdapterManager manager= Platform.getAdapterManager();
|
IAdapterManager manager= Platform.getAdapterManager();
|
||||||
manager.registerAdapters(new ResourceAdapterFactory(), IResource.class);
|
manager.registerAdapters(new ResourceAdapterFactory(), IResource.class);
|
||||||
manager.registerAdapters(new CElementAdapterFactory(), ICElement.class);
|
manager.registerAdapters(new CElementAdapterFactory(), ICElement.class);
|
||||||
manager.registerAdapters(new PluginAdapterFactory(), CCorePlugin.class);
|
|
||||||
CPluginImages.initialize();
|
CPluginImages.initialize();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -348,15 +315,6 @@ public class CPlugin extends AbstractUIPlugin implements ICPlugin {
|
||||||
return fCoreModel;
|
return fCoreModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getAdapter(Class adapter) {
|
|
||||||
return Platform.getAdapterManager().getAdapter(this, adapter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
public ACDebugModel getDebugModel() {
|
|
||||||
return fModel;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
public static String getPluginId() {
|
public static String getPluginId() {
|
||||||
return PLUGIN_ID;
|
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.ICElement;
|
||||||
import org.eclipse.cdt.core.model.ICModelMarker;
|
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.ISourceRange;
|
||||||
import org.eclipse.cdt.core.model.ISourceReference;
|
import org.eclipse.cdt.core.model.ISourceReference;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IMarker;
|
import org.eclipse.core.resources.IMarker;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
import org.eclipse.jface.text.Position;
|
import org.eclipse.jface.text.Position;
|
||||||
import org.eclipse.jface.text.source.Annotation;
|
import org.eclipse.jface.text.source.Annotation;
|
||||||
import org.eclipse.jface.text.source.IAnnotationModel;
|
import org.eclipse.jface.text.source.IAnnotationModel;
|
||||||
|
|
||||||
import org.eclipse.ui.texteditor.MarkerAnnotation;
|
import org.eclipse.ui.texteditor.MarkerAnnotation;
|
||||||
import org.eclipse.ui.texteditor.MarkerUtilities;
|
import org.eclipse.ui.texteditor.MarkerUtilities;
|
||||||
|
|
||||||
|
@ -43,9 +41,9 @@ public class ErrorTickAdornmentProvider implements IAdornmentProvider {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ICElement.C_PROJECT:
|
case ICElement.C_PROJECT:
|
||||||
case ICElement.C_FOLDER:
|
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:
|
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_FUNCTION:
|
||||||
case ICElement.C_CLASS:
|
case ICElement.C_CLASS:
|
||||||
case ICElement.C_UNION:
|
case ICElement.C_UNION:
|
||||||
|
@ -56,7 +54,7 @@ public class ErrorTickAdornmentProvider implements IAdornmentProvider {
|
||||||
if (tu != null && tu.exists()) {
|
if (tu != null && tu.exists()) {
|
||||||
// I assume that only source elements in compilation unit can have markers
|
// I assume that only source elements in compilation unit can have markers
|
||||||
ISourceRange range= ((ISourceReference)element).getSourceRange();
|
ISourceRange range= ((ISourceReference)element).getSourceRange();
|
||||||
return getErrorTicksFromMarkers(tu.getCorrespondingResource(), IResource.DEPTH_ONE, range);
|
return getErrorTicksFromMarkers(tu.getResource(), IResource.DEPTH_ONE, range);
|
||||||
}
|
}
|
||||||
default:
|
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) {
|
if (definedFilters == null) {
|
||||||
// Overide the default by the user preference
|
// Overide the default by the user preference
|
||||||
CPlugin plugin = CPlugin.getDefault();
|
CPlugin plugin = CPlugin.getDefault();
|
||||||
String storedPatterns= plugin.getPropertyStore().getString(FILTERS_TAG);
|
String storedPatterns= plugin.getPluginPreferences().getString(FILTERS_TAG);
|
||||||
|
|
||||||
if (storedPatterns.length() > 0) {
|
if (storedPatterns.length() > 0) {
|
||||||
StringTokenizer entries = new StringTokenizer(storedPatterns, COMMA_SEPARATOR);
|
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.core.runtime.IStatus;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A settable IStatus
|
* A settable IStatus
|
||||||
|
|
|
@ -5,12 +5,20 @@ package org.eclipse.cdt.internal.ui.preferences;
|
||||||
* All Rights Reserved.
|
* 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.resources.IProject;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
import org.eclipse.swt.layout.FillLayout;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.swt.widgets.Label;
|
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.DialogPageContextComputer;
|
||||||
import org.eclipse.ui.help.WorkbenchHelp;
|
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 {
|
public class CProjectPropertyPage extends PropertyPage implements IStatusChangeListener, IValidation {
|
||||||
|
|
||||||
private static final String MSG_NOCPROJECT= "CProjectPropertyPage.nocproject";
|
private static final String MSG_NOCPROJECT= "CProjectPropertyPage.nocproject";
|
||||||
|
@ -40,7 +39,7 @@ public class CProjectPropertyPage extends PropertyPage implements IStatusChangeL
|
||||||
|
|
||||||
protected Control createContents(Composite parent) {
|
protected Control createContents(Composite parent) {
|
||||||
Composite composite= new Composite(parent, SWT.NONE);
|
Composite composite= new Composite(parent, SWT.NONE);
|
||||||
composite.setLayout(new GridLayout());
|
composite.setLayout(new FillLayout());
|
||||||
|
|
||||||
IProject project= getProject();
|
IProject project= getProject();
|
||||||
if (!project.isOpen()) {
|
if (!project.isOpen()) {
|
||||||
|
@ -55,8 +54,6 @@ public class CProjectPropertyPage extends PropertyPage implements IStatusChangeL
|
||||||
private void contentForCProject(Composite parent) {
|
private void contentForCProject(Composite parent) {
|
||||||
folder = new TabFolder(parent, SWT.NONE);
|
folder = new TabFolder(parent, SWT.NONE);
|
||||||
folder.setLayout(new TabFolderLayout());
|
folder.setLayout(new TabFolderLayout());
|
||||||
GridData gdFolder= new GridData(GridData.FILL_HORIZONTAL);
|
|
||||||
folder.setLayoutData(gdFolder);
|
|
||||||
|
|
||||||
referenceBlock = new ReferenceBlock(this, getProject());
|
referenceBlock = new ReferenceBlock(this, getProject());
|
||||||
TabItem item = new TabItem(folder, SWT.NONE);
|
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.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.internal.ui.CPlugin;
|
import org.eclipse.cdt.internal.ui.CPlugin;
|
||||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||||
|
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||||
import org.eclipse.cdt.utils.ui.swt.IValidation;
|
import org.eclipse.cdt.utils.ui.swt.IValidation;
|
||||||
|
|
||||||
public class ReferenceBlock implements IWizardTab {
|
public class ReferenceBlock implements IWizardTab {
|
||||||
|
@ -59,14 +60,9 @@ public class ReferenceBlock implements IWizardTab {
|
||||||
lbldata.horizontalSpan = 1;
|
lbldata.horizontalSpan = 1;
|
||||||
label.setLayoutData(lbldata);
|
label.setLayoutData(lbldata);
|
||||||
|
|
||||||
referenceProjectsViewer = new CheckboxTableViewer(composite, SWT.BORDER);
|
referenceProjectsViewer = ControlFactory.createListViewer
|
||||||
GridData data = new GridData();
|
(composite, null, SWT.DEFAULT, SWT.DEFAULT, GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
|
||||||
data.horizontalAlignment = GridData.FILL;
|
|
||||||
data.grabExcessHorizontalSpace = true;
|
|
||||||
|
|
||||||
data.heightHint = getDefaultFontHeight( referenceProjectsViewer.getTable(),
|
|
||||||
PROJECT_LIST_MULTIPLIER);
|
|
||||||
referenceProjectsViewer.getTable().setLayoutData(data);
|
|
||||||
referenceProjectsViewer.setLabelProvider(new WorkbenchLabelProvider());
|
referenceProjectsViewer.setLabelProvider(new WorkbenchLabelProvider());
|
||||||
referenceProjectsViewer.setContentProvider(getContentProvider());
|
referenceProjectsViewer.setContentProvider(getContentProvider());
|
||||||
referenceProjectsViewer.setInput(ResourcesPlugin.getWorkspace());
|
referenceProjectsViewer.setInput(ResourcesPlugin.getWorkspace());
|
||||||
|
@ -96,11 +92,11 @@ public class ReferenceBlock implements IWizardTab {
|
||||||
if (!(element instanceof IWorkspace))
|
if (!(element instanceof IWorkspace))
|
||||||
return new Object[0];
|
return new Object[0];
|
||||||
ArrayList aList = new ArrayList(15);
|
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++) {
|
for (int i = 0; i < projects.length; i++) {
|
||||||
if (CoreModel.hasCNature(projects[i])) {
|
if (CoreModel.hasCNature(projects[i])) {
|
||||||
// Do not show the actual project being look at
|
// Do not show the actual project being look at
|
||||||
if (project != null && project.equals(projects[i])) {
|
if ((project != null) && project.equals(projects[i])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
aList.add(projects[i]);
|
aList.add(projects[i]);
|
||||||
|
|
Loading…
Add table
Reference in a new issue