Java Examples for org.eclipse.ui.PartInitException
The following java examples will help you to understand the usage of org.eclipse.ui.PartInitException. These source code samples are taken from different open source projects.
Example 1
Project: ASEME-master File: StateChartMatchingStrategy.java View source code |
/**
* @generated
*/
public boolean matches(IEditorReference editorRef, IEditorInput input) {
IEditorInput editorInput;
try {
editorInput = editorRef.getEditorInput();
} catch (PartInitException e) {
return false;
}
if (editorInput.equals(input)) {
return true;
}
if (editorInput instanceof URIEditorInput && input instanceof URIEditorInput) {
return ((URIEditorInput) editorInput).getURI().equals(((URIEditorInput) input).getURI());
}
return false;
}
Example 2
Project: CertWare-master File: OpenViewHandler.java View source code |
/**
* Handles the open view command request.
* Presumes the command came from a popup menu selection of file name.
* @param event used to find file
* @return always returns null
* @throws ExecutionException if open fails
* @see org.eclipse.core.commands.IHandler#execute(ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
try {
// fetch workbench context
// IWorkbenchPart latestPart = HandlerUtil.getActivePartChecked(event);
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
ISelectionService service = window.getSelectionService();
IStructuredSelection structured = (IStructuredSelection) service.getSelection();
// if we have a file selected, show view then load file
if (structured.getFirstElement() instanceof IFile) {
IViewPart viewPart = window.getActivePage().showView(PROJECT_VIEW_ID);
// IViewPart viewPart = latestPart.getSite().getPage().showView(PROJECT_VIEW_ID);
IFile ifile = (IFile) structured.getFirstElement();
ViewList view = (ViewList) viewPart;
view.setSelectedFile(ifile);
}
} catch (PartInitException e) {
CertWareLog.logError("Opening verification view", e);
} catch (ExecutionException e) {
CertWareLog.logError("Opening verification view", e);
}
return null;
}
Example 3
Project: gmf-tooling-master File: SimplemapMatchingStrategy.java View source code |
/**
* @generated
*/
public boolean matches(IEditorReference editorRef, IEditorInput input) {
IEditorInput editorInput;
try {
editorInput = editorRef.getEditorInput();
} catch (PartInitException e) {
return false;
}
if (editorInput.equals(input)) {
return true;
}
if (editorInput instanceof URIEditorInput && input instanceof URIEditorInput) {
return ((URIEditorInput) editorInput).getURI().equals(((URIEditorInput) input).getURI());
}
return false;
}
Example 4
Project: gmf-tooling.uml2tools-master File: UMLMatchingStrategy.java View source code |
/**
* @generated
*/
public boolean matches(IEditorReference editorRef, IEditorInput input) {
IEditorInput editorInput;
try {
editorInput = editorRef.getEditorInput();
} catch (PartInitException e) {
return false;
}
if (editorInput.equals(input)) {
return true;
}
if (editorInput instanceof URIEditorInput && input instanceof URIEditorInput) {
return ((URIEditorInput) editorInput).getURI().equals(((URIEditorInput) input).getURI());
}
return false;
}
Example 5
Project: modellipse-master File: UMLMatchingStrategy.java View source code |
/**
* @generated
*/
public boolean matches(IEditorReference editorRef, IEditorInput input) {
IEditorInput editorInput;
try {
editorInput = editorRef.getEditorInput();
} catch (PartInitException e) {
return false;
}
if (editorInput.equals(input)) {
return true;
}
if (editorInput instanceof URIEditorInput && input instanceof URIEditorInput) {
return ((URIEditorInput) editorInput).getURI().equals(((URIEditorInput) input).getURI());
}
return false;
}
Example 6
Project: org.roxgt-master File: RoxgtMatchingStrategy.java View source code |
/**
* @generated
*/
public boolean matches(IEditorReference editorRef, IEditorInput input) {
IEditorInput editorInput;
try {
editorInput = editorRef.getEditorInput();
} catch (PartInitException e) {
return false;
}
if (editorInput.equals(input)) {
return true;
}
if (editorInput instanceof URIEditorInput && input instanceof URIEditorInput) {
return ((URIEditorInput) editorInput).getURI().equals(((URIEditorInput) input).getURI());
}
return false;
}
Example 7
Project: Reuseware-master File: CompositionprogramMatchingStrategy.java View source code |
/**
* @generated
*/
public boolean matches(IEditorReference editorRef, IEditorInput input) {
IEditorInput editorInput;
try {
editorInput = editorRef.getEditorInput();
} catch (PartInitException e) {
return false;
}
if (editorInput.equals(input)) {
return true;
}
if (editorInput instanceof URIEditorInput && input instanceof URIEditorInput) {
return ((URIEditorInput) editorInput).getURI().equals(((URIEditorInput) input).getURI());
}
return false;
}
Example 8
Project: topsun-master File: SalesViewListener.java View source code |
@Override
public void handleEvent(Event event) {
String helpViewId = "com.topsun.posclient.sales.ui.menu.SalesView";
try {
IViewPart helpView = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(helpViewId);
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().activate(helpView);
ApplicationUtils.setStatusLine();
} catch (PartInitException e) {
e.printStackTrace();
}
}
Example 9
Project: ares-studio-master File: OpenLinkAction.java View source code |
public void run() { try { if (element.getResource() instanceof IFile) { IFile file = (IFile) element.getResource(); IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IDE.openEditor(page, file); } else { // 2012-04-13 sundl Ìí¼Ó´¦ÀíÒýÓðüÀïµÄ×ÊÔ´ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); if (element instanceof ArchiveARESResource) { ArchiveARESResource aresfile = (ArchiveARESResource) element; ARESResourceEditorInput input = new ARESResourceEditorInput(aresfile); boolean active = OpenStrategy.activateOnOpen(); try { IEditorDescriptor editor = IDE.getEditorDescriptor(aresfile.getElementName()); if (editor != null) { IDE.openEditor(page, input, editor.getId(), active); } } catch (PartInitException e) { e.printStackTrace(); } } } } catch (PartInitException e) { e.printStackTrace(); } }
Example 10
Project: biobank-master File: PerspectiveSecurity.java View source code |
public static synchronized void updateVisibility(UserWrapper user, IWorkbenchPage page) throws PartInitException {
String perspectiveId = page.getPerspective().getId();
Map<String, List<String>> map = rightsEnablements.get(perspectiveId);
if (map != null) {
IWorkbenchPart activePart = page.getActivePart();
boolean usePreviousActivePart = false;
if (activePart != null) {
// the same)
for (IViewReference ref : page.getViewReferences()) {
page.hideView(ref);
}
for (Entry<String, List<String>> entry : map.entrySet()) {
boolean show = true;
if (user.getCurrentWorkingCenter() == null && ProcessingPerspective.ID.equals(perspectiveId)) {
show = false;
}
if (show) {
page.showView(entry.getKey());
if (entry.getKey().equals(activePart.getClass().getName()))
usePreviousActivePart = true;
}
}
}
// want to display preferred view on top
String preferredView = null;
if (usePreviousActivePart)
preferredView = activePart.getClass().getName();
else
preferredView = preferredViews.get(perspectiveId);
if (preferredView != null)
for (IViewReference ref : page.getViewReferences()) {
if (ref.getId().equals(preferredView)) {
page.bringToTop(ref.getView(false));
}
}
}
}
Example 11
Project: d-case_editor-master File: DcaseMatchingStrategy.java View source code |
/**
* @generated
*/
public boolean matches(IEditorReference editorRef, IEditorInput input) {
IEditorInput editorInput;
try {
editorInput = editorRef.getEditorInput();
} catch (PartInitException e) {
return false;
}
if (editorInput.equals(input)) {
return true;
}
if (editorInput instanceof URIEditorInput && input instanceof URIEditorInput) {
return ((URIEditorInput) editorInput).getURI().equals(((URIEditorInput) input).getURI());
}
return false;
}
Example 12
Project: damp.ekeko.snippets-master File: TransformationEditorCommandHandler.java View source code |
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
try {
IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
IEditorPart openedEditor = window.getActivePage().openEditor(new TransformationEditorInput(), TransformationEditor.ID);
TransformationEditor transformationEditor = (TransformationEditor) openedEditor;
transformationEditor.setPreviouslyActiveEditor(activeEditor);
} catch (PartInitException e) {
e.printStackTrace();
}
return null;
}
Example 13
Project: Eclipse-JDE-master File: ConsoleUtils.java View source code |
/**
*
* @param console
*/
public static void openConsole(IConsole console) {
IWorkbenchPage workbenchPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
String consoleViewID = IConsoleConstants.ID_CONSOLE_VIEW;
try {
IConsoleView consoleView = (IConsoleView) workbenchPage.showView(consoleViewID);
consoleView.display(console);
} catch (PartInitException e) {
log.error(e.getMessage(), e);
}
}
Example 14
Project: eclipse-optimus-master File: TransformationDependencyMatchingStrategy.java View source code |
/**
* @generated
*/
public boolean matches(IEditorReference editorRef, IEditorInput input) {
IEditorInput editorInput;
try {
editorInput = editorRef.getEditorInput();
} catch (PartInitException e) {
return false;
}
if (editorInput.equals(input)) {
return true;
}
if (editorInput instanceof URIEditorInput && input instanceof URIEditorInput) {
return ((URIEditorInput) editorInput).getURI().equals(((URIEditorInput) input).getURI());
}
return false;
}
Example 15
Project: eclipse-themes-master File: OpenStoreClientHandler.java View source code |
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
IWorkbenchPage ap = window.getActivePage();
try {
ap.openEditor(new StoreEditorInput(), StoreClient.EDITOR_ID);
} catch (PartInitException e) {
e.printStackTrace();
}
return null;
}
Example 16
Project: iee-master File: TestJavaEditor.java View source code |
@Override
protected void createPages() {
try {
int textIndex = addPage(new TextEditor(), getEditorInput());
setPageText(textIndex, "Text");
editor = new CompilationUnitEditor();
int javaIndex = addPage(editor, getEditorInput());
setPageText(javaIndex, "Java");
int ieeIndex = addPage(new ExtendedJavaEditor(), getEditorInput());
setPageText(ieeIndex, "IEE");
} catch (PartInitException e) {
e.printStackTrace();
}
}
Example 17
Project: jenkow-plugin-master File: ActivitiDiagramMatchingStrategy.java View source code |
@Override
public boolean matches(final IEditorReference editorRef, final IEditorInput input) {
try {
final IFile newDataFile = FileService.getDataFileForInput(input);
final IFile openEditorDataFile = FileService.getDataFileForInput(editorRef.getEditorInput());
if (newDataFile.equals(openEditorDataFile)) {
return true;
}
} catch (PartInitException exception) {
exception.printStackTrace();
}
return new DiagramEditorMatchingStrategy().matches(editorRef, input);
}
Example 18
Project: jucy-master File: OpenEditorHandler.java View source code |
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
try {
window.getActivePage().openEditor(input, editorID, true);
} catch (PartInitException pie) {
MessageDialog.openError(window.getShell(), "Error", "Error opening " + input.getName() + ":" + pie.getMessage());
}
return null;
}
Example 19
Project: melanee-core-master File: PLMMatchingStrategy.java View source code |
/**
* @generated
*/
public boolean matches(IEditorReference editorRef, IEditorInput input) {
IEditorInput editorInput;
try {
editorInput = editorRef.getEditorInput();
} catch (PartInitException e) {
return false;
}
if (editorInput.equals(input)) {
return true;
}
if (editorInput instanceof URIEditorInput && input instanceof URIEditorInput) {
return ((URIEditorInput) editorInput).getURI().equals(((URIEditorInput) input).getURI());
}
return false;
}
Example 20
Project: molic-master File: MolicMatchingStrategy.java View source code |
/**
* @generated
*/
public boolean matches(IEditorReference editorRef, IEditorInput input) {
IEditorInput editorInput;
try {
editorInput = editorRef.getEditorInput();
} catch (PartInitException e) {
return false;
}
if (editorInput.equals(input)) {
return true;
}
if (editorInput instanceof URIEditorInput && input instanceof URIEditorInput) {
return ((URIEditorInput) editorInput).getURI().equals(((URIEditorInput) input).getURI());
}
return false;
}
Example 21
Project: org.nightlabs.jfire.max-master File: VoucherTypeSearchAdminActionHandler.java View source code |
// public void run() { // Collection<ProductTypeID> selectedObjects = getSearchResultProvider().getSelectedObjects(); // if (selectedObjects != null) { // for (ProductTypeID productTypeID : selectedObjects) { // try { // RCPUtil.openEditor(new VoucherTypeEditorInput(productTypeID), VoucherTypeEditor.EDITOR_ID); // } catch (PartInitException e) { // throw new RuntimeException(e); // } // } // } // } public void run() { Collection<VoucherType> selectedObjects = getSearchResultProvider().getSelectedObjects(); if (selectedObjects != null) { for (VoucherType productType : selectedObjects) { try { RCPUtil.openEditor(new VoucherTypeEditorInput((ProductTypeID) JDOHelper.getObjectId(productType)), VoucherTypeEditor.EDITOR_ID); } catch (PartInitException e) { throw new RuntimeException(e); } } } }
Example 22
Project: org.nightlabs.jfire.max.eclipse-master File: VoucherTypeSearchAdminActionHandler.java View source code |
// public void run() { // Collection<ProductTypeID> selectedObjects = getSearchResultProvider().getSelectedObjects(); // if (selectedObjects != null) { // for (ProductTypeID productTypeID : selectedObjects) { // try { // RCPUtil.openEditor(new VoucherTypeEditorInput(productTypeID), VoucherTypeEditor.EDITOR_ID); // } catch (PartInitException e) { // throw new RuntimeException(e); // } // } // } // } public void run() { Collection<VoucherType> selectedObjects = getSearchResultProvider().getSelectedObjects(); if (selectedObjects != null) { for (VoucherType productType : selectedObjects) { try { RCPUtil.openEditor(new VoucherTypeEditorInput((ProductTypeID) JDOHelper.getObjectId(productType)), VoucherTypeEditor.EDITOR_ID); } catch (PartInitException e) { throw new RuntimeException(e); } } } }
Example 23
Project: studio2-master File: EditorOpener.java View source code |
/**
* @param file
* @param activate
* @return
*/
public IEditorPart open(File file, boolean activate) {
IEditorInput input = CoreUIUtils.createJavaFileEditorInput(file);
try {
IEditorPart openEditor = IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), input, IDE.getEditorDescriptor(file.getName()).getId());
return openEditor;
} catch (PartInitException e) {
IdeLog.logError(Activator.getDefault(), e.getMessage());
return null;
}
}
Example 24
Project: android-essentials-toolbox-master File: OpenPermissionUsageViewHandler.java View source code |
@Override
public void run() {
try {
IWorkbenchPage page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
IViewPart view = page.showView(PermissionUsageView.ID);
page.activate(view);
} catch (PartInitException e) {
DisplayUtils.showError(e, "Could not load Permissin Usage View.");
}
}
Example 25
Project: archiv-editor-master File: OpenViewAction.java View source code |
public void run() {
if (window != null) {
try {
window.getActivePage().showView(viewId, Integer.toString(instanceNum++), IWorkbenchPage.VIEW_ACTIVATE);
} catch (PartInitException e) {
MessageDialog.openError(window.getShell(), "Error", "Error opening view:" + e.getMessage());
}
}
}
Example 26
Project: bndtools-master File: OpenMainConfigHandler.java View source code |
public Object execute(ExecutionEvent event) throws ExecutionException {
try {
IFile buildFile = Central.getWorkspaceBuildFile();
if (buildFile == null)
return null;
FileEditorInput input = new FileEditorInput(buildFile);
IWorkbenchPage page = HandlerUtil.getActiveWorkbenchWindowChecked(event).getActivePage();
page.openEditor(input, "bndtools.bndWorkspaceConfigEditor", true);
} catch (PartInitException e) {
ErrorDialog.openError(HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell(), "Error", "Unable to open editor", e.getStatus());
} catch (Exception e) {
logger.logError("Error retrieving bnd configuration file", e);
}
return null;
}
Example 27
Project: buckminster-master File: ViewCSpecAction.java View source code |
@Override
protected void run(CSpec cspec, Shell shell) {
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow wbWin = workbench.getActiveWorkbenchWindow();
if (wbWin == null)
return;
IWorkbenchPage page = wbWin.getActivePage();
if (page == null)
return;
IEditorRegistry editorRegistry = workbench.getEditorRegistry();
CSpecEditorInput input = new CSpecEditorInput(cspec);
IEditorDescriptor ed = editorRegistry.getDefaultEditor(input.getName(), input.getContentDescription().getContentType());
try {
page.openEditor(input, ed.getId());
} catch (PartInitException e) {
UiUtils.openError(page.getWorkbenchWindow().getShell(), Messages.unable_to_open_editor, e);
}
}
Example 28
Project: bundlemaker-master File: OpenDummyEditorHandler.java View source code |
/*
* (non-Javadoc)
*
* @see
* org.bundlemaker.analysis.ui.handlers.AbstractArtifactBasedHandler#execute(org.eclipse.core.commands.ExecutionEvent,
* java.util.List)
*/
@Override
protected void execute(ExecutionEvent event, List<IBundleMakerArtifact> selectedArtifacts) throws Exception {
IWorkbenchPage page = getActiveWorkbenchPage();
if (page != null) {
try {
IEditorPart editorPart = page.openEditor(nullInputEditor, DummyEditor.DummyEditor_ID);
if (!(editorPart instanceof DummyEditor)) {
System.err.println("EditorPart " + editorPart + " is not a XRefView?");
return;
}
} catch (PartInitException e) {
e.printStackTrace();
}
}
}
Example 29
Project: cdo-master File: AcoreMatchingStrategy.java View source code |
/**
* @generated
*/
public boolean matches(IEditorReference editorRef, IEditorInput input) {
IEditorInput editorInput;
try {
editorInput = editorRef.getEditorInput();
} catch (PartInitException e) {
return false;
}
if (editorInput.equals(input)) {
return true;
}
if (editorInput instanceof URIEditorInput && input instanceof URIEditorInput) {
return ((URIEditorInput) editorInput).getURI().equals(((URIEditorInput) input).getURI());
}
return false;
}
Example 30
Project: codefaces-master File: ImportRepoWizard.java View source code |
@Override
public boolean performFinish() {
Assert.isNotNull(settings.get(RepoSettings.REPO_RESOURCE_INPUT));
RepoFolder baseDirectory = (RepoFolder) getRepoSettings().get(RepoSettings.REPO_RESOURCE_INPUT);
if (baseDirectory != null) {
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(ProjectExplorerViewPart.ID);
RepoWorkspace.getCurrent().createProject(baseDirectory);
} catch (PartInitException e) {
IStatus status = new Status(Status.ERROR, CodeFacesUIActivator.PLUGIN_ID, "Errors occurs when openning view " + ProjectExplorerViewPart.ID, e);
CodeFacesUIActivator.getDefault().getLog().log(status);
}
}
return true;
}
Example 31
Project: DDT-master File: CommonDeeUITest.java View source code |
public static AbstractLangStructureEditor openDeeEditorForFile(IFile file) {
IWorkbenchPage page = WorkbenchUtils.getActivePage();
try {
AbstractLangStructureEditor editor = (AbstractLangStructureEditor) IDE.openEditor(page, file, EditorSettings_Actual.EDITOR_ID);
assertTrue(editor.getSourceViewer_() != null);
return editor;
} catch (PartInitException e) {
throw melnorme.utilbox.core.ExceptionAdapter.unchecked(e);
}
}
Example 32
Project: eclipse-gov.redhawk.core-master File: SadMatchingStrategy.java View source code |
/**
* @generated
*/
public boolean matches(IEditorReference editorRef, IEditorInput input) {
IEditorInput editorInput;
try {
editorInput = editorRef.getEditorInput();
} catch (PartInitException e) {
return false;
}
if (editorInput.equals(input)) {
return true;
}
if (editorInput instanceof URIEditorInput && input instanceof URIEditorInput) {
return ((URIEditorInput) editorInput).getURI().equals(((URIEditorInput) input).getURI());
}
return false;
}
Example 33
Project: eclipse-integration-commons-master File: OpenEditorFunction.java View source code |
@Override
public void call(String editorId) {
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(NULL_EDITOR, editorId);
} catch (PartInitException e) {
StatusManager.getManager().handle(new Status(IStatus.ERROR, BrowserPlugin.PLUGIN_ID, "Could not find editor extension " + editorId, e));
}
}
Example 34
Project: Eclipse-Markdown-Editor-Plugin-master File: OpenMdView.java View source code |
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
try {
IWorkbenchPage activePage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
String mdViewId = "winterwell.markdown.views.MarkdownPreview";
IViewPart mdView = activePage.showView(mdViewId);
activePage.activate(mdView);
} catch (PartInitException e) {
showError(e);
} catch (Exception e) {
showError(e);
}
return null;
}
Example 35
Project: eclipse-master File: ShowProfilingViewListener.java View source code |
public void run() {
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
ProfilingSessionEditorInput editorInput = new ProfilingSessionEditorInput(session);
if (activePage != null && activePage.findEditor(editorInput) == null) {
try {
activePage.openEditor(editorInput, "com.mobilesorcery.sdk.profiling.ui.profiling");
} catch (PartInitException e) {
e.printStackTrace();
}
}
}
Example 36
Project: eclipse-task-editor-master File: TagHyperLink.java View source code |
public void open() {
try {
TodoView todoView = (TodoView) TaskActivator.getInstance().getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(TodoView.ID);
String query = TagImplCustom.PREFIX + tag.getName();
if (!isEmpty(tag.getValue())) {
query += " = " + tag.getValue();
}
todoView.setQuery(query);
} catch (PartInitException e) {
LOG.error(e.getMessage(), e);
}
}
Example 37
Project: eclipse.platform.debug-master File: ConsoleViewConsoleFactory.java View source code |
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.console.IConsoleFactory#openConsole()
*/
@Override
public void openConsole() {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
IWorkbenchPage page = window.getActivePage();
if (page != null) {
try {
//$NON-NLS-1$
String secondaryId = "Console View #" + counter;
page.showView(IConsoleConstants.ID_CONSOLE_VIEW, secondaryId, 1);
counter++;
} catch (PartInitException e) {
ConsolePlugin.log(e);
}
}
}
}
Example 38
Project: eclipse.platform.ui-master File: MarkerViewTests.java View source code |
public void testOpenView() {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage page = window.getActivePage();
try {
page.showView(IPageLayout.ID_BOOKMARKS);
page.showView(IPageLayout.ID_PROBLEM_VIEW);
page.showView(IPageLayout.ID_TASK_LIST);
} catch (PartInitException e) {
assertTrue(e.getLocalizedMessage(), false);
return;
}
}
Example 39
Project: edt-master File: EvActionWidgetProperties.java View source code |
/**
* Declared in IAction.
*/
public void run() {
IWorkbench workbench = PlatformUI.getWorkbench();
if (workbench == null)
return;
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
if (window == null)
return;
IWorkbenchPage page = window.getActivePage();
if (page == null)
return;
try {
page.showView("org.eclipse.ui.views.PropertySheet");
} catch (PartInitException ex) {
}
}
Example 40
Project: eExplorer-master File: OpenExplorerView.java View source code |
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
try {
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
String viewId = "com.github.culmat.eexplore.views.ExplorerView";
IViewPart view = activePage.showView(viewId);
activePage.activate(view);
} catch (PartInitException e) {
showError(e);
} catch (Exception e) {
showError(e);
}
return null;
}
Example 41
Project: EMF-IncQuery-Examples-master File: LoadUMLModelHandler.java View source code |
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
try {
IWorkbenchPage page = HandlerUtil.getActiveSite(event).getPage();
ClassView view = (ClassView) page.findView(ClassView.ID);
if (view == null) {
view = (ClassView) page.showView(ClassView.ID);
}
PapyrusMultiDiagramEditor providerEditor = (PapyrusMultiDiagramEditor) HandlerUtil.getActiveEditor(event);
ResourceSet resourceSet = providerEditor.getDiagramEditPart().getEditingDomain().getResourceSet();
view.loadModel(resourceSet);
return null;
} catch (PartInitException e) {
throw new ExecutionException("Cannot find view", e);
} catch (IncQueryException e) {
throw new ExecutionException("Error initializing Pattern Matcher", e);
}
}
Example 42
Project: EPF-Composer-master File: DiagramMatchingStrategy.java View source code |
/**
* @generated
*/
public boolean matches(IEditorReference editorRef, IEditorInput input) {
IEditorInput editorInput;
try {
editorInput = editorRef.getEditorInput();
} catch (PartInitException e) {
return false;
}
if (editorInput.equals(input)) {
return true;
}
if (editorInput instanceof URIEditorInput && input instanceof URIEditorInput) {
return ((URIEditorInput) editorInput).getURI().equals(((URIEditorInput) input).getURI());
}
return false;
}
Example 43
Project: eu.geclipse.core-master File: WorkflowMatchingStrategy.java View source code |
/**
* @generated
*/
public boolean matches(IEditorReference editorRef, IEditorInput input) {
IEditorInput editorInput;
try {
editorInput = editorRef.getEditorInput();
} catch (PartInitException e) {
return false;
}
if (editorInput.equals(input)) {
return true;
}
if (editorInput instanceof URIEditorInput && input instanceof URIEditorInput) {
return ((URIEditorInput) editorInput).getURI().equals(((URIEditorInput) input).getURI());
}
return false;
}
Example 44
Project: fabeclipse-master File: GrepCommand.java View source code |
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
String text = null;
ISelection selection = HandlerUtil.getActiveMenuSelection(event);
selection = HandlerUtil.getCurrentSelection(event);
if (selection instanceof ITextSelection) {
ITextSelection textSelection = (ITextSelection) selection;
text = textSelection.getText();
}
try {
IViewPart view = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(GrepView.VIEW_ID);
if (text != null && text.length() > 0)
((GrepView) view).setGrepRegularExpression(text);
} catch (PartInitException e) {
e.printStackTrace();
}
return null;
}
Example 45
Project: gradleplugins-master File: OpenViewAction.java View source code |
public void run() {
if (window != null) {
try {
window.getActivePage().showView(viewId, Integer.toString(instanceNum++), IWorkbenchPage.VIEW_ACTIVATE);
} catch (PartInitException e) {
MessageDialog.openError(window.getShell(), "Error", "Error opening view:" + e.getMessage());
}
}
}
Example 46
Project: jbosstools-base-master File: MatchingStrategyImpl.java View source code |
public boolean matches(IEditorReference editorRef, IEditorInput input) {
if (editorRef == null || input == null)
return false;
IEditorInput editorInput = null;
try {
editorInput = editorRef.getEditorInput();
} catch (PartInitException t) {
return false;
}
if (editorInput == null)
return false;
return editorInput.equals(input) || input.equals(editorInput);
}
Example 47
Project: jbosstools-javaee-master File: InjectionPointMatchPresentation.java View source code |
public void showMatch(Match match, int currentOffset, int currentLength, boolean activate) throws PartInitException { try { IJavaElement element = ((CDIMatch) match).getJavaElement(); JavaUI.openInEditor(element); } catch (JavaModelException ex) { CDIUIPlugin.getDefault().logError(ex); } catch (PartInitException ex) { CDIUIPlugin.getDefault().logError(ex); } }
Example 48
Project: make-p2-buildable-with-tycho-master File: OpenViewAction.java View source code |
public void run() {
if (window != null) {
try {
window.getActivePage().showView(viewId, Integer.toString(instanceNum++), IWorkbenchPage.VIEW_ACTIVATE);
} catch (PartInitException e) {
MessageDialog.openError(window.getShell(), "Error", "Error opening view:" + e.getMessage());
}
}
}
Example 49
Project: MMI-master File: StateMatchingStrategy.java View source code |
/**
* @generated
*/
public boolean matches(IEditorReference editorRef, IEditorInput input) {
IEditorInput editorInput;
try {
editorInput = editorRef.getEditorInput();
} catch (PartInitException e) {
return false;
}
if (editorInput.equals(input)) {
return true;
}
if (editorInput instanceof URIEditorInput && input instanceof URIEditorInput) {
return ((URIEditorInput) editorInput).getURI().equals(((URIEditorInput) input).getURI());
}
return false;
}
Example 50
Project: MMINT-master File: StateMatchingStrategy.java View source code |
/**
* @generated
*/
public boolean matches(IEditorReference editorRef, IEditorInput input) {
IEditorInput editorInput;
try {
editorInput = editorRef.getEditorInput();
} catch (PartInitException e) {
return false;
}
if (editorInput.equals(input)) {
return true;
}
if (editorInput instanceof URIEditorInput && input instanceof URIEditorInput) {
return ((URIEditorInput) editorInput).getURI().equals(((URIEditorInput) input).getURI());
}
return false;
}
Example 51
Project: mongodb-ide-master File: OpenEditorHandler.java View source code |
@Override
protected Object execute(ExecutionEvent event, ContextHandlerEvent contextEvent) throws ExecutionException {
try {
T model = (T) contextEvent.getModel();
IEditorInput input = createEditorInput(model);
IEditorPart part = ContextHandlerUtils.openEditor(event, input, getEditorId(), true);
if (input instanceof AbstractEditorInput) {
String activePageIdOnLoad = ((AbstractEditorInput) input).getActivePageIdOnLoad();
if (StringUtils.isNotEmpty(activePageIdOnLoad)) {
((FormEditor) part).setActivePage(activePageIdOnLoad);
}
}
} catch (PartInitException e) {
throw new RuntimeException(e);
}
return null;
}
Example 52
Project: monkeytalk-master File: FoneMonkeyJSEditor.java View source code |
public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException { setPartName(editorInput.getName()); if (!(editorInput instanceof IFileEditorInput)) throw new PartInitException("Invalid Input: Must be IFileEditorInput"); else { textEditor = new TextEditor(); // textEditor.setInput(editorInput); } super.init(site, editorInput); try { fmc = new MonkeyTalkTabularEditor(FoneMonkeyPlugin.getDefault().getController()); fmc.init(site, editorInput); } catch (// TODO Auto-generated catch block e.printStackTrace(); Exception // TODO Auto-generated catch block e.printStackTrace(); e) { } }
Example 53
Project: netifera-master File: OpenFileSystemViewAction.java View source code |
@Override
public void run() {
IFileSystem fileSystem = createFileSystem();
try {
IViewPart view = UIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(FileSystemView.ID, "SecondaryFileSystem" + System.currentTimeMillis(), IWorkbenchPage.VIEW_ACTIVATE);
((FileSystemView) view).setInput(fileSystem);
} catch (PartInitException e) {
e.printStackTrace();
}
}
Example 54
Project: olca-app-master File: SimulationEditor.java View source code |
@Override
public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException {
super.init(site, editorInput);
SimulationInput input = (SimulationInput) editorInput;
setup = Cache.getAppCache().remove(input.getSetupKey(), CalculationSetup.class);
setPartName(Strings.cut(setup.productSystem.getName(), 75));
simulator = Cache.getAppCache().remove(input.getSolverKey(), Simulator.class);
}
Example 55
Project: org.eclipse.rap-master File: OpenViewAction.java View source code |
public void run() {
if (window != null) {
try {
window.getActivePage().showView(viewId, Integer.toString(instanceNum++), IWorkbenchPage.VIEW_ACTIVATE);
} catch (PartInitException e) {
MessageDialog.openError(window.getShell(), "Error", "Error opening view:" + e.getMessage());
}
}
}
Example 56
Project: org.phpsrc.eclipse.pti.tool.phpmd-master File: EditorUtil.java View source code |
public static void openEditor(IWorkbenchPage page, ISelection selection) {
if (false == (selection instanceof IStructuredSelection))
return;
Iterator<?> it = ((IStructuredSelection) selection).iterator();
if (false == it.hasNext())
return;
Object elm = it.next();
if (false == (elm instanceof IAdaptable))
return;
IFile file = (IFile) ((IAdaptable) elm).getAdapter(IFile.class);
if (null == file)
return;
try {
IDE.openEditor(page, file);
} catch (PartInitException e) {
PhpmdLog.logError(e);
}
}
Example 57
Project: qvto-master File: ShowTraceViewHandler.java View source code |
public Object handleStatus(IStatus status, Object source) throws CoreException {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(TraceViewPart.ID);
} catch (PartInitException e) {
QVTODebugCore.log(e);
}
}
});
return Boolean.TRUE;
}
Example 58
Project: radrails-master File: ModelEditorActionDelegate.java View source code |
public void run(IAction action) {
IFile currentFile = getCurrentFile();
IFile modelFile = RailsConventions.getModelFromController(currentFile);
if (modelFile == null)
modelFile = RailsConventions.getModelFromView(currentFile);
if (modelFile == null)
modelFile = RailsConventions.getModelFromHelper(currentFile);
if (modelFile == null)
modelFile = RailsConventions.getModelFromFunctionalTest(currentFile);
if (modelFile == null)
modelFile = RailsConventions.getModelFromUnitTest(currentFile);
if (modelFile == null)
return;
IEditorInput editorInput = new FileEditorInput(modelFile);
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(editorInput, RubyUI.ID_RUBY_EDITOR);
} catch (PartInitException e) {
RailsUILog.logError("Error creating editor", e);
}
}
Example 59
Project: rap-master File: MarkerViewTests.java View source code |
public void testOpenView() {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage page = window.getActivePage();
try {
page.showView(IPageLayout.ID_BOOKMARKS);
page.showView(IPageLayout.ID_PROBLEM_VIEW);
page.showView(IPageLayout.ID_TASK_LIST);
} catch (PartInitException e) {
assertTrue(e.getLocalizedMessage(), false);
return;
}
}
Example 60
Project: rascal-eclipse-master File: Editor.java View source code |
public static void edit(final IValue v, boolean indent, int tabsize) {
IWorkbench wb = PlatformUI.getWorkbench();
IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
final IEditorInput input = new ValueEditorInput(v, indent, tabsize);
if (win == null && wb.getWorkbenchWindowCount() != 0) {
win = wb.getWorkbenchWindows()[0];
}
if (win != null) {
final IWorkbenchPage page = win.getActivePage();
if (page != null) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
try {
page.openEditor(input, "org.eclipse.ui.DefaultTextEditor");
} catch (PartInitException e) {
}
}
});
}
}
}
Example 61
Project: rce-master File: OpenConfigurationFileHandler.java View source code |
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
File configurationFile;
configurationFile = ServiceRegistry.createAccessFor(this).getService(ConfigurationService.class).getProfileConfigurationFile();
try {
EditorsHelper.openExternalFileInEditor(configurationFile);
} catch (PartInitException e) {
LOGGER.error("Failed to open profile configuration file in an editor.", e);
}
return null;
}
Example 62
Project: rdt-master File: AbstractInspectAction.java View source code |
protected void showExpressionView() {
IViewPart part = page.findView(IDebugUIConstants.ID_EXPRESSION_VIEW);
if (part == null) {
try {
page.showView(IDebugUIConstants.ID_EXPRESSION_VIEW);
} catch (PartInitException e) {
RdtDebugUiPlugin.log(e);
}
} else {
page.bringToTop(part);
}
}
Example 63
Project: rt.equinox.p2-master File: OpenViewAction.java View source code |
public void run() {
if (window != null) {
try {
window.getActivePage().showView(viewId, Integer.toString(instanceNum++), IWorkbenchPage.VIEW_ACTIVATE);
} catch (PartInitException e) {
MessageDialog.openError(window.getShell(), "Error", "Error opening view:" + e.getMessage());
}
}
}
Example 64
Project: rtt-master File: OutputVersionContent.java View source code |
@Override
public void doDoubleClick(IWorkbenchPage currentPage) {
IEditorInput input = new OutputDataEditorInput(getProject(), suiteName, caseName, version.getNr(), type);
try {
IDE.openEditor(currentPage, input, ReferenceEditor.ID, true);
} catch (PartInitException e) {
ErrorDialog.openError(currentPage.getActivePart().getSite().getShell(), "Error", "Could not open editor", new Status(Status.ERROR, RttPluginUI.PLUGIN_ID, e.getMessage(), e));
}
}
Example 65
Project: sapphire-master File: ShowPropertiesPageHandler.java View source code |
@Override
protected Object run(Presentation context) {
try {
IViewPart propertiesView = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("org.eclipse.ui.views.PropertySheet");
ISapphirePart sapphirePart = getPart();
SapphireEditor editor = sapphirePart.nearest(SapphireEditor.class);
editor.setFocus();
propertiesView.setFocus();
} catch (PartInitException e) {
Sapphire.service(LoggingService.class).log(e);
}
return null;
}
Example 66
Project: scout-master File: OpenRTPairAllAction2.java View source code |
public void run() {
if (window != null) {
try {
window.getActivePage().showView(CounterRTAllPairChart2.ID, serverId + "&" + objType + "&" + counter1 + "&" + counter2, IWorkbenchPage.VIEW_ACTIVATE);
} catch (PartInitException e) {
ConsoleProxy.errorSafe("Error opening view:" + e.getMessage());
}
}
}
Example 67
Project: scouter-master File: OpenRTPairAllAction2.java View source code |
public void run() {
if (window != null) {
try {
window.getActivePage().showView(CounterRTAllPairChart2.ID, serverId + "&" + objType + "&" + counter1 + "&" + counter2, IWorkbenchPage.VIEW_ACTIVATE);
} catch (PartInitException e) {
ConsoleProxy.errorSafe("Error opening view:" + e.getMessage());
}
}
}
Example 68
Project: TBLips-master File: JSPNewWizard.java View source code |
@Override
public boolean performFinish() {
IFile file = _page.createNewFile();
if (file == null) {
return false;
}
try {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IDE.openEditor(page, file, true);
} catch (PartInitException ex) {
HTMLPlugin.logException(ex);
return false;
}
return true;
}
Example 69
Project: texclipse-master File: TexlipseNewTexFileWizard.java View source code |
@Override
public boolean performFinish() {
IFile file = page.createNewFile();
if (file != null) {
try {
IDE.openEditor(workbench.getActiveWorkbenchWindow().getActivePage(), file);
} catch (PartInitException ex) {
TexlipsePlugin.log("Error while opening file", ex);
}
return true;
} else {
return false;
}
}
Example 70
Project: texlipse-master File: TexlipseNewTexFileWizard.java View source code |
@Override
public boolean performFinish() {
IFile file = page.createNewFile();
if (file != null) {
try {
IDE.openEditor(workbench.getActiveWorkbenchWindow().getActivePage(), file);
} catch (PartInitException ex) {
TexlipsePlugin.log("Error while opening file", ex);
}
return true;
} else {
return false;
}
}
Example 71
Project: Wol-master File: JSPNewWizard.java View source code |
@Override
public boolean performFinish() {
IFile file = _page.createNewFile();
if (file == null) {
return false;
}
try {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IDE.openEditor(page, file, true);
} catch (PartInitException ex) {
HTMLPlugin.logException(ex);
return false;
}
return true;
}
Example 72
Project: wolips-master File: JSPNewWizard.java View source code |
@Override
public boolean performFinish() {
IFile file = _page.createNewFile();
if (file == null) {
return false;
}
try {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IDE.openEditor(page, file, true);
} catch (PartInitException ex) {
HTMLPlugin.logException(ex);
return false;
}
return true;
}
Example 73
Project: abstools-master File: MaudeCompilerAction.java View source code |
@Override
public void run(IAction action) {
boolean realTime = false;
IEditorPart editorPart = window.getActivePage().getActiveEditor();
try {
project = getCurrentProject(window, editorPart);
} catch (PartInitException e) {
}
//If no files or projects have been selected, show an error and abort
if (project == null || !project.exists()) {
showErrorMessage("No project has been selected. Please open a file or select one in the project explorer.");
return;
}
//Create a new MaudeJob which will generate Maude code and (if run button was pressed) execute it
saveEditors(project, true);
final Job maudeJob = new MaudeJob(project, realTime, action.getId().equals(ACTION_EXEC_ID));
maudeJob.addJobChangeListener(new MaudeJobChangeListener(project));
maudeJob.schedule();
}
Example 74
Project: andykunin-master File: OpenViewAction.java View source code |
public void run() {
if (window != null) {
try {
window.getActivePage().showView(viewId, Integer.toString(instanceNum++), IWorkbenchPage.VIEW_ACTIVATE);
} catch (PartInitException e) {
MessageDialog.openError(window.getShell(), "Error", "Error opening view:" + e.getMessage());
}
}
}
Example 75
Project: AngularJS-Eclipse-Tools-master File: AngularJSPackageJsonEditor.java View source code |
/**
* {@inheritDoc}
*
* @see org.eclipse.ui.forms.editor.FormEditor#addPages()
*/
@Override
protected void addPages() {
try {
this.addPage(new AngularJSPackageJsonOverviewFormPage(this));
this.addPage(new AngularJSPackageJsonDependenciesFormPage(this));
this.addPage(new AngularJSPackageJsonDevelopmentFormPage(this));
// this.addPage(this.createDependenciesFormPage());
// this.addPage(this.createDevelopmentDependenciesFormPage());
// this.addPage(this.createTextEditorPage());
} catch (PartInitException e) {
AngularJSIDEUIPlugin.log(e, true);
}
}
Example 76
Project: ant-ivyde-master File: ViewReverseDependenciesHandler.java View source code |
protected void handleProjects(Map projects) {
try {
ReverseDependencyExplorerView.setSelectedProjects((IProject[]) projects.keySet().toArray(new IProject[0]));
IWorkbenchPage page = IvyPlugin.getActivePage();
page.showView("org.apache.ivyde.eclipse.ui.views.ReverseDependencyExplorer");
ReverseDependencyExplorerView.refresh(true);
} catch (PartInitException e) {
IvyPlugin.logError("Error creating Reverse Dependency Explorer", e);
}
}
Example 77
Project: ArchStudio5-master File: FocusEditorUtils.java View source code |
private static void _focusEditor(IXArchADT xarch, ObjRef ref, String editorID, String editorName) {
if (ref == null) {
return;
}
if (!xarch.isValidObjRef(ref)) {
return;
}
ObjRef xArchRef = xarch.getDocumentRootRef(ref);
if (!xarch.isValidObjRef(xArchRef)) {
return;
}
URI uri = xarch.getURI(xArchRef);
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
Path path = new Path(uri.path());
IFile file = root.getFile(path);
if (file == null) {
return;
}
IWorkbench wb = PlatformUI.getWorkbench();
if (wb != null) {
IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
if (win != null) {
IWorkbenchPage page = win.getActivePage();
if (page != null) {
try {
IFileEditorInput fileEditorInput = new FileEditorInput(file);
IEditorPart editorPart = page.openEditor(fileEditorInput, editorID, true, IWorkbenchPage.MATCH_ID | IWorkbenchPage.MATCH_INPUT);
if (editorPart instanceof IFocusEditorListener) {
((IFocusEditorListener) editorPart).focusEditor(editorName, new ObjRef[] { ref });
}
} catch (PartInitException pie) {
}
}
}
}
}
Example 78
Project: arduino-eclipse-plugin-master File: OpenSerialMonitorHandler.java View source code |
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("io.sloeber.ui.monitor.views.SerialMonitor");
// find all projects
IProject SelectedProjects[] = ProjectExplorerListener.getSelectedProjects();
// on
if ((SelectedProjects.length > 0) && (MyPreferences.getOpenSerialWithMonitor() == true)) {
for (IProject curproject : SelectedProjects) {
int baud = Sketch.getCodeBaudRate(curproject);
if (baud > 0) {
String comPort = Sketch.getComport(curproject);
if (!comPort.isEmpty()) {
io.sloeber.ui.monitor.SerialConnection.add(comPort, baud);
}
}
}
}
} catch (PartInitException e) {
e.printStackTrace();
}
return null;
}
Example 79
Project: arquillian-eclipse-master File: ArquillianResourceHyperlink.java View source code |
@Override public void open() { if (file != null) { IWorkbenchPage page = ArquillianUIUtil.getActivePage(); try { IDE.openEditor(page, file); } catch (PartInitException e) { IFileEditorInput input = new FileEditorInput(file); try { IDE.openEditor(page, input, EditorsUI.DEFAULT_TEXT_EDITOR_ID); } catch (PartInitException e1) { ArquillianUIActivator.log(e); } } } }
Example 80
Project: as-spacebar-master File: AbstractBrowseHandler.java View source code |
@Override
protected void handle(ExecutionEvent event, Space space) throws ExecutionException {
final IWorkbenchPage page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
final MetaspaceNavigator navigator = (MetaspaceNavigator) page.findView(SpaceBarPlugin.ID_METASPACES);
navigator.getCommonViewer().addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
page.activate(navigator);
}
});
SpaceEditorExport export = Preferences.getSpaceEditorExport(getTimeScope());
try {
openEditor(page, new SpaceEditorInput(space, export));
} catch (PartInitException e) {
throw new ExecutionException("Could not open space editor", e);
}
}
Example 81
Project: awe-core-master File: AbstractDrillDownListener.java View source code |
private IAWETreeView showView() {
IViewPart view;
try {
view = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(viewId);
if (view instanceof IAWETreeView) {
return (IAWETreeView) view;
}
} catch (final PartInitException e) {
}
return null;
}
Example 82
Project: aws-toolkit-eclipse-master File: OpenPasswordPolicyEditorAction.java View source code |
public void run() {
try {
IWorkbenchWindow activeWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
activeWindow.getActivePage().openEditor(input, "com.amazonaws.eclipse.explorer.identitymanagement.passwordPolicyEditor");
} catch (PartInitException e) {
String errorMessage = "Unable to open the Amazon Identity Management password policy editor: " + e.getMessage();
Status status = new Status(Status.ERROR, IdentityManagementPlugin.PLUGIN_ID, errorMessage, e);
StatusManager.getManager().handle(status, StatusManager.LOG);
}
}
Example 83
Project: bioclipse.speclipse-master File: CheatSheetAction.java View source code |
public void run(String[] params, ICheatSheetManager manager) {
if (params[0].equals("opencompare")) {
IWorkbenchWindow dw = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage page = dw.getActivePage();
try {
page.showView("net.bioclipse.spectrum.views.SpectrumCompareView");
} catch (PartInitException e) {
LogUtils.handleException(e, logger);
}
} else if (params[0].equals("newspectrum")) {
NewSpectrumWizard predwiz = new NewSpectrumWizard();
WizardDialog wd = new WizardDialog(new Shell(), predwiz);
wd.open();
} else if (params[0].equals("saveas")) {
if (WorkbenchPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor() instanceof SpectrumEditor) {
((SpectrumEditor) WorkbenchPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor()).doSaveAs();
}
}
}
Example 84
Project: bioclipse.vscreen-master File: NewVscreenWizard.java View source code |
public boolean performFinish() {
//Open editor with content (String) as content
IEditorInput input = createEditorInput();
IWorkbenchPage page = activeWindow.getActivePage();
try {
page.openEditor(input, "net.bioclipse.jseditor.editor");
} catch (PartInitException e) {
e.printStackTrace();
}
return true;
}
Example 85
Project: buildship-master File: WorkbenchUtils.java View source code |
/**
* Shows the view with the given id and secondary id in the given mode.
*
* @param viewId the id of the view
* @param secondaryId the secondary id of the view, or {@code null] for no secondary id
* @param mode the activation mode, must be {@link org.eclipse.ui.IWorkbenchPage#VIEW_ACTIVATE},
* {@link org.eclipse.ui.IWorkbenchPage#VIEW_VISIBLE} or
* {@link org.eclipse.ui.IWorkbenchPage#VIEW_CREATE}
* @param <T> the expected type of the view
* @return the shown view, never null
* @throws RuntimeException thrown if the view cannot be initialized correctly
*/
public static <T extends IViewPart> T showView(String viewId, String secondaryId, int mode) {
IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
try {
@SuppressWarnings("unchecked") T view = (T) activeWorkbenchWindow.getActivePage().showView(viewId, secondaryId, mode);
return view;
} catch (PartInitException e) {
throw new RuntimeException(String.format("Cannot show view with id %s and secondary id %s.", viewId, secondaryId), e);
}
}
Example 86
Project: cdt-tests-runner-master File: OpenFiles.java View source code |
/**
* This method opens a list of files in the editor
*/
@Override
public void process(TemplateCore template, ProcessArgument[] args, String processId, IProgressMonitor monitor) throws ProcessFailureException {
ProcessArgument[][] files = args[1].getComplexArrayValue();
for (ProcessArgument[] file : files) {
String fileTargetPath = file[0].getSimpleValue();
String projectName = args[0].getSimpleValue();
IProject projectHandle = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
IFile iFile = projectHandle.getFile(fileTargetPath);
if (iFile.exists()) {
try {
IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), iFile);
} catch (PartInitException e) {
throw new ProcessFailureException(Messages.OpenFiles_CannotOpen_error + fileTargetPath);
}
} else {
throw new ProcessFailureException(Messages.OpenFiles_FileNotExist_error + fileTargetPath);
}
}
}
Example 87
Project: ceylon-ide-eclipse-master File: CeylonOpenTypeAction.java View source code |
@Override
protected void openInEditor(Object sourceElement) throws CoreException {
if (sourceElement instanceof IJavaElement && isCeylonDeclaration((IJavaElement) sourceElement)) {
IJavaElement javaElement = (IJavaElement) sourceElement;
IProject project = javaElement.getJavaProject().getProject();
if (isHierarchy()) {
Declaration declaration = toCeylonDeclaration(project, javaElement);
if (declaration != null) {
try {
showHierarchyView().focusOn(declaration);
return;
} catch (PartInitException e) {
e.printStackTrace();
}
}
typeHierarchyError();
} else {
Declaration declaration = toCeylonDeclaration(project, javaElement);
if (declaration != null) {
gotoDeclaration(declaration);
return;
}
showErrorMessage(ActionMessages.OpenTypeAction_2);
}
} else {
super.openInEditor(sourceElement);
}
}
Example 88
Project: ch.hsr.ifs.cdttesting-master File: Console.java View source code |
private static void revealConsole() {
IConsole myConsole = findConsole(name);
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
String id = IConsoleConstants.ID_CONSOLE_VIEW;
IConsoleView view;
try {
view = (IConsoleView) page.showView(id);
view.display(myConsole);
} catch (PartInitException e) {
return;
}
}
Example 89
Project: CIMTool-master File: NewProfile.java View source code |
@Override
public boolean performFinish() {
if (Jobs.runInteractive(Task.createProfile(main.getFile(), main.getNamespace(), main.getEnvname()), main.getFile().getParent(), getContainer(), getShell())) {
try {
workbench.getActiveWorkbenchWindow().getActivePage().openEditor(new FileEditorInput(main.getFile()), "au.com.langdale.cimtoole.editors.MessageModelEditor");
return true;
} catch (PartInitException e) {
e.printStackTrace();
return true;
}
} else
return false;
}
Example 90
Project: cloudbees-eclipse-master File: ShowCloudBeesViewHandler.java View source code |
public Object execute(ExecutionEvent event) throws ExecutionException {
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("com.cloudbees.eclipse.ui.views.CBTreeView");
} catch (PartInitException e) {
CloudBeesUIPlugin.getDefault().getLogger().error(e);
Shell shell = Display.getDefault().getActiveShell();
Status status = new Status(IStatus.ERROR, CloudBeesUIPlugin.PLUGIN_ID, e.getMessage(), e);
ErrorDialog.openError(shell, "Error", "Can't open CloudBees view", status);
}
return null;
}
Example 91
Project: cmsis-pack-eclipse-master File: RefClientGeneratorLauncher.java View source code |
private static void doLaunchGenerator(String gpdsc) {
IWorkbench wb = PlatformUI.getWorkbench();
if (wb == null)
return;
IWorkbenchWindow window = wb.getActiveWorkbenchWindow();
if (window == null)
return;
IWorkbenchPage page = window.getActivePage();
if (page == null)
return;
File fileToOpen = new File(gpdsc);
if (fileToOpen.exists() && fileToOpen.isFile()) {
IFileStore fileStore = EFS.getLocalFileSystem().getStore(fileToOpen.toURI());
try {
IDE.openEditorOnFileStore(page, fileStore);
} catch (PartInitException e) {
}
} else {
//Do something if the file does not exist
}
}
Example 92
Project: codemap-master File: NewCodemapCreationWizard.java View source code |
@Override
public boolean performFinish() {
String containerName = page.getContainerPath();
String fileName = page.getFilename();
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IResource resource = root.findMember(new Path(containerName));
IContainer container = (IContainer) resource;
final IFile file = container.getFile(new Path(fileName));
try {
InputStream stream = openContentStream();
if (file.exists()) {
file.setContents(stream, true, true, null);
} else {
file.create(stream, true, null);
}
stream.close();
} catch (Exception ex) {
throw new RuntimeException(ex);
}
getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
try {
IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), file, true);
} catch (PartInitException ex) {
throw new RuntimeException(ex);
}
}
});
return true;
}
Example 93
Project: CodingSpectator-master File: URLHyperlink.java View source code |
/* * @see org.eclipse.jface.text.hyperlink.URLHyperlink#open() * @since 3.1 */ public void open() { // Create the browser IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport(); IWebBrowser browser; try { browser = support.createBrowser(null); } catch (PartInitException e) { EditorsPlugin.logErrorStatus("Could not create Web browser for URLHyperlink", e.getStatus()); super.open(); return; } try { browser.openURL(new URL(getURLString())); } catch (PartInitException e) { super.open(); } catch (MalformedURLException e) { super.open(); } }
Example 94
Project: dawn-fable-master File: OpenPythonConsoleHandler.java View source code |
/*
* (non-Javadoc)
*
* @see
* org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
* .ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
try {
if (PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(IConsoleConstants.ID_CONSOLE_VIEW) == null) {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
window.getActivePage().showView(IConsoleConstants.ID_CONSOLE_VIEW, "0", IWorkbenchPage.VIEW_ACTIVATE);
}
} catch (PartInitException ex) {
FableUtils.excMsg(this, "Cannot open Console View", ex);
return null;
}
PythonConsole pythonConsole = new PythonConsole();
pythonConsole.run();
// Must currently be null
return null;
}
Example 95
Project: dbeaver-master File: SQLEditorMatchingStrategy.java View source code |
@Override
public boolean matches(IEditorReference editorRef, IEditorInput input) {
final File inputFile = EditorUtils.getLocalFileFromInput(input);
try {
final IEditorInput refInput = editorRef.getEditorInput();
if (refInput != null) {
final File refFile = EditorUtils.getLocalFileFromInput(refInput);
if (refFile != null && refFile.equals(inputFile)) {
return true;
}
}
} catch (PartInitException e) {
log.debug("Error getting input from editor ref", e);
return false;
}
return false;
}
Example 96
Project: Diver-master File: ResearchBrowserHandler.java View source code |
/*
* (non-Javadoc)
* @see
* org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.
* ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
try {
DiverPlugin.getDefault().getPreferenceStore().setValue(IResearchPreferences.HAS_PARTICIPATED, true);
IWebBrowser browser = PlatformUI.getWorkbench().getBrowserSupport().createBrowser("ca.uvic.chisel.diver.browser");
browser.openURL(new URL("http://keg.cs.uvic.ca/limesurvey/index.php?sid=26778&newtest=Y&lang=en"));
} catch (PartInitException e1) {
DiverPlugin.getDefault().log(e1);
} catch (MalformedURLException e1) {
DiverPlugin.getDefault().log(e1);
}
return null;
}
Example 97
Project: dltk.core-master File: HTTPConsoleHyperlink.java View source code |
@Override
public void linkActivated() {
String uri = getLinkURI();
IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
IWebBrowser browser;
try {
browser = browserSupport.createBrowser(null);
browser.openURL(new URL(uri));
} catch (PartInitException e) {
final String msg = NLS.bind(Messages.HTTPConsoleHyperlink_failedToInitializeBrowserFor, uri);
ScriptConsoleUIPlugin.error(msg, e);
} catch (MalformedURLException e) {
final String msg = NLS.bind(Messages.HTTPConsoleHyperlink_failedToOpenInvalidUri, uri);
ScriptConsoleUIPlugin.error(msg, e);
}
}
Example 98
Project: easyb-ext-master File: AbstractBehaviourWizard.java View source code |
@Override
public boolean performFinish() {
IFile file = newFileWizardPage.createNewBehaviour();
if (file != null) {
IWorkbenchPage wkPage = workbench.getActiveWorkbenchWindow().getActivePage();
IEditorDescriptor desc = workbench.getEditorRegistry().getDefaultEditor(file.getName());
try {
wkPage.openEditor(new FileEditorInput(file), desc.getId());
} catch (PartInitException e) {
EasybUIActivator.Log("Unable to open behaviour editor for new behaviour", e);
}
return true;
} else {
return false;
}
}
Example 99
Project: easyb-master File: AbstractBehaviourWizard.java View source code |
@Override
public boolean performFinish() {
IFile file = newFileWizardPage.createNewBehaviour();
if (file != null) {
IWorkbenchPage wkPage = workbench.getActiveWorkbenchWindow().getActivePage();
IEditorDescriptor desc = workbench.getEditorRegistry().getDefaultEditor(file.getName());
try {
wkPage.openEditor(new FileEditorInput(file), desc.getId());
} catch (PartInitException e) {
EasybUIActivator.Log("Unable to open behaviour editor for new behaviour", e);
}
return true;
} else {
return false;
}
}
Example 100
Project: ecf-master File: OpenBrowserCommand.java View source code |
/* (non-Javadoc)
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
// get service
final IServiceInfo serviceInfo = DiscoveryHandlerUtil.getActiveIServiceInfoChecked(event);
final URI location = serviceInfo.getLocation();
// open browser view or reuse existing if already open
final IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
try {
final URL url = location.toURL();
support.createBrowser(url.toExternalForm()).openURL(url);
} catch (PartInitException e) {
throw new ExecutionException(e.getMessage(), e);
} catch (MalformedURLException e) {
throw new ExecutionException(e.getMessage(), e);
}
return null;
}
Example 101
Project: eclemma-master File: OpenSessionExecutionDataHandler.java View source code |
public Object execute(ExecutionEvent event) throws ExecutionException {
final ICoverageSession session = sessionManager.getActiveSession();
final IEditorInput input = new CoverageSessionInput(session);
final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
try {
window.getActivePage().openEditor(input, ExecutionDataEditor.ID);
} catch (PartInitException e) {
throw new ExecutionException(UIMessages.ExecutionDataEditorOpeningError_message, e);
}
return null;
}