本文整理汇总了Java中com.sun.star.uno.Exception类的典型用法代码示例。如果您正苦于以下问题:Java Exception类的具体用法?Java Exception怎么用?Java Exception使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Exception类属于com.sun.star.uno包,在下文中一共展示了Exception类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: showMessageBox
import com.sun.star.uno.Exception; //导入依赖的package包/类
public static void showMessageBox(XComponentContext context, XDialog dialog, MessageBoxType type, String sTitle, String sMessage) {
XToolkit xToolkit;
try {
xToolkit = UnoRuntime.queryInterface(XToolkit.class,
context.getServiceManager().createInstanceWithContext("com.sun.star.awt.Toolkit", context));
} catch (Exception e) {
return;
}
XMessageBoxFactory xMessageBoxFactory = UnoRuntime.queryInterface(XMessageBoxFactory.class, xToolkit);
XWindowPeer xParentWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, dialog);
XMessageBox xMessageBox = xMessageBoxFactory.createMessageBox(xParentWindowPeer, type,
com.sun.star.awt.MessageBoxButtons.BUTTONS_OK, sTitle, sMessage);
if (xMessageBox == null)
return;
xMessageBox.execute();
}
开发者ID:smehrbrodt,项目名称:libreoffice-starter-extension,代码行数:18,代码来源:DialogHelper.java
示例2: invoke
import com.sun.star.uno.Exception; //导入依赖的package包/类
public Object invoke()
{
if (method == null)
{
throw new UnoReflectionException("No method selected. Call 'method' before 'invoke'.");
}
try
{
return method.invoke(object, new Object[][] { args.toArray() });
}
catch (Exception e)
{
throw new UnoReflectionException(e);
}
}
开发者ID:WollMux,项目名称:WollMux,代码行数:17,代码来源:UnoReflect.java
示例3: createDialog
import com.sun.star.uno.Exception; //导入依赖的package包/类
/**
* Create a dialog from an xdl file.
*
* @param xdlFile
* The filename in the `dialog` folder
* @param context
* @return XDialog
*/
public static XDialog createDialog(String xdlFile, XComponentContext context, XDialogEventHandler handler) {
Object oDialogProvider;
try {
oDialogProvider = context.getServiceManager().createInstanceWithContext("com.sun.star.awt.DialogProvider2",
context);
XDialogProvider2 xDialogProv = (XDialogProvider2) UnoRuntime.queryInterface(XDialogProvider2.class,
oDialogProvider);
File dialogFile = FileHelper.getDialogFilePath(xdlFile, context);
return xDialogProv.createDialogWithHandler(convertToURL(context, dialogFile), handler);
} catch (Exception e) {
return null;
}
}
开发者ID:smehrbrodt,项目名称:libreoffice-starter-extension,代码行数:22,代码来源:DialogHelper.java
示例4: convertToURL
import com.sun.star.uno.Exception; //导入依赖的package包/类
/** Returns a URL to be used with XDialogProvider to create a dialog */
public static String convertToURL(XComponentContext xContext, File dialogFile) {
String sURL = null;
try {
com.sun.star.ucb.XFileIdentifierConverter xFileConverter = (com.sun.star.ucb.XFileIdentifierConverter) UnoRuntime
.queryInterface(com.sun.star.ucb.XFileIdentifierConverter.class, xContext.getServiceManager()
.createInstanceWithContext("com.sun.star.ucb.FileContentProvider", xContext));
sURL = xFileConverter.getFileURLFromSystemPath("", dialogFile.getAbsolutePath());
} catch (com.sun.star.uno.Exception ex) {
return null;
}
return sURL;
}
开发者ID:smehrbrodt,项目名称:libreoffice-starter-extension,代码行数:14,代码来源:DialogHelper.java
示例5: getWriterDocument
import com.sun.star.uno.Exception; //导入依赖的package包/类
public static XTextDocument getWriterDocument() throws Exception {
XMultiComponentFactory xMngr = UnoSuite.getComponentContext().getServiceManager();
Object oDesktop = xMngr.createInstanceWithContext("com.sun.star.frame.Desktop", UnoSuite.getComponentContext());
XComponentLoader xLoader = (XComponentLoader)UnoRuntime.queryInterface(
XComponentLoader.class, oDesktop);
XComponent xDoc = xLoader.loadComponentFromURL("private:factory/swriter", "_default",
FrameSearchFlag.ALL, new PropertyValue[0]);
return (XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, xDoc);
}
开发者ID:indic-ocr,项目名称:LibreOCR,代码行数:12,代码来源:UnoHelper.java
示例6: connect
import com.sun.star.uno.Exception; //导入依赖的package包/类
/**
* (non-Javadoc)
* @see net.heartsome.cat.converter.ooconnect.OPconnect#connect()
* @throws ConnectException
*/
public void connect() throws ConnectException {
try {
XComponentContext localContext;
localContext = Bootstrap.createInitialComponentContext(null);
XMultiComponentFactory localServiceManager = localContext.getServiceManager();
XConnector connector = (XConnector) UnoRuntime.queryInterface(XConnector.class, localServiceManager
.createInstanceWithContext("com.sun.star.connection.Connector", localContext)); //$NON-NLS-1$
XConnection connection = connector.connect(strConnection);
XBridgeFactory bridgeFactory = (XBridgeFactory) UnoRuntime.queryInterface(XBridgeFactory.class,
localServiceManager.createInstanceWithContext("com.sun.star.bridge.BridgeFactory", localContext)); //$NON-NLS-1$
bridge = bridgeFactory.createBridge("ms2ooBridge", "urp", connection, null); //$NON-NLS-1$ //$NON-NLS-2$
bgComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, bridge);
// bgComponent.addEventListener(this);
serviceMg = (XMultiComponentFactory) UnoRuntime.queryInterface(XMultiComponentFactory.class, bridge
.getInstance("StarOffice.ServiceManager")); //$NON-NLS-1$
XPropertySet properties = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, serviceMg);
componentContext = (XComponentContext) UnoRuntime.queryInterface(XComponentContext.class, properties
.getPropertyValue("DefaultContext")); //$NON-NLS-1$
connected = true;
if (connected) {
System.out.println("has already connected"); //$NON-NLS-1$
} else {
System.out.println("connect to Openoffice fail,please check OpenOffice service that have to open"); //$NON-NLS-1$
}
} catch (NoConnectException connectException) {
throw new ConnectException(MessageFormat.format(Messages.getString("ooconnect.OPConnection.msg"), strConnection + ": " + connectException.getMessage())); //$NON-NLS-1$ //$NON-NLS-2$
} catch (Exception exception) {
throw new OPException(MessageFormat.format(Messages.getString("ooconnect.OPConnection.msg"), strConnection), exception); //$NON-NLS-1$
} catch (java.lang.Exception e) {
if (Converter.DEBUG_MODE) {
e.printStackTrace();
}
}
}
开发者ID:heartsome,项目名称:translationstudio8,代码行数:43,代码来源:OPConnection.java
示例7: createButton
import com.sun.star.uno.Exception; //导入依赖的package包/类
/**
* Erzeugt einen Button mit Label und ActionListener.
*
* @param xMCF
* @param context
* @param toolkit
* @param windowPeer
* @param label
* @param listener
* @param size
* @return
* @throws com.sun.star.uno.Exception
*/
public static XControl createButton(XMultiComponentFactory xMCF,
XComponentContext context, XToolkit toolkit, XWindowPeer windowPeer,
String label, XActionListener listener, Rectangle size)
throws com.sun.star.uno.Exception
{
XControl buttonCtrl =
createControl(xMCF, context, toolkit, windowPeer,
"com.sun.star.awt.UnoControlButton", null, null, size);
XButton button = UnoRuntime.queryInterface(XButton.class, buttonCtrl);
button.setLabel(label);
button.addActionListener(listener);
return buttonCtrl;
}
开发者ID:WollMux,项目名称:WollMux,代码行数:27,代码来源:GuiFactory.java
示例8: createTextfield
import com.sun.star.uno.Exception; //导入依赖的package包/类
/**
* Erzeugt ein Texteingabefeld.
*
* @param xMCF
* @param context
* @param toolkit
* @param windowPeer
* @param text
* @param size
* @return
* @throws com.sun.star.uno.Exception
*/
public static XControl createTextfield(XMultiComponentFactory xMCF,
XComponentContext context, XToolkit toolkit, XWindowPeer windowPeer,
String text, Rectangle size) throws com.sun.star.uno.Exception
{
XControl buttonCtrl =
createControl(xMCF, context, toolkit, windowPeer,
"com.sun.star.awt.UnoControlEdit", null, null, size);
XTextComponent txt = UnoRuntime.queryInterface(XTextComponent.class, buttonCtrl);
txt.setText(text);
return buttonCtrl;
}
开发者ID:WollMux,项目名称:WollMux,代码行数:25,代码来源:GuiFactory.java
示例9: createTree
import com.sun.star.uno.Exception; //导入依赖的package包/类
/**
* Erzeugt ein Baum-Steuerelement mit einem vorgegebenen Datenmodell.
* Das Datenmodel kann mit {@link #createTreeModel(XMultiComponentFactory, XComponentContext)}
* erzeugt werden.
*
* @param xMCF
* @param context
* @param toolkit
* @param windowPeer
* @param dataModel
* @return
* @throws Exception
*/
public static XControl createTree(XMultiComponentFactory xMCF,
XComponentContext context, XToolkit toolkit, XWindowPeer windowPeer, XMutableTreeDataModel dataModel) throws Exception
{
XControl treeCtrl =
GuiFactory.createControl(xMCF, context, toolkit, windowPeer,
"com.sun.star.awt.tree.TreeControl", null, null, new Rectangle(0, 0,
400, 400));
XPropertySet props =
UnoRuntime.queryInterface(XPropertySet.class, treeCtrl.getModel());
props.setPropertyValue("DataModel", dataModel);
return treeCtrl;
}
开发者ID:WollMux,项目名称:WollMux,代码行数:28,代码来源:GuiFactory.java
示例10: createCombobox
import com.sun.star.uno.Exception; //导入依赖的package包/类
public static XControl createCombobox(XMultiComponentFactory xMCF,
XComponentContext context, XToolkit toolkit, XWindowPeer windowPeer, String text, Rectangle size)
{
XControl ctrl =
createControl(xMCF, context, toolkit, windowPeer,
"com.sun.star.awt.UnoControlComboBox", null, null, size);
XTextComponent tf = UnoRuntime.queryInterface(XTextComponent.class, ctrl);
tf.setText(text);
XComboBox cmb = UnoRuntime.queryInterface(XComboBox.class, ctrl);
cmb.setDropDownLineCount((short) 10);
try
{
XControlModel model = ctrl.getModel();
// UnoRuntime.queryInterface(XControlModel.class,
// xMCF.createInstanceWithContext("com.sun.star.awt.UnoControlComboBoxModel", context));
XPropertySet props =
UnoRuntime.queryInterface(XPropertySet.class, model);
props.setPropertyValue("Dropdown", Boolean.TRUE);
//props.setPropertyValue("ReadOnly", Boolean.TRUE);
props.setPropertyValue("Autocomplete", Boolean.FALSE);
props.setPropertyValue("HideInactiveSelection", Boolean.TRUE);
ctrl.setModel(model);
ctrl.getPeer().invalidate(InvalidateStyle.UPDATE);
}
catch (Exception e)
{
Logger.error(e);
}
return ctrl;
}
开发者ID:WollMux,项目名称:WollMux,代码行数:36,代码来源:GuiFactory.java
示例11: getXDispatchHelper
import com.sun.star.uno.Exception; //导入依赖的package包/类
public XDispatchHelper getXDispatchHelper() {
try {
return createXDispatchHelper();
} catch (Exception e) {
throw new OpenOfficeException("Unable to create Open office components.", e);
}
}
开发者ID:cuba-platform,项目名称:yarg,代码行数:8,代码来源:OfficeResourceProvider.java
示例12: getXComponentLoader
import com.sun.star.uno.Exception; //导入依赖的package包/类
public XComponentLoader getXComponentLoader() {
try {
return as(XComponentLoader.class, createDesktop());
} catch (Exception e) {
throw new OpenOfficeException("Unable to create Open office components.", e);
}
}
开发者ID:cuba-platform,项目名称:yarg,代码行数:8,代码来源:OfficeResourceProvider.java
示例13: convert
import com.sun.star.uno.Exception; //导入依赖的package包/类
private static ByteArrayOutputStream convert(
ByteArrayOutputStream odxStream, String targetFormat,
Map<String, Object> filterParameters) throws BootstrapException,
Exception, IOException {
// TODO: Can this be done once during app init?
XComponentContext xContext = Bootstrap.bootstrap();
OOoStreamConverter converter = new OOoStreamConverter(xContext);
ByteArrayOutputStream generatedPDFOutputStream = new ByteArrayOutputStream();
OOoOutputStream convertedOutputStream = null;
OOoInputStream generatedODFInputStream = null;
try {
convertedOutputStream = null;
generatedODFInputStream = new OOoInputStream(
odxStream.toByteArray());
convertedOutputStream = new OOoOutputStream();
converter.convert(generatedODFInputStream, convertedOutputStream,
targetFormat, filterParameters);
generatedPDFOutputStream.write(convertedOutputStream.toByteArray());
} finally {
IOUtils.closeQuietly(generatedODFInputStream);
IOUtils.closeQuietly(convertedOutputStream);
}
return generatedPDFOutputStream;
}
开发者ID:Altrusoft,项目名称:docserv,代码行数:29,代码来源:Application.java
示例14: createControl
import com.sun.star.uno.Exception; //导入依赖的package包/类
/**
* Eine allgemeine Hilfsfunktion, mit der UNO-Steuerelemente erzeugt werden.
*
* @param xMCF
* @param xContext
* @param toolkit
* @param windowPeer
* @param type Klasse des Steuerelements, das erzeugt werden soll.
* @param propNames
* @param propValues
* @param rectangle
* @return
*/
public static XControl createControl(XMultiComponentFactory xMCF,
XComponentContext xContext, XToolkit toolkit, XWindowPeer windowPeer,
String type, String[] propNames, Object[] propValues, Rectangle rectangle)
{
try
{
XControl control =
UnoRuntime.queryInterface(XControl.class,
xMCF.createInstanceWithContext(type, xContext));
XControlModel controlModel =
UnoRuntime.queryInterface(XControlModel.class,
xMCF.createInstanceWithContext(type + "Model", xContext));
control.setModel(controlModel);
XMultiPropertySet properties =
UnoRuntime.queryInterface(XMultiPropertySet.class, control.getModel());
SortedMap<String, Object> props = new TreeMap<String, Object>();
if (type.equals("com.sun.star.awt.UnoControlImageControl"))
{
props.put("Border", (short) 0);
}
else if (type.equals("com.sun.star.awt.UnoControlEdit"))
{
props.put("MultiLine", false);
props.put("ReadOnly", false);
props.put("VScroll", false);
}
if (propNames != null)
{
for (int i = 0; i < propNames.length; i++)
{
props.put(propNames[i], propValues[i]);
}
}
if (props.size() > 0)
{
properties.setPropertyValues(
props.keySet().toArray(new String[props.size()]),
props.values().toArray(new Object[props.size()]));
}
control.createPeer(toolkit, windowPeer);
XWindow controlWindow = UnoRuntime.queryInterface(XWindow.class, control);
setWindowPosSize(controlWindow, rectangle);
return control;
}
catch (com.sun.star.uno.Exception ex)
{
Logger.debug(ex);
return null;
}
}
开发者ID:WollMux,项目名称:WollMux,代码行数:64,代码来源:GuiFactory.java
示例15: OfficeResourceProvider
import com.sun.star.uno.Exception; //导入依赖的package包/类
public OfficeResourceProvider(XComponentContext xComponentContext, OfficeIntegration officeIntegration) throws Exception {
this.xComponentContext = xComponentContext;
this.officeIntegration = officeIntegration;
}
开发者ID:cuba-platform,项目名称:yarg,代码行数:5,代码来源:OfficeResourceProvider.java
示例16: createXDispatchHelper
import com.sun.star.uno.Exception; //导入依赖的package包/类
protected XDispatchHelper createXDispatchHelper() throws Exception {
Object o = xComponentContext.getServiceManager().createInstanceWithContext(
"com.sun.star.frame.DispatchHelper", xComponentContext);
return as(XDispatchHelper.class, o);
}
开发者ID:cuba-platform,项目名称:yarg,代码行数:6,代码来源:OfficeResourceProvider.java
示例17: createDesktop
import com.sun.star.uno.Exception; //导入依赖的package包/类
protected XDesktop createDesktop() throws com.sun.star.uno.Exception {
Object o = xComponentContext.getServiceManager().createInstanceWithContext(
"com.sun.star.frame.Desktop", xComponentContext);
return as(XDesktop.class, o);
}
开发者ID:cuba-platform,项目名称:yarg,代码行数:6,代码来源:OfficeResourceProvider.java
示例18: convert
import com.sun.star.uno.Exception; //导入依赖的package包/类
public void convert(OOoInputStream input, OOoOutputStream output,
String filterName, Map<String, Object> filterParameters)
throws Exception {
XMultiComponentFactory xMultiComponentFactory = xComponentContext
.getServiceManager();
Object desktopService = xMultiComponentFactory
.createInstanceWithContext("com.sun.star.frame.Desktop",
xComponentContext);
XComponentLoader xComponentLoader = UnoRuntime.queryInterface(
XComponentLoader.class, desktopService);
PropertyValue[] conversionProperties = new PropertyValue[3];
conversionProperties[0] = new PropertyValue();
conversionProperties[1] = new PropertyValue();
conversionProperties[2] = new PropertyValue();
conversionProperties[0].Name = "InputStream";
conversionProperties[0].Value = input;
conversionProperties[1].Name = "Hidden";
conversionProperties[1].Value = Boolean.TRUE;
XComponent document = xComponentLoader.loadComponentFromURL(
"private:stream", "_blank", 0, conversionProperties);
List<PropertyValue> filterData = new ArrayList<PropertyValue>();
for (Map.Entry<String, Object> entry : filterParameters.entrySet()) {
PropertyValue propertyValue = new PropertyValue();
propertyValue.Name = entry.getKey();
propertyValue.Value = entry.getValue();
filterData.add(propertyValue);
}
conversionProperties[0].Name = "OutputStream";
conversionProperties[0].Value = output;
conversionProperties[1].Name = "FilterName";
conversionProperties[1].Value = filterName;
conversionProperties[2].Name = "FilterData";
conversionProperties[2].Value = filterData
.toArray(new PropertyValue[1]);
XStorable xstorable = UnoRuntime.queryInterface(XStorable.class,
document);
xstorable.storeToURL("private:stream", conversionProperties);
XCloseable xclosable = UnoRuntime.queryInterface(XCloseable.class,
document);
xclosable.close(true);
}
开发者ID:Altrusoft,项目名称:docserv,代码行数:49,代码来源:OOoStreamConverter.java
示例19: createSenderbox
import com.sun.star.uno.Exception; //导入依赖的package包/类
/**
* Erzeugt die Senderbox für die WollMux-Sidebar.
*
* @param xMCF
* @param context
* @param toolkit
* @param windowPeer
* @param label
* @param listener
* @param size
* @return
* @throws com.sun.star.uno.Exception
*/
public static XControl createSenderbox(XMultiComponentFactory xMCF,
XComponentContext context, XToolkit toolkit, XWindowPeer windowPeer,
String label, XActionListener listener, Rectangle size)
throws com.sun.star.uno.Exception
{
XControl buttonCtrl =
createButton(xMCF, context, toolkit, windowPeer, label, listener, size);
XControlModel model = buttonCtrl.getModel();
XPropertySet props = UnoRuntime.queryInterface(XPropertySet.class, model);
props.setPropertyValue("FocusOnClick", false);
return buttonCtrl;
}
开发者ID:WollMux,项目名称:WollMux,代码行数:26,代码来源:GuiFactory.java
示例20: createTreeModel
import com.sun.star.uno.Exception; //导入依赖的package包/类
/**
* Erzeugt ein Datenmodell für einen Baum-Steuerelement.
*
* @param xMCF
* @param context
* @return
* @throws Exception
*/
public static XMutableTreeDataModel createTreeModel(XMultiComponentFactory xMCF,
XComponentContext context) throws Exception
{
return UnoRuntime.queryInterface(XMutableTreeDataModel.class,
xMCF.createInstanceWithContext("com.sun.star.awt.tree.MutableTreeDataModel",
context));
}
开发者ID:WollMux,项目名称:WollMux,代码行数:16,代码来源:GuiFactory.java
注:本文中的com.sun.star.uno.Exception类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论