Skip to content

Commit

Permalink
#2310 Speedup Capella Startup - ImageDescriptors
Browse files Browse the repository at this point in the history
AbstractUIPlugin.imageDescriptorFromPlugin is used to replace
Activators.getDefault() used to retrieve imageDescriptors.

Removed activators from doc plugins.
Keep commandline doc empty interface used by commandline plugin
to retrieve documentation content and display it to user.

Change-Id: I0000000000000000000000000000000000000000
Signed-off-by: Arnaud Dieumegard <[email protected]>
  • Loading branch information
arnauddieumegard committed Jan 20, 2022
1 parent 0ba5f58 commit 9e55d22
Show file tree
Hide file tree
Showing 87 changed files with 260 additions and 1,524 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,12 @@ protected int getNbColumn() {
protected void initializeControls(final Composite parent, final IRendererContext context) {
super.initializeControls(parent, context);

ToolBar toolbar = new ToolBar(parent, SWT.HORIZONTAL);
ToolBar toolbar = new ToolBar(parent, SWT.HORIZONTAL);
final String ICONS_PATH = "icons/"; //$NON-NLS-1$
if (isBrowseButton()) {
browse = new ToolItem(toolbar, SWT.PUSH);
browse.setToolTipText(getBrowseText());
browse.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), "full/etool16/browse.gif").createImage());
browse.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), ICONS_PATH + "full/etool16/browse.gif").createImage());
browse.addSelectionListener(new SelectionListener() {

public void widgetSelected(SelectionEvent event) {
Expand All @@ -98,7 +99,7 @@ public void widgetDefaultSelected(SelectionEvent e) {
if (isDeleteButton()) {
delete = new ToolItem(toolbar, SWT.PUSH);
delete.setToolTipText("Delete all elements");
delete.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), "full/etool16/delete_edit.gif").createImage());
delete.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), ICONS_PATH + "full/etool16/delete_edit.gif").createImage());
delete.addSelectionListener(new SelectionListener() {

public void widgetSelected(SelectionEvent event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ protected boolean isImage() {
@Override
protected void initializeControls(final Composite parent, IRendererContext context) {

if (isCopyButton()) {
if (isCopyButton()) {
final String ICONS_PATH = "icons/"; //$NON-NLS-1$
copyButton = new Label(rootTextControl, SWT.NONE);
copyButton.setToolTipText("Copy to clipboard");
copyButton.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), "full/etool16/copy.gif").createImage());
copyButton.setToolTipText("Copy to clipboard"); //$NON-NLS-1$
copyButton.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), ICONS_PATH + "full/etool16/copy.gif").createImage()); //$NON-NLS-1$
copyButton.addMouseListener(new MouseListener() {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,18 @@ public class StatusLabelHelper {
*/
public static void updateImage(IStatus status, Label label) {
if (!label.isDisposed() && status != null) {
final String ICONS_PATH = "icons/"; //$NON-NLS-1$
if (status.isOK()) {
label.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(StatusLabelHelper.class).getSymbolicName(), "full/etool16/empty.gif").createImage());
label.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(StatusLabelHelper.class).getSymbolicName(), ICONS_PATH + "full/etool16/empty.gif").createImage());

} else if (status.matches(IStatus.INFO)) {
label.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(StatusLabelHelper.class).getSymbolicName(), "full/etool16/info_tsk.gif").createImage());
label.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(StatusLabelHelper.class).getSymbolicName(), ICONS_PATH + "full/etool16/info_tsk.gif").createImage());

} else if (status.matches(IStatus.WARNING)) {
label.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(StatusLabelHelper.class).getSymbolicName(), "full/etool16/warn_tsk.gif").createImage());
label.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(StatusLabelHelper.class).getSymbolicName(), ICONS_PATH + "full/etool16/warn_tsk.gif").createImage());

} else if (status.matches(IStatus.ERROR)) {
label.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(StatusLabelHelper.class).getSymbolicName(), "full/etool16/error_tsk.gif").createImage());
label.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(StatusLabelHelper.class).getSymbolicName(), ICONS_PATH + "full/etool16/error_tsk.gif").createImage());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.polarsys.capella.common.platform.eclipse.tools.report.ui;singleton:=true
Bundle-Version: 6.0.0.qualifier
Bundle-Activator: org.polarsys.capella.common.platform.eclipse.tools.report.ui.ReportManagerUI
Bundle-Vendor: %providerName
Require-Bundle: org.polarsys.capella.common.tools.report.ui,
org.eclipse.ui,
org.eclipse.core.runtime
Bundle-ActivationPolicy: lazy
Export-Package: org.polarsys.capella.common.platform.eclipse.tools.report.ui,
org.polarsys.capella.common.platform.eclipse.tools.report.ui.pref
Export-Package: org.polarsys.capella.common.platform.eclipse.tools.report.ui.pref
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Localization: plugin

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ protected void printHelp(List<String> hiddenArguments) {
}

