1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Start of work on doing Qt the new way.

Change-Id: Icc891538549485f9ad99614f36262ed218fb0609
This commit is contained in:
Doug Schaefer 2015-08-26 16:58:18 -04:00
parent 21f8bd8742
commit eb8d3cad86
91 changed files with 598 additions and 206 deletions

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="libs/freemarker-2.3.22.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>

View file

@ -2,8 +2,8 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.qt.core;singleton:=true
Bundle-Version: 1.1.0.qualifier
Bundle-Activator: org.eclipse.cdt.qt.core.QtPlugin
Bundle-Version: 2.0.0.qualifier
Bundle-Activator: org.eclipse.cdt.internal.qt.core.QtPlugin
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
@ -16,7 +16,9 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Export-Package: org.eclipse.cdt.internal.qt.core;x-friends:="org.eclipse.cdt.qt.ui,org.eclipse.cdt.qt.tests",
org.eclipse.cdt.internal.qt.core.build;x-friends:="org.eclipse.cdt.qt.ui",
org.eclipse.cdt.internal.qt.core.index;x-friends:="org.eclipse.cdt.qt.tests",
org.eclipse.cdt.internal.qt.core.parser;x-friends:="org.eclipse.cdt.qt.ui",
org.eclipse.cdt.qt.core,
org.eclipse.cdt.qt.core.index
org.eclipse.cdt.internal.qt.core.project;x-friends:="org.eclipse.cdt.qt.ui"
Bundle-ClassPath: libs/freemarker-2.3.22.jar,
.

View file

@ -5,6 +5,7 @@ bin.includes = META-INF/,\
plugin.xml,\
templates/,\
about.html,\
plugin.properties
plugin.properties,\
libs/freemarker-2.3.22.jar
src.includes = about.html,\
schema/

Binary file not shown.

View file

@ -41,9 +41,12 @@
point="org.eclipse.core.resources.natures">
<runtime>
<run
class="org.eclipse.cdt.qt.core.QtNature">
class="org.eclipse.cdt.internal.qt.core.QtNature">
</run>
</runtime>
<builder
id="org.eclipse.cdt.qt.core.qtBuilder">
</builder>
</extension>
<extension
point="org.eclipse.cdt.core.PDOMASTProcessor"
@ -112,4 +115,16 @@
<super type="org.eclipse.cdt.codan.core.codanProblem"/>
<persistent value="true"/>
</extension>
<extension
id="qtBuilder"
point="org.eclipse.core.resources.builders">
<builder
callOnEmptyDelta="true"
hasNature="true"
isConfigurable="true"
supportsConfigurations="true">
<run
class="org.eclipse.cdt.internal.qt.core.build.QtBuilder">
</run></builder>
</extension>
</plugin>

View file

@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
<version>1.1.0-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.qt.core</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -39,9 +39,8 @@ import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.cdt.qt.core.QtPlugin;
import org.eclipse.cdt.qt.core.index.IQMethod;
import org.eclipse.cdt.qt.core.index.IQObject;
import org.eclipse.cdt.internal.qt.core.index.IQMethod;
import org.eclipse.cdt.internal.qt.core.index.IQObject;
import org.eclipse.core.resources.IProject;
@SuppressWarnings("restriction")

View file

