use of org.eclipse.ui.views.properties.PropertySheet in project tdi-studio-se by Talend.
the class AbstractJvmPropertySection method getPropertySheet.
/**
* Gets the property sheet.
*
* @param pageSite The page site
* @return The property sheet, or <tt>null</tt> if not accessible
*/
private static PropertySheet getPropertySheet(PageSite pageSite) {
try {
//$NON-NLS-1$
Field field = PageSite.class.getDeclaredField("parentSite");
field.setAccessible(true);
return (PropertySheet) ((IViewSite) field.get(pageSite)).getPart();
} catch (Exception e) {
//$NON-NLS-1$
Activator.log(IStatus.ERROR, "", e);
}
return null;
}
use of org.eclipse.ui.views.properties.PropertySheet in project tdi-studio-se by Talend.
the class StartMonitorJobAction method showPropertiesView.
public void showPropertiesView(IActiveJvm jvm) {
try {
List<PropertySheet> views = getProperriesView();
// check if there are no properties views
if (views.size() == 0) {
openPropertiesView(jvm);
return;
}
// check if there is a corresponding properties view
PropertySheet view = getPropertiesView(jvm, views);
if (view != null) {
brindPropertiesViewToFront(view);
return;
}
// check if there is non-pinned properties view
view = getNonPinnedPropertiesView(views);
if (view != null) {
brindPropertiesViewToFront(view);
return;
}
openPropertiesView(jvm);
} catch (PartInitException e) {
Activator.log(IStatus.ERROR, Messages.bringPropertiesViewToFrontFailedMsg, e);
}
}
use of org.eclipse.ui.views.properties.PropertySheet in project tdi-studio-se by Talend.
the class AbstractElementPropertySectionController method fixedCursorPosition.
/**
* qzhang Comment method "fixedCursorPosition".
*
* @param param
* @param labelText
* @param value
* @param valueChanged
*/
protected void fixedCursorPosition(IElementParameter param, Control labelText, Object value, boolean valueChanged) {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IWorkbenchPart workbenchPart = page.getActivePart();
if ((workbenchPart instanceof PropertySheet) || (workbenchPart instanceof JobSettingsView) || (workbenchPart instanceof ComponentSettingsView)) {
Object control = editionControlHelper.undoRedoHelper.typedTextCommandExecutor.getActiveControl();
if (param.getName().equals(control) && valueChanged && !param.isRepositoryValueUsed()) {
String previousText = editionControlHelper.undoRedoHelper.typedTextCommandExecutor.getPreviousText2();
String currentText = String.valueOf(value);
labelText.setFocus();
ControlUtils.setCursorPosition(labelText, getcursorPosition(previousText, currentText));
}
}
}
use of org.eclipse.ui.views.properties.PropertySheet in project tdi-studio-se by Talend.
the class FindDialog method getFindTarget.
/**
* Gets the target for find action.
*
* @return The target for find action
*/
private static IFindTarget getFindTarget() {
IWorkbenchPart activePart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
if (activePart instanceof IFindTarget) {
return (IFindTarget) activePart;
}
PropertySheet part = (PropertySheet) activePart;
if (part == null) {
return null;
}
IPage page = part.getCurrentPage();
if (!(page instanceof TabbedPropertySheetPage)) {
return null;
}
TabbedPropertySheetPage propertySheetPage = (TabbedPropertySheetPage) page;
ISection[] sections = propertySheetPage.getCurrentTab().getSections();
if (sections.length != 1) {
return null;
}
ISection section = sections[0];
if (!(section instanceof IFindTarget)) {
return null;
}
return (IFindTarget) section;
}
use of org.eclipse.ui.views.properties.PropertySheet in project linuxtools by eclipse.
the class DockerContainersViewSWTBotTest method shouldShowSelectedContainerInPropertiesView.
@Test
public void shouldShowSelectedContainerInPropertiesView() {
// given
final DockerClient client = MockDockerClientFactory.container(MockContainerFactory.name("angry_bar").status("Stopped").build(), MockContainerInfoFactory.networkMode("host").build()).build();
final DockerConnection dockerConnection = MockDockerConnectionFactory.from("Test", client).withDefaultTCPConnectionSettings();
DockerConnectionManagerUtils.configureConnectionManager(dockerConnection);
final PropertySheet propertySheet = SWTUtils.syncExec(() -> SWTUtils.getView(bot, "org.eclipse.ui.views.PropertySheet", true));
this.dockerContainersView.setFocus();
// select the container in the table
selectContainerInTable("angry_bar");
// then the properties view should have a selected tab with container
// info
assertThat(propertySheet.getCurrentPage()).isInstanceOf(TabbedPropertySheetPage.class);
final TabbedPropertySheetPage currentPage = (TabbedPropertySheetPage) propertySheet.getCurrentPage();
TabDescriptorAssertions.assertThat(currentPage.getSelectedTab()).isNotNull().hasId("org.eclipse.linuxtools.docker.ui.properties.container.info");
}
Aggregations