Search in sources :

Example 31 with InvocationTargetException

use of java.lang.reflect.InvocationTargetException in project dbeaver by serge-rider.

the class ContentEditor method primeEditorValue.

@Override
public void primeEditorValue(@Nullable Object value) throws DBException {
    ContentEditorInput input = getEditorInput();
    IValueController valueController = input.getValueController();
    LOBInitializer initializer = new LOBInitializer(valueController, input.getEditors(), input.getDefaultEditor(), input);
    try {
        //valueController.getValueSite().getWorkbenchWindow().run(true, true, initializer);
        DBeaverUI.runInProgressService(initializer);
    } catch (InvocationTargetException e) {
        UIUtils.showErrorDialog(valueController.getValueSite().getShell(), "Cannot refresh content editor", null, e);
    } catch (InterruptedException e) {
    // ignore
    }
}
Also used : IValueController(org.jkiss.dbeaver.ui.data.IValueController) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 32 with InvocationTargetException

use of java.lang.reflect.InvocationTargetException in project dbeaver by serge-rider.

the class SearchDataPage method createControl.

@Override
public void createControl(Composite parent) {
    super.createControl(parent);
    initializeDialogUnits(parent);
    Composite searchGroup = new Composite(parent, SWT.NONE);
    searchGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
    searchGroup.setLayout(new GridLayout(3, false));
    setControl(searchGroup);
    UIUtils.createControlLabel(searchGroup, "String");
    searchText = new Combo(searchGroup, SWT.DROP_DOWN);
    searchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    if (params.searchString != null) {
        searchText.setText(params.searchString);
    }
    for (String history : searchHistory) {
        searchText.add(history);
    }
    searchText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            params.searchString = searchText.getText();
            updateEnablement();
        }
    });
    Composite optionsGroup = new SashForm(searchGroup, SWT.NONE);
    GridLayout layout = new GridLayout(2, true);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    optionsGroup.setLayout(layout);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.horizontalSpan = 3;
    optionsGroup.setLayoutData(gd);
    {
        final DBeaverCore core = DBeaverCore.getInstance();
        Group databasesGroup = UIUtils.createControlGroup(optionsGroup, "Databases", 1, GridData.FILL_BOTH, 0);
        gd = new GridData(GridData.FILL_BOTH);
        //gd.heightHint = 300;
        databasesGroup.setLayoutData(gd);
        final DBNProject projectNode = core.getNavigatorModel().getRoot().getProject(core.getProjectRegistry().getActiveProject());
        DBNNode rootNode = projectNode == null ? core.getNavigatorModel().getRoot() : projectNode.getDatabases();
        dataSourceTree = new DatabaseNavigatorTree(databasesGroup, rootNode, SWT.SINGLE | SWT.CHECK);
        gd = new GridData(GridData.FILL_BOTH);
        gd.heightHint = 300;
        dataSourceTree.setLayoutData(gd);
        final CheckboxTreeViewer viewer = (CheckboxTreeViewer) dataSourceTree.getViewer();
        viewer.addFilter(new ViewerFilter() {

            @Override
            public boolean select(Viewer viewer, Object parentElement, Object element) {
                if (element instanceof TreeLoadNode) {
                    return true;
                }
                if (element instanceof DBNNode) {
                    if (element instanceof DBNDatabaseFolder) {
                        DBNDatabaseFolder folder = (DBNDatabaseFolder) element;
                        Class<? extends DBSObject> folderItemsClass = folder.getChildrenClass();
                        return folderItemsClass != null && (DBSObjectContainer.class.isAssignableFrom(folderItemsClass) || DBSEntity.class.isAssignableFrom(folderItemsClass));
                    }
                    if (element instanceof DBNLocalFolder || element instanceof DBNProjectDatabases || element instanceof DBNDataSource) {
                        return true;
                    }
                    if (element instanceof DBSWrapper) {
                        DBSObject obj = ((DBSWrapper) element).getObject();
                        if (obj instanceof DBSObjectContainer)
                            return true;
                        if (obj instanceof DBSDataContainer && obj instanceof DBSEntity) {
                            if ((((DBSDataContainer) obj).getSupportedFeatures() & DBSDataContainer.DATA_SEARCH) != 0) {
                                return true;
                            }
                        }
                    }
                }
                return false;
            }
        });
        checkboxTreeManager = new CheckboxTreeManager(viewer, new Class[] { DBSDataContainer.class });
        viewer.addCheckStateListener(new ICheckStateListener() {

            @Override
            public void checkStateChanged(CheckStateChangedEvent event) {
                updateEnablement();
            }
        });
    }
    {
        //new Label(searchGroup, SWT.NONE);
        Composite optionsGroup2 = UIUtils.createControlGroup(optionsGroup, "Settings", 2, GridData.FILL_HORIZONTAL, 0);
        optionsGroup2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING));
        if (params.maxResults <= 0) {
            params.maxResults = 10;
        }
        final Spinner maxResultsSpinner = UIUtils.createLabelSpinner(optionsGroup2, "Sample rows", params.maxResults, 1, Integer.MAX_VALUE);
        maxResultsSpinner.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
        maxResultsSpinner.addModifyListener(new ModifyListener() {

            @Override
            public void modifyText(ModifyEvent e) {
                params.maxResults = maxResultsSpinner.getSelection();
            }
        });
        final Button caseCheckbox = UIUtils.createLabelCheckbox(optionsGroup2, CoreMessages.dialog_search_objects_case_sensitive, params.caseSensitive);
        caseCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
        caseCheckbox.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                params.caseSensitive = caseCheckbox.getSelection();
            }
        });
        final Button fastSearchCheckbox = UIUtils.createLabelCheckbox(optionsGroup2, "Fast search (indexed)", params.fastSearch);
        fastSearchCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
        fastSearchCheckbox.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                params.fastSearch = fastSearchCheckbox.getSelection();
            }
        });
        final Button searchNumbersCheckbox = UIUtils.createLabelCheckbox(optionsGroup2, "Search in numbers", params.searchNumbers);
        searchNumbersCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
        searchNumbersCheckbox.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                params.searchNumbers = searchNumbersCheckbox.getSelection();
            }
        });
        final Button searchLOBCheckbox = UIUtils.createLabelCheckbox(optionsGroup2, "Search in LOBs", params.searchLOBs);
        searchLOBCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
        searchLOBCheckbox.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                params.searchLOBs = searchNumbersCheckbox.getSelection();
            }
        });
    }
    final List<DBNNode> checkedNodes = new ArrayList<>();
    dataSourceTree.setEnabled(false);
    try {
        DBeaverUI.runInProgressDialog(new DBRRunnableWithProgress() {

            @Override
            public void run(DBRProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                monitor.beginTask("Load database nodes", 1);
                try {
                    monitor.subTask("Load tree state");
                    checkedNodes.addAll(loadTreeState(monitor, store, PROP_SOURCES));
                } finally {
                    monitor.done();
                }
            }
        });
    } catch (InvocationTargetException e) {
        UIUtils.showErrorDialog(getShell(), "Data sources load", "Error loading settings", e.getTargetException());
    }
    if (!checkedNodes.isEmpty()) {
        boolean first = true;
        for (DBNNode node : checkedNodes) {
            ((CheckboxTreeViewer) dataSourceTree.getViewer()).setChecked(node, true);
            if (first) {
                dataSourceTree.getViewer().reveal(NavigatorUtils.getDataSourceNode(node));
                first = false;
            }
        }
        checkboxTreeManager.updateCheckStates();
    }
    updateEnablement();
    dataSourceTree.setEnabled(true);
}
Also used : ModifyListener(org.eclipse.swt.events.ModifyListener) ArrayList(java.util.ArrayList) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) TreeLoadNode(org.jkiss.dbeaver.ui.navigator.database.load.TreeLoadNode) DBeaverCore(org.jkiss.dbeaver.core.DBeaverCore) SelectionEvent(org.eclipse.swt.events.SelectionEvent) CheckboxTreeManager(org.jkiss.dbeaver.ui.navigator.database.CheckboxTreeManager) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) DatabaseNavigatorTree(org.jkiss.dbeaver.ui.navigator.database.DatabaseNavigatorTree) InvocationTargetException(java.lang.reflect.InvocationTargetException) SashForm(org.eclipse.swt.custom.SashForm) GridData(org.eclipse.swt.layout.GridData) DBRRunnableWithProgress(org.jkiss.dbeaver.model.runtime.DBRRunnableWithProgress) DBRProgressMonitor(org.jkiss.dbeaver.model.runtime.DBRProgressMonitor)

