use of org.eclipse.wb.core.editor.IDesignPageSite in project windowbuilder by eclipse.
the class InstanceObjectPropertyEditor method openClass.
/**
* If there is class, open it, else create new anonymous class and open.
*/
private void openClass(Property property) throws Exception {
GenericProperty genericProperty = (GenericProperty) property;
Expression expression = genericProperty.getExpression();
if (expression != null) {
IDesignPageSite site = IDesignPageSite.Helper.getSite(genericProperty.getJavaInfo());
if (site != null) {
site.openSourcePosition(expression.getStartPosition());
}
} else {
// generate new class
generateNewClass(genericProperty);
openClass(property);
}
}
use of org.eclipse.wb.core.editor.IDesignPageSite in project windowbuilder by eclipse.
the class JavaPropertiesToolBarContributor method addGotoDefinitionAction.
private void addGotoDefinitionAction(IToolBarManager manager, List<ObjectInfo> objects) {
if (objects.size() == 1 && objects.get(0) instanceof JavaInfo) {
final JavaInfo javaInfo = (JavaInfo) objects.get(0);
IAction gotoDefinitionAction = new Action() {
@Override
public void run() {
int position = javaInfo.getCreationSupport().getNode().getStartPosition();
IDesignPageSite site = IDesignPageSite.Helper.getSite(javaInfo);
site.openSourcePosition(position);
}
};
gotoDefinitionAction.setImageDescriptor(DesignerPlugin.getImageDescriptor("structure/goto_definition.gif"));
gotoDefinitionAction.setToolTipText(Messages.ComponentsPropertiesPage_goDefinition);
manager.appendToGroup(GROUP_EDIT, gotoDefinitionAction);
}
}
use of org.eclipse.wb.core.editor.IDesignPageSite in project windowbuilder by eclipse.
the class OpenEditorLayoutEditPolicy method performDoubleClick.
// //////////////////////////////////////////////////////////////////////////
//
// DoubleClickLayoutEditPolicy
//
// //////////////////////////////////////////////////////////////////////////
@Override
protected void performDoubleClick() {
IDesignPageSite site = IDesignPageSite.Helper.getSite(m_javaInfo);
int position = m_javaInfo.getCreationSupport().getNode().getStartPosition();
site.openSourcePosition(position);
}
use of org.eclipse.wb.core.editor.IDesignPageSite in project windowbuilder by eclipse.
the class DatabindingsProvider method gotoDefinition.
@Override
public void gotoDefinition(IBindingInfo ibinding) {
BindingInfo binding = (BindingInfo) ibinding;
int position = binding.getDefinitionOffset();
if (position != -1) {
IDesignPageSite site = IDesignPageSite.Helper.getSite(m_xmlObjectRoot);
site.openSourcePosition(position);
}
}
use of org.eclipse.wb.core.editor.IDesignPageSite in project windowbuilder by eclipse.
the class EventsPropertyTest method DISABLE_test_openStubListenerMethod_valid.
// //////////////////////////////////////////////////////////////////////////
//
// openStubMethod - by listener and method names
//
// //////////////////////////////////////////////////////////////////////////
/**
* Test for {@link EventsProperty#openStubMethod(String, String)}. It should create and open
* listener.<br>
* In this case such listener/method combination exists.
*/
public void DISABLE_test_openStubListenerMethod_valid() throws Exception {
ContainerInfo panel = parseContainer("// filler filler filler", "public class Test extends JPanel {", " public Test() {", " }", "}");
// set mock for DesignPageSite
IDesignPageSite pageSite;
{
pageSite = EasyMock.createStrictMock(IDesignPageSite.class);
pageSite.openSourcePosition(org.easymock.EasyMock.anyInt());
EasyMock.replay(pageSite);
// do set
DesignPageSite.Helper.setSite(panel, pageSite);
}
// add key pressed listener
EventsProperty eventsProperty = (EventsProperty) panel.getPropertyByTitle("Events");
eventsProperty.openStubMethod("key/pressed");
waitEventLoop(0);
// test results
EasyMock.verify(pageSite);
assertEditor("// filler filler filler", "public class Test extends JPanel {", " public Test() {", " addKeyListener(new KeyAdapter() {", " @Override", " public void keyPressed(KeyEvent e) {", " }", " });", " }", "}");
}
Aggregations