@ -20,7 +20,6 @@ import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
import org.eclipse.cdt.qt.core.QtKeywords;
/**
* Extracts required information from FunctionCallExpressions that call

View file

@ -16,7 +16,6 @@ import org.eclipse.cdt.core.dom.ast.IASTInitializerClause;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.qt.core.QtKeywords;
/**
* Utility for managing interaction with QObject::connect and QObject::disconnect function

View file

@ -21,7 +21,6 @@ import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.cdt.qt.core.QtPlugin;
import org.eclipse.cdt.utils.spawner.ProcessFactory;
import org.eclipse.core.resources.IResource;
import org.w3c.dom.Element;

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.cdt.qt.core;
package org.eclipse.cdt.internal.qt.core;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IBinding;

View file

@ -21,13 +21,11 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.qt.core.index.IQMethod;
import org.eclipse.cdt.internal.qt.core.index.IQObject;
import org.eclipse.cdt.internal.qt.core.index.QtIndex;
import org.eclipse.cdt.internal.qt.core.pdom.ASTNameReference;
import org.eclipse.cdt.internal.qt.core.pdom.QtASTImageLocation;
import org.eclipse.cdt.qt.core.QtKeywords;
import org.eclipse.cdt.qt.core.QtPlugin;
import org.eclipse.cdt.qt.core.index.IQMethod;
import org.eclipse.cdt.qt.core.index.IQObject;
import org.eclipse.cdt.qt.core.index.QtIndex;
import org.eclipse.core.resources.IProject;
/**

View file

@ -8,7 +8,7 @@
* Contributors:
* Doug Schaefer (QNX) - Initial implementation
*******************************************************************************/
package org.eclipse.cdt.qt.core;
package org.eclipse.cdt.internal.qt.core;
import java.util.Arrays;
@ -28,7 +28,7 @@ import org.eclipse.core.runtime.IStatus;
@SuppressWarnings("restriction")
public class QtNature implements IProjectNature {
private static final String ID = "org.eclipse.cdt.qt.core.qtNature";
public static final String ID = "org.eclipse.cdt.qt.core.qtNature"; //$NON-NLS-1$
private IProject project;
@ -65,15 +65,18 @@ public class QtNature implements IProjectNature {
if (!(index instanceof CIndex))
return;
// Don't reindex the project if it already has a Qt linkage. The index will be updated
// Don't reindex the project if it already has a Qt linkage. The index
// will be updated
// by the normal triggers.
for(IIndexFragment fragment : ((CIndex) index).getFragments())
for(IIndexLinkage linkage : fragment.getLinkages())
for (IIndexFragment fragment : ((CIndex) index).getFragments())
for (IIndexLinkage linkage : fragment.getLinkages())
if (linkage.getLinkageID() == ILinkage.QT_LINKAGE_ID)
return;
// We need to force the index to be rebuilt the first time the Qt nature is added. If
// this doesn't happen then the PDOM could have the current version (so nothing would trigger
// We need to force the index to be rebuilt the first time the Qt nature
// is added. If
// this doesn't happen then the PDOM could have the current version (so
// nothing would trigger
// an update) but no Qt content.
CCorePlugin.log(IStatus.INFO, "Reindexing " + project.getName() + " because Qt nature has been added");
CCorePlugin.getIndexManager().reindex(cProject);

View file

@ -5,7 +5,7 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.cdt.qt.core;
package org.eclipse.cdt.internal.qt.core;
import java.util.concurrent.atomic.AtomicBoolean;
@ -19,35 +19,37 @@ import org.eclipse.core.runtime.Status;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
import org.osgi.framework.BundleListener;
import org.osgi.framework.ServiceReference;
public class QtPlugin extends Plugin {
public static final String ID = "org.eclipse.cdt.qt.core";
public static final String SIGNAL_SLOT_TAGGER_ID = ID + ".signalslot.tagger";
public static final String ID = "org.eclipse.cdt.qt.core";
public static final String SIGNAL_SLOT_TAGGER_ID = ID + ".signalslot.tagger";
public static final int SignalSlot_Mask_signal = 1;
public static final int SignalSlot_Mask_slot = 2;
public static final int SignalSlot_Mask_signal = 1;
public static final int SignalSlot_Mask_slot = 2;
public static final String QMAKE_ENV_PROVIDER_EXT_POINT_NAME = "qmakeEnvProvider"; //$NON-NLS-1$
public static final String QMAKE_ENV_PROVIDER_ID = ID + "." + QMAKE_ENV_PROVIDER_EXT_POINT_NAME; //$NON-NLS-1$
public static final String QT_SYNTAX_ERR_ID = "org.eclipse.cdt.qt.core.qtproblem"; //$NON-NLS-1$
public static final String QT_SYNTAX_ERR_ID = "org.eclipse.cdt.qt.core.qtproblem"; //$NON-NLS-1$
/**
* Instances of QtIndex are cached within the session properties of the project from
* which they are created. This name is used to store the property.
*/
public static final QualifiedName QTINDEX_PROP_NAME = new QualifiedName(ID, "qtindex");
/**
* Instances of QtIndex are cached within the session properties of the
* project from which they are created. This name is used to store the
* property.
*/
public static final QualifiedName QTINDEX_PROP_NAME = new QualifiedName(ID, "qtindex");
private static QtPlugin instance;
private static QtPlugin instance;
public static QtPlugin getDefault() {
return instance;
}
public static QtPlugin getDefault() {
return instance;
}
public QtPlugin() {
instance = this;
}
public QtPlugin() {
instance = this;
}
@Override
public void start(BundleContext context) throws Exception {
@ -56,6 +58,7 @@ public class QtPlugin extends Plugin {
// since the CoreModel is not completely initialized at this time
BundleListener bundleListener = new BundleListener() {
final AtomicBoolean initStarted = new AtomicBoolean(false);
@Override
public void bundleChanged(BundleEvent bundleEvent) {
if (bundleEvent.getType() == BundleEvent.STARTED) {
@ -75,9 +78,9 @@ public class QtPlugin extends Plugin {
super.stop(context);
}
public static CoreException coreException(String msg) {
return new CoreException(new Status(IStatus.INFO, ID, msg));
}
public static CoreException coreException(String msg) {
return new CoreException(new Status(IStatus.INFO, ID, msg));
}
public static IStatus info(String msg) {
return new Status(IStatus.INFO, ID, msg);
@ -96,7 +99,7 @@ public class QtPlugin extends Plugin {
}
public static void log(Throwable e) {
String msg= e.getMessage();
String msg = e.getMessage();
if (msg == null) {
log("Error", e); //$NON-NLS-1$
} else {
@ -106,8 +109,7 @@ public class QtPlugin extends Plugin {
public static void log(String message, Throwable e) {
Throwable nestedException;
if (e instanceof CModelException
&& (nestedException = ((CModelException)e).getException()) != null) {
if (e instanceof CModelException && (nestedException = ((CModelException) e).getException()) != null) {
e = nestedException;
}
log(IStatus.ERROR, message, e);
@ -116,4 +118,11 @@ public class QtPlugin extends Plugin {
public static void log(int code, String msg, Throwable e) {
getDefault().getLog().log(new Status(code, ID, msg, e));
}
public static <T> T getService(Class<T> service) {
BundleContext context = instance.getBundle().getBundleContext();
ServiceReference<T> ref = context.getServiceReference(service);
return ref != null ? context.getService(ref) : null;
}
}

View file

@ -0,0 +1,57 @@
package org.eclipse.cdt.internal.qt.core;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
public class QtTemplateGenerator {
private final Configuration config;
public QtTemplateGenerator() throws CoreException {
config = new Configuration(Configuration.VERSION_2_3_22);
URL templateDirURL = FileLocator.find(QtPlugin.getDefault().getBundle(), new Path("/templates"), null); //$NON-NLS-1$
try {
config.setDirectoryForTemplateLoading(new File(FileLocator.toFileURL(templateDirURL).toURI()));
} catch (IOException | URISyntaxException e) {
throw new CoreException(new Status(IStatus.ERROR, QtPlugin.ID, "Template configuration", e));
}
}
public void generateFile(final Object model, String templateFile, final IFile outputFile, IProgressMonitor monitor)
throws CoreException {
try {
final Template template = config.getTemplate(templateFile);
try (StringWriter writer = new StringWriter()) {
template.process(model, writer);
try (ByteArrayInputStream in = new ByteArrayInputStream(
writer.getBuffer().toString().getBytes(StandardCharsets.UTF_8))) {
if (outputFile.exists()) {
outputFile.setContents(in, true, true, monitor);
} else {
outputFile.create(in, true, monitor);
}
}
}
} catch (IOException | TemplateException e) {
throw new CoreException(new Status(IStatus.ERROR, QtPlugin.ID, "Processing template " + templateFile, e));
}
}
}

View file

@ -0,0 +1,14 @@
package org.eclipse.cdt.internal.qt.core.build;
import java.io.IOException;
public interface IConsoleService {
// TODO add error parsers
void monitor(Process process) throws IOException;
void writeOutput(String msg) throws IOException;
void writeError(String msg) throws IOException;
}

View file

@ -0,0 +1,60 @@
package org.eclipse.cdt.internal.qt.core.build;
import java.io.File;
import java.io.IOException;
import java.util.Map;
import org.eclipse.cdt.internal.qt.core.QtPlugin;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
public class QtBuilder extends IncrementalProjectBuilder {
public static final String ID = QtPlugin.ID + ".qtBuilder"; //$NON-NLS-1$
private static final String qmake = "/Users/dschaefer/Qt/5.5/clang_64/bin/qmake"; //$NON-NLS-1$
@Override
protected IProject[] build(int kind, Map<String, String> args, IProgressMonitor monitor) throws CoreException {
IProject project = getProject();
try {
IConsoleService console = QtPlugin.getService(IConsoleService.class);
IFolder buildFolder = project.getFolder("build"); //$NON-NLS-1$
if (!buildFolder.exists()) {
buildFolder.create(IResource.FORCE | IResource.DERIVED, true, monitor);
}
IFile makeFile = buildFolder.getFile("Makefile"); //$NON-NLS-1$
if (!makeFile.exists()) {
// Need to run qmake
String[] command = new String[] { qmake, "../main.pro", "CONFIG+=debug" }; //$NON-NLS-1$ //$NON-NLS-2$
Process process = new ProcessBuilder(command).directory(new File(buildFolder.getLocationURI())).start();
StringBuffer msg = new StringBuffer();
for (String arg : command) {
msg.append(arg).append(' ');
}
msg.append('\n');
console.writeOutput(msg.toString());
console.monitor(process);
}
// run make
Process process = new ProcessBuilder("make").directory(new File(buildFolder.getLocationURI())).start(); //$NON-NLS-1$
console.monitor(process);
buildFolder.refreshLocal(IResource.DEPTH_INFINITE, monitor);
return new IProject[] { project };
} catch (IOException e) {
throw new CoreException(new Status(IStatus.ERROR, QtPlugin.ID, "Building " + project.getName(), e));
}
}
}

View file

@ -21,9 +21,9 @@ import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.internal.qt.core.ASTUtil;
import org.eclipse.cdt.internal.qt.core.QtFunctionCall;
import org.eclipse.cdt.internal.qt.core.QtMethodReference;
import org.eclipse.cdt.qt.core.QtNature;
import org.eclipse.cdt.qt.core.QtPlugin;
import org.eclipse.cdt.qt.core.index.IQMethod;
import org.eclipse.cdt.internal.qt.core.QtNature;
import org.eclipse.cdt.internal.qt.core.QtPlugin;
import org.eclipse.cdt.internal.qt.core.index.IQMethod;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.osgi.util.NLS;

View file

@ -7,8 +7,7 @@
*/
package org.eclipse.cdt.internal.qt.core.index;
import org.eclipse.cdt.qt.core.index.IQObject;
import org.eclipse.cdt.qt.core.index.IQObject.IMember;
import org.eclipse.cdt.internal.qt.core.index.IQObject.IMember;
public abstract class AbstractQField implements IQObject.IMember {

View file

@ -8,7 +8,7 @@
package org.eclipse.cdt.internal.qt.core.index;
import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.qt.core.QtPlugin;
import org.eclipse.cdt.internal.qt.core.QtPlugin;
import org.eclipse.core.runtime.CoreException;
/**

View file

@ -5,7 +5,7 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.cdt.qt.core.index;
package org.eclipse.cdt.internal.qt.core.index;
import org.eclipse.cdt.core.dom.ast.IBinding;

View file

@ -5,7 +5,7 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.cdt.qt.core.index;
package org.eclipse.cdt.internal.qt.core.index;
import java.util.Collection;

View file

@ -5,7 +5,7 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.cdt.qt.core.index;
package org.eclipse.cdt.internal.qt.core.index;
import java.util.Collection;

View file

@ -5,7 +5,7 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.cdt.qt.core.index;
package org.eclipse.cdt.internal.qt.core.index;
/**
* Represents a QMake environment. It is usually created by IQMakeEnvProvider.createEnv() method for a specific project configuration.

View file

@ -5,7 +5,7 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.cdt.qt.core.index;
package org.eclipse.cdt.internal.qt.core.index;
/**
* Represents a QMake environment similarly to IQMakeEnv but it has an explicit init method which is called to notify

View file

@ -5,7 +5,7 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.cdt.qt.core.index;
package org.eclipse.cdt.internal.qt.core.index;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;

View file

@ -5,7 +5,7 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.cdt.qt.core.index;
package org.eclipse.cdt.internal.qt.core.index;
import java.util.List;
import java.util.Map;

View file

@ -5,7 +5,7 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.cdt.qt.core.index;
package org.eclipse.cdt.internal.qt.core.index;
/**
* Represents provider of QMake information.

View file

@ -5,7 +5,7 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.cdt.qt.core.index;
package org.eclipse.cdt.internal.qt.core.index;
/**
* A listener used for notifying that a QMake information provided by IQMakeProjectInfo might have changed.

View file

@ -5,7 +5,7 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.cdt.qt.core.index;
package org.eclipse.cdt.internal.qt.core.index;
import java.util.Collection;

View file

@ -5,7 +5,7 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.cdt.qt.core.index;
package org.eclipse.cdt.internal.qt.core.index;
import java.util.Collection;
import java.util.List;

View file

@ -5,7 +5,7 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.cdt.qt.core.index;
package org.eclipse.cdt.internal.qt.core.index;
/**
* A container for things declared as Q_PROPERTY within a subclass of QObject. In Qt 4.8,

View file

@ -5,7 +5,7 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.cdt.qt.core.index;
package org.eclipse.cdt.internal.qt.core.index;
/**
* Represents a specific QML type registration.

View file

@ -5,7 +5,7 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.cdt.qt.core.index;
package org.eclipse.cdt.internal.qt.core.index;
/**
* Represents a Qt version in form of major and minor number.

View file

@ -13,7 +13,6 @@ import java.util.List;
import org.eclipse.cdt.core.dom.ast.IEnumerator;
import org.eclipse.cdt.core.dom.ast.IValue;
import org.eclipse.cdt.qt.core.index.IQEnum;
public class QEnum implements IQEnum {

View file

@ -13,8 +13,6 @@ import java.util.List;
import org.eclipse.cdt.internal.qt.core.pdom.QtPDOMQEnum;
import org.eclipse.cdt.internal.qt.core.pdom.AbstractQtPDOMClass;
import org.eclipse.cdt.qt.core.index.IQEnum;
import org.eclipse.cdt.qt.core.index.IQGadget;
import org.eclipse.core.runtime.CoreException;
public class QGadget implements IQGadget {

View file

@ -5,7 +5,7 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.cdt.qt.core.index;
package org.eclipse.cdt.internal.qt.core.index;
import java.util.Collection;
import java.util.Collections;

View file

@ -11,10 +11,8 @@ import java.util.Arrays;
import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.qt.core.QtPlugin;
import org.eclipse.cdt.qt.core.index.IQMakeEnv;
import org.eclipse.cdt.qt.core.index.IQMakeEnvProvider;
import org.eclipse.cdt.qt.core.index.IQMakeEnvProvider.IController;
import org.eclipse.cdt.internal.qt.core.QtPlugin;
import org.eclipse.cdt.internal.qt.core.index.IQMakeEnvProvider.IController;
import org.eclipse.core.expressions.EvaluationContext;
import org.eclipse.core.expressions.EvaluationResult;
import org.eclipse.core.expressions.Expression;

View file

@ -14,11 +14,7 @@ import java.util.List;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.qt.core.QtPlugin;
import org.eclipse.cdt.qt.core.index.IQMakeEnv;
import org.eclipse.cdt.qt.core.index.IQMakeEnv2;
import org.eclipse.cdt.qt.core.index.IQMakeEnvProvider;
import org.eclipse.cdt.qt.core.index.QMakeEnvInfo;
import org.eclipse.cdt.internal.qt.core.QtPlugin;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IConfigurationElement;

View file

@ -17,9 +17,7 @@ import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
import org.eclipse.cdt.qt.core.QtPlugin;
import org.eclipse.cdt.qt.core.index.IQtVersion;
import org.eclipse.cdt.qt.core.index.IQMakeInfo;
import org.eclipse.cdt.internal.qt.core.QtPlugin;
import org.eclipse.cdt.utils.spawner.ProcessFactory;
/**

View file

@ -17,7 +17,7 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.cdt.qt.core.QtPlugin;
import org.eclipse.cdt.internal.qt.core.QtPlugin;
/**
* Provides a parser for QMake output.

View file

@ -20,13 +20,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.qt.core.index.IQMakeEnv;
import org.eclipse.cdt.qt.core.index.IQMakeEnv2;
import org.eclipse.cdt.qt.core.index.IQMakeEnvProvider.IController;
import org.eclipse.cdt.qt.core.index.IQMakeInfo;
import org.eclipse.cdt.qt.core.index.IQMakeProjectInfo;
import org.eclipse.cdt.qt.core.index.IQMakeProjectInfoListener;
import org.eclipse.cdt.qt.core.index.QMakeEnvInfo;
import org.eclipse.cdt.internal.qt.core.index.IQMakeEnvProvider.IController;
import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;

View file

@ -5,9 +5,8 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.cdt.qt.core.index;
package org.eclipse.cdt.internal.qt.core.index;
import org.eclipse.cdt.internal.qt.core.index.QMakeProjectInfoManager;
import org.eclipse.core.resources.IProject;
/**

View file

@ -10,8 +10,7 @@ package org.eclipse.cdt.internal.qt.core.index;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.cdt.qt.core.QtPlugin;
import org.eclipse.cdt.qt.core.index.IQtVersion;
import org.eclipse.cdt.internal.qt.core.QtPlugin;
/**
* A container class to interpret and store value of the the qmake version.

View file

@ -12,10 +12,8 @@ import java.util.Collections;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.internal.qt.core.QtMethodUtil;
import org.eclipse.cdt.internal.qt.core.index.IQObject.IMember;
import org.eclipse.cdt.internal.qt.core.pdom.QtPDOMQMethod;
import org.eclipse.cdt.qt.core.index.IQMethod;
import org.eclipse.cdt.qt.core.index.IQObject;
import org.eclipse.cdt.qt.core.index.IQObject.IMember;
import org.eclipse.core.runtime.CoreException;
public class QMethod implements IQMethod {

View file

@ -18,11 +18,6 @@ import org.eclipse.cdt.internal.qt.core.pdom.QtPDOMQEnum;
import org.eclipse.cdt.internal.qt.core.pdom.QtPDOMQMethod;
import org.eclipse.cdt.internal.qt.core.pdom.QtPDOMQObject;
import org.eclipse.cdt.internal.qt.core.pdom.QtPDOMQmlRegistration;
import org.eclipse.cdt.qt.core.index.IQEnum;
import org.eclipse.cdt.qt.core.index.IQMethod;
import org.eclipse.cdt.qt.core.index.IQObject;
import org.eclipse.cdt.qt.core.index.IQProperty;
import org.eclipse.cdt.qt.core.index.IQmlRegistration;
import org.eclipse.core.runtime.CoreException;
public class QObject implements IQObject {

View file

@ -13,8 +13,6 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.qt.core.index.IQObject;
public class QObjectMembers<T extends IQObject.IMember> implements IQObject.IMembers<T> {
private final List<T> all;

View file

@ -7,9 +7,6 @@
*/
package org.eclipse.cdt.internal.qt.core.index;
import org.eclipse.cdt.qt.core.index.IQObject;
import org.eclipse.cdt.qt.core.index.IQProperty;
public class QProperty extends AbstractQField implements IQProperty {
private String type;

View file

@ -8,11 +8,9 @@
package org.eclipse.cdt.internal.qt.core.index;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.internal.qt.core.index.IQObject.IMember;
import org.eclipse.cdt.internal.qt.core.pdom.QtPDOMQmlRegistration;
import org.eclipse.cdt.internal.qt.core.pdom.QtPDOMQmlUncreatable;
import org.eclipse.cdt.qt.core.index.IQObject;
import org.eclipse.cdt.qt.core.index.IQObject.IMember;
import org.eclipse.cdt.qt.core.index.IQmlRegistration;
import org.eclipse.core.runtime.CoreException;
public class QmlRegistration implements IQmlRegistration {

View file

@ -18,8 +18,7 @@ import org.eclipse.cdt.core.index.IIndexMacro;
import org.eclipse.cdt.core.index.IndexFilter;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.qt.core.QtPlugin;
import org.eclipse.cdt.qt.core.index.QtIndex;
import org.eclipse.cdt.internal.qt.core.QtPlugin;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;

View file

@ -5,12 +5,11 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.cdt.qt.core.index;
package org.eclipse.cdt.internal.qt.core.index;
import java.util.Collection;
import org.eclipse.cdt.internal.qt.core.index.QtFactory;
import org.eclipse.cdt.qt.core.QtPlugin;
import org.eclipse.cdt.internal.qt.core.QtPlugin;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;

View file

@ -18,13 +18,9 @@ import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.index.IIndexBinding;
import org.eclipse.cdt.core.index.IndexFilter;
import org.eclipse.cdt.internal.qt.core.ASTUtil;
import org.eclipse.cdt.internal.qt.core.QtKeywords;
import org.eclipse.cdt.internal.qt.core.pdom.AbstractQtPDOMClass;
import org.eclipse.cdt.internal.qt.core.pdom.QtPDOMQObject;
import org.eclipse.cdt.qt.core.QtKeywords;
import org.eclipse.cdt.qt.core.index.IQGadget;
import org.eclipse.cdt.qt.core.index.IQObject;
import org.eclipse.cdt.qt.core.index.IQmlRegistration;
import org.eclipse.cdt.qt.core.index.QtIndex;
import org.eclipse.core.runtime.CoreException;
public class QtIndexImpl extends QtIndex {

View file

@ -20,7 +20,7 @@ import org.eclipse.cdt.internal.core.pdom.dom.IPDOMBinding;
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
import org.eclipse.cdt.qt.core.QtPlugin;
import org.eclipse.cdt.internal.qt.core.QtPlugin;
import org.eclipse.core.runtime.CoreException;
/**

View file

@ -10,7 +10,7 @@ package org.eclipse.cdt.internal.qt.core.pdom;
import org.eclipse.cdt.internal.core.pdom.PDOM;
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMLinkageFactory;
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
import org.eclipse.cdt.qt.core.QtPlugin;
import org.eclipse.cdt.internal.qt.core.QtPlugin;
import org.eclipse.core.runtime.CoreException;
@SuppressWarnings("restriction")

View file

@ -8,7 +8,7 @@
package org.eclipse.cdt.internal.qt.core.pdom;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.qt.core.index.IQMethod;
import org.eclipse.cdt.internal.qt.core.index.IQMethod;
import org.eclipse.core.runtime.CoreException;
public class QMethodName extends AbstractQObjectMemberName implements IQtASTName {

View file

@ -18,8 +18,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
import org.eclipse.cdt.internal.qt.core.ASTUtil;
import org.eclipse.cdt.qt.core.QtKeywords;
import org.eclipse.cdt.qt.core.index.IQmlRegistration;
import org.eclipse.cdt.internal.qt.core.QtKeywords;
import org.eclipse.cdt.internal.qt.core.index.IQmlRegistration;
import org.eclipse.core.runtime.CoreException;
public class QmlTypeRegistration extends ASTDelegatedName implements IQtASTName {

View file

@ -21,8 +21,8 @@ import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorMacroExpansion;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisibilityLabel;
import org.eclipse.cdt.qt.core.QtKeywords;
import org.eclipse.cdt.qt.core.index.IQMethod;
import org.eclipse.cdt.internal.qt.core.QtKeywords;
import org.eclipse.cdt.internal.qt.core.index.IQMethod;
/**
* The AST for a QObject is separated into regions based on macro expansions. These

View file

@ -41,12 +41,12 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPSemantics;
import org.eclipse.cdt.internal.core.parser.scanner.LocationMap;
import org.eclipse.cdt.internal.qt.core.ASTUtil;
import org.eclipse.cdt.internal.qt.core.QtFunctionCall;
import org.eclipse.cdt.internal.qt.core.QtKeywords;
import org.eclipse.cdt.internal.qt.core.QtMethodReference;
import org.eclipse.cdt.internal.qt.core.QtMethodUtil;
import org.eclipse.cdt.internal.qt.core.index.IQMethod;
import org.eclipse.cdt.internal.qt.core.index.IQProperty;
import org.eclipse.cdt.internal.qt.core.index.QProperty;
import org.eclipse.cdt.qt.core.QtKeywords;
import org.eclipse.cdt.qt.core.index.IQMethod;
import org.eclipse.cdt.qt.core.index.IQProperty;
@SuppressWarnings("restriction")
public class QtASTVisitor extends ASTVisitor {

View file

@ -31,7 +31,7 @@ import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
import org.eclipse.cdt.internal.core.pdom.dom.PDOMName;
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
import org.eclipse.cdt.internal.core.pdom.dom.cpp.PDOMCPPGlobalScope;
import org.eclipse.cdt.qt.core.QtPlugin;
import org.eclipse.cdt.internal.qt.core.QtPlugin;
import org.eclipse.core.runtime.CoreException;
@SuppressWarnings("restriction")

View file

@ -10,8 +10,8 @@ package org.eclipse.cdt.internal.qt.core.pdom;
import org.eclipse.cdt.internal.core.pdom.db.Database;
import org.eclipse.cdt.internal.core.pdom.db.IString;
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
import org.eclipse.cdt.qt.core.QtPlugin;
import org.eclipse.cdt.qt.core.index.IQProperty;
import org.eclipse.cdt.internal.qt.core.QtPlugin;
import org.eclipse.cdt.internal.qt.core.index.IQProperty;
import org.eclipse.core.runtime.CoreException;
@SuppressWarnings("restriction")

View file

@ -10,7 +10,7 @@ package org.eclipse.cdt.internal.qt.core.pdom;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.internal.core.pdom.db.Database;
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
import org.eclipse.cdt.qt.core.index.IQMethod;
import org.eclipse.cdt.internal.qt.core.index.IQMethod;
import org.eclipse.core.runtime.CoreException;
@SuppressWarnings("restriction")

View file

@ -13,7 +13,7 @@ import java.util.List;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
import org.eclipse.cdt.qt.core.index.IQProperty;
import org.eclipse.cdt.internal.qt.core.index.IQProperty;
import org.eclipse.core.runtime.CoreException;
@SuppressWarnings("restriction")

View file

@ -0,0 +1,61 @@
package org.eclipse.cdt.internal.qt.core.project;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.cdt.core.CCProjectNature;
import org.eclipse.cdt.core.CProjectNature;
import org.eclipse.cdt.internal.qt.core.QtNature;
import org.eclipse.cdt.internal.qt.core.QtTemplateGenerator;
import org.eclipse.cdt.internal.qt.core.build.QtBuilder;
import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
public class QtProjectGenerator {
private final IProject project;
public QtProjectGenerator(IProject project) {
this.project = project;
}
public void generate(IProgressMonitor monitor) throws CoreException {
// Add natures to project: C, C++, Arduino
IProjectDescription projDesc = project.getDescription();
String[] oldIds = projDesc.getNatureIds();
String[] newIds = new String[oldIds.length + 3];
System.arraycopy(oldIds, 0, newIds, 0, oldIds.length);
newIds[newIds.length - 3] = CProjectNature.C_NATURE_ID;
newIds[newIds.length - 2] = CCProjectNature.CC_NATURE_ID;
newIds[newIds.length - 1] = QtNature.ID;
projDesc.setNatureIds(newIds);
// Add Arduino Builder
ICommand command = projDesc.newCommand();
command.setBuilderName(QtBuilder.ID);
command.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, false);
projDesc.setBuildSpec(new ICommand[] { command });
project.setDescription(projDesc, monitor);
// Generate the project
QtTemplateGenerator templateGen = new QtTemplateGenerator();
Map<String, Object> fmModel = new HashMap<>();
fmModel.put("projectName", project.getName()); //$NON-NLS-1$
IFile sourceFile = project.getFile("main.cpp"); //$NON-NLS-1$
templateGen.generateFile(fmModel, "project2/appProject/main.cpp", sourceFile, monitor); //$NON-NLS-1$
sourceFile = project.getFile("main.qml"); //$NON-NLS-1$
templateGen.generateFile(fmModel, "project2/appProject/main.qml", sourceFile, monitor); //$NON-NLS-1$
sourceFile = project.getFile("main.qrc"); //$NON-NLS-1$
templateGen.generateFile(fmModel, "project2/appProject/main.qrc", sourceFile, monitor); //$NON-NLS-1$
sourceFile = project.getFile("main.pro"); //$NON-NLS-1$
templateGen.generateFile(fmModel, "project2/appProject/main.pro", sourceFile, monitor); //$NON-NLS-1$
}
}

View file

@ -0,0 +1,12 @@
#include <QGuiApplication>
#include <QQmlApplicationEngine>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
return app.exec();
}

View file

@ -0,0 +1,8 @@
TEMPLATE = app
QT += qml quick
CONFIG += c++11
SOURCES += main.cpp
RESOURCES += main.qrc

View file

@ -0,0 +1,18 @@
import QtQuick 2.3
import QtQuick.Window 2.2
Window {
visible: true
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}
Text {
text: qsTr("Hello World")
anchors.centerIn: parent
}
}

View file

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
</qresource>
</RCC>

View file

@ -16,7 +16,7 @@ import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.testplugin.CProjectHelper;
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
import org.eclipse.cdt.core.testplugin.util.TestSourceReader;
import org.eclipse.cdt.qt.core.QtNature;
import org.eclipse.cdt.internal.qt.core.QtNature;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspace;

View file

@ -9,9 +9,9 @@ package org.eclipse.cdt.qt.tests;
import java.util.Collection;
import org.eclipse.cdt.qt.core.index.IQEnum;
import org.eclipse.cdt.qt.core.index.IQGadget;
import org.eclipse.cdt.qt.core.index.QtIndex;
import org.eclipse.cdt.internal.qt.core.index.IQEnum;
import org.eclipse.cdt.internal.qt.core.index.IQGadget;
import org.eclipse.cdt.internal.qt.core.index.QtIndex;
public class QGadgetTests extends BaseQtTestCase {

View file

@ -15,10 +15,10 @@ import java.util.Map;
import junit.framework.TestCase;
import org.eclipse.cdt.internal.qt.core.index.IQMakeInfo;
import org.eclipse.cdt.internal.qt.core.index.QMakeInfo;
import org.eclipse.cdt.internal.qt.core.index.QMakeParser;
import org.eclipse.cdt.internal.qt.core.index.QMakeVersion;
import org.eclipse.cdt.qt.core.index.IQMakeInfo;
public class QMakeTests extends TestCase {

View file

@ -18,12 +18,12 @@ import java.util.Set;
import org.eclipse.cdt.core.index.IIndexBinding;
import org.eclipse.cdt.core.index.IIndexName;
import org.eclipse.cdt.core.index.IndexFilter;
import org.eclipse.cdt.qt.core.index.IQEnum;
import org.eclipse.cdt.qt.core.index.IQMethod;
import org.eclipse.cdt.qt.core.index.IQObject;
import org.eclipse.cdt.qt.core.index.IQProperty;
import org.eclipse.cdt.qt.core.index.IQProperty.Attribute;
import org.eclipse.cdt.qt.core.index.QtIndex;
import org.eclipse.cdt.internal.qt.core.index.IQEnum;
import org.eclipse.cdt.internal.qt.core.index.IQMethod;
import org.eclipse.cdt.internal.qt.core.index.IQObject;
import org.eclipse.cdt.internal.qt.core.index.IQProperty;
import org.eclipse.cdt.internal.qt.core.index.QtIndex;
import org.eclipse.cdt.internal.qt.core.index.IQProperty.Attribute;
public class QObjectTests extends BaseQtTestCase {

View file

@ -9,9 +9,9 @@ package org.eclipse.cdt.qt.tests;
import java.util.Collection;
import org.eclipse.cdt.qt.core.index.IQObject;
import org.eclipse.cdt.qt.core.index.IQmlRegistration;
import org.eclipse.cdt.qt.core.index.QtIndex;
import org.eclipse.cdt.internal.qt.core.index.IQObject;
import org.eclipse.cdt.internal.qt.core.index.IQmlRegistration;
import org.eclipse.cdt.internal.qt.core.index.QtIndex;
public class QmlRegistrationTests extends BaseQtTestCase {

View file

@ -7,8 +7,8 @@
*/
package org.eclipse.cdt.qt.tests;
import org.eclipse.cdt.qt.core.index.IQObject;
import org.eclipse.cdt.qt.core.index.QtIndex;
import org.eclipse.cdt.internal.qt.core.index.IQObject;
import org.eclipse.cdt.internal.qt.core.index.QtIndex;
public class QtIndexTests extends BaseQtTestCase {

View file

@ -16,12 +16,12 @@ import java.util.Set;
import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.internal.core.model.ext.SourceRange;
import org.eclipse.cdt.internal.qt.core.index.IQMethod;
import org.eclipse.cdt.internal.qt.core.index.IQObject;
import org.eclipse.cdt.internal.qt.core.index.QtIndex;
import org.eclipse.cdt.internal.ui.editor.CEditor;
import org.eclipse.cdt.internal.ui.search.CSearchResult;
import org.eclipse.cdt.internal.ui.search.CSearchTextSelectionQuery;
import org.eclipse.cdt.qt.core.index.IQMethod;
import org.eclipse.cdt.qt.core.index.IQObject;
import org.eclipse.cdt.qt.core.index.QtIndex;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IStatus;

View file

@ -2,20 +2,22 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.qt.ui;singleton:=true
Bundle-Version: 1.1.0.qualifier
Bundle-Activator: org.eclipse.cdt.qt.ui.QtUIPlugin
Bundle-Version: 2.0.0.qualifier
Bundle-Activator: org.eclipse.cdt.internal.qt.ui.QtUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
org.eclipse.ui,
org.eclipse.ui.ide,
org.eclipse.ui.console;bundle-version="3.6.0",
org.eclipse.ui.editors,
org.eclipse.ui.workbench.texteditor,
org.eclipse.jface.text,
org.eclipse.cdt.ui,
org.eclipse.cdt.core,
org.eclipse.cdt.qt.core;bundle-version="[1.1.0,2.0.0)",
org.eclipse.jface.text,
org.eclipse.core.resources,
org.eclipse.ui.workbench.texteditor,
org.eclipse.ui.editors
org.eclipse.cdt.qt.core
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.cdt.internal.qt.ui.assist;x-friends:="org.eclipse.cdt.qt.tests",
org.eclipse.cdt.qt.ui
Export-Package: org.eclipse.cdt.internal.qt.ui.assist;x-friends:="org.eclipse.cdt.qt.tests"
Service-Component: OSGI-INF/consoleservice.xml

View file

@ -0,0 +1,6 @@
<component name="QtConsoleService">
<implementation class="org.eclipse.cdt.internal.qt.ui.QtConsoleService"/>
<service>
<provide interface="org.eclipse.cdt.internal.qt.core.build.IConsoleService"/>
</service>
</component>

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

View file

@ -8,4 +8,6 @@ pluginName=C/C++ Qt Support UI
providerName=Eclipse CDT
qtHighlighting.extName=Qt Semantic Highlighting
qtHighlighting.displayName=Qt Keywords
qtHighlighting.displayName=Qt Keywords
newProject.name=Qt Project

View file

@ -35,4 +35,16 @@
<partition type="__c_preprocessor"/>
</completionProposalComputer>
</extension>
<extension
point="org.eclipse.ui.newWizards">
<wizard
category="org.eclipse.cdt.ui.newCWizards"
class="org.eclipse.cdt.internal.qt.ui.NewQtProjectWizard"
finalPerspective="org.eclipse.cdt.ui.CPerspective"
icon="icons/newcc_app.gif"
id="org.eclipse.cdt.qt.ui.newProject"
name="%newProject.name"
project="true">
</wizard>
</extension>
</plugin>

View file

@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
<version>1.1.0-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.qt.ui</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -0,0 +1,35 @@
package org.eclipse.cdt.internal.qt.ui;
import org.eclipse.cdt.internal.qt.core.project.QtProjectGenerator;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
public class NewQtProjectWizard extends BasicNewProjectResourceWizard {
@Override
public boolean performFinish() {
if (!super.performFinish()) {
return false;
}
new Job("Creating Qt Project") {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
QtProjectGenerator generator = new QtProjectGenerator(getNewProject());
generator.generate(monitor);
} catch (CoreException e) {
return e.getStatus();
}
return Status.OK_STATUS;
}
}.schedule();
return true;
}
}

View file

@ -26,13 +26,12 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFieldReference;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.internal.qt.core.ASTUtil;
import org.eclipse.cdt.internal.qt.core.QtFunctionCallUtil;
import org.eclipse.cdt.internal.qt.core.QtKeywords;
import org.eclipse.cdt.internal.qt.core.index.IQMethod;
import org.eclipse.cdt.internal.qt.core.index.IQObject;
import org.eclipse.cdt.internal.qt.core.index.QtIndex;
import org.eclipse.cdt.internal.ui.text.contentassist.CCompletionProposal;
import org.eclipse.cdt.internal.ui.text.contentassist.RelevanceConstants;
import org.eclipse.cdt.qt.core.QtKeywords;
import org.eclipse.cdt.qt.core.index.IQMethod;
import org.eclipse.cdt.qt.core.index.IQObject;
import org.eclipse.cdt.qt.core.index.QtIndex;
import org.eclipse.cdt.qt.ui.QtUIPlugin;
import org.eclipse.cdt.ui.text.contentassist.ICEditorContentAssistInvocationContext;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.contentassist.ICompletionProposal;

View file

@ -15,7 +15,6 @@ import org.eclipse.cdt.internal.corext.template.c.CContextType;
import org.eclipse.cdt.internal.corext.template.c.TranslationUnitContext;
import org.eclipse.cdt.internal.corext.template.c.TranslationUnitContextType;
import org.eclipse.cdt.internal.ui.text.template.TemplateEngine.CTemplateProposal;
import org.eclipse.cdt.qt.ui.QtUIPlugin;
import org.eclipse.cdt.ui.text.contentassist.ICEditorContentAssistInvocationContext;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextSelection;

View file

@ -14,11 +14,10 @@ import org.eclipse.cdt.core.dom.ast.IASTCompletionContext;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.internal.corext.template.c.CContextType;
import org.eclipse.cdt.internal.qt.core.QtKeywords;
import org.eclipse.cdt.internal.qt.ui.assist.QPropertyExpansion;
import org.eclipse.cdt.internal.qt.ui.assist.QtProposalContext;
import org.eclipse.cdt.internal.qt.ui.assist.QtTemplateProposal;
import org.eclipse.cdt.qt.core.QtKeywords;
import org.eclipse.cdt.qt.ui.QtUIPlugin;
import org.eclipse.cdt.ui.text.contentassist.ICEditorContentAssistInvocationContext;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.contentassist.ICompletionProposal;

View file

@ -18,10 +18,9 @@ import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.internal.qt.core.QtNature;
import org.eclipse.cdt.internal.ui.text.contentassist.CContentAssistInvocationContext;
import org.eclipse.cdt.internal.ui.text.contentassist.ParsingBasedProposalComputer;
import org.eclipse.cdt.qt.core.QtNature;
import org.eclipse.cdt.qt.ui.QtUIPlugin;
import org.eclipse.cdt.ui.text.contentassist.ContentAssistInvocationContext;
import org.eclipse.cdt.ui.text.contentassist.ICEditorContentAssistInvocationContext;
import org.eclipse.core.resources.IProject;

View file

@ -0,0 +1,125 @@
package org.eclipse.cdt.internal.qt.ui;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.concurrent.CountDownLatch;
import org.eclipse.cdt.internal.qt.core.QtPlugin;
import org.eclipse.cdt.internal.qt.core.build.IConsoleService;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.console.ConsolePlugin;
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.MessageConsole;
import org.eclipse.ui.console.MessageConsoleStream;
public class QtConsoleService implements IConsoleService, IResourceChangeListener {
private MessageConsole console;
private MessageConsoleStream out;
private MessageConsoleStream err;
private void initConsole() {
console = new MessageConsole("Qt Builds", null);
ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { console });
out = console.newMessageStream();
err = console.newMessageStream();
// set the colors
final Display display = Display.getDefault();
display.syncExec(new Runnable() {
@Override
public void run() {
// TODO use preferences so user can change the colors
out.setColor(display.getSystemColor(SWT.COLOR_BLACK));
err.setColor(display.getSystemColor(SWT.COLOR_RED));
}
});
ResourcesPlugin.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.PRE_BUILD);
}
@Override
public void resourceChanged(IResourceChangeEvent event) {
switch (event.getType()) {
case IResourceChangeEvent.PRE_BUILD:
if (event.getBuildKind() != IncrementalProjectBuilder.AUTO_BUILD) {
// TODO this really should be done from the core and only when
// our projects are being built
console.clearConsole();
}
break;
}
}
@Override
public void monitor(final Process process) throws IOException {
if (console == null) {
initConsole();
}
console.activate();
final CountDownLatch latch = new CountDownLatch(2);
// Output stream reader
new Thread("Qt Build Console Output") {
public void run() {
try (BufferedReader processOut = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
for (String line = processOut.readLine(); line != null; line = processOut.readLine()) {
out.write(line);
out.write('\n');
}
} catch (IOException e) {
e.printStackTrace();
} finally {
latch.countDown();
}
}
}.start();
// Error stream reader
new Thread("Qt Build Console Error") {
public void run() {
try (BufferedReader processErr = new BufferedReader(new InputStreamReader(process.getErrorStream()))) {
for (String line = processErr.readLine(); line != null; line = processErr.readLine()) {
err.write(line);
out.write('\n');
}
} catch (IOException e) {
e.printStackTrace();
} finally {
latch.countDown();
}
}
}.start();
try {
latch.await();
process.waitFor();
} catch (InterruptedException e) {
QtPlugin.log(e);
}
}
@Override
public void writeOutput(String msg) throws IOException {
if (out == null) {
initConsole();
}
out.write(msg);
}
@Override
public void writeError(String msg) throws IOException {
if (err == null) {
initConsole();
}
err.write(msg);
}
}

View file

@ -12,7 +12,7 @@ import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IMacroBinding;
import org.eclipse.cdt.qt.core.QtKeywords;
import org.eclipse.cdt.internal.qt.core.QtKeywords;
import org.eclipse.cdt.ui.text.ISemanticHighlighter;
import org.eclipse.cdt.ui.text.ISemanticToken;

View file

@ -5,7 +5,7 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.cdt.qt.ui;
package org.eclipse.cdt.internal.qt.ui;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.core.runtime.CoreException;
@ -40,20 +40,15 @@ public class QtUIPlugin extends AbstractUIPlugin {
return null;
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
// context.registerService(IConsoleService.class, new
// QtConsoleService(), null);
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
@Override
public void stop(BundleContext context) throws Exception {
plugin = null;
@ -69,9 +64,9 @@ public class QtUIPlugin extends AbstractUIPlugin {
return plugin;
}
public static CoreException coreException(String msg) {
return new CoreException(new Status(IStatus.INFO, PLUGIN_ID, msg));
}
public static CoreException coreException(String msg) {
return new CoreException(new Status(IStatus.INFO, PLUGIN_ID, msg));
}
public static IStatus info(String msg) {
return new Status(IStatus.INFO, PLUGIN_ID, msg);
@ -90,7 +85,7 @@ public class QtUIPlugin extends AbstractUIPlugin {
}
public static void log(Throwable e) {
String msg= e.getMessage();
String msg = e.getMessage();
if (msg == null) {
log("Error", e); //$NON-NLS-1$
} else {
@ -100,8 +95,7 @@ public class QtUIPlugin extends AbstractUIPlugin {
public static void log(String message, Throwable e) {
Throwable nestedException;
if (e instanceof CModelException
&& (nestedException = ((CModelException)e).getException()) != null) {
if (e instanceof CModelException && (nestedException = ((CModelException) e).getException()) != null) {
e = nestedException;
}
log(IStatus.ERROR, message, e);

View file

@ -35,12 +35,12 @@ import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPParameter;
import org.eclipse.cdt.internal.qt.core.index.IQMethod;
import org.eclipse.cdt.internal.qt.core.index.IQObject;
import org.eclipse.cdt.internal.qt.core.index.IQProperty;
import org.eclipse.cdt.internal.qt.core.index.QtIndex;
import org.eclipse.cdt.internal.qt.ui.QtUIPlugin;
import org.eclipse.cdt.internal.ui.text.contentassist.CCompletionProposal;
import org.eclipse.cdt.qt.core.index.IQMethod;
import org.eclipse.cdt.qt.core.index.IQObject;
import org.eclipse.cdt.qt.core.index.IQProperty;
import org.eclipse.cdt.qt.core.index.QtIndex;
import org.eclipse.cdt.qt.ui.QtUIPlugin;
import org.eclipse.cdt.ui.text.contentassist.ICEditorContentAssistInvocationContext;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.contentassist.ICompletionProposal;

View file

@ -19,13 +19,13 @@ import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTypeId;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
import org.eclipse.cdt.internal.corext.template.c.CContextType;
import org.eclipse.cdt.internal.qt.core.QtKeywords;
import org.eclipse.cdt.internal.qt.core.index.IQProperty;
import org.eclipse.cdt.internal.qt.core.parser.QtParser;
import org.eclipse.cdt.internal.qt.ui.QtUIPlugin;
import org.eclipse.cdt.internal.ui.text.CHeuristicScanner;
import org.eclipse.cdt.internal.ui.text.Symbols;
import org.eclipse.cdt.internal.ui.text.contentassist.CCompletionProposal;
import org.eclipse.cdt.qt.core.QtKeywords;
import org.eclipse.cdt.qt.core.index.IQProperty;
import org.eclipse.cdt.qt.ui.QtUIPlugin;
import org.eclipse.cdt.ui.text.contentassist.ICEditorContentAssistInvocationContext;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;

View file

@ -7,7 +7,7 @@
*/
package org.eclipse.cdt.internal.qt.ui.assist;
import org.eclipse.cdt.qt.ui.QtUIPlugin;
import org.eclipse.cdt.internal.qt.ui.QtUIPlugin;
import org.eclipse.cdt.ui.text.ICCompletionProposal;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.templates.Template;