Example 33 with InvocationTargetException

use of java.lang.reflect.InvocationTargetException in project dbeaver by serge-rider.

the class SearchMetadataPage method createControl.

@Override
public void createControl(Composite parent) {
    super.createControl(parent);
    initializeDialogUnits(parent);
    Composite searchGroup = new Composite(parent, SWT.NONE);
    searchGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
    searchGroup.setLayout(new GridLayout(3, false));
    setControl(searchGroup);
    UIUtils.createControlLabel(searchGroup, CoreMessages.dialog_search_objects_label_object_name);
    searchText = new Combo(searchGroup, SWT.DROP_DOWN);
    searchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    if (nameMask != null) {
        searchText.setText(nameMask);
    }
    for (String history : searchHistory) {
        searchText.add(history);
    }
    searchText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            nameMask = searchText.getText();
            updateEnablement();
        }
    });
    Composite optionsGroup = new SashForm(searchGroup, SWT.NONE);
    GridLayout layout = new GridLayout(2, true);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    optionsGroup.setLayout(layout);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.horizontalSpan = 3;
    optionsGroup.setLayoutData(gd);
    {
        final DBeaverCore core = DBeaverCore.getInstance();
        Group sourceGroup = UIUtils.createControlGroup(optionsGroup, CoreMessages.dialog_search_objects_group_objects_source, 1, GridData.FILL_BOTH, 0);
        gd = new GridData(GridData.FILL_BOTH);
        //gd.heightHint = 300;
        sourceGroup.setLayoutData(gd);
        final DBNProject projectNode = core.getNavigatorModel().getRoot().getProject(core.getProjectRegistry().getActiveProject());
        DBNNode rootNode = projectNode == null ? core.getNavigatorModel().getRoot() : projectNode.getDatabases();
        dataSourceTree = new DatabaseNavigatorTree(sourceGroup, rootNode, SWT.SINGLE);
        gd = new GridData(GridData.FILL_BOTH);
        gd.heightHint = 300;
        dataSourceTree.setLayoutData(gd);
        dataSourceTree.getViewer().addFilter(new ViewerFilter() {

            @Override
            public boolean select(Viewer viewer, Object parentElement, Object element) {
                if (element instanceof TreeLoadNode) {
                    return true;
                }
                if (element instanceof DBNNode) {
                    if (element instanceof DBNDatabaseFolder) {
                        DBNDatabaseFolder folder = (DBNDatabaseFolder) element;
                        Class<? extends DBSObject> folderItemsClass = folder.getChildrenClass();
                        return folderItemsClass != null && DBSObjectContainer.class.isAssignableFrom(folderItemsClass);
                    }
                    if (element instanceof DBNLocalFolder || element instanceof DBNProjectDatabases || element instanceof DBNDataSource || (element instanceof DBSWrapper && ((DBSWrapper) element).getObject() instanceof DBSObjectContainer)) {
                        return true;
                    }
                }
                return false;
            }
        });
        dataSourceTree.getViewer().addSelectionChangedListener(new ISelectionChangedListener() {

            @Override
            public void selectionChanged(SelectionChangedEvent event) {
                fillObjectTypes();
                updateEnablement();
                IStructuredSelection structSel = (IStructuredSelection) event.getSelection();
                Object object = structSel.isEmpty() ? null : structSel.getFirstElement();
                if (object instanceof DBNNode) {
                    for (DBNNode node = (DBNNode) object; node != null; node = node.getParentNode()) {
                        if (node instanceof DBNDataSource) {
                            DBNDataSource dsNode = (DBNDataSource) node;
                            dsNode.initializeNode(null, new DBRProgressListener() {

                                @Override
                                public void onTaskFinished(IStatus status) {
                                    if (status.isOK()) {
                                        DBeaverUI.asyncExec(new Runnable() {

                                            @Override
                                            public void run() {
                                                if (!dataSourceTree.isDisposed()) {
                                                    fillObjectTypes();
                                                }
                                            }
                                        });
                                    }
                                }
                            });
                            break;
                        }
                    }
                }
            }
        });
    }
    {
        Group settingsGroup = UIUtils.createControlGroup(optionsGroup, "Settings", 2, GridData.FILL_BOTH, 0);
        gd = new GridData(GridData.FILL_BOTH);
        gd.heightHint = 300;
        settingsGroup.setLayoutData(gd);
        {
            //new Label(searchGroup, SWT.NONE);
            UIUtils.createControlLabel(settingsGroup, CoreMessages.dialog_search_objects_label_name_match);
            final Combo matchCombo = new Combo(settingsGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
            matchCombo.add(CoreMessages.dialog_search_objects_combo_starts_with, SearchMetadataConstants.MATCH_INDEX_STARTS_WITH);
            matchCombo.add(CoreMessages.dialog_search_objects_combo_contains, SearchMetadataConstants.MATCH_INDEX_CONTAINS);
            matchCombo.add(CoreMessages.dialog_search_objects_combo_like, SearchMetadataConstants.MATCH_INDEX_LIKE);
            matchCombo.select(0);
            matchCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
            if (matchTypeIndex >= 0) {
                matchCombo.select(matchTypeIndex);
            }
            matchCombo.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    matchTypeIndex = matchCombo.getSelectionIndex();
                }
            });
            matchCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
            if (maxResults <= 0) {
                maxResults = 100;
            }
            final Spinner maxResultsSpinner = UIUtils.createLabelSpinner(settingsGroup, CoreMessages.dialog_search_objects_spinner_max_results, maxResults, 1, 10000);
            maxResultsSpinner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
            maxResultsSpinner.addModifyListener(new ModifyListener() {

                @Override
                public void modifyText(ModifyEvent e) {
                    maxResults = maxResultsSpinner.getSelection();
                }
            });
            maxResultsSpinner.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
            final Button caseCheckbox = UIUtils.createLabelCheckbox(settingsGroup, CoreMessages.dialog_search_objects_case_sensitive, caseSensitive);
            caseCheckbox.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    caseSensitive = caseCheckbox.getSelection();
                }
            });
            caseCheckbox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        }
        Label otLabel = UIUtils.createControlLabel(settingsGroup, CoreMessages.dialog_search_objects_group_object_types);
        otLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
        typesTable = new Table(settingsGroup, SWT.CHECK | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
        typesTable.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                //checkedTypes.clear();
                for (TableItem item : typesTable.getItems()) {
                    DBSObjectType objectType = (DBSObjectType) item.getData();
                    if (item.getChecked()) {
                        checkedTypes.add(objectType);
                    } else {
                        checkedTypes.remove(objectType);
                    }
                }
                updateEnablement();
            }
        });
        typesTable.addMouseListener(new MouseAdapter() {

            @Override
            public void mouseDoubleClick(MouseEvent e) {
                TableItem tableItem = typesTable.getSelection()[0];
                tableItem.setChecked(!tableItem.getChecked());
            }
        });
        typesTable.setLayoutData(new GridData(GridData.FILL_BOTH));
        UIUtils.createTableColumn(typesTable, SWT.LEFT, CoreMessages.dialog_search_objects_column_type);
        UIUtils.createTableColumn(typesTable, SWT.LEFT, CoreMessages.dialog_search_objects_column_description);
    }
    try {
        DBeaverUI.runInProgressDialog(new DBRRunnableWithProgress() {

            @Override
            public void run(DBRProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                monitor.beginTask("Load database nodes", 1);
                try {
                    monitor.subTask("Load tree state");
                    sourceNodes = loadTreeState(monitor, DBeaverCore.getGlobalPreferenceStore(), PROP_SOURCES);
                } finally {
                    monitor.done();
                }
            }
        });
    } catch (InvocationTargetException e) {
        UIUtils.showErrorDialog(getShell(), "Data sources load", "Error loading settings", e.getTargetException());
    }
    if (!sourceNodes.isEmpty()) {
        dataSourceTree.getViewer().setSelection(new StructuredSelection(sourceNodes));
        dataSourceTree.getViewer().reveal(NavigatorUtils.getDataSourceNode(sourceNodes.get(0)));
    } else {
        updateEnablement();
    }
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) GridLayout(org.eclipse.swt.layout.GridLayout) TreeLoadNode(org.jkiss.dbeaver.ui.navigator.database.load.TreeLoadNode) DBeaverCore(org.jkiss.dbeaver.core.DBeaverCore) DBRProgressListener(org.jkiss.dbeaver.model.runtime.DBRProgressListener) DatabaseNavigatorTree(org.jkiss.dbeaver.ui.navigator.database.DatabaseNavigatorTree) InvocationTargetException(java.lang.reflect.InvocationTargetException) SashForm(org.eclipse.swt.custom.SashForm) GridData(org.eclipse.swt.layout.GridData) DBRRunnableWithProgress(org.jkiss.dbeaver.model.runtime.DBRRunnableWithProgress) DBRProgressMonitor(org.jkiss.dbeaver.model.runtime.DBRProgressMonitor)

