当前位置: 首页>>代码示例>>Java>>正文


Java IEditorSite类代码示例

本文整理汇总了Java中org.eclipse.ui.IEditorSite的典型用法代码示例。如果您正苦于以下问题:Java IEditorSite类的具体用法?Java IEditorSite怎么用?Java IEditorSite使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IEditorSite类属于org.eclipse.ui包,在下文中一共展示了IEditorSite类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.eclipse.ui.IEditorSite; //导入依赖的package包/类
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
    if (!(input instanceof ProjectEditorInput)) {
        throw new PartInitException(Messages.ProjectEditorDiffer_error_bad_input_type);
    }

    ProjectEditorInput in = (ProjectEditorInput) input;
    Exception ex = in.getError();
    if (ex != null) {
        throw new PartInitException(in.getError().getLocalizedMessage(), ex);
    }

    setInput(input);
    setSite(site);
    setPartName(in.getName());

    proj = new PgDbProject(in.getProject());
    sp = new ProjectEditorSelectionProvider(proj.getProject());

    // message box
    if(!site.getPage().getPerspective().getId().equals(PERSPECTIVE.MAIN)){
        askPerspectiveChange(site);
    }
    getSite().setSelectionProvider(sp);
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:26,代码来源:ProjectEditorDiffer.java

示例2: setStatusLineMessage

import org.eclipse.ui.IEditorSite; //导入依赖的package包/类
/**
 * Tries to set the given message on the workbench's status line. This is a
 * best effort method which fails to set the status line if there is no
 * active editor present from where the statuslinemanager can be looked up.
 * 
 * @param msg
 *            The message to be shown on the status line
 */
public static void setStatusLineMessage(final String msg) {
	IStatusLineManager statusLineManager = null;
	ISelectionProvider selectionService = null;

	// First try to get the StatusLineManager from the IViewPart and only
	// resort back to the editor if a view isn't active right now.
	final IWorkbenchPart workbenchPart = getActiveWindow().getActivePage().getActivePart();
	if (workbenchPart instanceof IViewPart) {
		final IViewPart viewPart = (IViewPart) workbenchPart;
		statusLineManager = viewPart.getViewSite().getActionBars().getStatusLineManager();
		selectionService = viewPart.getViewSite().getSelectionProvider();
	} else if (getActiveEditor() != null) {
		final IEditorSite editorSite = getActiveEditor().getEditorSite();
		statusLineManager = editorSite.getActionBars().getStatusLineManager();
		selectionService = editorSite.getSelectionProvider();
	}

	if (statusLineManager != null && selectionService != null) {
		statusLineManager.setMessage(msg);
		selectionService.addSelectionChangedListener(new StatusLineMessageEraser(statusLineManager,
				selectionService));
	}
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:32,代码来源:UIHelper.java

示例3: init

import org.eclipse.ui.IEditorSite; //导入依赖的package包/类
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
	super.init(site, input);
	if (site == null) {
		return;
	}
	IWorkbenchPage page = site.getPage();
	if (page == null) {
		return;
	}

	// workaround to show action set for block mode etc.
	// https://www.eclipse.org/forums/index.php/t/366630/
	page.showActionSet("org.eclipse.ui.edit.text.actionSet.presentation");

}
 
开发者ID:de-jcup,项目名称:eclipse-batch-editor,代码行数:17,代码来源:BatchEditor.java

示例4: init

