本文整理匯總了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);
}