diff options
author | slewis | 2007-04-18 23:21:01 +0000 |
---|---|---|
committer | slewis | 2007-04-18 23:21:01 +0000 |
commit | d37ee2eb11bed93b243c0869789d536394220416 (patch) | |
tree | 3b3d6836fbdf3ef6c9837a0fbb7620c193333cb0 | |
parent | 8d6184dab1618144ae4803b1b2f89a842622f236 (diff) | |
download | org.eclipse.ecf-d37ee2eb11bed93b243c0869789d536394220416.tar.gz org.eclipse.ecf-d37ee2eb11bed93b243c0869789d536394220416.tar.xz org.eclipse.ecf-d37ee2eb11bed93b243c0869789d536394220416.zip |
Initial checkin of org.eclipse.ecf.telephony.call.ui
13 files changed, 442 insertions, 0 deletions
diff --git a/framework/bundles/org.eclipse.ecf.telephony.call.ui/.classpath b/framework/bundles/org.eclipse.ecf.telephony.call.ui/.classpath new file mode 100644 index 000000000..751c8f2e5 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.telephony.call.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.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/framework/bundles/org.eclipse.ecf.telephony.call.ui/.cvsignore b/framework/bundles/org.eclipse.ecf.telephony.call.ui/.cvsignore new file mode 100644 index 000000000..ba077a403 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.telephony.call.ui/.cvsignore @@ -0,0 +1 @@ +bin diff --git a/framework/bundles/org.eclipse.ecf.telephony.call.ui/.project b/framework/bundles/org.eclipse.ecf.telephony.call.ui/.project new file mode 100644 index 000000000..3be3fb4a4 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.telephony.call.ui/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.ecf.telephony.call.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.telephony.call.ui/.settings/org.eclipse.jdt.core.prefs b/framework/bundles/org.eclipse.ecf.telephony.call.ui/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..527335e0c --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.telephony.call.ui/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,55 @@ +#Wed Apr 18 15:39:53 GMT-08:00 2007 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nullReference=ignore +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning diff --git a/framework/bundles/org.eclipse.ecf.telephony.call.ui/.settings/org.eclipse.pde.core.prefs b/framework/bundles/org.eclipse.ecf.telephony.call.ui/.settings/org.eclipse.pde.core.prefs new file mode 100644 index 000000000..b0bdf76bf --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.telephony.call.ui/.settings/org.eclipse.pde.core.prefs @@ -0,0 +1,4 @@ +#Wed Apr 18 15:38:41 GMT-08:00 2007 +eclipse.preferences.version=1 +pluginProject.extensions=false +resolve.requirebundle=false diff --git a/framework/bundles/org.eclipse.ecf.telephony.call.ui/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.telephony.call.ui/META-INF/MANIFEST.MF new file mode 100644 index 000000000..c6862b3ae --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.telephony.call.ui/META-INF/MANIFEST.MF @@ -0,0 +1,15 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: ECF Telephony Call UI API +Bundle-SymbolicName: org.eclipse.ecf.telephony.call.ui +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: org.eclipse.ecf.internal.telephony.call.ui.Activator +Bundle-Vendor: Eclipse.org +Eclipse-LazyStart: true +Import-Package: org.osgi.framework;version="1.3.0" +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.ecf, + org.eclipse.ecf.telephony.call +Export-Package: org.eclipse.ecf.call.ui.actions, + org.eclipse.ecf.internal.telephony.call.ui;x-internal:=true diff --git a/framework/bundles/org.eclipse.ecf.telephony.call.ui/about.html b/framework/bundles/org.eclipse.ecf.telephony.call.ui/about.html new file mode 100644 index 000000000..5d03fd4c9 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.telephony.call.ui/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>May 2, 2006</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="/">http://www.eclipse.org</a>.</p> + +</body> +</html>
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.ecf.telephony.call.ui/build.properties b/framework/bundles/org.eclipse.ecf.telephony.call.ui/build.properties new file mode 100644 index 000000000..fad931173 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.telephony.call.ui/build.properties @@ -0,0 +1,10 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + about.html,\ + plugin.properties +src.includes = META-INF/,\ + about.html,\ + plugin.properties,\ + src/ diff --git a/framework/bundles/org.eclipse.ecf.telephony.call.ui/plugin.properties b/framework/bundles/org.eclipse.ecf.telephony.call.ui/plugin.properties new file mode 100644 index 000000000..1decec876 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.telephony.call.ui/plugin.properties @@ -0,0 +1,13 @@ +/**************************************************************************** +* 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 +*****************************************************************************/ +plugin.name=ECF Call UI API +plugin.provider=Eclipse.org + diff --git a/framework/bundles/org.eclipse.ecf.telephony.call.ui/src/org/eclipse/ecf/call/ui/actions/AbstractCallAction.java b/framework/bundles/org.eclipse.ecf.telephony.call.ui/src/org/eclipse/ecf/call/ui/actions/AbstractCallAction.java new file mode 100644 index 000000000..7d1933179 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.telephony.call.ui/src/org/eclipse/ecf/call/ui/actions/AbstractCallAction.java @@ -0,0 +1,189 @@ +/**************************************************************************** + * 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.call.ui.actions; + +import java.util.Map; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.ecf.core.IContainer; +import org.eclipse.ecf.core.identity.ID; +import org.eclipse.ecf.core.identity.IDCreateException; +import org.eclipse.ecf.core.identity.IDFactory; +import org.eclipse.ecf.core.util.IExceptionHandler; +import org.eclipse.ecf.internal.telephony.call.ui.Activator; +import org.eclipse.ecf.internal.telephony.call.ui.Messages; +import org.eclipse.ecf.telephony.call.CallException; +import org.eclipse.ecf.telephony.call.CallSessionState; +import org.eclipse.ecf.telephony.call.ICallSession; +import org.eclipse.ecf.telephony.call.ICallSessionContainerAdapter; +import org.eclipse.ecf.telephony.call.ICallSessionListener; +import org.eclipse.ecf.telephony.call.events.ICallSessionEvent; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.dialogs.InputDialog; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IWorkbenchWindowActionDelegate; + +/** + * Abstract class to implement calling via ECF Call API. Subclasses may be + * created. + */ +public abstract class AbstractCallAction extends Action { + + protected ID callReceiver = null; + + protected IExceptionHandler exceptionHandler = null; + + public AbstractCallAction() { + } + + /** + * @param text + */ + public AbstractCallAction(String text) { + super(text); + } + + /** + * @param text + * @param image + */ + public AbstractCallAction(String text, ImageDescriptor image) { + super(text, image); + } + + /** + * @param text + * @param style + */ + public AbstractCallAction(String text, int style) { + super(text, style); + } + + public void setCallExceptionHandler(IExceptionHandler exceptionHandler) { + this.exceptionHandler = exceptionHandler; + } + + public IExceptionHandler getCallExceptionHandler() { + return this.exceptionHandler; + } + + public void setCallReceiver(ID callReceiver) { + this.callReceiver = callReceiver; + } + + public ID getCallReceiver() { + return this.callReceiver; + } + + protected ICallSessionContainerAdapter getCallContainerAdapter() { + IContainer c = getContainer(); + if (c == null) + return null; + return (ICallSessionContainerAdapter) c + .getAdapter(ICallSessionContainerAdapter.class); + } + + protected abstract IContainer getContainer(); + + protected ICallSessionListener createCallSessionListener() { + return new ICallSessionListener() { + public void handleCallSessionEvent(final ICallSessionEvent event) { + final ICallSession callSession = event.getCallSession(); + if (callSession.getState().equals(CallSessionState.FAILED)) + Display.getDefault().asyncExec(new Runnable() { + public void run() { + MessageDialog + .openInformation( + null, + Messages.CallAction_Title_Call_Failed, + NLS + .bind( + Messages.CallAction_Message_Call_Failed, + callSession + .getReceiver() + .getName(), + callSession + .getFailureReason() + .getReason())); + } + }); + } + }; + } + + protected ID getReceiverFromInputDialog(ICallSessionContainerAdapter adapter) + throws IDCreateException { + InputDialog id = new InputDialog(Display.getDefault().getActiveShell(), + Messages.CallAction_Initiate_Call_Title, + Messages.CallAction_Initiate_Call_Message, "", null); //$NON-NLS-3$ //$NON-NLS-1$ //$NON-NLS-1$ + id.setBlockOnOpen(true); + int res = id.open(); + String receiver = null; + if (res == InputDialog.OK) + receiver = id.getValue(); + if (receiver == null || receiver.equals("")) //$NON-NLS-1$ + return null; + else + return IDFactory.getDefault().createID( + adapter.getReceiverNamespace(), receiver); + } + + protected Map createOptions() { + return null; + } + + protected void makeCall() throws CallException, IDCreateException { + ICallSessionContainerAdapter adapter = getCallContainerAdapter(); + if (adapter == null) + throw new CallException( + Messages.CallAction_Exception_Container_Not_Call_API); + // If we haven't been given a skypeReceiver then show input dialog + if (callReceiver == null) + callReceiver = getReceiverFromInputDialog(adapter); + // If the skypeReceiver now has a value...ring them up + if (callReceiver != null) + adapter.sendCallRequest(callReceiver, createCallSessionListener(), + createOptions()); + } + + /** + * The action has been activated. The argument of the method represents the + * 'real' action sitting in the workbench UI. + * + * @see IWorkbenchWindowActionDelegate#run + */ + public void run() { + try { + makeCall(); + } catch (Exception e) { + if (exceptionHandler != null) + exceptionHandler.handleException(e); + else + Activator + .getDefault() + .getLog() + .log( + new Status( + IStatus.ERROR, + Activator.PLUGIN_ID, + IStatus.ERROR, + Messages.CallAction_Exception_CallAction_Run, + e)); + } + + } + +} diff --git a/framework/bundles/org.eclipse.ecf.telephony.call.ui/src/org/eclipse/ecf/internal/telephony/call/ui/Activator.java b/framework/bundles/org.eclipse.ecf.telephony.call.ui/src/org/eclipse/ecf/internal/telephony/call/ui/Activator.java new file mode 100644 index 000000000..6ae386998 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.telephony.call.ui/src/org/eclipse/ecf/internal/telephony/call/ui/Activator.java @@ -0,0 +1,46 @@ +package org.eclipse.ecf.internal.telephony.call.ui; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +public class Activator extends AbstractUIPlugin { + + public static final String PLUGIN_ID = "org.eclipse.ecf.telephony.call.ui"; + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/framework/bundles/org.eclipse.ecf.telephony.call.ui/src/org/eclipse/ecf/internal/telephony/call/ui/Messages.java b/framework/bundles/org.eclipse.ecf.telephony.call.ui/src/org/eclipse/ecf/internal/telephony/call/ui/Messages.java new file mode 100644 index 000000000..0880d8545 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.telephony.call.ui/src/org/eclipse/ecf/internal/telephony/call/ui/Messages.java @@ -0,0 +1,40 @@ +/**************************************************************************** + * 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.internal.telephony.call.ui; + +import org.eclipse.osgi.util.NLS; + +/** + * + */ +public class Messages extends NLS { + + private static final String BUNDLE_NAME = "org.eclipse.ecf.internal.telephony.call.ui.messages"; //$NON-NLS-1$ + + public static String CallAction_Exception_CallAction_Run; + + public static String CallAction_Exception_Container_Not_Call_API; + + public static String CallAction_Title_Call_Failed; + public static String CallAction_Message_Call_Failed; + public static String CallAction_Initiate_Call_Title; + public static String CallAction_Initiate_Call_Message; + + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } + +} diff --git a/framework/bundles/org.eclipse.ecf.telephony.call.ui/src/org/eclipse/ecf/internal/telephony/call/ui/messages.properties b/framework/bundles/org.eclipse.ecf.telephony.call.ui/src/org/eclipse/ecf/internal/telephony/call/ui/messages.properties new file mode 100644 index 000000000..f7b1cc38c --- /dev/null +++ b/framework/bundles/org.eclipse.ecf.telephony.call.ui/src/org/eclipse/ecf/internal/telephony/call/ui/messages.properties @@ -0,0 +1,6 @@ +CallAction_Title_Call_Failed=Call Failed +CallAction_Message_Call_Failed=Call to {0} failed.\n\n{1} +CallAction_Initiate_Call_Title=Initiate Call +CallAction_Initiate_Call_Message=Enter ID to Call +CallAction_Exception_Container_Not_Call_API=Container does not support call API +CallAction_Exception_CallAction_Run=Exception in CallAction.run |