private void handleConvert() { try { // remove listeners of Info section before we convert. If we don't // we may get a model changed event while disposing the page. Bug 156414 fInfoSection.removeListeners(); PDEFormEditor editor = getPDEEditor(); IPluginModelBase model = (IPluginModelBase) editor.getAggregateModel(); IRunnableWithProgress op = new CreateManifestOperation(model); IProgressService service = PlatformUI.getWorkbench().getProgressService(); editor.doSave(null); service.runInUI(service, op, PDEPlugin.getWorkspace().getRoot()); updateBuildProperties(); editor.doSave(null); } catch (InvocationTargetException e) { MessageDialog.openError( PDEPlugin.getActiveWorkbenchShell(), PDEUIMessages.OverviewPage_error, e.getCause().getMessage()); // if convert failed and this OverviewPage hasn't been removed from the editor, reattach // listeners if (!fDisposed) fInfoSection.addListeners(); } catch (InterruptedException e) { // if convert failed and this OverviewPage hasn't been removed from the editor, reattach // listeners if (!fDisposed) fInfoSection.addListeners(); } }
private void createContentSection( IManagedForm managedForm, Composite parent, FormToolkit toolkit) { String sectionTitle; // if (isFragment()) { // sectionTitle = PDEUIMessages.ManifestEditor_ContentSection_ftitle; // } else { // sectionTitle = PDEUIMessages.ManifestEditor_ContentSection_title; // } sectionTitle = PDEUIMessages.MonitorEditor_ContentSection_title; Section section = createStaticSection(toolkit, parent, sectionTitle); Composite container = createStaticSectionClient(toolkit, section); FormText text = createClient( container, isFragment() ? PDEUIMessages.OverviewPage_fContent : PDEUIMessages.OverviewPage_content, toolkit); PDELabelProvider lp = PDEPlugin.getDefault().getLabelProvider(); text.setImage( "page", lp.get(PDEPluginImages.DESC_PAGE_OBJ, SharedLabelProvider.F_EDIT)); // $NON-NLS-1$ if (!isBundle() && isEditable()) { String content; if (isFragment()) { content = PDEUIMessages.OverviewPage_fOsgi; } else { content = PDEUIMessages.OverviewPage_osgi; } text = createClient(container, content, toolkit); } section.setClient(container); }
protected void createFormContent(IManagedForm managedForm) { super.createFormContent(managedForm); ScrolledForm form = managedForm.getForm(); FormToolkit toolkit = managedForm.getToolkit(); if (isFragment()) { form.setImage( PDEPlugin.getDefault().getLabelProvider().get(PDEPluginImages.DESC_FRAGMENT_MF_OBJ)); } else { form.setImage( PDEPlugin.getDefault().getLabelProvider().get(PDEPluginImages.DESC_PLUGIN_MF_OBJ)); } form.setText(PDEUIMessages.MonitorEditor_OverviewPage_title); fillBody(managedForm, toolkit); PlatformUI.getWorkbench() .getHelpSystem() .setHelp(form.getBody(), IHelpContextIds.MONITOR_PLUGIN_OVERVIEW); }
/* * (non-Javadoc) * * @see org.eclipse.ui.forms.events.HyperlinkListener#linkActivated(org.eclipse.ui.forms.events.HyperlinkEvent) */ public void linkActivated(HyperlinkEvent e) { String href = (String) e.getHref(); // try page references if (href.equals("dependencies")) // $NON-NLS-1$ getEditor().setActivePage(DependenciesPage.PAGE_ID); else if (href.equals("runtime")) // $NON-NLS-1$ getEditor().setActivePage(RuntimePage.PAGE_ID); else if (href.equals("extensions")) { // $NON-NLS-1$ if (getEditor().setActivePage(ExtensionsPage.PAGE_ID) == null) activateExtensionPages(ExtensionsPage.PAGE_ID); } else if (href.equals("ex-points")) { // $NON-NLS-1$ if (getEditor().setActivePage(ExtensionPointsPage.PAGE_ID) == null) activateExtensionPages(ExtensionPointsPage.PAGE_ID); } else if (href.equals("build")) { // $NON-NLS-1$ if (!getPDEEditor().hasInputContext(BuildInputContext.CONTEXT_ID)) { if (!MessageDialog.openQuestion( PDEPlugin.getActiveWorkbenchShell(), PDEUIMessages.OverviewPage_buildTitle, PDEUIMessages.OverviewPage_buildQuestion)) return; IFile file = PDEProject.getBuildProperties(getPDEEditor().getCommonProject()); WorkspaceBuildModel model = new WorkspaceBuildModel(file); model.save(); IEditorInput in = new FileEditorInput(file); getPDEEditor() .getContextManager() .putContext(in, new BuildInputContext(getPDEEditor(), in, false)); } getEditor().setActivePage(BuildPage.PAGE_ID); } else if (href.equals("export")) { // $NON-NLS-1$ getExportAction().run(); } else if (href.equals("action.convert")) { // $NON-NLS-1$ handleConvert(); } else if (href.equals("organize")) { // $NON-NLS-1$ getEditor().doSave(null); OrganizeManifestsAction organizeAction = new OrganizeManifestsAction(); organizeAction.selectionChanged( null, new StructuredSelection(getPDEEditor().getCommonProject())); organizeAction.run(null); } else if (href.equals("externalize")) { // $NON-NLS-1$ getEditor().doSave(null); GetNonExternalizedStringsAction externalizeAction = new GetNonExternalizedStringsAction(); externalizeAction.selectionChanged( null, new StructuredSelection(getPDEEditor().getCommonProject())); externalizeAction.run(null); } else super.linkActivated(e); }
private void activateExtensionPages(String activePageId) { MessageDialog mdiag = new MessageDialog( PDEPlugin.getActiveWorkbenchShell(), PDEUIMessages.OverviewPage_extensionPageMessageTitle, null, PDEUIMessages.OverviewPage_extensionPageMessageBody, MessageDialog.QUESTION, new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL}, 0); if (mdiag.open() != Window.OK) return; try { MonitorEditor manifestEditor = (MonitorEditor) getEditor(); manifestEditor.addExtensionTabs(); manifestEditor.setShowExtensions(true); manifestEditor.setActivePage(activePageId); } catch (PartInitException e) { } catch (BackingStoreException e) { } }
private void createExtensionSection( IManagedForm managedForm, Composite parent, FormToolkit toolkit) { String sectionTitle = PDEUIMessages.ManifestEditor_ExtensionSection_title; Section section = createStaticSection(toolkit, parent, sectionTitle); Composite container = createStaticSectionClient(toolkit, section); FormText text = createClient( container, isFragment() ? PDEUIMessages.OverviewPage_fExtensionContent : PDEUIMessages.OverviewPage_extensionContent, toolkit); PDELabelProvider lp = PDEPlugin.getDefault().getLabelProvider(); text.setImage( "page", lp.get(PDEPluginImages.DESC_PAGE_OBJ, SharedLabelProvider.F_EDIT)); // $NON-NLS-1$ section.setClient(container); }
private void createTestingSection( IManagedForm managedForm, Composite parent, FormToolkit toolkit) { Section section = createStaticSection(toolkit, parent, PDEUIMessages.ManifestEditor_TestingSection_title); PDELabelProvider lp = PDEPlugin.getDefault().getLabelProvider(); Composite container = createStaticSectionClient(toolkit, section); String prefixText = (!((MonitorEditor) getEditor()).showExtensionTabs()) ? PDEUIMessages.OverviewPage_OSGiTesting : isFragment() ? PDEUIMessages.OverviewPage_fTesting : PDEUIMessages.OverviewPage_testing; FormText text = createClient(container, getLauncherText(getLauncherHelper().isOSGi(), prefixText), toolkit); text.setImage("run", lp.get(PDEPluginImages.DESC_RUN_EXC)); // $NON-NLS-1$ text.setImage("debug", lp.get(PDEPluginImages.DESC_DEBUG_EXC)); // $NON-NLS-1$ text.setImage("profile", lp.get(PDEPluginImages.DESC_PROFILE_EXC)); // $NON-NLS-1$ section.setClient(container); }