Example 34 with InvocationTargetException

use of java.lang.reflect.InvocationTargetException in project AsmackService by rtreffer.

the class ZLibOutputStream method flush.

/**
     * Flush the given stream, preferring Java7 FLUSH_SYNC if available.
     * @throws IOException In case of a lowlevel exception.
     */
@Override
public void flush() throws IOException {
    if (!SUPPORTED) {
        super.flush();
        return;
    }
    int count = 0;
    if (!def.needsInput()) {
        do {
            count = def.deflate(buf, 0, buf.length);
            out.write(buf, 0, count);
        } while (count > 0);
        out.flush();
    }
    try {
        do {
            count = (Integer) method.invoke(def, buf, 0, buf.length, 2);
            out.write(buf, 0, count);
        } while (count > 0);
    } catch (IllegalArgumentException e) {
        throw new IOException("Can't flush");
    } catch (IllegalAccessException e) {
        throw new IOException("Can't flush");
    } catch (InvocationTargetException e) {
        throw new IOException("Can't flush");
    }
    super.flush();
}
Also used : IOException(java.io.IOException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 35 with InvocationTargetException

use of java.lang.reflect.InvocationTargetException in project lombok by rzwitserloot.

the class EclipseLoaderPatcherTransplants method overrideLoadResult.

public static Class overrideLoadResult(ClassLoader original, String name, boolean resolve) throws ClassNotFoundException {
    try {
        Field shadowLoaderField = original.getClass().getField("lombok$shadowLoader");
        ClassLoader shadowLoader = (ClassLoader) shadowLoaderField.get(original);
        if (shadowLoader == null) {
            synchronized ("lombok$shadowLoader$globalLock".intern()) {
                shadowLoader = (ClassLoader) shadowLoaderField.get(original);
                if (shadowLoader == null) {
                    Class shadowClassLoaderClass = (Class) original.getClass().getField("lombok$shadowLoaderClass").get(null);
                    Class classLoaderClass = Class.forName("java.lang.ClassLoader");
                    String jarLoc = (String) original.getClass().getField("lombok$location").get(null);
                    if (shadowClassLoaderClass == null) {
                        JarFile jf = new JarFile(jarLoc);
                        InputStream in = null;
                        try {
                            ZipEntry entry = jf.getEntry("lombok/launch/ShadowClassLoader.class");
                            in = jf.getInputStream(entry);
                            byte[] bytes = new byte[65536];
                            int len = 0;
                            while (true) {
                                int r = in.read(bytes, len, bytes.length - len);
                                if (r == -1)
                                    break;
                                len += r;
                                if (len == bytes.length)
                                    throw new IllegalStateException("lombok.launch.ShadowClassLoader too large.");
                            }
                            in.close();
                            {
                                Class[] paramTypes = new Class[4];
                                paramTypes[0] = "".getClass();
                                paramTypes[1] = new byte[0].getClass();
                                paramTypes[2] = Integer.TYPE;
                                paramTypes[3] = paramTypes[2];
                                Method defineClassMethod = classLoaderClass.getDeclaredMethod("defineClass", paramTypes);
                                defineClassMethod.setAccessible(true);
                                shadowClassLoaderClass = (Class) defineClassMethod.invoke(original, new Object[] { "lombok.launch.ShadowClassLoader", bytes, new Integer(0), new Integer(len) });
                                original.getClass().getField("lombok$shadowLoaderClass").set(null, shadowClassLoaderClass);
                            }
                        } finally {
                            if (in != null)
                                in.close();
                            jf.close();
                        }
                    }
                    Class[] paramTypes = new Class[5];
                    paramTypes[0] = classLoaderClass;
                    paramTypes[1] = "".getClass();
                    paramTypes[2] = paramTypes[1];
                    paramTypes[3] = Class.forName("java.util.List");
                    paramTypes[4] = paramTypes[3];
                    Constructor constructor = shadowClassLoaderClass.getDeclaredConstructor(paramTypes);
                    constructor.setAccessible(true);
                    shadowLoader = (ClassLoader) constructor.newInstance(new Object[] { original, "lombok", jarLoc, Arrays.asList(new Object[] { "lombok." }), Arrays.asList(new Object[] { "lombok.patcher.Symbols" }) });
                    shadowLoaderField.set(original, shadowLoader);
                }
            }
        }
        if (resolve) {
            Class[] paramTypes = new Class[2];
            paramTypes[0] = "".getClass();
            paramTypes[1] = Boolean.TYPE;
            Method m = shadowLoader.getClass().getDeclaredMethod("loadClass", new Class[] { String.class, boolean.class });
            m.setAccessible(true);
            return (Class) m.invoke(shadowLoader, new Object[] { name, Boolean.TRUE });
        } else {
            return shadowLoader.loadClass(name);
        }
    } catch (Exception ex) {
        Throwable t = ex;
        if (t instanceof InvocationTargetException)
            t = t.getCause();
        if (t instanceof RuntimeException)
            throw (RuntimeException) t;
        if (t instanceof Error)
            throw (Error) t;
        throw new RuntimeException(t);
    }
}
Also used : InputStream(java.io.InputStream) Constructor(java.lang.reflect.Constructor) ZipEntry(java.util.zip.ZipEntry) Method(java.lang.reflect.Method) JarFile(java.util.jar.JarFile) InvocationTargetException(java.lang.reflect.InvocationTargetException) InvocationTargetException(java.lang.reflect.InvocationTargetException) Field(java.lang.reflect.Field)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)2006 Method (java.lang.reflect.Method)902 IOException (java.io.IOException)233 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)179 ArrayList (java.util.ArrayList)163 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)157 Test (org.junit.Test)136 Constructor (java.lang.reflect.Constructor)133 File (java.io.File)110 Field (java.lang.reflect.Field)99 CoreException (org.eclipse.core.runtime.CoreException)93 HashMap (java.util.HashMap)88 ProgressMonitorDialog (org.eclipse.jface.dialogs.ProgressMonitorDialog)87 List (java.util.List)78 Map (java.util.Map)76 IStatus (org.eclipse.core.runtime.IStatus)66 Status (org.eclipse.core.runtime.Status)50 IFile (org.eclipse.core.resources.IFile)37 AccessibleObject (java.lang.reflect.AccessibleObject)34 DBRProgressMonitor (org.jkiss.dbeaver.model.runtime.DBRProgressMonitor)34