Example usage for org.eclipse.jface.resource ImageDescriptor createFromFile

List of usage examples for org.eclipse.jface.resource ImageDescriptor createFromFile

Introduction

In this page you can find the example usage for org.eclipse.jface.resource ImageDescriptor createFromFile.

Prototype

public static ImageDescriptor createFromFile(Class<?> location, String filename) 

Source Link

Document

Creates and returns a new image descriptor from a file.

Usage

From source file:edu.harvard.i2b2.eclipse.plugins.ontology.views.edit.UpdateOntologyDialog.java

License:Open Source License

public Thread processStatus(ProgressBar bar, Label updateStatus, Button ok, Button background,
        String operationType, boolean includeHiddens) {
    final ProgressBar theBar = bar;
    final Label theStatus = updateStatus;
    final Button theOkButton = ok;
    final Button theBackgroundButton = background;
    final Display theDisplay = Display.getCurrent();
    final String theOperation = operationType;
    final boolean hidden = includeHiddens;

    return new Thread() {
        @Override// ww w .  java2  s .co m
        public void run() {
            try {
                synchronize(theOperation, hidden, theDisplay);
                if (this.getName().equals("stop")) {
                    System.gc();
                    return;
                }
                long waitTime = 5000; //  msec
                Thread.sleep(waitTime);

                while (ProcessStatus.getInstance().getStatus().getProcessStatusCd().equals("PROCESSING")) {
                    if (this.getName().equals("stop")) {
                        System.gc();
                        return;
                    }
                    // need to do something if this fails...
                    getStatus();
                    String step = ProcessStatus.getInstance().getStatus().getProcessStepCd();
                    if (step.equals("ONT_BUILD_PDO_START")) {
                        if (!(this.getName().equals("stop"))) {
                            theDisplay.syncExec(new Runnable() {
                                public void run() {
                                    theBar.setSelection(33);
                                    theStatus.setText("Building data file to upload");
                                }
                            });
                        }
                    } else if (step.equals("ONT_SENTTO_FRC")) {
                        if (!(this.getName().equals("stop"))) {
                            theDisplay.syncExec(new Runnable() {
                                public void run() {
                                    theBar.setSelection(50);
                                    theStatus.setText("Uploading data file to FRC");
                                }
                            });
                        }
                    } else if (step.equals("ONT_SENTTO_CRCLOADER")) {
                        if (!(this.getName().equals("stop"))) {
                            theDisplay.syncExec(new Runnable() {
                                public void run() {
                                    theBar.setSelection(60);
                                    theStatus.setText("Loading data into dimension table");
                                }
                            });
                        }
                    }
                    if (ProcessStatus.getInstance().getStatus().getProcessStatusCd().equals("COMPLETED")) {
                        if (!(this.getName().equals("stop"))) {
                            theDisplay.syncExec(new Runnable() {
                                public void run() {
                                    theBar.setSelection(100);
                                    theStatus.setText("Synchronization complete");
                                }
                            });
                        }
                        break;
                    }
                    if (ProcessStatus.getInstance().getStatus().getProcessStatusCd().equals("ERROR")) {
                        break;
                    }
                    Thread.sleep(waitTime);
                }
                if (ProcessStatus.getInstance().getStatus().getProcessStatusCd().equals("COMPLETED")) {
                    if (!(this.getName().equals("stop"))) {
                        theDisplay.syncExec(new Runnable() {
                            public void run() {
                                theBar.setSelection(100);
                                theStatus.setText("Synchronization complete");
                                if (theOperation.equals("synchronize_all")) {
                                    theOkButton.setEnabled(false);
                                    MetadataRecord.getInstance().getSyncAction()
                                            .setImageDescriptor(ImageDescriptor.createFromFile(EditView.class,
                                                    "/icons/database_refresh.png"));
                                } else {
                                    theOkButton.setEnabled(false);
                                    if ((ProcessStatus.getInstance()
                                            .getDirtyState() == DirtyValueType.DELETE_EDIT))
                                        MetadataRecord.getInstance().getSyncAction().setImageDescriptor(
                                                ImageDescriptor.createFromFile(EditView.class,
                                                        "/icons/red_database_refresh.png"));
                                    else
                                        MetadataRecord.getInstance().getSyncAction().setImageDescriptor(
                                                ImageDescriptor.createFromFile(EditView.class,
                                                        "/icons/database_refresh.png"));
                                }
                                theBackgroundButton.setEnabled(false);
                            }
                        });
                    }
                }
                if (ProcessStatus.getInstance().getStatus().getProcessStatusCd().equals("ERROR")) {
                    final String errorMessage = "Synchronize process is reporting an error";
                    if (!(this.getName().equals("stop"))) {
                        theDisplay.syncExec(new Runnable() {
                            public void run() {
                                theStatus.setText(errorMessage);
                                theOkButton.setEnabled(true);
                                theBackgroundButton.setEnabled(true);
                            }
                        });

                        java.awt.EventQueue.invokeLater(new Runnable() {
                            public void run() {
                                JOptionPane.showMessageDialog(null, errorMessage, "Error",
                                        JOptionPane.INFORMATION_MESSAGE);
                            }
                        });
                    }
                }
            } catch (InterruptedException e) {
                //         log.error(e.getMessage());
                final String errorMessage = "Synchronize process is reporting a communication error.";
                if (!(this.getName().equals("stop"))) {
                    theDisplay.syncExec(new Runnable() {
                        public void run() {
                            theStatus.setText(errorMessage);
                            theOkButton.setEnabled(true);
                            theBackgroundButton.setEnabled(true);
                        }
                    });
                    java.awt.EventQueue.invokeLater(new Runnable() {
                        public void run() {
                            JOptionPane.showMessageDialog(null, errorMessage, "Error",
                                    JOptionPane.INFORMATION_MESSAGE);
                        }
                    });
                }

            } catch (Exception e) {
                if (!(this.getName().equals("stop"))) {
                    final String errorMessage = "Synchronize process is reporting an error";
                    theDisplay.syncExec(new Runnable() {
                        public void run() {
                            theStatus.setText(errorMessage);
                            theOkButton.setEnabled(true);
                            theBackgroundButton.setEnabled(true);
                        }
                    });
                    java.awt.EventQueue.invokeLater(new Runnable() {
                        public void run() {
                            JOptionPane.showMessageDialog(null, errorMessage, "Error",
                                    JOptionPane.INFORMATION_MESSAGE);
                        }
                    });
                }
            } finally {
                //   interrupt();

            }

        }
    };
}

