diff options
| author | slewis | 2005-02-07 23:41:39 +0000 |
|---|---|---|
| committer | slewis | 2005-02-07 23:41:39 +0000 |
| commit | 465b32a462e95c854a6a5a143b53084fb51efc64 (patch) | |
| tree | b80023bcb5f04ca6de84a48613613c79c3ae05ed | |
| parent | 34a366b6f53204a830cff2c496ced6ec7daefabc (diff) | |
| download | org.eclipse.ecf-465b32a462e95c854a6a5a143b53084fb51efc64.tar.gz org.eclipse.ecf-465b32a462e95c854a6a5a143b53084fb51efc64.tar.xz org.eclipse.ecf-465b32a462e95c854a6a5a143b53084fb51efc64.zip | |
Initial checkin for org.eclipse.ecf.ui plugin project
9 files changed, 256 insertions, 0 deletions
diff --git a/framework/bundles/org.eclipse.ecf.ui/.classpath b/framework/bundles/org.eclipse.ecf.ui/.classpath new file mode 100644 index 000000000..065ac06e1 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.ui/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/framework/bundles/org.eclipse.ecf.ui/.cvsignore b/framework/bundles/org.eclipse.ecf.ui/.cvsignore new file mode 100644 index 000000000..ba077a403 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.ui/.cvsignore @@ -0,0 +1 @@ +bin diff --git a/framework/bundles/org.eclipse.ecf.ui/.options b/framework/bundles/org.eclipse.ecf.ui/.options new file mode 100644 index 000000000..59c50a370 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.ui/.options @@ -0,0 +1,3 @@ +org.eclipse.ecf.ui/debug = true +org.eclipse.ecf.ui/debug/filter = * +org.eclipse.ecf.ui/debug/flag = true diff --git a/framework/bundles/org.eclipse.ecf.ui/.project b/framework/bundles/org.eclipse.ecf.ui/.project new file mode 100644 index 000000000..b16b0479e --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.ui/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.ecf.ui</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/framework/bundles/org.eclipse.ecf.ui/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.ui/META-INF/MANIFEST.MF new file mode 100644 index 000000000..f634ebe7d --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.ui/META-INF/MANIFEST.MF @@ -0,0 +1,12 @@ +Manifest-Version: 1.0 +Bundle-Name: ECF UI +Bundle-SymbolicName: org.eclipse.ecf.ui +Bundle-Version: 0.0.1 +Bundle-ClassPath: ui.jar +Bundle-Activator: org.eclipse.ecf.ui.UiPlugin +Bundle-Vendor: Eclipse.org +Bundle-Localization: plugin +Require-Bundle: org.eclipse.ui, + org.eclipse.ecf, + org.eclipse.core.runtime +Eclipse-AutoStart: true diff --git a/framework/bundles/org.eclipse.ecf.ui/build.properties b/framework/bundles/org.eclipse.ecf.ui/build.properties new file mode 100644 index 000000000..ec7d3b395 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.ui/build.properties @@ -0,0 +1,5 @@ +source.ui.jar = src/ +output.ui.jar = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + ui.jar diff --git a/framework/bundles/org.eclipse.ecf.ui/plugin.xml b/framework/bundles/org.eclipse.ecf.ui/plugin.xml new file mode 100644 index 000000000..8e49b5212 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.ui/plugin.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.0"?> +<plugin> + +</plugin> diff --git a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/Trace.java b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/Trace.java new file mode 100644 index 000000000..c35c3be56 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/Trace.java @@ -0,0 +1,120 @@ +/**************************************************************************** +* Copyright (c) 2004 Composent, Inc. and others. +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Eclipse Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v10.html +* +* Contributors: +* Composent, Inc. - initial API and implementation +*****************************************************************************/ + +package org.eclipse.ecf.ui; + +import java.text.SimpleDateFormat; +import java.util.Date; +import org.eclipse.core.runtime.Platform; + +public class Trace { + public static final String tracePrefix = "(trace)"; + + public static boolean ON = false; + protected static boolean isEclipse = false; + protected static String pluginName = ""; + protected static String debugPrefix = "/debug/"; + static { + try { + ON = Platform.inDebugMode(); + String val = System.getProperty(UiPlugin.PLUGIN_ID+".Trace"); + if (val != null) { + setTrace(true); + isEclipse = false; + // No eclipse Platform available + System.out.println("WARNING: Eclipse platform not being use for trace...overridden by system property org.eclipse.ecf.ui.Trace"); + } else { + isEclipse = true; + pluginName = UiPlugin.PLUGIN_ID; + } + } catch (Exception e) { + try { + String val = System.getProperty(UiPlugin.PLUGIN_ID+".Trace"); + if (val != null) { + setTrace(true); + isEclipse = false; + // No eclipse Platform available + System.out.println("WARNING: Eclipse platform not available for trace...using system.out for org.eclipse.ecf.ui"); + } else { + System.out.println(Trace.class.getName()+": OFF"); + } + } catch (Exception except) { + } + } + } + public static void setTrace(boolean on) { + ON = on; + } + + public static Trace create(String key) { + if (isEclipse) { + String res = Platform + .getDebugOption(pluginName + debugPrefix + key); + if (res != null) { + Boolean on = new Boolean(res); + if (on.booleanValue()) + return new Trace(pluginName + "(" + key + ")"); + else + return null; + } else { + return null; + } + } else + return new Trace(key); + } + + String name; + + public void dumpStack(Throwable e, String msg) { + msg(msg); + e.printStackTrace(System.err); + } + + public void msg(String msg) { + StringBuffer sb = new StringBuffer(name); + sb.append(getTimeString()).append(msg); + System.out.println(sb.toString()); + } + + protected static String getTimeString() { + Date d = new Date(); + SimpleDateFormat df = new SimpleDateFormat("[MM/dd/yy;HH:mm:ss:SSS]"); + return df.format(d); + } + + protected Trace(String str) { + name = tracePrefix+str; + } + public static String convertStringAToString(String [] strings) { + if (strings==null) return ""; + StringBuffer sb = new StringBuffer(); + for(int i=0; i < strings.length; i++) { + if (strings[i]==null) sb.append("(null)"); + else sb.append(strings[i]); + if (i != (strings.length-1)) sb.append(";"); + } + return sb.toString(); + } + public static String convertObjectAToString(Object [] objs) { + if (objs==null) return ""; + StringBuffer sb = new StringBuffer(); + for(int i=0; i < objs.length; i++) { + if (objs[i]==null) sb.append("(null)"); + else sb.append(objs[i].toString()); + if (i != (objs.length-1)) sb.append(";"); + } + return sb.toString(); + } + + public static void setThreadDebugGroup(Object obj) { + // Do nothing + } +}
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/UiPlugin.java b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/UiPlugin.java new file mode 100644 index 000000000..0e2f6e890 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.ui/src/org/eclipse/ecf/ui/UiPlugin.java @@ -0,0 +1,75 @@ +package org.eclipse.ecf.ui; + +import org.eclipse.ui.plugin.*; +import org.osgi.framework.BundleContext; +import java.util.*; + +/** + * The main plugin class to be used in the desktop. + */ +public class UiPlugin extends AbstractUIPlugin { + + public static final String PLUGIN_ID = "org.eclipse.ecf.ui"; + + //The shared instance. + private static UiPlugin plugin; + //Resource bundle. + private ResourceBundle resourceBundle; + + /** + * The constructor. + */ + public UiPlugin() { + super(); + plugin = this; + } + + /** + * This method is called upon plug-in activation + */ + public void start(BundleContext context) throws Exception { + super.start(context); + } + + /** + * This method is called when the plug-in is stopped + */ + public void stop(BundleContext context) throws Exception { + super.stop(context); + plugin = null; + resourceBundle = null; + } + + /** + * Returns the shared instance. + */ + public static UiPlugin getDefault() { + return plugin; + } + + /** + * Returns the string from the plugin's resource bundle, + * or 'key' if not found. + */ + public static String getResourceString(String key) { + ResourceBundle bundle = UiPlugin.getDefault().getResourceBundle(); + try { + return (bundle != null) ? bundle.getString(key) : key; + } catch (MissingResourceException e) { + return key; + } + } + + /** + * Returns the plugin's resource bundle, + */ + public ResourceBundle getResourceBundle() { + try { + if (resourceBundle == null) + resourceBundle = ResourceBundle.getBundle("org.eclipse.ecf.ui.UiPluginResources"); + } catch (MissingResourceException x) { + resourceBundle = null; + } + return resourceBundle; + } +} |
