use of org.eclipse.ui.WorkbenchException in project core by jcryptool.
the class ShowPluginViewHandler method execute.
public Object execute(ExecutionEvent event) {
try {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
page.showView(viewId);
if (viewId.contains("org.jcryptool.games") || viewId.contains("org.jcryptool.visual")) {
// $NON-NLS-1$ //$NON-NLS-2$
page.setPartState(page.getActivePartReference(), IWorkbenchPage.STATE_MAXIMIZED);
}
} catch (WorkbenchException ex) {
LogUtil.logError(CorePlugin.PLUGIN_ID, ex);
}
return (null);
}
use of org.eclipse.ui.WorkbenchException in project tmdm-studio-se by Talend.
the class NewDataModelAction method run.
public void run(IIntroSite site, Properties params) {
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
if (factory.isUserReadOnlyOnCurrentProject()) {
MessageDialog.openWarning(null, Messages.NewDataModelAction_UserAuthority, Messages.NewDataModelAction_CanNotCreateModel);
} else {
PlatformUI.getWorkbench().getIntroManager().closeIntro(PlatformUI.getWorkbench().getIntroManager().getIntro());
IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (null == workbenchWindow) {
return;
}
IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
if (null == workbenchPage) {
return;
}
IPerspectiveDescriptor currentPerspective = workbenchPage.getPerspective();
if (!IBrandingConfiguration.PERSPECTIVE_MDM_ID.equals(currentPerspective.getId())) {
// show mdm perspective
try {
workbenchWindow.getWorkbench().showPerspective(IBrandingConfiguration.PERSPECTIVE_MDM_ID, workbenchWindow);
workbenchPage = workbenchWindow.getActivePage();
} catch (WorkbenchException e) {
ExceptionHandler.process(e);
return;
}
}
//
// $NON-NLS-1$
IRepositoryViewObject folderViewObj = ContainerCacheService.get(IServerObjectRepositoryType.TYPE_DATAMODEL, "");
selectObj = folderViewObj;
if (folderViewObj != null && folderViewObj instanceof FolderRepositoryObject) {
Item pItem = folderViewObj.getProperty().getItem();
if (pItem instanceof ContainerItem) {
setParentItem((ContainerItem) pItem);
}
}
run();
}
}
use of org.eclipse.ui.WorkbenchException in project egit by eclipse.
the class CommitMessageHistory method getCommitHistory.
/**
* @return saved commit messages
*/
public static Set<String> getCommitHistory() {
String all = getPreferenceStore().getString(UIPreferences.COMMIT_DIALOG_HISTORY_MESSAGES);
if (all.length() == 0)
return Collections.emptySet();
int max = getCommitHistorySize();
if (max < 1)
return Collections.emptySet();
XMLMemento memento;
try {
memento = XMLMemento.createReadRoot(new StringReader(all));
} catch (WorkbenchException e) {
org.eclipse.egit.ui.Activator.logError("Error reading commit message history", // $NON-NLS-1$
e);
return Collections.emptySet();
}
Set<String> messages = new LinkedHashSet<>();
for (IMemento child : memento.getChildren(KEY_MESSAGE)) {
messages.add(child.getTextData());
if (messages.size() == max)
break;
}
return messages;
}
use of org.eclipse.ui.WorkbenchException in project egit by eclipse.
the class BranchProjectTracker method getProjectPaths.
/**
* Load the project paths associated with the given branch. These paths will
* be relative to the repository root.
*
* @param branch
* @return non-null but possibly empty array of projects
*/
public String[] getProjectPaths(final String branch) {
String pref = getPreference(branch);
String value = Activator.getDefault().getPreferenceStore().getString(pref);
if (value.length() == 0)
return new String[0];
XMLMemento memento;
try {
memento = XMLMemento.createReadRoot(new StringReader(value));
} catch (WorkbenchException e) {
// $NON-NLS-1$
Activator.logError("Error reading branch-project associations", e);
return new String[0];
}
IMemento[] children = memento.getChildren(KEY_PROJECT);
if (children.length == 0)
return new String[0];
List<String> projects = new ArrayList<>(children.length);
for (int i = 0; i < children.length; i++) {
String path = children[i].getTextData();
if (path != null && path.length() > 0)
projects.add(path);
}
return projects.toArray(new String[projects.size()]);
}
use of org.eclipse.ui.WorkbenchException in project tdq-studio-se by Talend.
the class ChangePerspectiveAction method run.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
if (!perspectiveId.equals(page.getPerspective().getId())) {
try {
workbench.showPerspective(perspectiveId, workbench.getActiveWorkbenchWindow());
} catch (WorkbenchException e) {
// $NON-NLS-1$
IStatus status = new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, IStatus.OK, "Show perspective failed.", e);
CorePlugin.getDefault().getLog().log(status);
}
}
IPreferenceStore preferenceStore = CorePlugin.getDefault().getPreferenceStore();
IViewPart findView = page.findView(CHEAT_SHEET_VIEW);
if (PERSPECTIVE_ID.equals(perspectiveId)) {
if (preferenceStore.getBoolean(CHEAT_SHEET_VIEW)) {
try {
page.showView(CHEAT_SHEET_VIEW);
} catch (PartInitException e) {
log.error(e, e);
}
}
action.perspectiveId = SE_ID;
action.setToolTipText(SWITCH_TO_DATA_DISCOVERY);
IPerspectiveDescriptor fp = registry.findPerspectiveWithId(SE_ID);
if (fp != null) {
action.setImageDescriptor(fp.getImageDescriptor());
}
} else {
preferenceStore.setValue(CHEAT_SHEET_VIEW, findView != null);
if (findView != null) {
page.hideView(findView);
}
action.perspectiveId = PERSPECTIVE_ID;
action.setToolTipText(SWITCH_TO_DATA_PROFILING);
IPerspectiveDescriptor fp = registry.findPerspectiveWithId(PERSPECTIVE_ID);
if (fp != null) {
action.setImageDescriptor(fp.getImageDescriptor());
}
}
}
Aggregations