From source file:edu.harvard.i2b2.eclipse.plugins.ontology.views.find.FindView.java

License:Open Source License

private void addHelpButtonToToolBar() {
    final IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
    Action helpAction = new Action() {
        @Override// ww w. jav a 2  s  . c o m
        public void run() {
            helpSystem.displayHelpResource(
                    "/edu.harvard.i2b2.eclipse.plugins.ontology/html/i2b2_find_terms_index.htm");
        }
    };
    helpAction.setImageDescriptor(ImageDescriptor.createFromFile(FindView.class, "/icons/help.png"));
    getViewSite().getActionBars().getToolBarManager().add(helpAction);
}

From source file:edu.harvard.i2b2.eclipse.plugins.ontology.views.find.ModifierComposite.java

License:Open Source License

private void createImageRegistry() {
    ImageDescriptor imageDescriptor = ImageDescriptor.createFromFile(getClass(), "icons/modifier_small.png");
    this.imageRegistry.put("modifier", imageDescriptor);
    imageDescriptor = ImageDescriptor.createFromFile(getClass(), "icons/modifierFolder.png");
    this.imageRegistry.put("modifierFolder", imageDescriptor);
    imageDescriptor = ImageDescriptor.createFromFile(getClass(), "icons/modifierContainer.png");
    this.imageRegistry.put("modifierContainer", imageDescriptor);

    //     imageDescriptor = ImageDescriptor.createFromFile(getClass(), "icons/xyz.jpg");
    //     this.imageRegistry.put("error", imageDescriptor);
}

From source file:edu.harvard.i2b2.eclipse.plugins.ontology.views.find.NodeBrowser.java

License:Open Source License

private void createImageRegistry() {
    ImageDescriptor imageDescriptor = ImageDescriptor.createFromFile(getClass(), "icons/leaf.jpg");
    this.imageRegistry.put("leaf", imageDescriptor);
    imageDescriptor = ImageDescriptor.createFromFile(getClass(), "icons/multi.bmp");
    this.imageRegistry.put("multi", imageDescriptor);
    imageDescriptor = ImageDescriptor.createFromFile(getClass(), "icons/openFolder.jpg");
    this.imageRegistry.put("openFolder", imageDescriptor);
    imageDescriptor = ImageDescriptor.createFromFile(getClass(), "icons/openCase.jpg");
    this.imageRegistry.put("openCase", imageDescriptor);
    imageDescriptor = ImageDescriptor.createFromFile(getClass(), "icons/closedFolder.jpg");
    this.imageRegistry.put("closedFolder", imageDescriptor);
    imageDescriptor = ImageDescriptor.createFromFile(getClass(), "icons/closedCase.jpg");
    this.imageRegistry.put("closedCase", imageDescriptor);
    // imageDescriptor = ImageDescriptor.createFromFile(getClass(), "icons/xyz.jpg");
    // this.imageRegistry.put("error", imageDescriptor);
}

From source file:edu.harvard.i2b2.eclipse.plugins.ontology.views.NodeBrowser.java

License:Open Source License

