package org.openlca.app.rcp;

import org.eclipse.ui.application.IWorkbenchConfigurer;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
import org.eclipse.ui.application.WorkbenchAdvisor;
import org.eclipse.ui.application.WorkbenchWindowAdvisor;
import org.openlca.app.logging.Console;
import org.openlca.app.logging.LoggerPreference;

public class RcpWorkbenchAdvisor extends WorkbenchAdvisor {

	/**
	 * The ID of the openLCA perspective
	 */
	private static final String PERSPECTIVE_ID = "perspectives.standard";

	@Override
	public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(
			final IWorkbenchWindowConfigurer configurer) {
		return new RcpWindowAdvisor(configurer);
	}

	@Override
	public String getInitialWindowPerspectiveId() {
		return PERSPECTIVE_ID;
	}

	@Override
	public void initialize(final IWorkbenchConfigurer configurer) {
		super.initialize(configurer);
		configurer.setSaveAndRestore(false);
		if (LoggerPreference.getShowConsole()) {
			Console.show();
		}
	}

	@Override
	public void postStartup() {
		super.postStartup();
	}
}

@@ -23,16 +23,53 @@
 p.rcp;%0A%0A
+import org.eclipse.ui.ISharedImages;%0A
 import o
@@ -303,86 +303,283 @@
 org.
-openlca.app.logging.Console;%0Aimport org.openlca.app.logging.LoggerPreference;%0A
+eclipse.ui.internal.IWorkbenchGraphicConstants;%0Aimport org.eclipse.ui.internal.WorkbenchImages;%0Aimport org.openlca.app.logging.Console;%0Aimport org.openlca.app.logging.LoggerPreference;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0A@SuppressWarnings(%22restriction%22)
 %0Apub
@@ -640,56 +640,8 @@
  %7B%0A%0A
-%09/**%0A%09 * The ID of the openLCA perspective%0A%09 */%0A
 %09pri
@@ -783,22 +783,16 @@
 sor(%0A%09%09%09
-final 
 IWorkben
@@ -995,22 +995,16 @@
 tialize(
-final 
 IWorkben
@@ -1167,16 +1167,912 @@
 ();%0A%09%09%7D%0A
+%09%09changeWorkbenchImages();%0A%09%7D%0A%0A%09/**%0A%09 * There is no official method/extension point for replacing the shared%0A%09 * workbench images. Thus, we access the internal WorkbenchImages class here%0A%09 * and replace some images with our own here.%0A%09 */%0A%09private void changeWorkbenchImages() %7B%0A%09%09try %7B%0A%09%09%09WorkbenchImages.declareImage(%0A%09%09%09%09%09IWorkbenchGraphicConstants.IMG_WIZBAN_IMPORT_WIZ,%0A%09%09%09%09%09RcpActivator.getImageDescriptor(%22icons/wizard/import.png%22),%0A%09%09%09%09%09true);%0A%09%09%09WorkbenchImages.declareImage(%0A%09%09%09%09%09IWorkbenchGraphicConstants.IMG_WIZBAN_EXPORT_WIZ,%0A%09%09%09%09%09RcpActivator.getImageDescriptor(%22icons/wizard/export.png%22),%0A%09%09%09%09%09true);%0A%09%09%09WorkbenchImages.declareImage(%0A%09%09%09%09%09ISharedImages.IMG_OBJ_FOLDER,%0A%09%09%09%09%09RcpActivator.getImageDescriptor(%22icons/folder_open.png%22),%0A%09%09%09%09%09true);%0A%09%09%7D catch (Exception e) %7B%0A%09%09%09Logger log = LoggerFactory.getLogger(getClass());%0A%09%09%09log.error(%22failed to patch workbench images%22, e);%0A%09%09%7D%0A
 %09%7D%0A%0A%09@Ov

change workbench images