score:1
ok, i found a solution myself.
the thing is, that the view is not a part of the e4 ui-tree. view.econtainer
is directly the mwindow
. to be placed at the right spot the view is connected to the mplaceholder
, that is a part of the e4 ui-tree and has getparent() != null
.
in order to resize a view the steps are:
- show view
- find
mplaceholder
of the view - find
mpartstack
and `mpartsashcontainer´ object - set
containerdata
- redraw widget (yes, auto-update seam not to work in this case)
example:
emodelservice modelservice = platformui.getworkbench().getservice(emodelservice.class);
epartservice partservice = platformui.getworkbench().getservice(epartservice.class);
// show view
iworkbenchpage page = platformui.getworkbench().getactiveworkbenchwindow().getactivepage();
page.showview(myview.id, null, iworkbenchpage.view_activate);
mpart view = partservice.findpart(myview.id);
// view.getparent() => null, because 'view' is not a part of the e4 ui-model!
// it is connected to the model using mplaceholder
// let's find the placeholder
mwindow window = (mwindow)(((eobject)eview).econtainer);
mplaceholder placeholder = modelservice.findplaceholderfor(window, view);
muielement element = placeholder;
mpartstack partstack = null;
while (element != null) {
// this may not suite your configuration of views/stacks/sashes
if (element instanceof mpartstack && ((object)element.parent) instanceof mpartsashcontainer) {
partstack = (mpartstack)element;
break;
}
element = element.parent;
}
}
if (partstack == null) { /* handle error */ }
// now let's change the width weights
for (muielement element : partstack.getparent().getchildren()) {
if (element == partstack) {
element.setcontainerdata("50"); // width for my view
} else {
element.setcontainerdata("25"); // widths for other views & editors
}
}
// surprisingly i had to redraw tho ui manually
// there is for sure a better way to do it. here is my (quick & very dirty):
partstack.toberendered = false
partstack.toberendered = true
Source: stackoverflow.com
Related Query
- Programmatically resize a view in Eclipse
- Programmatically showing a View from an Eclipse Plug-in
- How do I programmatically resize an eclipse ViewPart?
- How to detect the resize of a view in Eclipse
- Attaching an Eclipse detached view programmatically
- Eclipse RCP - Programmatically setting a view to not be closeable
- Eclipse RCP: How to programmatically get Problems View records
- How to programmatically control/get JUnit view while devloping Eclipse plug-in?
- Open Editor in an Eclipse PDE View programmatically
- eclipse - set position of view (or move view) programmatically
- Set data to programmatically opened View in Eclipse
- Programmatically open a view eclipse view
- How to view hierarchical package structure in Eclipse package explorer
- Eclipse IDE view gone - how to get it back
- An Eclipse console view that respects ANSI color codes?
- Eclipse Problems View not showing Errors anymore
- Remove project .jars from project explorer view in Eclipse
- Cannot find "Package Explorer" view in Eclipse
- Is there way to expand all folders in Eclipse project view and search results?
- How do I stop the error log view showing in eclipse
- How to view all items of Errors under Problems View in Eclipse Editor
- How do I view different representations of integers in the Eclipse watch window?
- Export eclipse console view output to text file
- How to filter call stack in Eclipse debug view for Java
- How to view shell commands used by eclipse "run configurations"
- Change Project Explorer tree view font size in Eclipse Oxygen
- Eclipse debug view current line
- Docking a detached view with Eclipse
- "Servers" view missing from Eclipse Indigo
- Making Eclipse view different file extensions as PHP
More Query from same tag
- HowTo update Spring Boot dependencies correctly
- Copying class members into other classes - eclipse
- Eclipse Juno - Assertion Failed (Problems occurred when invoking code from plug-in: "org.eclipse.jface".)
- Java Eclipse android-XML editor (graphic display) is not working
- Exception in thread "main" org.hibernate.HibernateException:
- Hadoop/Eclipse - Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/fs/FileSystem
- Eclipse file not found error - Despite file showing up in the package explorer
- eclipse doesn't see basic libraries
- Short cut key for jumping to end of the macro block in eclipse kepler
- C++, find unused code and includes
- Eclipse Mars Support for Java9 - Build path settings
- Printing reduced form of division
- Problems with drawing program in processing
- do not pass correct settings.xml to Maven Release Plugin
- How can I set a breakpoint for when variable changes in Eclipse?
- How to get Eclipse SWT Browser component running on Ubuntu 11.04 (Natty Narwhal) with Webkit?
- Eclipse - XML Schema Definition
- PyDev-Eclipse Python not configured
- Can't change Dynamic Web Module Facet from 3.0 to 2.5
- Genymotion Android Emulator Plugin for Mosync IDE
- Eclipse: Error ".. overlaps the location of another project.." when trying to create new project
- sharedpreferences null method check
- Eclipse C/C++ Debug Variable Default Format as Hex
- Why does PocketSphinx Android demo require cygwin
- Unresolved import in PyDev in package __init__
- Load a class to Java classpath dynamically using Eclipse and OSGi
- Using date functions in android application?
- Maven pom.xml file shows error
- Why my Maven cant find the route to the specified jar?
- What are the requirements and use cases to have an eclipse headless application?