private void createImageRegistry() {
    ImageDescriptor imageDescriptor = ImageDescriptor.createFromFile(getClass(), "icons/leaf.jpg");
    this.imageRegistry.put("leaf", imageDescriptor);
    imageDescriptor = ImageDescriptor.createFromFile(getClass(), "icons/multi.bmp");
    this.imageRegistry.put("multi", imageDescriptor);
    imageDescriptor = ImageDescriptor.createFromFile(getClass(), "icons/openFolder.jpg");
    this.imageRegistry.put("openFolder", imageDescriptor);
    imageDescriptor = ImageDescriptor.createFromFile(getClass(), "icons/openCase.jpg");
    this.imageRegistry.put("openCase", imageDescriptor);
    imageDescriptor = ImageDescriptor.createFromFile(getClass(), "icons/closedFolder.jpg");
    this.imageRegistry.put("closedFolder", imageDescriptor);
    imageDescriptor = ImageDescriptor.createFromFile(getClass(), "icons/closedCase.jpg");
    this.imageRegistry.put("closedCase", imageDescriptor);
    imageDescriptor = ImageDescriptor.createFromFile(getClass(), "icons/modifier_small.png");
    this.imageRegistry.put("modLeaf", imageDescriptor);
    imageDescriptor = ImageDescriptor.createFromFile(getClass(), "icons/modifierFolder.png");
    this.imageRegistry.put("modFolder", imageDescriptor);
    imageDescriptor = ImageDescriptor.createFromFile(getClass(), "icons/modifierContainer.png");
    this.imageRegistry.put("modCase", imageDescriptor);
    //     imageDescriptor = ImageDescriptor.createFromFile(getClass(), "icons/xyz.jpg");
    //     this.imageRegistry.put("error", imageDescriptor);
}

From source file:edu.harvard.i2b2.eclipse.plugins.ontology.views.OntologyView.java

License:Open Source License

private void addHelpButtonToToolBar() {
    final IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
    Action helpAction = new Action() {
        @Override// w  w w.ja  va 2 s .  c  o m
        public void run() {
            helpSystem.displayHelpResource(
                    "/edu.harvard.i2b2.eclipse.plugins.ontology/html/i2b2_navigate_terms_index.htm");
        }
    };
    helpAction.setImageDescriptor(ImageDescriptor.createFromFile(OntologyView.class, "/icons/help.png"));
    getViewSite().getActionBars().getToolBarManager().add(helpAction);
}

From source file:edu.harvard.i2b2.eclipse.plugins.patientMapping.views.PatientMappingView.java

License:Open Source License

private void addHelpButtonToToolBar() {
    final IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
    Action helpAction = new Action() {
        public void run() {
            helpSystem.displayHelpResource(
                    "/edu.harvard.i2b2.eclipse.plugins.patientMapping/html/i2b2_pm_index.html");
        }/*from  w  ww .  ja  v a  2 s .  co  m*/
    };
    helpAction.setImageDescriptor(ImageDescriptor.createFromFile(PatientMappingView.class, "/icons/help.png"));

    getViewSite().getActionBars().getToolBarManager().add(helpAction);
}

From source file:edu.harvard.i2b2.eclipse.plugins.patientSet.views.PatientSetView.java

License:Open Source License

private void addHelpButtonToToolBar() {
    final IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
    Action helpAction = new Action() {
        public void run() {
            helpSystem.displayHelpResource(
                    "/edu.harvard.i2b2.eclipse.plugins.patientSet/html/i2b2_ps_index.html");
        }/*www.ja  v a 2 s .co  m*/
    };
    helpAction.setImageDescriptor(ImageDescriptor.createFromFile(PatientSetView.class, "/icons/help.png"));

    getViewSite().getActionBars().getToolBarManager().add(helpAction);
}

From source file:edu.harvard.i2b2.eclipse.plugins.previousquery.views.PreviousQueryView.java

License:Open Source License

private void addHelpButtonToToolBar() {
    final IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
    Action helpAction = new Action() {
        public void run() {
            helpSystem.displayHelpResource(
                    "/edu.harvard.i2b2.eclipse.plugins.previousQuery/html/i2b2_pq_index.htm");
        }/* www .java  2 s .c  o m*/
    };
    helpAction.setImageDescriptor(ImageDescriptor.createFromFile(PreviousQueryView.class, "/icons/help.png"));

    getViewSite().getActionBars().getToolBarManager().add(helpAction);
}

From source file:edu.harvard.i2b2.eclipse.plugins.query.views.QueryView.java

License:Open Source License

private void addHelpButtonToToolBar() {
    final IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
    Action helpAction = new Action() {
        public void run() {
            helpSystem.displayHelpResource("/edu.harvard.i2b2.eclipse.plugins.query/html/i2b2_qt_index.htm");
        }//  w  w w.  j  a  v a2  s .c  o  m
    };
    helpAction.setImageDescriptor(ImageDescriptor.createFromFile(QueryView.class, "/icons/help.png"));
    getViewSite().getActionBars().getToolBarManager().add(helpAction);
}