我接手了一位同事的RCP申请,我将从现在开始维护。我发现了一个错误,在更改一切看起来正常之前,窗口最大化按钮在透视更改后消失。不需要此行为,并且最大化按钮应保持原样: - )。
但在切换透视后,最大化按钮消失了
我对RCP不太熟悉,所以我不知道在哪里看。唯一相关的源代码,我发现它似乎是管理透视变化的处理程序。
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.Execute;
import java.util.logging.Logger;
import javax.inject.Named;
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective;
import org.eclipse.e4.ui.model.application.ui.advanced.MPerspectiveStack;
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
public class SwitchPerspectiveHandler {
@CanExecute
boolean canExecute(MPerspective perspective, @Named("********.command.2.perspective") String perspectiveId) {
return !perspective.getElementId().equals(perspectiveId);
}
@Execute
void execute(EPartService partService, MPerspective current, MWindow window, @Named("********.command.2.perspective") String perspectiveId) {
MPerspectiveStack stack = (MPerspectiveStack) window.getChildren().get(0);
for (MPerspective p : stack.getChildren()) {
if (perspectiveId.equals(p.getElementId())) {
String ABC_VIEW_VISIBLE = "abc_view_visible";
boolean abc_view_visible = false;
IEclipseContext ctx = window.getContext();
if (p.getElementId().equals("abcperspective")) {
abc_view_visible = true;
}
ctx.set(ABC_VIEW_VISIBLE, abc_view_visible);
partService.switchPerspective(p);
break;
}
}
}
}
我也查看了application.e4xmi,但是找不到任何可以改变其装饰的透视。