protected void printArgumentsFromTable(String tableId, boolean printTitle, List<String> hiddenArguments) {
Bundle bundle = FrameworkUtil.getBundle(org.polarsys.capella.commandline.doc.Activator.class);
Bundle bundle = FrameworkUtil.getBundle(org.polarsys.capella.commandline.doc.ICommandLineDoc.class);
URL fileURL = bundle.getEntry("html/19. Command Line Support/19.1. Core Mechanism and Applications.html");
try {
URL resolvedUrl = FileLocator.toFileURL(fileURL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ protected static String getCustomText(Object object, int columnIndex) {
@Override
@SuppressWarnings("synthetic-access")
protected void createCustomActions(Composite parent) {

_timeEventBtn = createTableButton(parent, AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), IImageKeys.TIME_EVENT_IMG_16).createImage(),
final String ICONS_PATH = "icons/"; //$NON-NLS-1$
_timeEventBtn = createTableButton(parent, AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), ICONS_PATH + IImageKeys.TIME_EVENT_IMG_16).createImage(),
new Runnable() {
@Override
public void run() {
Expand All @@ -122,7 +122,7 @@ public void run() {
});
_timeEventBtn.setToolTipText("Create a Time Event");

_changeEventBtn = createTableButton(parent, AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), IImageKeys.CHANGE_EVENT_IMG_16).createImage(),
_changeEventBtn = createTableButton(parent, AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), ICONS_PATH + IImageKeys.CHANGE_EVENT_IMG_16).createImage(),
new Runnable() {
@Override
public void run() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ Require-Bundle: org.eclipse.core.expressions,
org.polarsys.capella.common.ui.toolkit
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Export-Package: org.polarsys.capella.core.libraries.ui,
org.polarsys.capella.core.libraries.ui.handlers,
Export-Package: org.polarsys.capella.core.libraries.ui.handlers,
org.polarsys.capella.core.libraries.ui.move,
org.polarsys.capella.core.libraries.ui.propertyTester,
org.polarsys.capella.core.libraries.ui.views.libraryManager,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import org.apache.log4j.Priority;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.internal.ui.DebugPluginImages;
import org.eclipse.debug.ui.IDebugUIConstants;
Expand Down Expand Up @@ -119,9 +120,11 @@
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.views.properties.IPropertySheetPage;
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.common.flexibility.wizards.ui.FlexibilityColors;
import org.polarsys.capella.common.helpers.EcoreUtil2;
Expand All @@ -133,7 +136,6 @@
import org.polarsys.capella.common.ui.toolkit.ToolkitPlugin;
import org.polarsys.capella.core.data.core.validation.constraint.ReferentialConstraintsResourceSetListener;
import org.polarsys.capella.core.libraries.model.ICapellaModel;
import org.polarsys.capella.core.libraries.ui.Activator;
import org.polarsys.capella.core.model.helpers.move.CapellaMoveHelper;
import org.polarsys.capella.core.model.helpers.move.Stage;
import org.polarsys.capella.core.model.helpers.move.StageListener;
Expand Down Expand Up @@ -978,7 +980,8 @@ private class AddRequiredAction extends AbstractAddRequiredAction {

private AddRequiredAction() {
super(Messages.MoveStagingView_addRequiredElementsLabel);
setImageDescriptor(Activator.getDefault().getImageDescriptor("full/etool16/add_dependencies.gif")); //$NON-NLS-1$
final String ICONS_PATH = "icons/";
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), ICONS_PATH + "full/etool16/add_dependencies.gif")); //$NON-NLS-1$
setToolTipText(Messages.MoveStagingView_addRequiredElementsLabel);
}

Expand All @@ -998,7 +1001,8 @@ private class AddAllRequiredAction extends AbstractAddRequiredAction {

protected AddAllRequiredAction() {
super(Messages.MoveStagingView_addAllRequiredElementsLabel);
setImageDescriptor(Activator.getDefault().getImageDescriptor("full/etool16/add_alldependencies.gif")); //$NON-NLS-1$
final String ICONS_PATH = "icons/"; //$NON-NLS-1$
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), ICONS_PATH + "full/etool16/add_alldependencies.gif")); //$NON-NLS-1$
setToolTipText(Messages.MoveStagingView_addAllRequiredElementsLabel);
}

