import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbench;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
+import eu.etaxonomy.taxeditor.view.AbstractCdmDataViewer;
+import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart;
+import eu.etaxonomy.taxeditor.view.supplementaldata.SupplementalDataViewPart;
/**
* <p>Abstract AbstractUtility class.</p>
return getActivePage() != null ? getActivePage().getActivePart() : null;
}
+ public static IWorkbench getWorkbench(){
+ return TaxeditorStorePlugin.getDefault().getWorkbench();
+ }
+
/**
* <p>getWorkbenchWindow</p>
*
* @return a {@link org.eclipse.jface.window.ApplicationWindow} object.
*/
public static ApplicationWindow getWorkbenchWindow(){
- if(TaxeditorStorePlugin.getDefault().getWorkbench().getWorkbenchWindowCount() > 1){
+ if(getWorkbench().getWorkbenchWindowCount() > 1){
throw new IllegalStateException("More than one workbench window");
}
- return (ApplicationWindow) TaxeditorStorePlugin.getDefault().getWorkbench().getWorkbenchWindows()[0];
+ return (ApplicationWindow) getWorkbench().getWorkbenchWindows()[0];
}
/**
protected static String getPluginId(){
return "eu.taxeditor";
}
+
+ /**
+ * <p>getActiveEditor</p>
+ *
+ * @return a {@link org.eclipse.ui.IEditorPart} object.
+ */
+ public static IEditorPart getActiveEditor(){
+ return getActivePage() != null ? getActivePage().getActiveEditor() : null;
+ }
+
+ /**
+ * <p>getDetailsView</p>
+ *
+ * @return a {@link eu.etaxonomy.taxeditor.view.detail.DetailsViewPart} object.
+ */
+ public static DetailsViewPart getDetailsView(){
+ return (DetailsViewPart) getView(DetailsViewPart.ID, false);
+ }
+
+ /**
+ * <p>refreshDetailsViewer</p>
+ */
+ public static void refreshDetailsViewer(){
+ if(getDetailsView() != null){
+ ((AbstractCdmDataViewer) getDetailsView().getViewer()).refresh();
+ }
+ }
+
+ /**
+ * <p>reflowDetailsViewer</p>
+ */
+ public static void reflowDetailsViewer(){
+ if(getDetailsView() != null){
+ ((AbstractCdmDataViewer) getDetailsView().getViewer()).reflow();
+ }
+ }
+
+ public static SupplementalDataViewPart getSupplementalDataView(){
+ return (SupplementalDataViewPart) getView(SupplementalDataViewPart.ID, false);
+ }
+
+ public static void reflowSupplementalViewer(){
+ if(getSupplementalDataView() != null){
+ ((AbstractCdmDataViewer) getSupplementalDataView().getViewer()).reflow();
+ }
+ }
}