Package dk.contix.eclipse.hudson.views

Source Code of dk.contix.eclipse.hudson.views.HudsonBrowser

package dk.contix.eclipse.hudson.views;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IPathEditorInput;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.EditorPart;

public class HudsonBrowser extends EditorPart {

  private Browser browser;

  public void doSave(IProgressMonitor monitor) {

  }

  public void doSaveAs() {
  }

  public void init(IEditorSite site, IEditorInput input)
      throws PartInitException {
    setSite(site);
    setInput(input);
  }

  public boolean isDirty() {
    return false;
  }

  public boolean isSaveAsAllowed() {
    return false;
  }

  public void createPartControl(Composite parent) {
   
    browser = new Browser(parent, SWT.NONE);
    if (getEditorInput() != null) {
      openUrl(((IPathEditorInput)getEditorInput()).getPath().toString(), getEditorInput().getName());
    }
  }

  public void setFocus() {
    browser.setFocus();
  }
 
  protected void setInput(IEditorInput input) {
    super.setInput(input);

    if (browser != null) {
      browser.setUrl(((IPathEditorInput)input).getPath().toString());
    }
  }
 
  public void openUrl(String url, String name) {
    browser.setUrl(url);
    setPartName("Hudson: " + name);
  }

}
TOP

Related Classes of dk.contix.eclipse.hudson.views.HudsonBrowser

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.