本文整理汇总了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);
}
示例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));
}
}
示例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");
}
示例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" );
}
}
示例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();
}
示例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);
}
}
});
}
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
}
示例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);
}
示例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);
}