Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti2008-09-11 22:00:35 -0400
committerSilenio Quarti2008-09-11 22:00:35 -0400
commiteba2980846542ce825cd95844f29446150061549 (patch)
tree699409618ea358acb0765a605432d050cfc9af7c /bundles/org.eclipse.swt.tools
parent7a1699f79bf5676a2fa4bafdb1a541733633c04a (diff)
downloadeclipse.platform.swt-eba2980846542ce825cd95844f29446150061549.tar.gz
eclipse.platform.swt-eba2980846542ce825cd95844f29446150061549.tar.xz
eclipse.platform.swt-eba2980846542ce825cd95844f29446150061549.zip
check 64 bit tool and action to enable it
Diffstat (limited to 'bundles/org.eclipse.swt.tools')
-rw-r--r--bundles/org.eclipse.swt.tools/plugin.properties1
-rw-r--r--bundles/org.eclipse.swt.tools/plugin.xml28
-rw-r--r--bundles/org.eclipse.swt.tools/src/org/eclipse/swt/tools/builders/Check64CompilationParticipant.java16
-rw-r--r--bundles/org.eclipse.swt.tools/src/org/eclipse/swt/tools/builders/Check64EnableAction.java24
4 files changed, 59 insertions, 10 deletions
diff --git a/bundles/org.eclipse.swt.tools/plugin.properties b/bundles/org.eclipse.swt.tools/plugin.properties
index 8ec5b8faf5..0882f7399e 100644
--- a/bundles/org.eclipse.swt.tools/plugin.properties
+++ b/bundles/org.eclipse.swt.tools/plugin.properties
@@ -12,3 +12,4 @@ pluginName = SWT Tools
providerName = Eclipse.org
macViewName = Mac Generator
jniBuilderName = JNI Builder
+enableCheck64Name = Report 64-bit Problems
diff --git a/bundles/org.eclipse.swt.tools/plugin.xml b/bundles/org.eclipse.swt.tools/plugin.xml
index b8e3e765e1..225847f92c 100644
--- a/bundles/org.eclipse.swt.tools/plugin.xml
+++ b/bundles/org.eclipse.swt.tools/plugin.xml
@@ -33,12 +33,36 @@
</builder>
</extension>
- <!--<extension
+ <extension
point="org.eclipse.jdt.core.compilationParticipant">
<compilationParticipant
class="org.eclipse.swt.tools.builders.Check64CompilationParticipant"
id="org.eclipse.swt.tools.Check64CompilationParticipant">
</compilationParticipant>
- </extension>-->
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ objectClass="org.eclipse.jdt.core.IJavaProject"
+ id="org.eclipse.swt.tools.contribution">
+ <menu
+ label="%pluginName"
+ path="additions"
+ id="org.eclipse.swt.tools.menu">
+ <separator
+ name="group1">
+ </separator>
+ </menu>
+ <action
+ label="%enableCheck64Name"
+ class="org.eclipse.swt.tools.builders.Check64EnableAction"
+ menubarPath="org.eclipse.swt.tools.menu/group1"
+ style="toggle"
+ enablesFor="1"
+ id="org.eclipse.swt.tools.check64EnableAction">
+ </action>
+ </objectContribution>
+ </extension>
</plugin>
diff --git a/bundles/org.eclipse.swt.tools/src/org/eclipse/swt/tools/builders/Check64CompilationParticipant.java b/bundles/org.eclipse.swt.tools/src/org/eclipse/swt/tools/builders/Check64CompilationParticipant.java
index 648a74ed26..024e77db70 100644
--- a/bundles/org.eclipse.swt.tools/src/org/eclipse/swt/tools/builders/Check64CompilationParticipant.java
+++ b/bundles/org.eclipse.swt.tools/src/org/eclipse/swt/tools/builders/Check64CompilationParticipant.java
@@ -46,7 +46,9 @@ public class Check64CompilationParticipant extends CompilationParticipant {
static final char[] DOUBLE_FLOAT_ARRAY = "double[] /*float[]*/".toCharArray();
static final String buildDir = "/.build64/";
static final String pluginDir = "/org.eclipse.swt/";
- static final String SOURCE_ID = "JNI";/*JavaBuilder.SOURCE_ID*/
+ static final String SOURCE_ID = "JNI";
+
+ public static boolean Enabled;
void create(IContainer file) throws CoreException {
if (file.exists()) return;
@@ -96,6 +98,7 @@ void replace64(char[] source) {
public void buildStarting(BuildContext[] files, boolean isBatch) {
if (sources == null) sources = new HashSet();
+// long time = System.currentTimeMillis();
for (int i = 0; i < files.length; i++) {
BuildContext context = files[i];
IFile file = context.getFile();
@@ -110,13 +113,12 @@ public void buildStarting(BuildContext[] files, boolean isBatch) {
create(newFile.getParent());
char[] source = context.getContents();
replace64(source);
- //TODO encoding
-// System.out.println(i + "-" + file);
newFile.create(new ByteArrayInputStream(new String(source).getBytes()), true, null);
} catch (CoreException e) {
e.printStackTrace();
}
}
+// System.out.println("copying time=" + (System.currentTimeMillis() - time));
}
public void buildFinished(IJavaProject project) {
@@ -136,6 +138,7 @@ public void buildFinished(IJavaProject project) {
}
}
if (hasProblems) return;
+ if (!Enabled) return;
String root = proj.getLocation().toPortableString() + buildDir;
StringBuffer sourcePath = new StringBuffer(), cp = new StringBuffer();
IClasspathEntry[] entries = project.getResolvedClasspath(true);
@@ -163,10 +166,8 @@ public void buildFinished(IJavaProject project) {
"-sourcepath", sourcePath.toString(),
}));
args.addAll(sources);
-// System.out.println("start=" + sources.size());
PrintWriter writer = new PrintWriter(new ByteArrayOutputStream());
BatchCompiler.compile((String[])args.toArray(new String[args.size()]), writer, writer, null);
-// System.out.println("time0=" +( System.currentTimeMillis() - time));
InputStream is = new BufferedInputStream(new FileInputStream(log));
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(is));
is.close();
@@ -188,7 +189,7 @@ public void buildFinished(IJavaProject project) {
NodeList problem = ((Element)problems.item(k)).getElementsByTagName("problem");
for (int l = 0; l < problem.getLength(); l++) {
Element node = (Element)problem.item(l);
- String path = source.getAttribute("path");
+ String path = source.getAttribute("path").replace('\\', '/');
path = path.replaceAll(buildDir, "/");
if (path.startsWith(projPath)) {
path = path.substring(projPath.length());
@@ -207,7 +208,7 @@ public void buildFinished(IJavaProject project) {
}
}
}
-// System.out.println("copiling time=" +( System.currentTimeMillis() - time));
+// System.out.println("compiling time=" + (System.currentTimeMillis() - time));
} catch (Exception e) {
e.printStackTrace();
}
@@ -215,7 +216,6 @@ public void buildFinished(IJavaProject project) {
public void cleanStarting(IJavaProject project) {
if (!isActive(project)) return;
-// System.out.println("clean");
sources = null;
IResource resource = project.getProject().findMember(new Path(buildDir));
if (resource != null) {
diff --git a/bundles/org.eclipse.swt.tools/src/org/eclipse/swt/tools/builders/Check64EnableAction.java b/bundles/org.eclipse.swt.tools/src/org/eclipse/swt/tools/builders/Check64EnableAction.java
new file mode 100644
index 0000000000..80508618f3
--- /dev/null
+++ b/bundles/org.eclipse.swt.tools/src/org/eclipse/swt/tools/builders/Check64EnableAction.java
@@ -0,0 +1,24 @@
+package org.eclipse.swt.tools.builders;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+public class Check64EnableAction implements IObjectActionDelegate {
+
+ public Check64EnableAction() {
+ super();
+ }
+
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ }
+
+ public void run(IAction action) {
+ Check64CompilationParticipant.Enabled = action.isChecked();
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+}

Back to the top