org.eclipse.swt.SWTError Java Examples
The following examples show how to use
org.eclipse.swt.SWTError.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LapseView.java From lapse-plus with GNU General Public License v3.0 | 6 votes |
public void run() { StringBuffer buf= new StringBuffer(); addCalls(fViewer.getTree().getSelection()[0], 0, buf);//we get the node selected in the tree TextTransfer plainTextTransfer = TextTransfer.getInstance();//for converting plain text in a String into Platform specific representation try{ fClipboard.setContents( new String[]{ convertLineTerminators(buf.toString()) }, new Transfer[]{ plainTextTransfer }); } catch (SWTError e){ if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD) throw e; if (MessageDialog.openQuestion(fView.getViewSite().getShell(), ("CopyCallHierarchyAction.problem"), ("CopyCallHierarchyAction.clipboard_busy")) ) { run(); } } }
Example #2
Source File: ClipboardHandler.java From Pydev with Eclipse Public License 1.0 | 6 votes |
public void putIntoClipboard(int clipboardType, Display display, String plainText) throws SWTError { Clipboard clipboard = new Clipboard(display); try { TextTransfer plainTextTransfer = TextTransfer.getInstance(); String[] data = new String[] { plainText }; Transfer[] types = new Transfer[] { plainTextTransfer }; try { clipboard.setContents(data, types, clipboardType); } catch (SWTError error) { // Copy to clipboard failed. This happens when another application // is accessing the clipboard while we copy. Ignore the error. // Fixes 1GDQAVN // Rethrow all other errors. Fixes bug 17578. if (error.code != DND.ERROR_CANNOT_SET_CLIPBOARD) { throw error; } } } finally { clipboard.dispose(); } }
Example #3
Source File: CopyAction.java From Pydev with Eclipse Public License 1.0 | 6 votes |
/** * Set the clipboard contents. Prompt to retry if clipboard is busy. * * @param resources the resources to copy to the clipboard * @param fileNames file names of the resources to copy to the clipboard * @param names string representation of all names */ private void setClipboard(IResource[] resources, String[] fileNames, String names) { try { // set the clipboard contents if (fileNames.length > 0) { clipboard.setContents( new Object[] { resources, fileNames, names }, new Transfer[] { ResourceTransfer.getInstance(), FileTransfer.getInstance(), TextTransfer.getInstance() }); } else { clipboard.setContents(new Object[] { resources, names }, new Transfer[] { ResourceTransfer.getInstance(), TextTransfer.getInstance() }); } } catch (SWTError e) { if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD) { throw e; } if (MessageDialog.openQuestion(shell, "Problem with copy title", // TODO ResourceNavigatorMessages.CopyToClipboardProblemDialog_title, //$NON-NLS-1$ "Problem with copy.")) { //$NON-NLS-1$ setClipboard(resources, fileNames, names); } } }
Example #4
Source File: LocationCopyAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public void run() { IStructuredSelection selection= (IStructuredSelection) fLocationViewer.getSelection(); StringBuffer buf= new StringBuffer(); for (Iterator<?> iterator= selection.iterator(); iterator.hasNext();) { CallLocation location= (CallLocation) iterator.next(); buf.append(location.getLineNumber()).append('\t').append(location.getCallText()); buf.append('\n'); } TextTransfer plainTextTransfer = TextTransfer.getInstance(); try { fClipboard.setContents( new String[]{ CopyCallHierarchyAction.convertLineTerminators(buf.toString()) }, new Transfer[]{ plainTextTransfer }); } catch (SWTError e){ if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD) throw e; if (MessageDialog.openQuestion(fViewSite.getShell(), CallHierarchyMessages.CopyCallHierarchyAction_problem, CallHierarchyMessages.CopyCallHierarchyAction_clipboard_busy)) run(); } }
Example #5
Source File: CopyCallHierarchyAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public void run() { StringBuffer buf= new StringBuffer(); addCalls(fViewer.getTree().getSelection()[0], 0, buf); TextTransfer plainTextTransfer= TextTransfer.getInstance(); try { fClipboard.setContents( new String[] { convertLineTerminators(buf.toString()) }, new Transfer[] { plainTextTransfer }); } catch (SWTError e) { if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD) throw e; if (MessageDialog.openQuestion(fView.getViewSite().getShell(), CallHierarchyMessages.CopyCallHierarchyAction_problem, CallHierarchyMessages.CopyCallHierarchyAction_clipboard_busy)) run(); } }
Example #6
Source File: CopyToClipboardAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private void copyToClipboard(IResource[] resources, String[] fileNames, String names, IJavaElement[] javaElements, TypedSource[] typedSources, int repeat, Clipboard clipboard) { final int repeat_max_count= 10; try{ clipboard.setContents(createDataArray(resources, javaElements, fileNames, names, typedSources), createDataTypeArray(resources, javaElements, fileNames, typedSources)); } catch (SWTError e) { if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD || repeat >= repeat_max_count) throw e; if (fAutoRepeatOnFailure) { try { Thread.sleep(500); } catch (InterruptedException e1) { // do nothing. } } if (fAutoRepeatOnFailure || MessageDialog.openQuestion(fShell, ReorgMessages.CopyToClipboardAction_4, ReorgMessages.CopyToClipboardAction_5)) copyToClipboard(resources, fileNames, names, javaElements, typedSources, repeat + 1, clipboard); } }
Example #7
Source File: CopyAction.java From gama with GNU General Public License v3.0 | 6 votes |
/** * Set the clipboard contents. Prompt to retry if clipboard is busy. * * @param resources * the resources to copy to the clipboard * @param fileNames * file names of the resources to copy to the clipboard * @param names * string representation of all names */ private void setClipboard(final IResource[] resources, final String[] fileNames, final String names) { try { // set the clipboard contents if (fileNames.length > 0) { clipboard.setContents(new Object[] { resources, fileNames, names }, new Transfer[] { ResourceTransfer.getInstance(), FileTransfer.getInstance(), TextTransfer.getInstance() }); } else { clipboard.setContents(new Object[] { resources, names }, new Transfer[] { ResourceTransfer.getInstance(), TextTransfer.getInstance() }); } } catch (final SWTError e) { if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD) { throw e; } if (MessageDialog.openQuestion(shell, "Problem with copy title", // TODO //$NON-NLS-1$ // ResourceNavigatorMessages.CopyToClipboardProblemDialog_title, "Problem with copy.")) { //$NON-NLS-1$ setClipboard(resources, fileNames, names); } } }
Example #8
Source File: XbaseInformationControl.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
/** * Tells whether the SWT Browser widget and hence this information control is available. * * @param parent * the parent component used for checking or <code>null</code> if none * @return <code>true</code> if this control is available */ public static boolean isAvailable(Composite parent) { if (!fgAvailabilityChecked) { try { Browser browser = new Browser(parent, SWT.NONE); browser.dispose(); fgIsAvailable = true; Slider sliderV = new Slider(parent, SWT.VERTICAL); Slider sliderH = new Slider(parent, SWT.HORIZONTAL); int width = sliderV.computeSize(SWT.DEFAULT, SWT.DEFAULT).x; int height = sliderH.computeSize(SWT.DEFAULT, SWT.DEFAULT).y; fgScrollBarSize = new Point(width, height); sliderV.dispose(); sliderH.dispose(); } catch (SWTError er) { fgIsAvailable = false; } finally { fgAvailabilityChecked = true; } } return fgIsAvailable; }
Example #9
Source File: ManageableTableTreeEx.java From SWET with MIT License | 6 votes |
void addItem(TableTreeItem item, int index) { if (item == null) throw new SWTError(SWT.ERROR_NULL_ARGUMENT); if (index < 0 || index > items.length) throw new SWTError(SWT.ERROR_INVALID_ARGUMENT); /* Now that item has a sub-node it must provide a cue that it can be expanded */ if (items.length == 0 && index == 0) { if (tableItem != null) { Image image = expanded ? parent.getMinusImage() : parent.getPlusImage(); tableItem.setImage(0, image); } } TableTreeItem[] newItems = new TableTreeItem[items.length + 1]; System.arraycopy(items, 0, newItems, 0, index); newItems[index] = item; System.arraycopy(items, index, newItems, index + 1, items.length - index); items = newItems; if (expanded) item.setVisible(true); }
Example #10
Source File: SinkView.java From lapse-plus with GNU General Public License v3.0 | 6 votes |
public void run() { StringBuffer buf = new StringBuffer(); addCalls(viewer.getTable().getSelection(), buf); TextTransfer plainTextTransfer = TextTransfer.getInstance(); try { fClipboard.setContents(new String[]{convertLineTerminators(buf.toString())}, new Transfer[]{plainTextTransfer}); } catch (SWTError e) { if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD) throw e; if (MessageDialog .openQuestion(fView.getViewSite().getShell(), ("CopyCallHierarchyAction.problem"), ("CopyCallHierarchyAction.clipboard_busy"))) { run(); } } }
Example #11
Source File: SourceView.java From lapse-plus with GNU General Public License v3.0 | 6 votes |
public void run() { StringBuffer buf = new StringBuffer(); addCalls(viewer.getTable().getSelection(), buf); TextTransfer plainTextTransfer = TextTransfer.getInstance(); try{ fClipboard.setContents( new String[]{ convertLineTerminators(buf.toString()) }, new Transfer[]{ plainTextTransfer }); } catch (SWTError e){ if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD) throw e; if (MessageDialog.openQuestion(fView.getViewSite().getShell(), ("CopyCallHierarchyAction.problem"), ("CopyCallHierarchyAction.clipboard_busy")) ) { run(); } } }
Example #12
Source File: ManageableTableTreeEx.java From SWET with MIT License | 5 votes |
public void setSelection(TableTreeItem[] items) { TableItem[] tableItems = new TableItem[items.length]; for (int i = 0; i < items.length; i++) { if (items[i] == null) throw new SWTError(SWT.ERROR_NULL_ARGUMENT); if (!items[i].getVisible()) expandItem(items[i]); tableItems[i] = items[i].tableItem; } table.setSelection(tableItems); }
Example #13
Source File: ProcessDiagramEditor.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public void dispose() { unhookOutlineViewer(); if (thumbnail != null) { try { thumbnail.deactivate(); } catch (SWTError e) { //Avoid popup } } this.overviewInitialized = false; super.dispose(); }
Example #14
Source File: DefinitionResourceProvider.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected ImageRegistry createImageRegistry() { // If we are in the UI Thread use that if (Display.getDefault() != null) { return new ImageRegistry(Display.getDefault()); } if (PlatformUI.isWorkbenchRunning()) { return new ImageRegistry(PlatformUI.getWorkbench().getDisplay()); } // Invalid thread access if it is not the UI Thread // and the workbench is not created. throw new SWTError(SWT.ERROR_THREAD_INVALID_ACCESS); }
Example #15
Source File: EmbeddedBrowserFactory.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Must run on UI thread * * @return */ private boolean test( ) { // !remove OS check, see bugzilla#270189 // if ( !Constants.OS_WIN32.equalsIgnoreCase( Platform.getOS( ) ) // && !Constants.OS_LINUX.equalsIgnoreCase( Platform.getOS( ) ) ) // { // return false; // } if ( !tested ) { tested = true; Shell sh = new Shell( ); try { new Browser( sh, SWT.NONE ); available = true; } catch ( SWTError se ) { if ( se.code == SWT.ERROR_NO_HANDLES ) { // Browser not implemented available = false; } } catch ( Exception e ) { // Browser not implemented } if ( sh != null && !sh.isDisposed( ) ) sh.dispose( ); } return available; }
Example #16
Source File: UIUtil.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Must run on UI thread * * @return */ private static boolean test( ) { if ( !Constants.OS_WIN32.equalsIgnoreCase( Platform.getOS( ) ) && !Constants.OS_LINUX.equalsIgnoreCase( Platform.getOS( ) ) ) { return false; } if ( !embeddedBrowserTested ) { embeddedBrowserTested = true; Shell sh = new Shell( ); try { new Browser( sh, SWT.NONE ); embeddedBrowserAvailable = true; } catch ( SWTError se ) { if ( se.code == SWT.ERROR_NO_HANDLES ) { // Browser not implemented embeddedBrowserAvailable = false; } } catch ( Exception e ) { // Browser not implemented } if ( sh != null && !sh.isDisposed( ) ) { sh.dispose( ); } } return embeddedBrowserAvailable; }
Example #17
Source File: CSpinner.java From birt with Eclipse Public License 1.0 | 5 votes |
protected void addSelectionListener( SelectionListener listener ) { if ( listener == null ) throw new SWTError( SWT.ERROR_NULL_ARGUMENT ); addListener( SWT.Selection, new TypedListener( listener ) ); }
Example #18
Source File: CopyAction.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * Set the clipboard contents. Prompt to retry if clipboard is busy. * * @param resources the resources to copy to the clipboard * @param fileNames file names of the resources to copy to the clipboard * @param names string representation of all names */ private void setClipboard(IResource[] resources, String[] fileNames, String names) { try { // set the clipboard contents if (fileNames.length > 0) { clipboard.setContents(new Object[] { resources, fileNames, names }, new Transfer[] { ResourceTransfer.getInstance(), FileTransfer.getInstance(), TextTransfer.getInstance() }); } else { clipboard.setContents(new Object[] { resources, names }, new Transfer[] { ResourceTransfer.getInstance(), TextTransfer.getInstance() }); } } catch (SWTError e) { if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD) { throw e; } if (MessageDialog .openQuestion( shell, WorkbenchNavigatorMessages.actions_CopyAction_msgTitle, // TODO ResourceNavigatorMessages.CopyToClipboardProblemDialog_title, //$NON-NLS-1$ WorkbenchNavigatorMessages.actions_CopyAction_msg)) { //$NON-NLS-1$ setClipboard(resources, fileNames, names); } } }
Example #19
Source File: CopyAction.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * Set the clipboard contents. Prompt to retry if clipboard is busy. * * @param resources the resources to copy to the clipboard * @param fileNames file names of the resources to copy to the clipboard * @param names string representation of all names */ private void setClipboard(IResource[] resources, String[] fileNames, String names) { try { // set the clipboard contents if (fileNames.length > 0) { clipboard.setContents(new Object[] { resources, fileNames, names }, new Transfer[] { ResourceTransfer.getInstance(), FileTransfer.getInstance(), TextTransfer.getInstance() }); } else { clipboard.setContents(new Object[] { resources, names }, new Transfer[] { ResourceTransfer.getInstance(), TextTransfer.getInstance() }); } } catch (SWTError e) { if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD) { throw e; } if (MessageDialog .openQuestion( shell, WorkbenchNavigatorMessages.actions_CopyAction_msgTitle, // TODO ResourceNavigatorMessages.CopyToClipboardProblemDialog_title, //$NON-NLS-1$ WorkbenchNavigatorMessages.actions_CopyAction_msg)) { //$NON-NLS-1$ setClipboard(resources, fileNames, names); } } }
Example #20
Source File: ClipboardOperationAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void setClipboardContents(Clipboard clipboard, Object[] datas, Transfer[] transfers) { try { clipboard.setContents(datas, transfers); } catch (SWTError e) { if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD) { throw e; } // silently fail. see e.g. https://bugs.eclipse.org/bugs/show_bug.cgi?id=65975 } }
Example #21
Source File: ManageableTableTreeEx.java From SWET with MIT License | 5 votes |
int addItem(TableTreeItem item, int index) { if (index < 0 || index > items.length) throw new SWTError(SWT.ERROR_INVALID_ARGUMENT); TableTreeItem[] newItems = new TableTreeItem[items.length + 1]; System.arraycopy(items, 0, newItems, 0, index); newItems[index] = item; System.arraycopy(items, index, newItems, index + 1, items.length - index); items = newItems; if (index == items.length - 1) return table.getItemCount(); else return table.indexOf(items[index + 1].tableItem); }
Example #22
Source File: CopyToClipboardAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void copyToClipboard(ITextSelection selection, int repeatCount) { try{ fClipboard.setContents(new String[] { selection.getText() }, new Transfer[] { TextTransfer.getInstance() }); } catch (SWTError e) { if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD || repeatCount >= MAX_REPEAT_COUNT) throw e; if (MessageDialog.openQuestion(getShell(), InfoViewMessages.CopyToClipboard_error_title, InfoViewMessages.CopyToClipboard_error_message)) copyToClipboard(selection, repeatCount + 1); } }
Example #23
Source File: CustomBrowserInformationControl.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * Tells whether the SWT Browser widget and hence this information control is available. * * @param parent * the parent component used for checking or <code>null</code> if none * @return <code>true</code> if this control is available */ public static boolean isAvailable(Composite parent) { if (!fgAvailabilityChecked) { try { Browser browser = new Browser(parent, SWT.NONE); browser.dispose(); fgIsAvailable = true; Slider sliderV = new Slider(parent, SWT.VERTICAL); Slider sliderH = new Slider(parent, SWT.HORIZONTAL); int width = sliderV.computeSize(SWT.DEFAULT, SWT.DEFAULT).x; int height = sliderH.computeSize(SWT.DEFAULT, SWT.DEFAULT).y; fgScrollBarSize = new Point(width, height); sliderV.dispose(); sliderH.dispose(); } catch (SWTError er) { fgIsAvailable = false; } finally { fgAvailabilityChecked = true; } } return fgIsAvailable; }
Example #24
Source File: ContentAssistant.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * showAssist * * @param showStyle */ protected void showAssist(final int showStyle) { final Display d = fContentAssistSubjectControlAdapter.getControl().getDisplay(); if (d != null) { try { d.syncExec(new Runnable() { public void run() { Control c = d.getFocusControl(); if (c == null) { return; } if (showStyle == SHOW_PROPOSALS) { fProposalPopup.showProposals(true); } else if (showStyle == SHOW_CONTEXT_INFO && fContextInfoPopup != null) { fContextInfoPopup.showContextProposals(true); } // } } }); } catch (SWTError e) { } } }
Example #25
Source File: ManageableTableTreeEx.java From SWET with MIT License | 5 votes |
public void showItem(TableTreeItem item) { if (item == null) throw new SWTError(SWT.ERROR_NULL_ARGUMENT); if (!item.getVisible()) expandItem(item); TableItem tableItem = item.tableItem; table.showItem(tableItem); }
Example #26
Source File: JavadocView.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override protected void internalCreatePartControl(Composite parent) { try { fBrowser= new Browser(parent, SWT.NONE); fBrowser.setJavascriptEnabled(false); fIsUsingBrowserWidget= true; addLinkListener(fBrowser); fBrowser.addOpenWindowListener(new OpenWindowListener() { public void open(WindowEvent event) { event.required= true; // Cancel opening of new windows } }); } catch (SWTError er) { /* The Browser widget throws an SWTError if it fails to * instantiate properly. Application code should catch * this SWTError and disable any feature requiring the * Browser widget. * Platform requirements for the SWT Browser widget are available * from the SWT FAQ web site. */ IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore(); boolean doNotWarn= store.getBoolean(DO_NOT_WARN_PREFERENCE_KEY); if (WARNING_DIALOG_ENABLED) { if (!doNotWarn) { String title= InfoViewMessages.JavadocView_error_noBrowser_title; String message= InfoViewMessages.JavadocView_error_noBrowser_message; String toggleMessage= InfoViewMessages.JavadocView_error_noBrowser_doNotWarn; MessageDialogWithToggle dialog= MessageDialogWithToggle.openError(parent.getShell(), title, message, toggleMessage, false, null, null); if (dialog.getReturnCode() == Window.OK) store.setValue(DO_NOT_WARN_PREFERENCE_KEY, dialog.getToggleState()); } } fIsUsingBrowserWidget= false; } if (!fIsUsingBrowserWidget) { fText= new StyledText(parent, SWT.V_SCROLL | SWT.H_SCROLL); fText.setEditable(false); fPresenter= new HTMLTextPresenter(false); fText.addControlListener(new ControlAdapter() { /* * @see org.eclipse.swt.events.ControlAdapter#controlResized(org.eclipse.swt.events.ControlEvent) */ @Override public void controlResized(ControlEvent e) { doSetInput(fOriginalInput); } }); } initStyleSheet(); listenForFontChanges(); getViewSite().setSelectionProvider(new SelectionProvider(getControl())); }
Example #27
Source File: ManageableTableTreeEx.java From SWET with MIT License | 4 votes |
public void removeSelectionListener(SelectionListener listener) { if (listener == null) throw new SWTError(SWT.ERROR_NULL_ARGUMENT); removeListener(SWT.Selection, listener); removeListener(SWT.DefaultSelection, listener); }
Example #28
Source File: ImportsAwareClipboardAction.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
private void doCutCopyWithImportsOperation() { try { final XbaseClipboardData cbData = createClipboardData(); if (cbData != null ) { ClipboardUtil.clipboardOperation(new Function<Clipboard, Boolean>() { @Override public Boolean apply(Clipboard clipboard) { Map<Object,Transfer> payload = newLinkedHashMap(); payload.put(cbData, TRANSFER_INSTANCE); TextTransfer textTransfer = TextTransfer.getInstance(); String textData = (String) clipboard.getContents(textTransfer); if (textData == null || textData.isEmpty()) { // StyledText copied any data to ClipBoard return Boolean.FALSE; } payload.put(textData, textTransfer); RTFTransfer rtfTransfer = RTFTransfer.getInstance(); String rtfData = (String) clipboard.getContents(rtfTransfer); if (rtfData != null && !rtfData.isEmpty()) { payload.put(rtfData, rtfTransfer); } List<Object> datas = newArrayList(); List<Transfer> dataTypes = newArrayList(); for (Entry<Object, Transfer> entry : payload.entrySet()) { datas.add(entry.getKey()); dataTypes.add(entry.getValue()); } try { clipboard.setContents(datas.toArray(), dataTypes.toArray(new Transfer[] {})); return Boolean.TRUE; } catch (SWTError e) { if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD) { throw e; } if (MessageDialog.openQuestion(getShell(), ActionMessages.CopyQualifiedNameAction_ErrorTitle, ActionMessages.CopyQualifiedNameAction_ErrorDescription)) { clipboard.setContents(datas.toArray(), dataTypes.toArray(new Transfer[] {})); return Boolean.TRUE; } return Boolean.FALSE; } } }); } } finally { textOperationTarget.doOperation(operationCode); } }
Example #29
Source File: ManageableTableTreeEx.java From SWET with MIT License | 4 votes |
public void removeTreeListener(TreeListener listener) { if (listener == null) throw new SWTError(SWT.ERROR_NULL_ARGUMENT); removeListener(SWT.Expand, listener); removeListener(SWT.Collapse, listener); }
Example #30
Source File: BrowserWrapperSWTFactory.java From BiglyBT with GNU General Public License v2.0 | 4 votes |
public static BrowserWrapper create( Composite composite, int style ) { try{ Map<String,Object> properties = new HashMap<>(); for ( BrowserProvider provider: providers ){ try{ BrowserWrapper browser = provider.create( composite, style, properties); if ( browser != null ){ return( browser ); } }catch( Throwable e ){ Debug.out( e ); } Utils.disposeComposite( composite, false ); } return( new BrowserWrapperSWT( composite, style )); }catch( SWTError error ){ Control[] children = composite.getChildren(); for (Control child : children) { if ( child.getData( BROWSER_KEY ) != null ){ try { child.dispose(); } catch (Throwable t) { } } } return( new BrowserWrapperFake( composite, style, error )); } }