我创建一个视图的RCP应用程序模板 完全占据最初创建的项目我的角度来看类看起来像这样如何使一个自定义视图中的透视RCP应用程序中
import org.eclipse.ui.IPageLayout;
public class Perspective implements IPerspectiveFactory {
public void createInitialLayout(IPageLayout layout) {
layout.setEditorAreaVisible(false);
layout.setFixed(true);
}
}
我后已经创建了一个新视图,并添加到名为ErrorView的org.eclipse.ui.views扩展中,并生成了该视图的相应类。 我做了一个小的变化透视类
public class Perspective implements IPerspectiveFactory {
private URL u;
private HttpURLConnection huc;
public void createInitialLayout(IPageLayout layout) {
try{
u= new URL("https://google.com/");
huc = (HttpURLConnection)u.openConnection();
huc.setRequestMethod("GET");
huc.connect();
if(huc.getResponseCode()==200){
layout.setEditorAreaVisible(false);
layout.setFixed(true);
}
else{
layout.addStandaloneView(View1.ID, true, IPageLayout.LEFT, 1.0f, layout.getEditorArea());
layout.getViewLayout(View1.ID).setCloseable(false);
layout.setEditorAreaVisible(false);
}
}
catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
layout.addStandaloneView(View1.ID, true, IPageLayout.LEFT, 1.0f, layout.getEditorArea());
layout.getViewLayout(View1.ID).setCloseable(false);
layout.setEditorAreaVisible(false);
}
}
}
肯定别人/ catch块被执行
我怎样才能让ErrorView占据整个角度,而不显示基础视图或简单地隐藏了基(默认视图)完全。
“IPerspectiveFactory”类仅执行一次,以在第一次打开透视图时定义布局。之后不会运行,因为布局已经知道了。你想要什么行为?这是一个启动行为(就像你重新启动,编辑器打开,但谷歌不会给你的信息)? –
@Paul Webster 更准确地说,我希望完全显示单独的erroview,而不是加载默认视图(上图中右侧部分)的视角。是的,这是一个有点启动行为之前,一个视图显示我想显示除默认视图以外的任何视图(通过使用eclipse rcp **视图模板**创建)。希望你明白保罗,我准备好详细说明问题 – srk