import org.eclipse.ui.IEditorSite; //导入依赖的package包/类
@Override
public void init ( final IEditorSite site, final IEditorInput input ) throws PartInitException
{
    setSite ( site );
    setInput ( input );

    final IFileEditorInput fileInput = AdapterHelper.adapt ( input, IFileEditorInput.class );
    if ( fileInput != null )
    {
        this.loader = new FileLoader ( fileInput );
        setContentDescription ( fileInput.getName () );
        setPartName ( fileInput.getName () );
    }

    if ( this.loader == null )
    {
        throw new PartInitException ( "Invalid editor input. Unable to load data" );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:20,代码来源:HDSEditor.java

示例5: init

import org.eclipse.ui.IEditorSite; //导入依赖的package包/类
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
	setSite(site);
	setInput(input);
	
	applicationEditorInput = (ApplicationComponentEditorInput) input;
	ApplicationComponent application = applicationEditorInput.application;
	Project project = application.getProject();

	datasetDir = new File(project.getDirPath() + "/dataset");
	datasetDir.mkdirs();
	
	devicePref = new File(Engine.USER_WORKSPACE_PATH, "studio/device-" + project.getName() + ".json");
	
	setPartName(project.getName() + " [A: " + application.getName() + "]");
	terminateNode();
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:18,代码来源:ApplicationComponentEditor.java

示例6: init

import org.eclipse.ui.IEditorSite; //导入依赖的package包/类
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
	super.init(site, input);
	setSite(site);
	setPartName(input.getName());
	setInputWithNotify(input);
	site.setSelectionProvider(this);
	if (getEditorInput() instanceof FileEditorInput) {
		FileEditorInput fei = (FileEditorInput) getEditorInput();
		IFile file = fei.getFile();
		gWGraph = ResourceManager.load(file);
		Display.getDefault().asyncExec(new Runnable() {
			@Override
			public void run() {
				gWGraph.initialize(getGraphicalViewer().getEditPartRegistry());
				if (!ResourceManager.isEditable(file)) {
					gWGraph.setReadOnly(true);
					getGraphicalViewer().getControl().setEnabled(false);
					String title = MessageUtil.getString("conversion");
					String message = MessageUtil.getString("not_formatted_as_json_convert_it");
					DialogManager.displayWarning(title, message);
				}
			}
		});
	}

}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:27,代码来源:GW4EEditor.java

示例7: init

import org.eclipse.ui.IEditorSite; //导入依赖的package包/类
@Override
public void init(final IEditorSite site, final IEditorInput input) throws PartInitException {
    if (!(input instanceof WorkItemEditorInput)) {
        throw new PartInitException("Invalid Input: Must be WITQueryResultsEditorInput"); //$NON-NLS-1$
    }
    setSite(site);
    setInput(input);

    final WorkItemEditorInput editorInput = (WorkItemEditorInput) getEditorInput();
    final WorkItem workItem = editorInput.getWorkItem();

    stateListener = new StateListener();
    workItem.addWorkItemStateListener(stateListener);

    fieldTracker = new FieldTracker();
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:17,代码来源:WorkItemEditor.java

示例8: init

import org.eclipse.ui.IEditorSite; //导入依赖的package包/类
/**
 * @see org.eclipse.ui.part.MultiPageEditorPart#init(org.eclipse.ui.IEditorSite,
 *      org.eclipse.ui.IEditorInput)
 */
@Override
public void init(final IEditorSite site, final IEditorInput input) throws PartInitException {
    if (!(input instanceof BuildExplorerEditorInput)) {
        throw new PartInitException("Invalid Input: Must be BuildExplorerEditorInput"); //$NON-NLS-1$
    }

    buildDefinition = ((BuildExplorerEditorInput) input).getBuildDefinition();
    buildServer = buildDefinition.getBuildServer();

    pollInterval = 30000;

    refreshAction.setActiveEditor(this);

    super.init(site, input);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:20,代码来源:BuildExplorer.java

示例9: getService

import org.eclipse.ui.IEditorSite; //导入依赖的package包/类
/**
 * Returns an OSGi service from {@link ExecutionEvent}. It looks up a service in the following
 * locations (if exist) in the given order:
 *
 * {@code HandlerUtil.getActiveSite(event)}
 * {@code HandlerUtil.getActiveEditor(event).getEditorSite()}
 * {@code HandlerUtil.getActiveEditor(event).getSite()}
 * {@code HandlerUtil.getActiveWorkbenchWindow(event)}
 * {@code PlatformUI.getWorkbench()}
 */
public static <T> T getService(ExecutionEvent event, Class<T> api) {
  IWorkbenchSite activeSite = HandlerUtil.getActiveSite(event);
  if (activeSite != null) {
    return activeSite.getService(api);
  }

  IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
  if (activeEditor != null) {
    IEditorSite editorSite = activeEditor.getEditorSite();
    if (editorSite != null) {
      return editorSite.getService(api);
    }
    IWorkbenchPartSite site = activeEditor.getSite();
    if (site != null) {
      return site.getService(api);
    }
  }

  IWorkbenchWindow workbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
  if (workbenchWindow != null) {
    return workbenchWindow.getService(api);
  }

  return PlatformUI.getWorkbench().getService(api);
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:36,代码来源:ServiceUtils.java

示例10: init

import org.eclipse.ui.IEditorSite; //导入依赖的package包/类
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
	isDirty = false;
	try {
		if (input instanceof FileEditorInput) {
			File file = FileUtils.getFile(((FileEditorInput) input).getFile());
			if (FileUtils.getExtension(file).equals(NETWORK_PARTITIONING)) {
				partitioning = new XmlNetworkPartitioningReader().load(file);
				setPartName(file.getName());
			} else {
				throw new Exception("Invalid input");
			}
		}
	} catch (Exception e) {
		throw new PartInitException("Input file is corrupted or not valid");
	}
	setSite(site);
	setInput(input);
}
 
开发者ID:turnus,项目名称:turnus,代码行数:20,代码来源:NetworkPartitioningEditor.java

示例11: init

import org.eclipse.ui.IEditorSite; //导入依赖的package包/类
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
	isDirty = false;
	try {
		if (input instanceof FileEditorInput) {
			File file = FileUtils.getFile(((FileEditorInput) input).getFile());
			if (FileUtils.getExtension(file).equals(NETWORK_WEIGHT)) {
				weights = new XmlNetworkWeightReader().load(file);
				setPartName(file.getName());
			} else {
				throw new Exception("Invalid input");
			}
		}
	} catch (Exception e) {
		throw new PartInitException("Input file is corrupted or not valid");
	}
	setSite(site);
	setInput(input);

}
 
开发者ID:turnus,项目名称:turnus,代码行数:21,代码来源:NetworkWeightEditor.java

示例12: init

import org.eclipse.ui.IEditorSite; //导入依赖的package包/类
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
	isDirty = false;
	try {
		if (input instanceof FileEditorInput) {
			File file = FileUtils.getFile(((FileEditorInput) input).getFile());
			if (FileUtils.getExtension(file).equals(BUFFER_SIZE)) {
				bufferSize = new XmlBufferSizeReader().load(file);
				setPartName(file.getName());
			} else {
				throw new Exception("Invalid input");
			}
		}
	} catch (Exception e) {
		throw new PartInitException("Input file is corrupted or not valid");
	}
	setSite(site);
	setInput(input);

}
 
开发者ID:turnus,项目名称:turnus,代码行数:21,代码来源:BufferSizeEditor.java

示例13: init

import org.eclipse.ui.IEditorSite; //导入依赖的package包/类
@Override
public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException {
	setSite(site);
	setInput(editorInput);
	setPartName(editorInput.getName());

	try {
		IFile file = ((FileEditorInput) editorInput).getFile();
		htmlText = toHtml(file);
		htmlText = HtmlUtils.appendStyle(htmlText, css.toArray(new String[0]));
		htmlText = HtmlUtils.appendJs(htmlText, js.toArray(new String[0]));
	} catch (Exception e) {
		htmlText = "<p>Error processing the file</p>";
		file = null;
	}
}
 
开发者ID:turnus,项目名称:turnus,代码行数:17,代码来源:AbstractBrowserEditor.java

示例14: init

import org.eclipse.ui.IEditorSite; //导入依赖的package包/类
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
	isDirty = false;
	try {
		if (input instanceof FileEditorInput) {
			File file = FileUtils.getFile(((FileEditorInput) input).getFile());
			if (FileUtils.getExtension(file).equals(CONFIGURATION)) {
				configuration = Configuration.load(file);
				setPartName(file.getName());
			} else {
				throw new Exception("Invalid input");
			}
		}
	} catch (Exception e) {
		throw new PartInitException("Input file is corrupted or not valid");
	}
	setSite(site);
	setInput(input);
}
 
开发者ID:turnus,项目名称:turnus,代码行数:20,代码来源:ConfigurationEditor.java

示例15: init

import org.eclipse.ui.IEditorSite; //导入依赖的package包/类
public void init(IEditorSite site, IEditorInput input) throws PartInitException
{

    tlaEditorInput = input;
    if (input instanceof FileEditorInput)
    {
        FileEditorInput finput = (FileEditorInput) input;
        if (finput != null)
        {
            if (ResourceHelper.isModule(finput.getFile()))
            {
                this.setPartName(finput.getFile().getName());
            }

            if (ResourceHelper.isRoot(finput.getFile()))
            {
                setTitleImage(rootImage);
            }
        }
    }
    super.init(site, input);
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:23,代码来源:TLAEditorAndPDFViewer.java


注:本文中的org.eclipse.ui.IEditorSite类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。