Expand Down Expand Up @@ -1473,7 +1477,8 @@ public void selectElementInCapellaExplorer(ISelection selection) {
try {
window.getActivePage().showView(CapellaCommonNavigator.ID, null, IWorkbenchPage.VIEW_ACTIVATE);
} catch (PartInitException e) {
Activator.getDefault().getLog().log(new Status(IStatus.ERROR, FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), e.getLocalizedMessage(), e));
Bundle bundle = FrameworkUtil.getBundle(this.getClass());
Platform.getLog(bundle).error(e.getLocalizedMessage(), e);
}
super.selectElementInCapellaExplorer(selection);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbench;
import org.polarsys.capella.core.libraries.ui.Activator;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.FrameworkUtil;
import org.polarsys.capella.core.platform.sirius.ui.project.NewProjectWizard;
import org.polarsys.capella.core.platform.sirius.ui.project.internal.WizardNewProjectCreationPage;
import org.polarsys.capella.core.platform.sirius.ui.project.operations.SessionCreationHelper;
Expand All @@ -32,7 +33,8 @@ protected SessionCreationHelper createSessionCreationHelper() {
public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
super.init(workbench, currentSelection);
setWindowTitle("New Capella Library"); //$NON-NLS-1$
ImageDescriptor descriptor = Activator.getDefault().getImageDescriptor("libraryWizard.png"); //$NON-NLS-1$
final String ICONS_PATH = "icons/"; //$NON-NLS-1$
ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(this.getClass()).getSymbolicName(), ICONS_PATH + "libraryWizard.png"); //$NON-NLS-1$
if (null == descriptor) {
descriptor = ImageDescriptor.getMissingImageDescriptor();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ Require-Bundle: org.eclipse.ui,
org.polarsys.capella.common.ui,
org.polarsys.capella.core.ui.properties
Bundle-ActivationPolicy: lazy
Export-Package: org.polarsys.capella.core.platform.eclipse.capella.ui.trace,
org.polarsys.capella.core.platform.eclipse.capella.ui.trace.commands,
Export-Package: org.polarsys.capella.core.platform.eclipse.capella.ui.trace.commands,
org.polarsys.capella.core.platform.eclipse.capella.ui.trace.icons,
org.polarsys.capella.core.platform.eclipse.capella.ui.trace.messages,
org.polarsys.capella.core.platform.eclipse.capella.ui.trace.views,
Expand Down

This file was deleted.

Loading

0 comments on commit 9e55d22

Please sign in to comment.