Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2011 IBM Corporation 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: IBM Corporation - initial API and implementation /
 
 
 package org.eclipse.help.ui.internal.views;
 
 import  org.eclipse.swt.SWT;
 import  org.eclipse.swt.graphics.Image;
 import  org.eclipse.swt.layout.GridData;
 import  org.eclipse.swt.layout.GridLayout;
 import  org.eclipse.swt.widgets.Composite;
 import  org.eclipse.swt.widgets.Control;
 
 public class MissingContentPart extends AbstractFormPart implements IHelpPart  {
 
 	private Composite container;
 	private String id;
 	private boolean wasRemoteHelpUnavailable = false;
 	private boolean wasUnresolvedPlaceholders = false;
 	
 	public MissingContentPart(Composite parentFormToolkit toolkit) {			
 		 = toolkit.createComposite(parent, SWT.NULL);
 		.setBackgroundMode(SWT.INHERIT_DEFAULT);
 		GridLayout layout = new GridLayout();
 		layout.marginHeight = 0;
 		layout.verticalSpacing = 0;
 		layout.marginTop = 2;
 		.setLayout(layout);
 	}
 
 	public void updateStatus() {
 		// Only update the controls if the status has changed
 		boolean isRemoteHelpUnavailable = RemoteStatusData.isAnyRemoteHelpUnavailable();
 		if ( isRemoteHelpUnavailable && ) {
 			return// Nothing to do, remote help unavailable message already showing
 		}
 		boolean isUnresolvedPlaceholders = MissingContentManager.getInstance().isUnresolvedPlaceholders();
 		if ( isRemoteHelpUnavailable ==  && isUnresolvedPlaceholders ==  ) {
 			return;
 		}
 		 = isRemoteHelpUnavailable;
 		 = isUnresolvedPlaceholders;
 		FormToolkit toolkit = new FormToolkit(.getDisplay());
 		if ( isRemoteHelpUnavailable ) {
 			        MissingContentManager.getInstance().getRemoteHelpUnavailablePage(true), true);
 		} else if ( isUnresolvedPlaceholders) {
 					MissingContentManager.getInstance().getHelpMissingPage(true), false);
 		}
 		toolkit.dispose();
 	}
 	
 	private void createHelpMissingLink(Composite containerFormToolkit toolkitString imageKeyString linkTextString linkTargetboolean isRemoteUnavailableLink) {
 		final String target = linkTarget;
 		final boolean isRemote = isRemoteUnavailableLink;
 		Composite padding = new Composite(container, SWT.NULL);
 		GridData paddingData = new GridData();
 		paddingData.heightHint = 2;
 		padding.setLayoutData(paddingData);
 		toolkit.adapt(padding);
         Image warningImage = JFaceResources.getImage(imageKey);	
 		 = toolkit.createImageHyperlink(container, SWT.NULL);
 		.setText(linkText);
 		.setImage(warningImage);
 			public void linkActivated(HyperlinkEvent e) {
 				.showURL(target); 
 				if ( isRemote ) {
 				} else {
 				}
 			}
 		});
		GridData statusData = new GridData(GridData.BEGINNING, GridData.CENTER, falsefalse);
		.setLayoutData(statusData);
	}
	private void disposeLink() {
		if ( != null) {
		}
		 = null;
	}
	public void setSubsequentPage(String subsequentPage) {
	}	
	public void init(ReusableHelpPart parentString idIMemento memento) {
		this. = id;
		this. = parent;
	}
	public void saveState(IMemento memento) {
	}
	public Control getControl() {
		return ;
	}
	public String getId() {
		return ;
	}
	public void setVisible(boolean visible) {
		if ( != null) {
		    .setVisible(visible);
		}
	}
	public boolean hasFocusControl(Control control) {
		return false;
	}
	public boolean fillContextMenu(IMenuManager manager) {
		return false;
	}
		return null;
	}
	public void stop() {
	}
	public void toggleRoleFilter() {
	}
	public void refilter() {
	}
	public void dispose() {
	}
New to GrepCode? Check out our FAQ X