use of org.eclipse.ui.IWorkbench in project tdi-studio-se by Talend.
the class GenericRepositoryContentHandler method newSchemaWizard.
@Override
public IWizard newSchemaWizard(IWorkbench workbench, boolean creation, IRepositoryViewObject object, MetadataTable metadataTable, String[] existingNames, boolean forceReadOnly) {
if (object == null) {
return null;
}
IWorkbench wb = workbench;
if (wb == null) {
wb = PlatformUI.getWorkbench();
}
MetadataTable table = metadataTable;
if (table == null && object instanceof MetadataTableRepositoryObject) {
MetadataTableRepositoryObject metaTableRepObj = (MetadataTableRepositoryObject) object;
table = metaTableRepObj.getTable();
}
if (table == null) {
return null;
}
ConnectionItem connectionItem = (ConnectionItem) object.getProperty().getItem();
table = SchemaUtils.getMetadataTable(connectionItem.getConnection(), table.getLabel(), table.eContainer().getClass());
return new GenericSchemaWizard(wb, creation, object, connectionItem, table, forceReadOnly);
}
use of org.eclipse.ui.IWorkbench in project tdi-studio-se by Talend.
the class BindingActions method registerActions.
/**
* DOC smallet Comment method "registerActions".
*/
private void registerActions() {
IContextService contextService = (IContextService) PlatformUI.getWorkbench().getAdapter(IContextService.class);
//$NON-NLS-1$
contextService.activateContext("talend.global");
IWorkbench workbench = PlatformUI.getWorkbench();
IHandlerService handlerService = (IHandlerService) workbench.getService(IHandlerService.class);
IHandler handler;
for (IAction action : actions) {
handler = new ActionHandler(action);
handlerService.activateHandler(action.getActionDefinitionId(), handler);
}
}
use of org.eclipse.ui.IWorkbench in project tdi-studio-se by Talend.
the class BootTalendAction method run.
public void run(IAction action) {
IWorkbench workbench = PlatformUI.getWorkbench();
if (store.getInt(LOGIN_COUNTER) > 1) {
boolean openConfirm = MessageDialog.openConfirm(Display.getDefault().getActiveShell(), "Confirm", "Are you want to switch to another project");
if (!openConfirm) {
return;
}
// workbench.restart();
}
int counter = store.getInt(LOGIN_COUNTER);
store.setValue(LOGIN_COUNTER, ++counter);
IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
if (activeWorkbenchWindow == null) {
return;
}
IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
if (activePage == null) {
return;
}
IPerspectiveDescriptor pDescriptor = activePage.getPerspective();
if (!pDescriptor.getId().equals(TALEND_PERSPECTIVE_ID)) {
pDescriptor = getPerspective(TALEND_PERSPECTIVE_ID);
activePage.setPerspective(pDescriptor);
}
SwitchProjectAction switchAction = new SwitchProjectAction();
switchAction.run();
return;
}
use of org.eclipse.ui.IWorkbench in project bndtools by bndtools.
the class MissingWorkspaceMarkerResolutionGenerator method getResolutions.
@Override
public IMarkerResolution[] getResolutions(IMarker marker) {
return new IMarkerResolution[] { new IMarkerResolution() {
@Override
public void run(IMarker marker) {
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
WorkspaceSetupWizard wizard = new WorkspaceSetupWizard();
wizard.init(workbench, StructuredSelection.EMPTY);
WizardDialog dialog = new WizardDialog(window.getShell(), wizard);
dialog.open();
}
@Override
public String getLabel() {
return "Open 'New Bnd OSGi Workspace' Wizard";
}
} };
}
use of org.eclipse.ui.IWorkbench in project bndtools by bndtools.
the class WorkingSetTracker method doWorkingSets.
static void doWorkingSets(final Project model, final IProject targetProject) {
IWorkbench workbench = PlatformUI.getWorkbench();
final IWorkingSetManager workingSetManager = workbench.getWorkingSetManager();
String mergeProperties = model.mergeProperties("-workingset");
if (mergeProperties == null)
return;
Parameters memberShips = new Parameters(mergeProperties);
IWorkingSet[] allWorkingSets = workingSetManager.getAllWorkingSets();
for (IWorkingSet currentWorkingSet : allWorkingSets) {
Attrs attrs = memberShips.remove(currentWorkingSet.getName());
boolean shouldBeMember = attrs != null && Processor.isTrue(attrs.get("member", "true"));
IAdaptable[] elements = currentWorkingSet.getElements();
List<IAdaptable> members = new ExtList<>(elements);
boolean foundProjectInCurrentWorkingSet = false;
for (Iterator<IAdaptable> it = members.iterator(); it.hasNext(); ) {
IAdaptable member = it.next();
if (member.getAdapter(IProject.class) == targetProject) {
foundProjectInCurrentWorkingSet = true;
if (!shouldBeMember) {
it.remove();
}
}
}
if (!foundProjectInCurrentWorkingSet && shouldBeMember) {
members.add(targetProject);
}
if (elements.length != members.size()) {
updateWorkingSet(currentWorkingSet, members);
}
}
for (final Entry<String, Attrs> e : memberShips.entrySet()) {
String name = e.getKey();
boolean isMember = Processor.isTrue(e.getValue().get("member", "true"));
if (!isMember)
continue;
if (!JAVAID_P.matcher(name).matches()) {
SetLocation error = model.warning("Invalid working set name '%s'. Must use pattern of Java identifier", name);
error.file(model.getPropertiesFile().getAbsolutePath());
error.header("-workingset");
continue;
}
IAdaptable[] members = new IAdaptable[1];
members[0] = targetProject;
IWorkingSet newWorkingSet = workingSetManager.createWorkingSet(name, members);
newWorkingSet.setId("org.eclipse.jdt.ui.JavaWorkingSetPage");
newWorkingSet.setLabel(null);
workingSetManager.addWorkingSet(newWorkingSet);
}
}
Aggregations