@Override public void populateToolbarActions(ToolBarManager tbm, CustomBrowserInformationControl iControl) { final OpenDeclarationAction openDeclarationAction = new OpenDeclarationAction(iControl); final OpenHelpAction openHelpAction = new OpenHelpAction(iControl); tbm.add(openDeclarationAction); tbm.add(openHelpAction); IInputChangedListener inputChangeListener = new IInputChangedListener() { public void inputChanged(Object newInput) { if (newInput instanceof BrowserInformationControlInput) { openDeclarationAction.update(); openHelpAction.update(); } } }; iControl.addInputChangeListener(inputChangeListener); }
public IInformationControl doCreateInformationControl(Shell parent) { if (de.darwinspl.preferences.resource.dwprofile.ui.DwprofileBrowserInformationControl.isAvailable(parent)) { ToolBarManager tbm = new ToolBarManager(SWT.FLAT); de.darwinspl.preferences.resource.dwprofile.ui.DwprofileBrowserInformationControl iControl = new de.darwinspl.preferences.resource.dwprofile.ui.DwprofileBrowserInformationControl(parent, FONT, tbm); final OpenDeclarationAction openDeclarationAction = new OpenDeclarationAction(iControl); tbm.add(openDeclarationAction); final SimpleSelectionProvider selectionProvider = new SimpleSelectionProvider(); IInputChangedListener inputChangeListener = new IInputChangedListener() { public void inputChanged(Object newInput) { if (newInput == null) { selectionProvider.setSelection(new StructuredSelection()); } else if (newInput instanceof de.darwinspl.preferences.resource.dwprofile.ui.DwprofileDocBrowserInformationControlInput) { de.darwinspl.preferences.resource.dwprofile.ui.DwprofileDocBrowserInformationControlInput input = (de.darwinspl.preferences.resource.dwprofile.ui.DwprofileDocBrowserInformationControlInput) newInput; Object inputElement = input.getInputElement(); selectionProvider.setSelection(new StructuredSelection(inputElement)); // If there is an element of type EObject in the input element, the button to open // the declaration will be set enable boolean isEObjectInput = inputElement instanceof EObject; openDeclarationAction.setEnabled(isEObjectInput); if (isEObjectInput) { String simpleName = inputElement.getClass().getSimpleName(); simpleName = simpleName.substring(0, simpleName.length() - 4); openDeclarationAction.setText("Open " + simpleName); } else openDeclarationAction.setText("Open Declaration"); } } }; iControl.addInputChangeListener(inputChangeListener); tbm.update(true); return iControl; } else { return new DefaultInformationControl(parent, true); } }
public IInformationControl doCreateInformationControl(Shell parent) { if (eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionBrowserInformationControl.isAvailable(parent)) { ToolBarManager tbm = new ToolBarManager(SWT.FLAT); eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionBrowserInformationControl iControl = new eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionBrowserInformationControl(parent, FONT, tbm); final OpenDeclarationAction openDeclarationAction = new OpenDeclarationAction(iControl); tbm.add(openDeclarationAction); final SimpleSelectionProvider selectionProvider = new SimpleSelectionProvider(); IInputChangedListener inputChangeListener = new IInputChangedListener() { public void inputChanged(Object newInput) { if (newInput == null) { selectionProvider.setSelection(new StructuredSelection()); } else if (newInput instanceof eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionDocBrowserInformationControlInput) { eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionDocBrowserInformationControlInput input = (eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionDocBrowserInformationControlInput) newInput; Object inputElement = input.getInputElement(); selectionProvider.setSelection(new StructuredSelection(inputElement)); // If there is an element of type EObject in the input element, the button to open // the declaration will be set enable boolean isEObjectInput = inputElement instanceof EObject; openDeclarationAction.setEnabled(isEObjectInput); if (isEObjectInput) { String simpleName = inputElement.getClass().getSimpleName(); simpleName = simpleName.substring(0, simpleName.length() - 4); openDeclarationAction.setText("Open " + simpleName); } else openDeclarationAction.setText("Open Declaration"); } } }; iControl.addInputChangeListener(inputChangeListener); tbm.update(true); return iControl; } else { return new DefaultInformationControl(parent, true); } }
public IInformationControl doCreateInformationControl(Shell parent) { if (eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaBrowserInformationControl.isAvailable(parent)) { ToolBarManager tbm = new ToolBarManager(SWT.FLAT); eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaBrowserInformationControl iControl = new eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaBrowserInformationControl(parent, FONT, tbm); final OpenDeclarationAction openDeclarationAction = new OpenDeclarationAction(iControl); tbm.add(openDeclarationAction); final SimpleSelectionProvider selectionProvider = new SimpleSelectionProvider(); IInputChangedListener inputChangeListener = new IInputChangedListener() { public void inputChanged(Object newInput) { if (newInput == null) { selectionProvider.setSelection(new StructuredSelection()); } else if (newInput instanceof eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaDocBrowserInformationControlInput) { eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaDocBrowserInformationControlInput input = (eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaDocBrowserInformationControlInput) newInput; Object inputElement = input.getInputElement(); selectionProvider.setSelection(new StructuredSelection(inputElement)); // If there is an element of type EObject in the input element, the button to open // the declaration will be set enable boolean isEObjectInput = inputElement instanceof EObject; openDeclarationAction.setEnabled(isEObjectInput); if (isEObjectInput) { String simpleName = inputElement.getClass().getSimpleName(); simpleName = simpleName.substring(0, simpleName.length() - 4); openDeclarationAction.setText("Open " + simpleName); } else openDeclarationAction.setText("Open Declaration"); } } }; iControl.addInputChangeListener(inputChangeListener); tbm.update(true); return iControl; } else { return new DefaultInformationControl(parent, true); } }
public IInformationControl doCreateInformationControl(Shell parent) { if (eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueBrowserInformationControl.isAvailable(parent)) { ToolBarManager tbm = new ToolBarManager(SWT.FLAT); eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueBrowserInformationControl iControl = new eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueBrowserInformationControl(parent, FONT, tbm); final OpenDeclarationAction openDeclarationAction = new OpenDeclarationAction(iControl); tbm.add(openDeclarationAction); final SimpleSelectionProvider selectionProvider = new SimpleSelectionProvider(); IInputChangedListener inputChangeListener = new IInputChangedListener() { public void inputChanged(Object newInput) { if (newInput == null) { selectionProvider.setSelection(new StructuredSelection()); } else if (newInput instanceof eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueDocBrowserInformationControlInput) { eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueDocBrowserInformationControlInput input = (eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueDocBrowserInformationControlInput) newInput; Object inputElement = input.getInputElement(); selectionProvider.setSelection(new StructuredSelection(inputElement)); // If there is an element of type EObject in the input element, the button to open // the declaration will be set enable boolean isEObjectInput = inputElement instanceof EObject; openDeclarationAction.setEnabled(isEObjectInput); if (isEObjectInput) { String simpleName = inputElement.getClass().getSimpleName(); simpleName = simpleName.substring(0, simpleName.length() - 4); openDeclarationAction.setText("Open " + simpleName); } else openDeclarationAction.setText("Open Declaration"); } } }; iControl.addInputChangeListener(inputChangeListener); tbm.update(true); return iControl; } else { return new DefaultInformationControl(parent, true); } }
public IInformationControl doCreateInformationControl(Shell parent) { if (eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingBrowserInformationControl.isAvailable(parent)) { ToolBarManager tbm = new ToolBarManager(SWT.FLAT); eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingBrowserInformationControl iControl = new eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingBrowserInformationControl(parent, FONT, tbm); final OpenDeclarationAction openDeclarationAction = new OpenDeclarationAction(iControl); tbm.add(openDeclarationAction); final SimpleSelectionProvider selectionProvider = new SimpleSelectionProvider(); IInputChangedListener inputChangeListener = new IInputChangedListener() { public void inputChanged(Object newInput) { if (newInput == null) { selectionProvider.setSelection(new StructuredSelection()); } else if (newInput instanceof eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingDocBrowserInformationControlInput) { eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingDocBrowserInformationControlInput input = (eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingDocBrowserInformationControlInput) newInput; Object inputElement = input.getInputElement(); selectionProvider.setSelection(new StructuredSelection(inputElement)); // If there is an element of type EObject in the input element, the button to open // the declaration will be set enable boolean isEObjectInput = inputElement instanceof EObject; openDeclarationAction.setEnabled(isEObjectInput); if (isEObjectInput) { String simpleName = inputElement.getClass().getSimpleName(); simpleName = simpleName.substring(0, simpleName.length() - 4); openDeclarationAction.setText("Open " + simpleName); } else openDeclarationAction.setText("Open Declaration"); } } }; iControl.addInputChangeListener(inputChangeListener); tbm.update(true); return iControl; } else { return new DefaultInformationControl(parent, true); } }
public IInformationControl doCreateInformationControl(Shell parent) { if (eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsBrowserInformationControl.isAvailable(parent)) { ToolBarManager tbm = new ToolBarManager(SWT.FLAT); eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsBrowserInformationControl iControl = new eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsBrowserInformationControl(parent, FONT, tbm); final OpenDeclarationAction openDeclarationAction = new OpenDeclarationAction(iControl); tbm.add(openDeclarationAction); final SimpleSelectionProvider selectionProvider = new SimpleSelectionProvider(); IInputChangedListener inputChangeListener = new IInputChangedListener() { public void inputChanged(Object newInput) { if (newInput == null) { selectionProvider.setSelection(new StructuredSelection()); } else if (newInput instanceof eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsDocBrowserInformationControlInput) { eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsDocBrowserInformationControlInput input = (eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsDocBrowserInformationControlInput) newInput; Object inputElement = input.getInputElement(); selectionProvider.setSelection(new StructuredSelection(inputElement)); // If there is an element of type EObject in the input element, the button to open // the declaration will be set enable boolean isEObjectInput = inputElement instanceof EObject; openDeclarationAction.setEnabled(isEObjectInput); if (isEObjectInput) { String simpleName = inputElement.getClass().getSimpleName(); simpleName = simpleName.substring(0, simpleName.length() - 4); openDeclarationAction.setText("Open " + simpleName); } else openDeclarationAction.setText("Open Declaration"); } } }; iControl.addInputChangeListener(inputChangeListener); tbm.update(true); return iControl; } else { return new DefaultInformationControl(parent, true); } }
public IInformationControl doCreateInformationControl(Shell parent) { if (eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestBrowserInformationControl.isAvailable(parent)) { ToolBarManager tbm = new ToolBarManager(SWT.FLAT); eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestBrowserInformationControl iControl = new eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestBrowserInformationControl(parent, FONT, tbm); final OpenDeclarationAction openDeclarationAction = new OpenDeclarationAction(iControl); tbm.add(openDeclarationAction); final SimpleSelectionProvider selectionProvider = new SimpleSelectionProvider(); IInputChangedListener inputChangeListener = new IInputChangedListener() { public void inputChanged(Object newInput) { if (newInput == null) { selectionProvider.setSelection(new StructuredSelection()); } else if (newInput instanceof eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestDocBrowserInformationControlInput) { eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestDocBrowserInformationControlInput input = (eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestDocBrowserInformationControlInput) newInput; Object inputElement = input.getInputElement(); selectionProvider.setSelection(new StructuredSelection(inputElement)); // If there is an element of type EObject in the input element, the button to open // the declaration will be set enable boolean isEObjectInput = inputElement instanceof EObject; openDeclarationAction.setEnabled(isEObjectInput); if (isEObjectInput) { String simpleName = inputElement.getClass().getSimpleName(); simpleName = simpleName.substring(0, simpleName.length() - 4); openDeclarationAction.setText("Open " + simpleName); } else openDeclarationAction.setText("Open Declaration"); } } }; iControl.addInputChangeListener(inputChangeListener); tbm.update(true); return iControl; } else { return new DefaultInformationControl(parent, true); } }
/** * @since 2.3 */ protected void configureControl(final IXtextBrowserInformationControl control, ToolBarManager tbm, String font){ final BackAction backAction = new BackAction(control); backAction.setEnabled(false); tbm.add(backAction); final ForwardAction forwardAction = new ForwardAction(control); tbm.add(forwardAction); forwardAction.setEnabled(false); // final ShowInJavadocViewAction showInJavadocViewAction= new ShowInJavadocViewAction(iControl); // tbm.add(showInJavadocViewAction); final OpenDeclarationAction openDeclarationAction = new OpenDeclarationAction(control); tbm.add(openDeclarationAction); // final SimpleSelectionProvider selectionProvider= new SimpleSelectionProvider(); IInputChangedListener inputChangeListener = new IInputChangedListener() { public void inputChanged(Object newInput) { backAction.update(); forwardAction.update(); if (newInput == null) { // selectionProvider.setSelection(new StructuredSelection()); } else if (newInput instanceof XtextBrowserInformationControlInput) { // XtextBrowserInformationControlInput input= (XtextBrowserInformationControlInput) newInput; // Object inputElement = input.getInputElement(); // selectionProvider.setSelection(new StructuredSelection(inputElement)); // boolean isJavaElementInput= inputElement instanceof IJavaElement; // showInJavadocViewAction.setEnabled(isJavaElementInput); openDeclarationAction.setEnabled(true); } } }; control.addInputChangeListener(inputChangeListener); tbm.update(true); addLinkListener(control); }
/** * {@inheritDoc} This control can handle {@link String}(no handle) and */ public void setInput(Object input) { Assert.isLegal(input == null || input instanceof String || input instanceof de.darwinspl.preferences.resource.dwprofile.ui.DwprofileDocBrowserInformationControlInput); if (input instanceof String) { setInformation((String)input); return; } fInput= (de.darwinspl.preferences.resource.dwprofile.ui.DwprofileDocBrowserInformationControlInput) input; String content= null; if (fInput != null) content= fInput.getHtml(); fBrowserHasContent= content != null && content.length() > 0; if (!fBrowserHasContent) content= "<html><body ></html>"; boolean RTL= (getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0; boolean resizable= isResizable(); // The default "overflow:auto" would not result in a predictable width for the // client area and the re-wrapping would cause visual noise String[] styles= null; if (RTL && resizable) { styles= new String[] { "direction:rtl;", "overflow:scroll;", "word-wrap:break-word;" }; } else if (RTL && !resizable) { styles= new String[] { "direction:rtl;", "overflow:hidden;", "word-wrap:break-word;" }; } else if (!resizable) { // XXX: In IE, "word-wrap: break-word;" causes bogus wrapping even in non-broken // words :-(see e.g. Javadoc of String). Re-check whether we really still need // this now that the Javadoc Hover header already sets this style. styles= new String[] { "overflow:hidden;"/*, "word-wrap: break-word;"*/ }; } else { styles= new String[] { "overflow:scroll;" }; } StringBuffer buffer= new StringBuffer(content); de.darwinspl.preferences.resource.dwprofile.ui.DwprofileHTMLPrinter.insertStyles(buffer, styles); content= buffer.toString(); // XXX: Should add some JavaScript here that shows something like "(continued...)" // or "..." at the end of the visible area when the page overflowed with // "overflow:hidden;". fCompleted= false; fBrowser.setText(content); Object[] listeners= fInputChangeListeners.getListeners(); for (int i= 0; i < listeners.length; i++) { ((IInputChangedListener)listeners[i]).inputChanged(fInput); } }
/** * {@inheritDoc} This control can handle {@link String}(no handle) and */ public void setInput(Object input) { Assert.isLegal(input == null || input instanceof String || input instanceof eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionDocBrowserInformationControlInput); if (input instanceof String) { setInformation((String)input); return; } fInput= (eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionDocBrowserInformationControlInput) input; String content= null; if (fInput != null) content= fInput.getHtml(); fBrowserHasContent= content != null && content.length() > 0; if (!fBrowserHasContent) content= "<html><body ></html>"; boolean RTL= (getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0; boolean resizable= isResizable(); // The default "overflow:auto" would not result in a predictable width for the // client area and the re-wrapping would cause visual noise String[] styles= null; if (RTL && resizable) { styles= new String[] { "direction:rtl;", "overflow:scroll;", "word-wrap:break-word;" }; } else if (RTL && !resizable) { styles= new String[] { "direction:rtl;", "overflow:hidden;", "word-wrap:break-word;" }; } else if (!resizable) { // XXX: In IE, "word-wrap: break-word;" causes bogus wrapping even in non-broken // words :-(see e.g. Javadoc of String). Re-check whether we really still need // this now that the Javadoc Hover header already sets this style. styles= new String[] { "overflow:hidden;"/*, "word-wrap: break-word;"*/ }; } else { styles= new String[] { "overflow:scroll;" }; } StringBuffer buffer= new StringBuffer(content); eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionHTMLPrinter.insertStyles(buffer, styles); content= buffer.toString(); // XXX: Should add some JavaScript here that shows something like "(continued...)" // or "..." at the end of the visible area when the page overflowed with // "overflow:hidden;". fCompleted= false; fBrowser.setText(content); Object[] listeners= fInputChangeListeners.getListeners(); for (int i= 0; i < listeners.length; i++) { ((IInputChangedListener)listeners[i]).inputChanged(fInput); } }
/** * {@inheritDoc} This control can handle {@link String}(no handle) and */ public void setInput(Object input) { Assert.isLegal(input == null || input instanceof String || input instanceof eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaDocBrowserInformationControlInput); if (input instanceof String) { setInformation((String)input); return; } fInput= (eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaDocBrowserInformationControlInput) input; String content= null; if (fInput != null) content= fInput.getHtml(); fBrowserHasContent= content != null && content.length() > 0; if (!fBrowserHasContent) content= "<html><body ></html>"; boolean RTL= (getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0; boolean resizable= isResizable(); // The default "overflow:auto" would not result in a predictable width for the // client area and the re-wrapping would cause visual noise String[] styles= null; if (RTL && resizable) { styles= new String[] { "direction:rtl;", "overflow:scroll;", "word-wrap:break-word;" }; } else if (RTL && !resizable) { styles= new String[] { "direction:rtl;", "overflow:hidden;", "word-wrap:break-word;" }; } else if (!resizable) { // XXX: In IE, "word-wrap: break-word;" causes bogus wrapping even in non-broken // words :-(see e.g. Javadoc of String). Re-check whether we really still need // this now that the Javadoc Hover header already sets this style. styles= new String[] { "overflow:hidden;"/*, "word-wrap: break-word;"*/ }; } else { styles= new String[] { "overflow:scroll;" }; } StringBuffer buffer= new StringBuffer(content); eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaHTMLPrinter.insertStyles(buffer, styles); content= buffer.toString(); // XXX: Should add some JavaScript here that shows something like "(continued...)" // or "..." at the end of the visible area when the page overflowed with // "overflow:hidden;". fCompleted= false; fBrowser.setText(content); Object[] listeners= fInputChangeListeners.getListeners(); for (int i= 0; i < listeners.length; i++) { ((IInputChangedListener)listeners[i]).inputChanged(fInput); } }
/** * {@inheritDoc} This control can handle {@link String}(no handle) and */ public void setInput(Object input) { Assert.isLegal(input == null || input instanceof String || input instanceof eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueDocBrowserInformationControlInput); if (input instanceof String) { setInformation((String)input); return; } fInput= (eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueDocBrowserInformationControlInput) input; String content= null; if (fInput != null) content= fInput.getHtml(); fBrowserHasContent= content != null && content.length() > 0; if (!fBrowserHasContent) content= "<html><body ></html>"; boolean RTL= (getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0; boolean resizable= isResizable(); // The default "overflow:auto" would not result in a predictable width for the // client area and the re-wrapping would cause visual noise String[] styles= null; if (RTL && resizable) { styles= new String[] { "direction:rtl;", "overflow:scroll;", "word-wrap:break-word;" }; } else if (RTL && !resizable) { styles= new String[] { "direction:rtl;", "overflow:hidden;", "word-wrap:break-word;" }; } else if (!resizable) { // XXX: In IE, "word-wrap: break-word;" causes bogus wrapping even in non-broken // words :-(see e.g. Javadoc of String). Re-check whether we really still need // this now that the Javadoc Hover header already sets this style. styles= new String[] { "overflow:hidden;"/*, "word-wrap: break-word;"*/ }; } else { styles= new String[] { "overflow:scroll;" }; } StringBuffer buffer= new StringBuffer(content); eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueHTMLPrinter.insertStyles(buffer, styles); content= buffer.toString(); // XXX: Should add some JavaScript here that shows something like "(continued...)" // or "..." at the end of the visible area when the page overflowed with // "overflow:hidden;". fCompleted= false; fBrowser.setText(content); Object[] listeners= fInputChangeListeners.getListeners(); for (int i= 0; i < listeners.length; i++) { ((IInputChangedListener)listeners[i]).inputChanged(fInput); } }
/** * {@inheritDoc} This control can handle {@link String}(no handle) and */ public void setInput(Object input) { Assert.isLegal(input == null || input instanceof String || input instanceof eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingDocBrowserInformationControlInput); if (input instanceof String) { setInformation((String)input); return; } fInput= (eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingDocBrowserInformationControlInput) input; String content= null; if (fInput != null) content= fInput.getHtml(); fBrowserHasContent= content != null && content.length() > 0; if (!fBrowserHasContent) content= "<html><body ></html>"; boolean RTL= (getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0; boolean resizable= isResizable(); // The default "overflow:auto" would not result in a predictable width for the // client area and the re-wrapping would cause visual noise String[] styles= null; if (RTL && resizable) { styles= new String[] { "direction:rtl;", "overflow:scroll;", "word-wrap:break-word;" }; } else if (RTL && !resizable) { styles= new String[] { "direction:rtl;", "overflow:hidden;", "word-wrap:break-word;" }; } else if (!resizable) { // XXX: In IE, "word-wrap: break-word;" causes bogus wrapping even in non-broken // words :-(see e.g. Javadoc of String). Re-check whether we really still need // this now that the Javadoc Hover header already sets this style. styles= new String[] { "overflow:hidden;"/*, "word-wrap: break-word;"*/ }; } else { styles= new String[] { "overflow:scroll;" }; } StringBuffer buffer= new StringBuffer(content); eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingHTMLPrinter.insertStyles(buffer, styles); content= buffer.toString(); // XXX: Should add some JavaScript here that shows something like "(continued...)" // or "..." at the end of the visible area when the page overflowed with // "overflow:hidden;". fCompleted= false; fBrowser.setText(content); Object[] listeners= fInputChangeListeners.getListeners(); for (int i= 0; i < listeners.length; i++) { ((IInputChangedListener)listeners[i]).inputChanged(fInput); } }
/** * {@inheritDoc} This control can handle {@link String}(no handle) and */ public void setInput(Object input) { Assert.isLegal(input == null || input instanceof String || input instanceof eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsDocBrowserInformationControlInput); if (input instanceof String) { setInformation((String)input); return; } fInput= (eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsDocBrowserInformationControlInput) input; String content= null; if (fInput != null) content= fInput.getHtml(); fBrowserHasContent= content != null && content.length() > 0; if (!fBrowserHasContent) content= "<html><body ></html>"; boolean RTL= (getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0; boolean resizable= isResizable(); // The default "overflow:auto" would not result in a predictable width for the // client area and the re-wrapping would cause visual noise String[] styles= null; if (RTL && resizable) { styles= new String[] { "direction:rtl;", "overflow:scroll;", "word-wrap:break-word;" }; } else if (RTL && !resizable) { styles= new String[] { "direction:rtl;", "overflow:hidden;", "word-wrap:break-word;" }; } else if (!resizable) { // XXX: In IE, "word-wrap: break-word;" causes bogus wrapping even in non-broken // words :-(see e.g. Javadoc of String). Re-check whether we really still need // this now that the Javadoc Hover header already sets this style. styles= new String[] { "overflow:hidden;"/*, "word-wrap: break-word;"*/ }; } else { styles= new String[] { "overflow:scroll;" }; } StringBuffer buffer= new StringBuffer(content); eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsHTMLPrinter.insertStyles(buffer, styles); content= buffer.toString(); // XXX: Should add some JavaScript here that shows something like "(continued...)" // or "..." at the end of the visible area when the page overflowed with // "overflow:hidden;". fCompleted= false; fBrowser.setText(content); Object[] listeners= fInputChangeListeners.getListeners(); for (int i= 0; i < listeners.length; i++) { ((IInputChangedListener)listeners[i]).inputChanged(fInput); } }
/** * {@inheritDoc} This control can handle {@link String}(no handle) and */ public void setInput(Object input) { Assert.isLegal(input == null || input instanceof String || input instanceof eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestDocBrowserInformationControlInput); if (input instanceof String) { setInformation((String)input); return; } fInput= (eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestDocBrowserInformationControlInput) input; String content= null; if (fInput != null) content= fInput.getHtml(); fBrowserHasContent= content != null && content.length() > 0; if (!fBrowserHasContent) content= "<html><body ></html>"; boolean RTL= (getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0; boolean resizable= isResizable(); // The default "overflow:auto" would not result in a predictable width for the // client area and the re-wrapping would cause visual noise String[] styles= null; if (RTL && resizable) { styles= new String[] { "direction:rtl;", "overflow:scroll;", "word-wrap:break-word;" }; } else if (RTL && !resizable) { styles= new String[] { "direction:rtl;", "overflow:hidden;", "word-wrap:break-word;" }; } else if (!resizable) { // XXX: In IE, "word-wrap: break-word;" causes bogus wrapping even in non-broken // words :-(see e.g. Javadoc of String). Re-check whether we really still need // this now that the Javadoc Hover header already sets this style. styles= new String[] { "overflow:hidden;"/*, "word-wrap: break-word;"*/ }; } else { styles= new String[] { "overflow:scroll;" }; } StringBuffer buffer= new StringBuffer(content); eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestHTMLPrinter.insertStyles(buffer, styles); content= buffer.toString(); // XXX: Should add some JavaScript here that shows something like "(continued...)" // or "..." at the end of the visible area when the page overflowed with // "overflow:hidden;". fCompleted= false; fBrowser.setText(content); Object[] listeners= fInputChangeListeners.getListeners(); for (int i= 0; i < listeners.length; i++) { ((IInputChangedListener)listeners[i]).inputChanged(fInput); } }
public void addInputChangeListener(IInputChangedListener inputChangeListener) { control.addInputChangeListener(inputChangeListener); }
/** * {@inheritDoc} This control can handle {@link String} and {@link BrowserInformationControlInput}. */ public void setInput(Object input) { Assert.isLegal(input == null || input instanceof String || input instanceof BrowserInformationControlInput); if (input instanceof String) { setInformation((String) input); return; } fInput = (BrowserInformationControlInput) input; String content = null; if (fInput != null) content = fInput.getHtml(); fBrowserHasContent = content != null && content.length() > 0; if (!fBrowserHasContent) content = "<html><body ></html>"; //$NON-NLS-1$ boolean RTL = (getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0; boolean resizable = isResizable(); // The default "overflow:auto" would not result in a predictable width for the client area // and the re-wrapping would cause visual noise String[] styles = null; if (RTL && resizable) styles = new String[] { "direction:rtl;", "overflow:scroll;", "word-wrap:break-word;" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ else if (RTL && !resizable) styles = new String[] { "direction:rtl;", "overflow:hidden;", "word-wrap:break-word;" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ else if (!resizable) // XXX: In IE, "word-wrap: break-word;" causes bogus wrapping even in non-broken words :-(see e.g. Javadoc // of String). // Re-check whether we really still need this now that the Javadoc Hover header already sets this style. styles = new String[] { "overflow:hidden;"/* , "word-wrap: break-word;" */}; //$NON-NLS-1$ else styles = new String[] { "overflow:scroll;" }; //$NON-NLS-1$ StringBuffer buffer = new StringBuffer(content); HTMLPrinter.insertStyles(buffer, styles); content = buffer.toString(); /* * XXX: Should add some JavaScript here that shows something like "(continued...)" or "..." at the end of the * visible area when the page overflowed with "overflow:hidden;". */ fCompleted = false; fBrowser.setText(content); Object[] listeners = fInputChangeListeners.getListeners(); for (int i = 0; i < listeners.length; i++) ((IInputChangedListener) listeners[i]).inputChanged(fInput); }
public void setDelayedInputChangeListener(IInputChangedListener inputChangeListener) { fDelayedInputChangeListener = inputChangeListener; }
@Override public IInformationControl doCreateInformationControl(Shell parent) { if (BrowserInformationControl.isAvailable(parent)) { ToolBarManager tbm= new ToolBarManager(SWT.FLAT); String font= PreferenceConstants.APPEARANCE_JAVADOC_FONT; BrowserInformationControl iControl= new BrowserInformationControl(parent, font, tbm); final BackAction backAction= new BackAction(iControl); backAction.setEnabled(false); tbm.add(backAction); final ForwardAction forwardAction= new ForwardAction(iControl); tbm.add(forwardAction); forwardAction.setEnabled(false); final ShowInJavadocViewAction showInJavadocViewAction= new ShowInJavadocViewAction(iControl); tbm.add(showInJavadocViewAction); final OpenDeclarationAction openDeclarationAction= new OpenDeclarationAction(iControl); tbm.add(openDeclarationAction); final SimpleSelectionProvider selectionProvider= new SimpleSelectionProvider(); if (fSite != null) { OpenAttachedJavadocAction openAttachedJavadocAction= new OpenAttachedJavadocAction(fSite); openAttachedJavadocAction.setSpecialSelectionProvider(selectionProvider); openAttachedJavadocAction.setImageDescriptor(JavaPluginImages.DESC_ELCL_OPEN_BROWSER); openAttachedJavadocAction.setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_OPEN_BROWSER); selectionProvider.addSelectionChangedListener(openAttachedJavadocAction); selectionProvider.setSelection(new StructuredSelection()); tbm.add(openAttachedJavadocAction); } IInputChangedListener inputChangeListener= new IInputChangedListener() { public void inputChanged(Object newInput) { backAction.update(); forwardAction.update(); if (newInput == null) { selectionProvider.setSelection(new StructuredSelection()); } else if (newInput instanceof BrowserInformationControlInput) { BrowserInformationControlInput input= (BrowserInformationControlInput) newInput; Object inputElement= input.getInputElement(); selectionProvider.setSelection(new StructuredSelection(inputElement)); boolean isJavaElementInput= inputElement instanceof IJavaElement; showInJavadocViewAction.setEnabled(isJavaElementInput); openDeclarationAction.setEnabled(isJavaElementInput); } } }; iControl.addInputChangeListener(inputChangeListener); tbm.update(true); addLinkListener(iControl); return iControl; } else { return new DefaultInformationControl(parent, true); } }
/** * <p> * Adds a listener for input changes to this input change provider. Has no effect * if an identical listener is already registered. * </p> * * @param inputChangeListener the listener to add * * @since 3.4 */ public void addInputChangeListener(IInputChangedListener inputChangeListener) { Assert.isNotNull(inputChangeListener); fInputChangeListeners.add(inputChangeListener); }
/** * <p> * Removes the given input change listener from this input change provider. Has no * effect if an identical listener is not registered. * </p> * * @param inputChangeListener the listener to remove * * @since 3.4 */ public void removeInputChangeListener(IInputChangedListener inputChangeListener) { fInputChangeListeners.remove(inputChangeListener); }
/** * * @see * IDelayedInputChangeProvider#setDelayedInputChangeListener(IInputChangedListener) * * @since 3.4 */ public void setDelayedInputChangeListener(IInputChangedListener inputChangeListener) { fDelayedInputChangeListener= inputChangeListener; }